claude-code
claude-code copied to clipboard
[BUG] Context low warning shows 7% when actually 36% free (auto-compact disabled)
Description
When auto-compact is disabled via /config, the context warning message shows incorrect remaining percentage.
Steps to Reproduce
- Disable auto-compact in
/config - Use Claude Code until context reaches ~63%
- Run
/contextto see actual usage - Observe the warning message in the status bar
Expected Behavior
Warning should reflect actual free space (36.6% in this case).
Actual Behavior
-
/contextshows: 127k/200k (63% used) with 73k free (36.6%) - Status bar warning shows: "Context low (7% remaining)"
Screenshot of /context:
Context Usage
claude-opus-4-5-20251101 · 127k/200k tokens (63%)
⛁ System prompt: 6.9k tokens (3.5%)
⛁ System tools: 15.8k tokens (7.9%)
⛁ Custom agents: 438 tokens (0.2%)
⛁ Memory files: 9.4k tokens (4.7%)
⛁ Messages: 94.3k tokens (47.2%)
⛶ Free space: 73k (36.6%)
Status bar shows:
Context low (7% remaining) · Run /compact to compact & continue
Analysis
The math doesn't add up:
- 7% of 200k = 14k tokens
- Actual free space = 73k tokens (36.6%)
It seems like the warning system is still calculating as if auto-compact buffer (77k) is reserved, even though auto-compact is disabled.
Environment
- Claude Code version: 2.0.75
- Model: claude-opus-4-5-20251101
- OS: Linux (WSL2)
- Auto-compact: Disabled
Expected Fix
When auto-compact is disabled, the "Context low" warning should use actual free space percentage, not a calculation that assumes the auto-compact buffer is still reserved.