statusline/cost: session cost ($) and duration not reset by /clear

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 19, 2026

Description

After running /clear, both the statusline's cost.total_cost_usd / cost.total_duration_ms fields and the /cost command continue to show large accumulated values from before the clear, instead of resetting.

Steps to reproduce

  1. Run a Claude Code session for a while (accumulating cost/duration).
  2. Run /clear.
  3. Check the statusline (via a custom statusLine command reading the JSON payload's cost.total_cost_usd / cost.total_duration_ms) and/or run /cost.

Observed

  • Statusline showed $541 cost and 96h elapsed duration immediately after /clear.
  • Running /cost independently confirmed the same ~$541 total — so this isn't just a statusline-refresh glitch, the underlying session cost/duration state itself wasn't reset.
  • Confirmed the custom statusline script's transcript-file-age fallback wasn't the cause: the new session's transcript file had a birth time of ~2 minutes prior, ruling out stale-file-based duration calculation. The large values are coming from the cost object in the statusline JSON payload / from /cost itself.

Expected

Per the docs (https://code.claude.com/docs/en/costs), "these totals reset when /clear starts a new session, so the next session's total cost starts at $0." Both the statusline cost fields and /cost should reflect $0 / ~0s immediately after /clear, not the prior session's accumulated totals.

Environment

  • Plan: Pro (not metered/API billing — this is a cost estimate only, not an actual billing concern, but the stale value itself is a bug)
  • Platform: macOS (Darwin)
  • Related but distinct from #61150 (stale shells/monitors counters after /clear) — this report is specifically about the cost object (total_cost_usd / total_duration_ms) not resetting.

View original on GitHub ↗