Context & Reasoning/Context Engineering
Intermediate7 min

Subagents as Context Isolation

The primary reason to use subagents isn't parallelism — it's keeping investigation noise out of your main context window. A subagent that reads 20 files returns a 200-token summary instead of 20,000 tokens inline.

Quick Reference

  • Each subagent gets a fresh, isolated context window — not shared with the parent
  • Subagent reads, searches, and tool outputs stay in the subagent's window — parent stays clean
  • Explore subagent: Haiku-powered, read-only, cheapest for codebase search
  • General-purpose subagent: full tool access, inherits parent model, for complex investigation
  • 20 file reads in a subagent = ~200-token summary in parent vs ~20,000 tokens inline
  • Subagents run concurrently — multiple can execute in parallel from one parent message
  • Spawning overhead: ~1 extra API call and initialization cost per subagent
  • Don't use subagents for isolation when you need the raw detail in the main context for follow-up work

Why Context Isolation Is the Real Benefit

Most articles about subagents focus on parallelism. Parallelism is real and valuable, but it is not the primary benefit for context engineering. The main benefit is that investigation work — reading files, running searches, exploring a codebase — happens in a separate context window, and the parent window only receives the summary.

Without subagentsWith subagents
Read 20 files to investigate a bug → 20,000+ tokens added to main contextSubagent reads 20 files → returns 200-token summary → main context stays clean
Search results for all matching files live in main context for the entire sessionSearch results live only in the subagent's window, which closes after it returns
Main context fills with investigation noise before the fix even beginsMain context receives only the conclusion — which file, which line, what to change
Each Subagent Gets a Fresh Window

Subagents cannot see the parent's context, prior tool results, other subagents' output, or conversation history. Each subagent is an isolated Claude instance with its own system prompt, tool access list, and context window. The only thing that flows back is what the subagent explicitly includes in its final response.