Context File Budget
Each context-file section (SOUL, AGENTS chain sections, other injected files) is capped by a character budget.
Two names, two meanings
Section titled “Two names, two meanings”| Name | Meaning |
|---|---|
CONTEXT_FILE_MAX_CHARS (= 20_000) |
Code constant: fallback value and the floor of the dynamic calculation |
context_file_max_chars (config.yaml) |
Optional explicit key: when set, it is the exact ceiling for every context file |
Case 1 — context_file_max_chars set in config.yaml:
context_file_max_chars: 2000020 000 is then an exact ceiling: no context file exceeds it in the prompt. The dynamic calculation is disabled.
Case 2 — key absent: Hermes computes a budget from the model context window:
candidate = window_tokens × 4 × 6 %budget = min(500 000, max(20 000, candidate))- 20 000 is the floor of the dynamic mode only;
- 500 000 is the cap of the dynamic mode;
- when the model window is unknown, the budget is 20 000 characters.
| Model window | Dynamic budget | Effective budget |
|---|---|---|
| 40 000 tokens | 9 600 chars | 20 000 chars (floor) |
| 128 000 tokens | 30 720 chars | 30 720 chars |
| 2 000 000 tokens | 480 000 chars | 480 000 chars |
| 3 000 000 tokens | 720 000 chars | 500 000 chars (cap) |
Application
Section titled “Application”- The budget is in characters, per context section.
- The merged AGENTS chain receives a second global cap at the same effective budget.
- Truncation is deterministic, not sampling: 70 % of the head and 20 % of the tail are kept, the middle is replaced by a marker telling the agent the path of the full file.
- An explicit
context_file_max_chars: 20000is an exact ceiling, never merely a floor.