Context window tracking in statusline doesn't reset on /clear
Description
The context_window data provided to statusline commands (total_input_tokens, total_output_tokens) does not reset when using /clear. This appears to track cumulative CLI session usage rather than the current conversation's context window.
Expected Behavior
After running /clear, the context window usage should reset to near-zero (just system prompt), since /clear starts a fresh conversation where Claude no longer has access to previous messages.
Actual Behavior
The total_input_tokens and total_output_tokens values continue to accumulate across /clear commands within the same CLI session. The statusline shows high context usage even after clearing the conversation.
Steps to Reproduce
- Start a Claude Code session:
claude - Have a conversation that uses significant context
- Note the context window percentage in statusline
- Run
/clear - Observe that the context window percentage remains unchanged
Environment
- macOS (Darwin 25.2.0)
- Claude Code CLI
Suggested Fix
Either:
- Reset
total_input_tokensandtotal_output_tokenson/clear - Add new fields like
current_input_tokens/current_output_tokensthat track the active conversation's context - Document that these fields are cumulative session totals, not current context
Use Case
Users rely on context window tracking to know how much context remains before hitting limits. After /clear, users expect a fresh start with full context available.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗