A subagent is an agent assigned a task by another agent. In Claude Code, subagents run as separate conversations and can work in parallel, then return their results to the main agent. Their separate contexts keep detailed task work from filling the main session’s context. section 6.4 section 6.12
The main agent requests a subagent much like a tool call, and Claude Code checks whether the request is permitted. The subagent starts with a standard system prompt and may receive CLAUDE.md, but it does not inherit the main conversation. Its task prompt must therefore include enough background to work independently. On completion, its output returns as a tool response. section 6.4
Claude Code can delegate different kinds of work:
- Explore agents conduct read-only research. section 6.4
- Plan agents prepare plans for the main session to implement. section 6.4
- General-purpose agents can edit and run commands, subject to the main session’s permission model. section 6.4
Plan dependent slices in parallel
When implementation slices depend on earlier slices, their builds may need to run in sequence even though their plans can be prepared in parallel. Ask a coordinator to review dependencies and open decisions, establish shared contracts, and assign one planner to each slice. Once the planners report back, the coordinator can check the plans for inconsistencies and dispatch separate reviewers. Review the resulting plans before building. section 6.9 section 6.10
Listing 6.6 Part of the prompt Claude wrote for me to send to the next Claude
Do this yourself, before dispatching anything. Write `docs/plans/ch06/04-slice-contracts.md`. Six planners working blind will close the same gap two different ways wherever slices touch. This document is the answer, and it is the reason the fan-out is safe. It is not a summary of the delivery plan — it is a set of **rulings**, each naming the one slice that owns the thing.
This prompt excerpt establishes shared rulings and ownership before planners start, reducing the risk that independently prepared plans conflict. section 6.10
You can explicitly request delegation: “Run the tests using a subagent for each component and report back with the summary.” You can also ask a parent subagent to coordinate nested subagents and summarize their responses. Choose parallel work around real dependencies; separate sessions do not remove the need to review results and resolve shared decisions. section 6.4 section 6.10 section 6.12






