Token Efficiency Encyclopedia

Context Isolation via Subagents

Delegate a bulk-reading or bulk-generating subtask to a separate agent that has its own context window, and return only the answer to the caller. The raw material — file contents, search results, logs, generated code — enters the subagent's context and never enters the orchestrator's.

The saving is not that the work is cheaper. The saving is that the orchestrator pays for a paragraph instead of ten thousand lines, on this turn and on every subsequent turn, because the material was never added to a transcript that keeps getting resent.

The Two Axes

Delegation is often described as sending work to a cheaper model, but two independent things are being decided:

They compose but do not imply each other. A subagent running the same model as its parent still gives the full context saving. A cheap model called as an ordinary tool, whose output is pasted back into the transcript, gives none of it.

Context isolation is the axis that produces the large numbers, because its effect is cumulative: a transcript that never absorbed the corpus stays small for the rest of the session.

How It Works

  1. The orchestrator issues a task description, not a data request: a question plus a list of paths, rather than "read these files".
  2. The subagent starts from a fresh context, pulls in the material itself, and works on it.
  3. The subagent returns a compact, structured answer.
  4. The orchestrator appends only that answer. The material is discarded with the subagent's context.

The delegated unit must be one-shot and stateless. If the caller needs to iterate on the material, the material has to come back, and the isolation is lost.

What Delegates Well

What Does Not Delegate

Enforcement

Routing rules written as advice in a system prompt or CLAUDE.md are advisory: the agent may ignore them, and every project needs its own copy. Enforcing the redirect at the harness level — a pre-tool-use hook that blocks reads over a line threshold and points at the delegation skill — makes the behavior deterministic and project-independent.

A good enforcement layer degrades gracefully: the hook blocks the expensive call even when the model has not read the instructions, and the instructions merely make the redirect smoother. It must also let targeted reads through — a read with an offset and limit, or a cat piped into grep, is already narrow and should not be delegated.

Trade-offs

Anti-patterns

See Also

Tools