Lead · 7 chapters
Sub-agent context isolation
The real reason to split agents — a fresh window per subtask, not role-play
If the split isn't buying isolation or parallelism, it probably isn't buying anything.
Read these first
What you will know
Build a comparison of the same subtask with inherited context and with a fresh window
Hold inputs and task instructions constant so improvements can be attributed to removing stale instructions, irrelevant history, or context pressure.
Show a sub-agent succeeding because its window was clean
A clean window should remove distracting or contradictory state; changing only the role name or persona is not evidence of isolation.
Distinguish a split that buys isolation from one that is role-play
Use the transferred data, dependency boundary, and measurable benefit as evidence rather than treating different prompts as separate agents.
Decide what the sub-agent returns to the parent, and how much
Returning full transcripts can recreate the original context, while returning too little loses assumptions, provenance, or actionable results.
Reject a multi-agent design that buys neither isolation nor parallelism
The rejection should account for extra calls, synchronization, token cost, latency, quality regressions, and additional failure modes.
Chapters
- 1
A persona changes the register, not the evidence
A sub-agent labelled senior security reviewer, handed the parent's whole conversation history, keeps approving plans containing the flaw the parent introduced. It is conditioned on the reasoning that produced the flaw, so it continues that chain instead of examining it, and no wording of the review instruction removes evidence already sitting in the window. This is why so many review steps in production approve everything.
- 2
What you withheld is what makes it a split
The fastest way to tell a real isolation boundary from a costume is to ask what was deliberately kept out of the sub-agent's window, and why. A different system prompt over the same context is one loop wearing two names; a window holding only the plan, the policy and the instruction is a different body of evidence. Judge splits by transferred data, dependency boundary and measurable benefit.
- 3
The fresh window wrote the script four failed attempts had poisoned
A migration the main loop failed at four times is written correctly on the first try by a sub-agent given the same instruction verbatim, because the loop's window still held every failed attempt and every correction after it. To establish that in general, run the identical subtask instruction and inputs twice, once with the parent's accumulated context and once with only what the subtask needs, over a set of runs rather than one anecdote.
- 4
A rewritten instruction and a dropped tool are two other explanations
A subtask goes from 60% to 90% when extracted, and the extraction also rewrote the instruction and removed two tools it never used. Isolation is one of three candidate causes and probably not the strongest. A team that skips this untangling makes the next split by analogy to a result nobody understands, and keeps paying for a boundary that a prompt edit might have delivered for free.
- 5
Returning the transcript rebuilds the context the split removed
Six tool calls and a 28k-token transcript come back to the parent, whose window is now larger than before the split and whose quality is flat. Summarising is not the fix either: an unstructured summary keeps the confident findings and drops the caveats, so the parent proceeds as though everything were settled. Specify fields instead — findings, where each came from, assumptions made, and what could not be determined.
- 6
Parallel fan-out buys wall-clock and pays in duplicated input
Isolation is one of the two things a split can buy; concurrency is the other, and it has a different ledger. Wall-clock time drops to the slowest branch, while every branch re-sends the shared inputs, a join step has to reconcile results that were produced without knowledge of each other, and one branch failing leaves the parent holding a partial answer it must either retry or degrade around. The test for whether a subtask can go in a branch is not organisational but data-flow: can it be written without reading any sibling's output, and would you accept the result if the siblings had been written in the opposite order. That criterion is also the positive standard a split proposal has to meet — a measured window reduction, a demonstrated independence, or a wall-clock win big enough to pay for the join.
- 7
Five sequential agents with growing context buy nothing
One agent per report section, run in sequence, each receiving the brief plus every previous agent's full output: no window is smaller than the single loop's would be, and nothing runs concurrently. Running them in parallel is not the rescue, because each section is written conditioned on the ones before it, so removing that dependency changes the output rather than the schedule. Price the extra calls, boundaries and failure modes, then reject it.
External resources
- Subagents in the SDKcode.claude.com
Official contract for isolating context, parallelism and per-agent instructions.
- Efficient Long-Horizon LLM-Based Agent Serving with ...arxiv.org
Runtime mechanisms for isolating sub-agent contexts during efficient long-horizon LLM agent serving.
- Slash Commands vs Subagents: How to Keep AI Tools ...jxnl.co
A substantive explainer contrasts same-thread slash commands with isolated subagents, showing how fresh context windows reduce pollution and preserve focused reasoning through a concrete test-run example.
- Context Management in Claude CodeClaude
Shows the context window filling and why a fresh one changes outcomes.
- Claude Subagents vs Agent Teams: What’s the difference?Shaw Talebi
Separates isolation-for-context from role-play, with side-by-side runs.