Subagent spend is not invisible — you are reading the wrong meter
Subagent tokens are not invisible to Claude Code. Only the prompt cache line is main-conversation-only; /usage attributes usage to subagents by name and the agent panel shows a live per-subagent token count. /context excludes them by design, not as a gap.
This advice is common and does not hold. The official page saying otherwise is linked below.
What this costs you if it is wrong
Believing the strong "invisible" version pushes you to avoid subagents where they genuinely save context. Believing the corrected version and then not checking is worse: fan-out really can burn a quota window fast, and the instruments named here are approximate, computed from local session history on this machine, and exclude other devices. Treat them as direction, not billing.
A turn delegated four subagents. They came back with tidy summaries, /context showed
your window barely moved, and twenty minutes later you hit a rate limit you did not see
coming. The folk explanation for this is that subagent tokens are invisible to Claude
Code's own instruments. That explanation is close enough to be repeated a lot and wrong
in the part that matters: the numbers exist, they are just not on the screen you looked at.
What each meter is actually scoped to
| Instrument | Scope | Subagents included? |
|---|---|---|
/context | The current context window | No — by design. A subagent has its own window; only its final text plus a small metadata trailer returns to yours |
Session Total cost line | "all API calls in the current session" | Not carved out anywhere in the docs. The statusline cost.total_cost_usd field is documented with that same wording |
Prompt cache (main) line | The main conversation's cache stats | No — explicitly. This is the one documented exclusion |
/usage → Attribution | Recent usage on your plan | Yes — usage is attributed to skills, subagents, plugins and MCP servers, each as a percentage of the total |
| Agent panel row | One live subagent | Yes — the default row is name · description · token count |
| OpenTelemetry | Every request | Yes — query_source (main / subagent / auxiliary) and agent_id tag each one |
The confusion has a clean origin. The docs say, in one sentence, "It covers the main
conversation only, not subagents." That sentence is about the Prompt cache (main) line —
requests, hit ratio, misses, warm or cold. It has been generalized into a claim about all
cost telemetry, which the same page contradicts two sections later when it lists subagents
as an attribution category in /usage.
What to do instead
Keep the habit, drop the reasoning behind it. Delegation genuinely can cost several times
what the same work costs inline — each subagent pays for its own system prompt, its own
CLAUDE.md load, and its own MCP tool definitions, and none of that rides your warm cache.
The fix is to look at the meter that is scoped to the thing you are worried about:
- Before and after a fan-out turn, check
/usage, not/context. Pressdorwto switch between 24 hours and 7 days. The Attribution list will name the subagents. - During the turn, the agent panel under your prompt already shows a token count per running subagent. Watching four rows climb in parallel is the most direct signal there is.
- If you want it in your status line,
subagentStatusLinereceives every visible row as JSON withtokenCount,contextWindowSizeandtokenSamplesper task, so you can render a running total yourself.contextWindowSize— the field that turns a raw count into a percentage — arrived late: it and the per-taskmodelfield "require Claude Code v2.1.205 or later and are omitted for a task whose model isn't resolved yet." - If you need real accounting, export OpenTelemetry and group by
query_sourceandagent_id. That is the only path that gives you per-subagent token and cost metrics you can trust rather than estimate.
What is still unverified
Nobody has run a controlled measurement for this entry. Specifically:
- The cost total. No doc sentence says the session
Total costfigure includes subagent API calls. It says it accumulates all API calls in the session, and a subagent's requests are made in that session — but that is an inference from wording, not a stated guarantee. This is the single load-bearing gap. If the total in fact excludes subagents, the original "invisible" claim is right about/costand wrong only about/usage. - How fast attribution updates.
/usageis described as showing recent usage; whether a subagent that finished sixty seconds ago is already in the percentages is not documented.
What would settle it: two headless runs of comparable work, one that delegates and one that
does not, comparing the reported total_cost_usd against the token counts the subagents
themselves reported. If the delegating run's total is roughly the inline run's total plus the
subagents' own consumption, the cost line is inclusive and the strong claim is dead.
# Same task, one delegating, one not. Compare the totals.
claude -p "Use a subagent to summarize src/, then report" --output-format json \
| jq '{total_cost_usd, usage}'
claude -p "Summarize src/ yourself, then report" --output-format json \
| jq '{total_cost_usd, usage}'Run it twice in each direction — cache warmth alone moves these numbers enough to fool a single comparison.
Checkpoint
- Your
/contextgrid barely moved after a turn that spawned five subagents. Is that evidence the turn was cheap?Show answerAnswer
No — it is evidence of nothing at all about cost.
/contextvisualizes the current context window, and each subagent runs in its own window; only its final text plus a small metadata trailer comes back to yours. The docs walk through a subagent that reads 6,100 tokens of files and returns 420, which is the point of delegating rather than a reporting gap — a request to add a per-subagent breakdown to/contextwas closed as not planned. Check/usagebefore and after the fan-out instead. - Which single number in the Session block is documented as main-conversation-only, and
which meter names subagents explicitly?
Show answerAnswer
The
Prompt cache (main)line is the one documented exclusion: the sentence "It covers the main conversation only, not subagents" is about that line's requests, hit ratio and misses, and has been over-generalized into a claim about all cost telemetry. The meter that names subagents is/usage→ Attribution, which splits recent usage across skills, subagents, plugins and MCP servers as percentages — on the same docs page, two sections later. The sessionTotal costline is neither: nothing carves subagents out of it, but nothing states they are in it either, and that inference is this tip's one load-bearing gap. - You need per-subagent cost you can put in a spreadsheet. Which of these six instruments
is the only one built for that?
Show answerAnswer
OpenTelemetry. It tags every request with
query_source—main,subagentorauxiliary— and withagent_id, so grouping by those gives you per-subagent token and cost metrics you can trust rather than estimate. Every other instrument here is approximate: computed locally at list price from this machine's session history, with other devices and claude.ai missing. If you are reconciling against a bill, the Console usage page is the authority.