[BUG] `/context` header token usage doesn't include Autocompact buffer

Resolved 💬 3 comments Opened Apr 11, 2026 by JackieTien97 Closed Apr 14, 2026

Follow-up to #45719

After the fix in #45719 that added the Messages section to /context, the header token usage still doesn't account for the Autocompact buffer, causing an inconsistency.

Problem

The token usage shown in the header bar doesn't equal Total context - Free space. The Autocompact buffer is missing from the header calculation.

From the screenshot below:

| Item | Value |
|------|-------|
| Header display | 106.9k/1m tokens (10%) |
| Free space | 862.1k (86.2%) |
| Autocompact buffer | 33k tokens (3.3%) |

Expected: Header should show ~137.9k (1M - 862.1k free space = 137.9k), or equivalently 10% + 3.3% ≈ 13.7%.

Actual: Header shows 106.9k (10%), which is 137.9k - 33k (autocompact buffer) ≈ 106.9k. The autocompact buffer is clearly excluded from the header's token count.

Screenshot

<img width="1332" height="806" alt="Image" src="https://github.com/user-attachments/assets/c884a3a4-0ef8-4d6f-8eea-2dc037998da7" />

The relationship should hold: Header token usage = Total context − Free space, which means the Autocompact buffer should be included in the header's used token count, since it is part of the occupied context window.

Expected Behavior

The header token usage should include the Autocompact buffer, so that:

Header used tokens + Free space = Total context window

Environment

  • Claude Code with Opus 4.6 (3M context / 1M active)

View original on GitHub ↗

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