A Fresh Mind for a Side Task
Leila asks her agent which of the 200 product pages in a folder still show last year's prices. Ten minutes later it has the answer: 11 pages. But when she goes back to the real job, rewriting the spring campaign, the agent is slow, and twice it mixes up a detail from one of the product pages with her campaign notes.
The answer was 11 file names. Why did finding them make everything after it worse?
Leila It did exactly what I asked. It just seems tired afterwards.
Omid Think about where those 200 pages went after the agent read them.
Leila Into its context. Every page it read became a tool result in the conversation. So they're all still there.
Omid All 200, in every request from now on. How much of that do you actually need for the campaign?
Leila One line. The list of 11 pages.
Omid So the reading was necessary, but keeping it wasn't. If you'd had a colleague, what would you have done?
Leila Asked them to go through the pages and send me the list. I'd never see the 200 pages, only their message.
Omid An agent can do the same thing: start a second agent, give it the job, and get back only its message.
Leila A second agent with its own context window?
Omid A brand-new one, empty apart from its own instructions and the job you gave it. It reads the 200 pages in its context. When it's done, its context is thrown away and only the report comes back to yours.
How a subagent works
A subagent is an agent started by another agent to do one side task. The main agent writes it a brief: a message saying what to do, where to look and what to send back. The harness then starts a new agent with:
- its own fresh context window, holding its own system prompt and the brief, and nothing else;
- its own loop: it asks for tools, reads results and decides its next steps, just like the main agent;
- often its own set of tools, and sometimes a cheaper, faster model.
When it decides it's done, it writes a final report. Only that report goes back into the main agent's context, as one tool result. The 200 pages it read, all its tool calls and all its thinking stay behind in its own context, which is then dropped.
In Leila's case, that could mean around 150,000 tokens of product pages read in the subagent's context, and a report of a few hundred tokens arriving in hers. Her main conversation stays as clean as it was before she asked.
Handing work to a helper like this is called delegation.
Several at once
Because each subagent has its own context, several can work at the same time without getting in each other's way. The main agent might send one to check the product pages, one to search old campaigns for the spring slogan, and one to read the brand guide for rules about prices. They work side by side, and three short reports come back.
This is faster, and it keeps the main context free for the campaign itself.
What it costs
Delegation isn't always worth it.
- More tokens in total. Each subagent has its own system prompt and does its own reading. Three helpers can use more tokens than one agent doing the same work, even though the main context stays small.
- The helper knows only the brief. It hasn't seen your conversation. If you spent ten minutes explaining that "price" means the price before tax, and the brief doesn't say so, the helper doesn't know.
- The report can drop details. You get the summary, not the reading. Something the helper thought unimportant may be exactly what you needed.
- You can't watch it work. You see what it reports, written in the same confident style whether it's right or wrong.
So delegation pays off when a side task needs a lot of reading and only a little of it is the answer. Searching many files, checking a long document for one thing, looking up how something works elsewhere in a project: good. A quick look at one file: just let the main agent do it.
Subagents in Claude Code
Claude Code starts subagents on its own when a task fits, and you can ask for one ("use a subagent to..."). It has built-in ones, such as Explore, a read-only helper for searching through a project, and a general-purpose one with all the usual tools.
You can also define your own, as a Markdown file in .claude/agents/ (for one project) or ~/.claude/agents/ (for all of yours). The top of the file names the helper, says when to use it, and can limit its tools and choose its model; the rest is its own system prompt:
---
name: price-checker
description: Checks product pages for prices and reports only the pages and prices found.
tools: Read, Grep, Glob
model: haiku
---
You check product pages for prices. Never edit files.
Report one line per page: the file name and the price you found.Notice what the file gives this helper: a clear job, only reading and searching tools (so it can't change anything), a small, cheap model, and a fixed shape for its report. A good brief and a good helper definition are short for the same reason: the helper starts with nothing else.
Try it
In Claude Code, run
/contextand note how full the context is. Then ask: "Use a subagent to find every file in this folder that mentions the word price, and report only the file names." Run/contextagain: the context grew by the report, not by the files. Without an agent, you can do the same by hand: summarise a long document in a separate chat, then paste only the summary into your main one.
Using it well
- Delegate reading, not deciding. Hand off searching and checking where most of what's read is thrown away; keep the decisions in your main conversation, where the full picture is.
- Write the brief as if to a new colleague. Say the goal, where to look, what you already know or have ruled out, and anything that's easy to get wrong. The helper has seen none of your conversation.
- Ask for a fixed shape of report. "One line per page: file name and price" is easier to use, and harder to pad with guesses, than "tell me what you find".
- Check what matters. A helper's report is a summary of work you didn't see. Open one or two of the files it names before you build on the answer.
Words to know
- subagent - an agent started by another agent for one side task, with its own fresh context, whose final report is all that comes back
- brief - the message that tells a helper agent what to do, where to look and what to report
- delegation - handing a task to a helper, so its work happens outside your own context
Big idea
A subagent does a side task in a context of its own and sends back only the answer. Delegate when a job needs a lot of reading and little of it is the answer, and write the brief for someone who knows nothing else.