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
- Run a Claude Code session for a while (accumulating cost/duration).
- Run
/clear. - Check the statusline (via a custom
statusLinecommand reading the JSON payload'scost.total_cost_usd/cost.total_duration_ms) and/or run/cost.
Observed
- Statusline showed
$541cost and96helapsed duration immediately after/clear. - Running
/costindependently 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
costobject in the statusline JSON payload / from/costitself.
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
costobject (total_cost_usd / total_duration_ms) not resetting.