Context window tracking in statusline doesn't reset on /clear

Resolved 💬 4 comments Opened Dec 12, 2025 by YishenTu Closed Jan 3, 2026

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

  1. Start a Claude Code session: claude
  2. Have a conversation that uses significant context
  3. Note the context window percentage in statusline
  4. Run /clear
  5. Observe that the context window percentage remains unchanged

Environment

  • macOS (Darwin 25.2.0)
  • Claude Code CLI

Suggested Fix

Either:

  1. Reset total_input_tokens and total_output_tokens on /clear
  2. Add new fields like current_input_tokens / current_output_tokens that track the active conversation's context
  3. 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.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗