Subagents Keep the Main Context Clean

A subagent in Claude Code is a markdown file (in .claude/agents/) that defines a worker with its own isolated context window, its own scoped tool permissions, and its own blast radius. The point is not just delegation; it is context hygiene. A debugging hunt or a fifty-file exploration can burn an entire context window, and doing it in the main session degrades everything that comes after. Hand it to a subagent and only a tidy summary comes back.

The guide’s /pr-review example shows two design choices that make subagents work well. First, deliberately read-only tools: “a reviewer that can patch code starts rationalizing its own fixes instead of flagging them.” Second, an explicit “Do NOT flag” list, because without it the useful findings drown in nitpicks.

The general principle: separate concerns into separate contexts. Each worker sees only what its task needs, so per-task quality goes up while the orchestrating session stays lean enough to keep judging.