Building with agents, lesson 5.3
Subagents: planner, implementer, reviewer
One long session fills up with everything it reads. This lesson splits a job across three helpers, a planner, an implementer and a reviewer, each starting with a clean slate.
Every example below changes to fit what you pick. The businesses are made up for teaching.
The picture, one step at a time
Each box is one stage. The picture lights up as you scroll.
One job split across a planner, an implementer and a reviewer
1Your main session
Where you talk to the agent. It hands out jobs and gets back short reports.
2The planner
Reads the code and writes the plan. It can look, but it cannot change anything.
3The implementer
Makes the change the plan describes, and runs the checks.
4The reviewer
Starts fresh, reads the change against the plan, and lists what is wrong.
5Back to you
Only a summary comes back to the main session. You decide what ships.
One session, holding everything it has read.
Step 1 of 6
One long chat fills up
Everything the agent reads stays in its context window: the text it holds in mind for one conversation. Search results, test output and whole files pile up. The more there is, the less room for the job, and the more the early details get lost.
Step 2 of 6
A subagent is a helper with a clean slate
A subagent is a helper your main session hands one job to. It works in its own context window, with its own instructions and its own tools. When it finishes, only a short summary comes back. All the reading it did stays out of your main session.
Anthropic's docs: "Each subagent runs in its own context window with a custom system prompt, specific tool access, and independent permissions" (as of November 2026).
Step 3 of 6
Each helper is one file
A subagent is a short text file in the .claude/agents folder of your repo, shared with your team, or in your home folder, for you alone. The top lines give its name, a description of when to use it, the tools it may use and the model. Below that are its instructions. The planner gets reading tools only, so it can look but cannot change anything.
If a file leaves out the tools line, the helper gets every tool (as of November 2026). So list them.
How does the main session decide when to hand a job to your planner?
Step 4 of 6
The implementer makes the change
The implementer gets the plan and the editing tools, and makes the change for free delivery over £50. It runs the checks your CLAUDE.md names. Ask it to report what it changed and the output of the checks, not just "done".
Step 5 of 6
The reviewer starts fresh
Whoever wrote the code is the worst judge of it, because it remembers why it did everything. A reviewer subagent never saw that conversation. Give it the plan and the change, reading tools only, and ask what is wrong, most serious first.
Anthropic's docs say a review in a fresh subagent "isn't swayed by the reasoning that produced the code."
Why give the reviewer no memory of how the code was written?
Step 6 of 6
Helpers cost more, so use them for big jobs
Each helper sends its own requests to the model, and they count towards the same limits as your main session. Splitting a small job costs more than doing it. Use helpers when a job is big, or when side work would flood your chat with output you will not need again. You still decide what ships.
In June 2025 Anthropic reported that its multi-agent research system used about 15 times as many tokens as a chat, and that most coding tasks have fewer truly parallel parts than research.
Who should do this?
Here are four jobs from one change in your business. Sort each one to the helper that should do it, or keep it in the main session.
1Find every place the checkout works out delivery costs, and write down how to add free delivery over £50.
2Change the code as the plan says, and get the checkout tests passing.
3Read the finished change against the plan, with no memory of how it was written, and list what is wrong.
4Change the wording on the "Add to basket" button.
0 of 4 right so far, 4 to go.
Three subagent files
This is what you keep: what goes in each of the three files, in plain words, ready to write for your own repo.
Three subagent files
- Each file sits in the .claude/agents folder and starts with a name, a description of when to use it, its tools and its model.
- The planner: reading and searching tools only. It writes the plan to a file: the files to change, the change, and what done looks like.
- The implementer: reading and editing tools, and the shell to run checks. It follows the plan and reports the checks' output.
- The reviewer: reading tools only, and no memory of the build. It checks the change against the plan and lists problems, most serious first.
- Write each description as when to use the helper, so the main session knows when to hand a job over.
Hand a job over when it is big or noisy. Keep small jobs in the main session, and you decide what ships.
Next: Lesson 6.1: What makes a repo agent-ready. The things in a codebase that let an agent set itself up and check its own work.