Status line shows 0.0k tokens and ctx% disappears after /compact

Resolved 💬 3 comments Opened May 12, 2026 by leon13018 Closed May 15, 2026

Description

After running /compact, the status line immediately displays incorrect data:

  • Token count resets to 0.0k
  • ctx:% disappears entirely

The correct values only restore after sending the next regular message.

Steps to Reproduce

  1. Use Claude Code normally until context has meaningful usage (e.g. ctx:30%+)
  2. Run /compact
  3. Observe the status line immediately after compact completes

Expected Behavior

Status line should continue showing the correct context usage after /compact
(matching what /context reports).

Actual Behavior

Status line shows:

<path>  <model>  0.0k  5h:XX%  7d:XX%
branch main · clean
  • Token count is 0.0k (should be ~30k+)
  • ctx:% is missing entirely

Running /context at this moment shows correct data (e.g. 32.8k / 200k (16%)),
confirming the compact completed successfully and CC's internal state is accurate.

Root Cause Analysis

The status line reads context_window data from the most recent API response.
After /compact, the most recent API call is the summarization request — a
special call whose context_window fields (total_input_tokens,
total_output_tokens, used_percentage) are either zeroed or null.

CC's internal context state is correct (visible via /context), but the status
line only updates when a new regular chat completion response arrives.

Suggested Fix

After /compact completes, emit a status line update with the accurate
post-compact context stats (sourced from CC's internal state rather than the
compact API call's response headers).

Environment

  • OS: Windows 11
  • Claude Code: latest
  • Status line type: custom command

View original on GitHub ↗

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