Overview › 5Context
Context
4 optimizations in 3 sub-categories.
a.Compacting
Keep the window lean as the task grows
- i.
Compact conversation history in stages: elide stale tool outputs, then keep an anchored summary
Manage the history before it overflows.
b.Filtering input
Filter what enters the context
- i.
Give the model the schema it queries, in context: descriptions, keys, codes, sample values
When the model writes SQL or structured filters, put the schema it is querying in its context: table and column descriptions, key relationships, what enum codes and nulls mean, sample values.
See also
- 2.a.i
Reduce the tool surface: remove and consolidate tools, then defer the rest behind search
Offer the agent only the tools the task needs.
- 2.c.i
Bound tool output: cap it, or write it to a file the agent can read
Cap the characters of tool output kept per call (VeRO settled near 15-20 KB on TerminalBench), or, better, write long output to a file and return its path with a short head, so the agent can read more if it needs to.
c.Isolating subtasks
Isolate sub-tasks in their own contexts
- i.
Discrete phase separation
Run research, planning and implementation as separate agent sessions, each starting from a fresh context that holds only the previous phase's written output (a research document, then a plan file), and have a person review that document before the next phase starts.
- ii.
Sub-agent architectures with clean contexts
Hand a context-heavy side task (code search, reading many files, documents or logs) to a sub-agent that starts with a fresh context and only the tools it needs, and have it return a short result or file references so the parent's context stays small.
See also
- 6.b.iii
Use multi-agent orchestration only for breadth-first, independent sub-tasks
Spawn parallel sub-agents when the work splits into independent, breadth-first parts with little shared context; expect about 15x the tokens of a chat and up to 90% less wall-clock.