[BUG] context_window metrics not updated after /compact until next API interaction

Resolved 💬 11 comments Opened Jan 21, 2026 by villeodell Closed Apr 29, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

After running /compact, the context_window object in the status line JSON retains pre-compaction values until the next API interaction. This affects any status line configuration that displays context usage.

What Should Happen?

After /compact completes, the context_window metrics should immediately reflect the new (reduced) context state.

Steps to Reproduce

  1. Have a conversation with some context built up
  2. Run /compact
  3. Observe: context_window.used_percentage still shows pre-compaction value
  4. Send any message
  5. Observe: value now reflects actual post-compaction state

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

2.1.14 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Entire context_window object is stale after /compact, not just used_percentage. Manual calculation from cache_read_input_tokens + input_tokens shows the same stale behavior—confirming the issue is that the context_window object isn't refreshed after compaction until the next API round-trip.

View original on GitHub ↗

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