[BUG] Context low warning shows 7% when actually 36% free (auto-compact disabled)

Status Closed — not planned
Maintainer reply None cached
Activity 13 comments · opened Dec 21, 2025 · closed Feb 27, 2026

Description

When auto-compact is disabled via /config, the context warning message shows incorrect remaining percentage.

Steps to Reproduce

  1. Disable auto-compact in /config
  2. Use Claude Code until context reaches ~63%
  3. Run /context to see actual usage
  4. Observe the warning message in the status bar

Expected Behavior

Warning should reflect actual free space (36.6% in this case).

Actual Behavior

  • /context shows: 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.

View original on GitHub ↗

13 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14785
  2. https://github.com/anthropics/claude-code/issues/13653
  3. https://github.com/anthropics/claude-code/issues/11335

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

michelsdev · 8 months ago
davenadig · 7 months ago

This is KILLING me, AND it's autocompacting despite the flags being set correctly. CC reports this is precisely this unfixed error, and is robbing me of 30% of my context eveyr darn session.

tylerburleigh · 7 months ago

Bug persists on 2.1.6

XTVB · 7 months ago

Bug seems worse with 2.1.7, now it says "Context limit reached" and doesn't allow more requests when the auto-compact limit is reached even though auto-compact is disabled

michelsdev · 7 months ago
Bug seems worse with 2.1.7, now it says "Context limit reached" and doesn't allow more requests when the auto-compact limit is reached even though auto-compact is disabled

Yeah.. same here.. 2.1.7 got worse, I had to rollback to 2.1.6 for now.

He11oJack · 7 months ago

I'm experiencing a similar issue in the VSCode extension.

<img width="352" height="524" alt="Image" src="https://github.com/user-attachments/assets/da01c267-d79c-452e-a3fa-38b012e0a461" />

<img width="347" height="252" alt="Image" src="https://github.com/user-attachments/assets/b5a05bd9-8ec0-4304-9d80-0c129dcb4b39" />

Left screenshot:

  • Status bar: 76% used
  • /context: 93.6k / 200.0k (47%)

Right screenshot:

  • Status bar: 100% used
  • /context: 132.1k / 200.0k (66%)

The status bar shows 100%, which would normally indicate the context is full and unusable. However, /context reveals 34% free space remaining, and the conversation continues to work normally.

This causes confusion because users might think they need to start a new session when there's actually significant context space available.

This issue occurs in both Linux (WSL2, as reported above) and Windows with VSCode extension, suggesting the percentage calculation logic may be a common issue across different environments.

Environment:

  • OS: Windows 10
  • Interface: VSCode Extension
  • Model: claude-opus-4-5-20251101
  • Claude Code CLI version: 2.1.7
  • Claude Code VSCode Extension version: 2.1.7
  • VSCode version: 1.108.0
  • Auto-compact: Disabled

---

Update: Here's another case showing a more severe issue.

<img width="257" height="207" alt="Image" src="https://github.com/user-attachments/assets/3b8fa562-62d1-4c3d-829e-1d483e8333c4" />

Screenshot 3:

  • Error message: "Prompt is too long"
  • /context: 169.1k / 200.0k (85%)

The error blocks further usage entirely, even though 15% (approximately 31k tokens) of context space is still available according to /context.

renchris · 7 months ago

Root cause: The status bar/warning counts INPUT + OUTPUT tokens against a ~123k limit, while /context counts INPUT tokens only against 200k.

In output-heavy sessions (code generation), Claude's responses consume OUTPUT tokens that /context doesn't show. This explains the discrepancy even with auto-compact disabled.

Source code analysis: https://github.com/anthropics/claude-code/issues/12520#issuecomment-3761894473

renchris · 7 months ago

Note: This fix requires an Anthropic engineer—the statusline/warning logic is in the closed-source core (cli.js), not the public repo.

MariusWilsch · 7 months ago

<img width="854" height="1051" alt="Image" src="https://github.com/user-attachments/assets/a8e02223-876c-45c0-ace6-9da7de2ebfe9" />

Is this a bug? I still have 30, around about 30% left, and the context is full?

MariusWilsch · 7 months ago

I think it's auto-compacting even with auto compact false because my conversations also get lost????

github-actions[bot] · 6 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.