[BUG] Token counter appears to omit sub-agent consumption, causing up to 10× undercount
Describe the bug
The running token counter shown in the Claude Code Desktop app appears to only count API calls on the main conversation thread. When Claude spawns sub-agents via the Agent tool, those sub-agents make their own API calls — which appear to be invisible to the counter. The displayed number can therefore be off by an order of magnitude, with no indication that any omission is occurring.
To reproduce
Give Claude a task that causes it to spawn sub-agents (e.g. "build test infrastructure for these two repos"). Watch the running counter during execution. Compare the displayed token count to the actual API usage in the session's JSONL file under ~/.claude/projects/.
Expected behavior
The counter reflects total token consumption for the session, including all sub-agent API calls attributed to that session.
Actual behavior
In a concrete example: the Desktop counter showed ~60K tokens for a 51-minute autonomous task. The underlying session JSONL recorded 239 deduplicated API calls with 605K output tokens — roughly 10× the displayed figure. The counter gave no indication it was incomplete.
Impact
This affects every user trying to manage their consumption — Pro, Max, and Enterprise alike. Pro users have the least headroom and arguably the most to lose from an understated counter. Enterprise users have the most at stake financially. Nobody can manage what they can't accurately see.
This is not a niche concern. Anthropic has clearly recognized the importance of usage transparency — the Plan usage display (showing 5-hour limit, weekly limits, per-model breakdowns) is evidence of that investment. The sub-agent blind spot undermines the value of that entire feature: a user watching their plan consumption bars approach limits is working with a number that may be substantially lower than actual usage.
Prior art / not a duplicate
A search of existing issues turned up several that are related in theme but distinct in complaint:
- #54623 — Reports unexpectedly high token consumption when sub-agents were used against the user's instructions. The complaint is about agent behavior (unauthorized sub-agent spawning) and task failure, not about the accuracy of the token counter display.
- #36727 — Reports a sub-agent running in an unbounded loop with no tool call or time limits. The complaint is about the absence of guardrails on sub-agent execution, not about the counter failing to reflect sub-agent consumption.
- #54673 — Requests that token counts be exposed to hooks and session context for programmatic use. This is a feature request for developer access to token metadata, not a bug report about the counter being incorrect for end users.
This issue is specifically about the counter being silently incomplete — not about agent behavior, not about programmatic access, but about the number shown to users being wrong in a way that makes cost management impossible.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗