Foundation · 5 of 9
Context is a working set
An agent does not carry its whole history inside the model. The harness continuously chooses a bounded, ordered view of a larger durable record.
§1
The window is not the world
A context window is the model request’s finite token budget. A working set is the information the harness actually places inside that window for the next inference.
The working set is assembled from a larger world: instructions, transcript events, tool schemas, observations, summaries, retrieved material, and durable artifacts. Some items enter verbatim; some are transformed; some stay outside with a pointer; some are dropped. Interpretation
The transcript is not identical to the working set. Nor is durable state. A harness may retain a full tool output on disk, display it in the UI, and send only a short excerpt to the model. “Saved,” “visible to the user,” and “visible to the model now” are three separate properties.
§2
An eight-item context ledger
| Item | Tokens | Why it is present | If pressure rises |
|---|---|---|---|
| Instructions | 1,400 | Defines role, task constraints, and operating rules. | Usually protected; deduplicate repeated guidance. |
| Tool definitions | 900 | Describes capabilities available for this step. | Expose only relevant tools or use a smaller presentation. |
| Recent conversation | 2,400 | Preserves the current line of reasoning and user intent. | Keep recent turns; compress or summarize older ones. |
| Older conversation | 1,800 | Carries decisions and evidence from earlier work. | Compact into a summary while retaining the original durably. |
| Repository map | 900 | Orients the model before narrower reads. | Regenerate or retrieve only the relevant subtree. |
| File read | 3,600 | Supplies exact code for the current hypothesis. | Paginate, select a range, or spill the full file with a pointer. |
| Test output | 1,600 | Provides environmental evidence about the failure. | Keep the failure frame; truncate repeated stack or log noise. |
| Free/output reserve | 3,400 | Leaves room for new observations and the model response. | Protect it; overflowing the window is not a useful strategy. |
| Total window | 16,000 | A simplified accounting example; providers count tokens under their own rules. | |
§3
Operate on the working set
The controls below all reduce or change pressure differently. Watch both columns: model-visible context and durable off-context state. The decision record names when exact information is preserved, made indirect, or discarded.
§4
Six operations, six information contracts
- Add
- Place new content directly in context. This is lossless for the item but consumes budget immediately.
- Paginate
- Expose one bounded slice while retaining the rest for later pages. The model lacks the hidden portion now, but exact recovery remains possible.
- Truncate
- Keep a prefix, suffix, or selected frame and discard the remainder from this representation. Unless another copy exists, this is irreversible information loss.
- Spill
- Move exact content to durable storage and leave a handle, path, or artifact ID in context. The data survives; immediate model visibility does not.
- Retrieve
- Select content from durable state or an index and copy it into the working set. Retrieval can miss relevant material, so absence from results is not proof of absence.
- Compact
- Replace a larger source region with a smaller derived summary. The original may remain durable, while the model sees gist and selected facts rather than exact wording.
Compaction is different from truncation because it creates a new representation intended to preserve useful meaning. It is different from retrieval because it transforms a known source region rather than searching a larger corpus. Its quality depends on what the summarizer selects and what later tasks need.
§6
Maintain an information-loss ledger
Every context transformation should answer four questions: what remained verbatim, what became a derived representation, what moved outside the model’s view, and what can no longer be recovered. That ledger matters when a later answer depends on a detail omitted by an earlier summary.
A practical harness can record source identifiers and token estimates beside a summary, attach artifact handles to spilled outputs, include continuation instructions after pagination, and distinguish “not retrieved” from “not present.” These small contracts prevent the model from treating a partial view as the complete world.