A sub-agent is a separate Claude with its own context window, its own instructions and its own tools. The main session gives it a task; it works; only a short report comes back. Two things follow from that, and both matter more than speed.
1. A clean context is a fresh pair of eyes
The session that wrote a quiz "knows" what each question meant, so it reads its own mistakes as correct. Our tech-reviewer agent starts with nothing but the files and a checklist: is the marked answer really right according to current docs, is any distractor also right, are the accepted commands complete? It found a question with two correct answers that three human readers had missed.
Our rule in CLAUDE.md: graded content (quiz, commands, final tests) must pass tech-reviewer before merge. The writer and the reviewer are never the same context.
2. Noisy work stays out of the main session
Reading 40 files to find where something is used fills the main context with text you will never need again. A sub-agent reads them and returns five lines. The main session stays small and sharp for decisions.
flowchart LR M["Main session"] --> W["assessment-writer"] W --> F["quiz.yaml, lessons"] F --> R["tech-reviewer (clean context)"] R --> T["Table of issues"] T --> M %% step M: The main session only plans and decides. %% step W: A writer agent produces the content from the notes. %% step R: The reviewer has not seen how the content was written. %% step T: Only the findings come back, not the 40 files it read.
When parallel agents are worth it
Running several agents at once is tempting and can burn through a plan fast. We run things in parallel only when:
- the tasks are independent (no task needs another's result);
- each task is big enough to justify starting an agent (seconds of work is cheaper inline);
- we want several options to compare (three designs, three approaches).
Writing four module maps that share nothing: parallel. Fixing a bug and then writing the test for it: one session, in order.
Writing an agent file
An agent is a Markdown file in .claude/agents/ with a name, a description that says when to use it, the tools it may use, and its instructions. Give reviewers read-only tools. Ask for a fixed report format. Tell it what it must not do ("never commit", "do not edit files"). That is enough; the shorter the file, the more of the agent's context is left for the task.