Skip to content

Use subagents to protect the main context

Subagents are not just for parallelism — their real value is keeping irrelevant tool output out of the parent conversation.

Updated Apr 18, 2026
Concept

Context hygiene

The discipline of keeping the parent conversation's working memory focused on decisions, not raw tool output.

Every grep, find, and 200-line log read consumes the same context that needs to hold the problem statement, your plan, and the in-flight edits. Subagents are how you keep that separation clean.

The framing that helped

I used to reach for subagents only when I had genuinely parallel work. That left a lot on the table. The other reason to spawn one is context hygiene: the subagent reads files, runs greps, walks logs — and returns a 200-word summary. The parent never sees the noise.

This matters more than parallelism does. The main conversation is the scarce resource. Filling it with find output is how a session degrades.

When to spawn vs not

Spawn a subagent
  • “Find every place X is used” — wide search across the repo
  • Reading external library source you’ll throw away
  • Summarising 20 log lines — extraction, not synthesis
  • Anything that needs ≥3 tool calls and you only want the conclusion
Just do it inline
  • A single targeted file read
  • Work that needs your judgement at each step
  • “Implement feature X” — too open-ended; the subagent will misjudge intent
  • Anything you’d want to course-correct mid-flight

The prompt shape

A good subagent prompt
Audit what's left before this branch can ship.
Context: I've already merged main and run tests locally.
Check: uncommitted changes, commits ahead of main,
whether the feature-flag gate is wired up,
whether CI-relevant files changed.
Report a punch list — done vs missing. Under 200 words.

What I keep getting wrong

Anti-pattern
Trusting the summary as ground truth
Smell

Subagent reports “I edited X.ts to handle the null case.” You move on without diffing.

Why it happens

The summary reads cleanly. The work sounded done. You’re saving cognitive effort by treating it as done.

Fix instead

The summary describes intent. The diff describes effect. If the subagent wrote code, you still read the diff before reporting the task as complete.

Subagent
A short-lived agent spawned by the parent agent. Has its own context window and tools; returns one final message.
Context window
The bounded conversation history the model sees per turn. Once full, you start losing the earliest content.
Tool call
An invocation of a tool (read file, grep, run command) inside the agent loop. Tool results are written into the conversation.

Related