Claude Code Subagents Read 7x More Than They Return
Claude Code subagents, measured: one real run read 6.9x what it returned. The seven built-ins, custom subagent files, the 20-agent limit, skills vs agent teams.
Claude Code subagents are separate Claude instances that your main session starts through its Agent tool. Each one gets a fresh context window, its own prompt, tools and model, does the noisy work, and returns only a summary. You define them as Markdown files in .claude/agents/, and Claude delegates on its own or when you name one.
Updated November 23, 2026 · by the AITerm team
tool output one of our subagents read, against what it handed back (38,513 vs 5,604 characters, Nov 1, 2026)
subagents running at once before Claude Code refuses the next spawn, by default
long sessions in one of our repos where Claude chose to delegate, Oct 26 to Nov 23, 2026
Key takeaways
- A subagent protects your main context window. It does not lower your bill: its requests draw on the same limits.
- You already have seven built-in subagents. Explore and Plan do most of the useful delegation without any setup.
- A custom subagent is one Markdown file with a name and a description. The description decides when Claude uses it.
- Default limits: 20 running at once, three layers of nesting, no total cap per session.
- Need the agents to argue with each other? That is agent teams. Need the same instructions everywhere? That is a skill.
What are subagents in Claude Code?
A subagent is a worker that Claude Code's main session starts for one task. Anthropic's documentation describes it as a specialized assistant that "runs in its own context window with a custom system prompt, specific tool access, and independent permissions", and returns only a summary. The main session never sees the files it opened or the commands it ran.
At AITerm, where we build a native macOS terminal for piloting Claude Code and Codex agent sessions, we took one real subagent run from November 1, 2026 and measured it: 31 tool calls in 94 seconds, 38,513 characters of tool output read, 5,604 characters handed back. That 6.9x gap is what a subagent is for. It keeps the main window clean, and you still pay for every token it read.
Here's the thing. Most guides ranking for this query were written around the July 2025 launch, when InfoQ covered the feature as freshly available. A lot has moved since: fork mode, background subagents by default, nesting, worktree isolation, persistent memory. If a tutorial tells you /agents opens a wizard, it describes Claude Code 2.1.197 or older.
The audience grew with it. In Stack Overflow's 2026 Developer Survey, Claude Code was the coding agent developers chose most, at 66%. Plenty of those users have never opened .claude/agents/, and that is fine: the built-ins already delegate for them.
The seven built-in subagents you already have
Before writing a single file, look at what ships in the box. Claude Code registers these subagents in every interactive session, and each inherits your permission rules. Turns out the first two cover most of the delegation a normal coding day needs.
| Subagent | Tools | What Claude uses it for |
|---|---|---|
| Explore | Read-only | Codebase search at three depths: quick, medium, very thorough |
| Plan | Read-only | Research while you are in plan mode |
| general-purpose | All subagent tools | Multi-step tasks that need to explore and act |
| claude | All subagent tools | Catch-all, and the default agent for background sessions |
| web-fetch | Web reading | Reads pages, on Haiku when it can |
| claude-code-guide | Docs lookup | Answers questions about Claude Code itself, on Haiku |
| statusline-setup | Settings | Runs when you type /statusline, on Sonnet |
Two details catch people. A project or user subagent named Explore replaces the built-in one and keeps its own model field, so model: haiku gives you cheap exploration. And Explore, Plan and web-fetch skip your CLAUDE.md, which explains why an Explore pass sometimes ignores a convention you wrote down. If you rely on our plan mode workflow, the research behind each plan comes from that read-only Plan subagent.
What one subagent run cost us
Nobody in the current top results puts a number on the context a subagent saves, so we pulled one from our own logs. On November 1, a long headless Claude Code session in one of our repos had to check six third-party web pages. Nothing in the prompt mentioned subagents. Claude spawned a general-purpose subagent in the background on its own.
31 tool calls in 94 seconds
22 WebFetch, 8 Bash, 1 ToolSearch, spread over 27 API requests on Opus 5.5.
38,513 characters in
Raw tool results that stayed in the subagent's window. Its context peaked at 36,518 tokens.
5,604 characters out
One structured report, about 1,400 tokens. That is all the main session had to carry from then on.
804k input tokens processed
719k of them cache reads. Every request resends the subagent's growing context, and all of it counts.
So the main conversation received 5,604 characters instead of 38,513. That lines up with Anthropic's own engineering guidance from September 2025, which says a subagent may use "tens of thousands of tokens or more" and return a summary of "often 1,000-2,000 tokens". Our report landed right in that band.
The launch posts skip the bill. Honestly, it surprised us too: the subagent re-read its own context on each of its 27 requests, which adds up to 803,972 input tokens, mostly served from cache. The docs are blunt about it: subagent requests "count toward the same usage limits as the main conversation". You buy a clean main window with extra usage, and that is a good trade only when the main session is long enough to need it.
One run, one task type (web research), measured from the session's JSONL transcripts. A code-reading subagent will show a different ratio. Count yours with the same method: the subagent transcript lives at ~/.claude/projects/<project>/<session>/subagents/agent-<id>.jsonl.
How do you create a custom subagent?
You write one Markdown file. Only name and description are required, the body becomes the subagent's system prompt, and Claude Code watches the agents folders, so a new file is live within seconds. Since version 2.1.198, /agents just reminds you where the files go. Here is the shape we would start from for a test runner, the most common verbose job in a coding session:
---
name: test-runner
description: Runs the test suite and reports only failures with file and line. Use proactively after code changes.
tools: Bash, Read, Grep, Glob
model: haiku
maxTurns: 15
---
Run the project's tests. Report each failing test with its file, line,
assertion and the smallest relevant excerpt of output. Do not paste
passing tests. Do not edit files. If everything passes, say so in one line.
Pick the scope
.claude/agents/ for one repo, committed with the code. ~/.claude/agents/ for every project on your machine. Subfolders are allowed.
Write the description first
It is the routing rule. Say when to use the subagent, in one sentence that no other subagent could claim.
Cut the tools
An allowlist in tools, or a denylist in disallowedTools. Omit both and it inherits everything, MCP included.
Call it by name once
Type @agent-test-runner or "use the test-runner subagent". If Claude cannot find it, restart the session.
For a throwaway test or a script, skip the file. The --agents flag takes the same fields as JSON and the definition lives only for that session:
claude --agents '{
"log-reader": {
"description": "Reads long log files and reports the errors it finds.",
"prompt": "Report each distinct error once, with a count and the first timestamp.",
"tools": ["Read", "Grep", "Bash"],
"model": "haiku"
}
}'
Watch the precedence when names collide: managed settings win, then --agents, then the project folder, then your user folder, then plugins. A file is silently skipped if the opening --- is not on line 1, if the name contains a colon or if the YAML does not parse. Run /doctor when a subagent seems to vanish.
The frontmatter fields that change behavior
Honestly, most of the frontmatter list is optional polish. These are the fields we would actually reach for, because each one changes what the subagent can do or what it costs:
| Field | Values | Why it matters |
|---|---|---|
model | haiku, sonnet, opus, fable, full ID, inherit | The biggest cost lever. Without it, the subagent runs on your session's model. |
tools / disallowedTools | Tool names, mcp__server__* | A reviewer without Edit can still write files through Bash. Deny what you mean. |
isolation | worktree | Runs in a temporary git worktree, removed if it changed nothing. |
permissionMode | default, acceptEdits, auto, dontAsk, plan… | Ignored if your main session already runs in bypass, acceptEdits or auto mode. |
memory | user, project, local | Gives it a MEMORY.md that survives sessions. Project scope can be committed. |
maxTurns | Integer | A ceiling on runaway work. Output comes back marked partial and can be resumed. |
skills | Up to 32 skill names | Preloads the full skill content at startup, since subagents do not inherit your invoked skills. |
Trap
Field names are camelCase and unknown fields are dropped without an error. max_turns or disallowed-tools simply do nothing. Run claude --debug and search the debug log for "does not recognize or apply" (v2.1.296 and later).
Does Claude Code automatically use subagents?
Yes. Claude reads your request, the description of every subagent and the current context, then decides whether to delegate. Phrases like "use proactively" in a description push it toward delegating. It also calls the built-in Explore and Plan subagents without being asked. Since fork mode became the default, it can even fork the whole conversation into a background subagent.
In practice it delegates less than the marketing suggests. Across 34 long Claude Code sessions in one of our repos between October 26 and November 23, 2026, Claude called the Agent tool exactly once, for the web research run measured above. None of those prompts mentioned subagents. And yes, we found that low too, then realized we had never written a single description that invited delegation.
Look, if you want Claude to delegate a kind of work every time, say it in the description, or ask for it by name. Keep descriptions short: once the combined descriptions of your custom subagents pass about 15,000 tokens, Claude Code warns you at startup, and the routing gets fuzzier long before that.
Two defaults surprise people coming from 2025 tutorials. A custom subagent that Claude spawns from the main conversation now starts in the background, and its result arrives as a notification in a later turn. Press Ctrl+B to send a running task to the background yourself. If you prefer Claude to wait, set CLAUDE_CODE_FORK_SUBAGENT to 0 in settings.json and start a new session.
How many subagents can Claude Code run?
Twenty at a time, by default. The 21st spawn fails with "Concurrent subagent limit reached" and Claude is told not to retry. You can change the ceiling with CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS, there is no cap on the total over a session, and subagents can spawn their own subagents up to three layers below the main conversation.
{
"env": {
"CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS": "6",
"CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH": "1",
"CLAUDE_CODE_SUBAGENT_MODEL": "sonnet"
}
}
That is the block we would put in a shared settings.json: six at once, no nesting, Sonnet unless a file says otherwise. Fair question: why throttle a limit nobody hits? Because the cost curve climbs much faster than the agent count suggests. Anthropic's June 2025 write-up of its multi-agent research system gives the multipliers, measured against a plain chat:
That last caveat is the one to remember. The same Anthropic article says "most coding tasks involve fewer truly parallelizable tasks than research". Four subagents reading four modules in parallel works. Four subagents editing the same feature is a merge conflict with extra steps, and Anthropic's own April 2026 guide calls two subagents editing one file "a recipe for conflict".
Subagents, skills or agent teams
The three get mixed up because they all extend Claude Code. They solve different problems. A skill is instructions loaded on demand into the current context. A subagent is a separate worker with its own window that reports back once. An agent team is several full Claude Code instances that keep running and message each other.
| Skill | Subagent | Agent team | |
|---|---|---|---|
| Context | Your main window | Its own, fresh | One per teammate |
| Talks to | Nobody | The main session only | Each other, via a shared task list |
| Lifetime | While invoked | One task, resumable | Until you shut it down |
| Extra cost | Near zero | Its own requests | ~7x a standard session in plan mode |
| Use it for | Conventions, procedures | Noisy reads, tests, logs, reviews | Work where the agents must disagree |
Our rule of thumb: if the problem is "Claude keeps forgetting how we do X", write a skill. If it is "this job floods my context", write a subagent. If it is "I want three opinions that challenge each other", read our Claude Code agent teams breakdown first, because teams are experimental, need CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 and cost real money. And if you need several agents writing code at the same time, none of the three replaces separate worktrees, which our guide to running multiple AI coding agents covers end to end.
Our opinion
Those GitHub collections of 75 or 100 ready-made specialists are a bad starting point. Every extra description makes routing less reliable, and most of those agents duplicate what your main session already does well. Simon Willison puts it plainly: your root agent "is perfectly capable of debugging or reviewing its own output provided it has the tokens to spare". Start with zero custom subagents. Add one only when you can name the verbose output it will swallow.
Cognition made the opposite case in June 2025 with "Don't Build Multi-Agents": agents should share full context, because "actions carry implicit decisions". We agree for writers. For readers, a subagent that never sees your conversation is the feature: it cannot inherit your wrong assumption about where the bug lives.
Where subagents bit us
We build a terminal whose whole job is showing what agents do, and subagents were a blind spot at first. The parent transcript only records the Agent call and, much later, its result. Until our August 19 release, that is all AITerm showed too: one line in the thread for what could be minutes of work and dozens of tool calls.
Fixing it meant reading each subagent's own transcript from the subagents/ folder next to the session, nesting the steps under the call that spawned them, and doing it without a timer, because a streaming thread rereads its transcript about ten times a second. So, three traps we would warn any team about:
Opus by inheritance
Switch your session to Opus and every subagent without a model field follows. Anthropic's cost docs recommend model: haiku for simple subagent tasks.
The invisible permission
A background subagent's permission prompt appears in the main session. Miss it, and the subagent sits there waiting while you think it is working.
The summary you trust
The main session sees only the report. If the subagent misread a file, nothing upstream knows. Ask for paths and line numbers in every report.
That third trap is why we tell people to keep subagents on read-heavy work. A wrong summary of a log costs you a minute. A wrong summary of edits the subagent made, in files you never looked at, can cost you a day.
Watching subagents from outside the session
AITerm, the native macOS terminal we build for running Claude Code, Codex and other agent sessions in parallel panes, reads each subagent's transcript and shows it inside the thread that spawned it: its name, its mission, the tool it holds right now and its report when it finishes, including subagents spawned by subagents. Their turns also count in the cost view, since they are billed like any other.
In practice that changes one habit. You stop guessing whether a session is stuck or quietly running four Explore passes, and you can see when a background subagent is waiting on a permission prompt. Claude Code's own /tasks view shows the model and effort of a running subagent. We wanted the same answer for twenty panes at once. If you are new to the tool itself, start with our guide to using Claude Code. If you are still choosing an agent, our Claude Code alternatives roundup shows which rivals have subagents at all.
The short version: let Explore and Plan do their job, write one custom subagent for the noisiest thing you run, give it a cheap model and a tight tool list, and count what it returns. Then tell us what broke: hello@aiterm.app.
Going further
Sources
- Create custom subagents, Claude Code documentation, read November 23, 2026: built-in subagents, file locations and precedence, frontmatter fields,
--agents, automatic delegation and the 15,000-token description budget, background defaults, nesting depth, the 20 concurrent subagent limit, context passed to subagents, forks. - Manage costs effectively, Claude Code documentation, read November 23, 2026: delegating verbose operations to subagents, subagent requests drawing on your usage,
model: haikufor simple subagents, agent teams at about 7x tokens in plan mode. - How and when to use subagents in Claude Code, Anthropic, April 7, 2026: when to use and avoid subagents, same-file edits, subagents that cannot talk to one another.
- How we built our multi-agent research system, Anthropic Engineering, June 13, 2025: agents at about 4x and multi-agent systems at about 15x the tokens of chat, coding tasks less parallelizable than research.
- Effective context engineering for AI agents, Anthropic Engineering, September 29, 2025: subagents exploring with tens of thousands of tokens and returning summaries of often 1,000 to 2,000 tokens.
- Don't Build Multi-Agents, Walden Yan, Cognition, June 12, 2025: sharing full context, actions carrying implicit decisions.
- Subagents, Simon Willison, Agentic Engineering Patterns, read November 23, 2026: the Explore subagent, specialist subagents and the case against having too many.
- Claude Code Subagents Enable Modular AI Workflows with Isolated Context, Hien Luu, InfoQ, August 19, 2025: general availability of subagents.
- The results of the 2026 Developer Survey are here, Stack Overflow, October 6, 2026: Claude Code as the coding agent developers choose most (66%).
Frequently asked questions
What is a subagent in Claude Code?
A subagent is a separate Claude instance that the main session starts through its Agent tool. It begins with a fresh context window, its own system prompt, tool list and model, works on one task, and returns only a summary to the main conversation. Claude Code ships built-in subagents such as Explore, Plan and general-purpose, and you can add your own as Markdown files.
Does Claude Code automatically use subagents?
Yes. Claude decides to delegate based on your request and on the description field of each subagent, and words like 'use proactively' in a description make delegation more likely. It also uses the built-in Explore and Plan subagents on its own. In practice delegation is rarer than people expect: in 34 of our own long sessions, Claude delegated once without being asked.
How many subagents can Claude Code run at once?
By default, 20 running subagents. The next spawn fails with 'Concurrent subagent limit reached', and the variable CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS changes that number. There is no cap on the total over a session. Subagents can also spawn subagents up to three layers below the main conversation, adjustable with CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH.
How do I create a custom subagent in Claude Code?
Create a Markdown file in .claude/agents/ for one project or ~/.claude/agents/ for all of them. The YAML frontmatter needs a name and a description, and can add tools, model, permissionMode, isolation, memory and more. The body is the subagent's system prompt. Claude Code watches those folders, so a new file is picked up within seconds.
Do subagents save tokens in Claude Code?
They save main-context tokens, not total tokens. A subagent's own requests count toward the same usage limits as your main conversation. What it saves is the space in your main window: in one of our runs, a subagent read 38,513 characters of tool output and handed back 5,604. To spend less on subagents, set model: haiku or sonnet on the simple ones.
What is the difference between subagents and agent teams?
Subagents work for the main session and report only to it, then disappear. Agent teams are separate Claude Code instances that keep running, share a task list and message each other. Teams are experimental, enabled with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, and Anthropic's cost docs put them at roughly 7x the tokens of a standard session in plan mode.
Can a Claude Code subagent read my CLAUDE.md?
Most do. A non-fork subagent receives your CLAUDE.md files, a git status snapshot and its own prompt, but not your conversation history or the files the main session already read. The built-in Explore, Plan and web-fetch subagents skip CLAUDE.md, and a custom subagent can skip it with omitClaudeMd: true.