What are sub-agents and when should I spawn them?
Categories:
Claude Code Developer Guide
Sub-agents are parallel Claude Code instances spawned by your main session, each with its own context window, working independently on a task you delegate. Useful when:
- Parallel work: spawn three sub-agents to audit, build, and test in parallel — they each get a fresh context window, so a 30-min audit doesn’t blow your main session’s context.
- Long-running tasks: a sub-agent can grind on “port these 80 Luma blocks to Hyvä” for an hour while you keep planning in your main session.
- Specialised personas: a sub-agent with a stricter
CLAUDE.md(e.g. “you are a security auditor; only output findings, never edit”) gives you focused output without polluting your main agent’s instructions.
Spawn with the Task tool. They report back to the main session when done — you get the summary, not the keystroke-by-keystroke noise.
Was this helpful?