statusLine: cost and duration reset after navigating to agents view and back

Status Open
Reported on v2.1.211
Maintainer reply None cached
Activity 1 comment · opened Jul 16, 2026

Description

When using a custom statusLine script that reads cost.total_cost_usd and cost.total_duration_ms from the stdin JSON payload, both values reset to near-zero after navigating to the agents/subagent panel (down-arrow from the prompt) and then back to the main session view. context_window.* fields (token counts, remaining/used percentage) are unaffected and stay correct across the same navigation.

Per the statusline docs, cost.total_cost_usd is described as "estimated session cost in USD" and total_duration_ms as "total wall-clock time since the session started" - both should be cumulative for the whole session, resetting only on /clear, /compact, or a new session. Switching to the agents view and back doesn't match any of those cases, so this looks like a bug rather than intended behavior.

Steps to reproduce

  1. Configure a statusLine command script that prints cost.total_cost_usd and cost.total_duration_ms from stdin.
  2. Use the CLI for a while so both values are non-trivial (e.g. cost > $1, duration > 30m).
  3. Press the down arrow (or otherwise navigate) to the agents/subagent panel.
  4. Navigate back to the main session view.
  5. Observe the status line.

Expected behavior

cost.total_cost_usd and cost.total_duration_ms continue reflecting the full cumulative session values.

Actual behavior

Both fields reset to near-zero, while context_window fields (token counts, used/remaining percentage) remain correct and unaffected.

Environment

  • Claude Code version: 2.1.211
  • OS: macOS (Darwin 25.5.0, Apple Silicon)

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗