Problem
The session-cost widget shows cost.total_cost_usd from the status line stdin. In current Claude Code, subagent/Task runs are stored as separate transcripts (projects/<proj>/<session>/subagents/agent-*.jsonl), and Claude Code's total_cost_usd only reflects the main transcript. So the cost value stays flat while subagents burn tokens — users running heavy Agent/Task workloads (parallel subagents, background tasks) see a misleadingly low cost.
Why ccstatusline can do this
ccstatusline already reads those subagents/*.jsonl files for the speed-metrics widgets (getReferencedSubagentIds / includeSubagents). The same transcript walk exposes each subagent's usage token counts. Cost can be computed from tokens × model pricing (as the closed #18 ccusage-style widgets proposed) and combined with the stdin total_cost_usd.
Proposal
Two possible shapes (either or both):
A. Option on existing session-cost widget — e.g. includeSubagents: true that adds subagent token cost to the displayed total.
B. New dedicated widget — e.g. session-cost-with-subagents (or total-cost) that always shows main + subagent cost, leaving the existing session-cost as main-only. This keeps the two values distinguishable for users who want both segments on the line:
$2.45 main + $1.10 agents = $3.55 total
Option B avoids changing existing behavior and lets users place main-only and combined side by side.
Environment
- ccstatusline 2.2.22
- Claude Code stores subagents in a separate
subagents/ dir (no isSidechain inlining in the main transcript), which is why total_cost_usd excludes them.
Problem
The
session-costwidget showscost.total_cost_usdfrom the status line stdin. In current Claude Code, subagent/Task runs are stored as separate transcripts (projects/<proj>/<session>/subagents/agent-*.jsonl), and Claude Code'stotal_cost_usdonly reflects the main transcript. So the cost value stays flat while subagents burn tokens — users running heavy Agent/Task workloads (parallel subagents, background tasks) see a misleadingly low cost.Why ccstatusline can do this
ccstatusline already reads those
subagents/*.jsonlfiles for the speed-metrics widgets (getReferencedSubagentIds/includeSubagents). The same transcript walk exposes each subagent'susagetoken counts. Cost can be computed from tokens × model pricing (as the closed #18 ccusage-style widgets proposed) and combined with the stdintotal_cost_usd.Proposal
Two possible shapes (either or both):
A. Option on existing
session-costwidget — e.g.includeSubagents: truethat adds subagent token cost to the displayed total.B. New dedicated widget — e.g.
session-cost-with-subagents(ortotal-cost) that always shows main + subagent cost, leaving the existingsession-costas main-only. This keeps the two values distinguishable for users who want both segments on the line:Option B avoids changing existing behavior and lets users place main-only and combined side by side.
Environment
subagents/dir (noisSidechaininlining in the main transcript), which is whytotal_cost_usdexcludes them.