Context
Any session long enough to matter. Symptoms are familiar: quality degrades as the run goes on, the agent starts contradicting instructions it followed an hour ago, and the same file gets re-read every few turns.
Problem
A context window has no natural stopping point. The harness fills it, the agent fills it, and nothing in the system says "this is enough". Every extra token is paid for on every subsequent turn - in money, in latency, and in attention diluted away from the actual task.
Pattern
Budget the window explicitly, by layer:
- Standing instructions - a fixed, small share. Re-state critical constraints at the start of new phases rather than assuming they survive forty turns of history.
- Project facts - files in the repo: conventions, architecture, invariants. Retrieved, not pasted.
- Task statement - one task per session, restated when the agent drifts.
- Working set - the files needed for the current step only. Give the agent the ability to open a file, not the contents in advance.
- Tool output - compressed at the boundary: the error and the file, not the full log.
- History - pruned at phase boundaries. Abandoned reasoning is the most expensive thing in the window because it reads as precedent.
Tradeoffs
Budgeting costs turns - retrieval is a tool call, and tool calls are slower than having the text already present. On small tasks with a small codebase, filling the window is genuinely faster and the degradation never appears.
When not to use it
One-shot questions, single-file edits, and anything that fits comfortably in a few thousand tokens. The pattern exists for sessions that run long enough to rot.