Skip to content

Feature request: Session Cost including subagent/Task cost (option or new widget) #474

Description

@lala74

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions