Aggregate token usage / cost across sub-agent sessions in status line

Resolved 💬 2 comments Opened Apr 14, 2026 by joshreep Closed Apr 14, 2026

Feature Request

Problem

When using multi-agent workflows (e.g., an orchestrator that spawns several sub-agents via the Agent tool), the cost and context_window data provided to the status line script only reflects the primary session's token usage. Sub-agents run in isolated sessions, so their costs are invisible to the user in the status line.

This makes it difficult to understand the true cost of a pipeline run that delegates work across multiple agents.

Proposed Solution

Provide an aggregated cost field in the status line JSON input that includes token usage from all sub-agent sessions spawned by the current conversation. For example:

{
  "cost": {
    "total_cost_usd": 0.12,
    "aggregate_cost_usd": 0.87,
    "sub_agent_cost_usd": 0.75
  }
}

Or alternatively, expose a parent_session_id linkage so external tooling can correlate and sum costs across related sessions.

Use Case

I maintain a Claude Code plugin with a multi-agent SDL pipeline that orchestrates 6+ sub-agents (ticket fetcher, architect, implementer, reviewer, e2e tester, auditor). After a full pipeline run, the status line only shows the orchestrator's cost — a small fraction of the actual spend. Being able to see the total cost at a glance would help with cost awareness and budgeting.

Alternatives Considered

  • Manual state file tracking: Have each sub-agent write its token usage to a shared file, then read it in the status line script. Works but fragile and requires modifying every agent.
  • Parsing transcript files: Extract token counts from transcript JSONs. Slow and brittle.

Neither approach is ideal compared to native support.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗