[BUG] Wrong Context Amount and Autocompact

Resolved 💬 4 comments Opened Oct 16, 2025 by AlpSha Closed Oct 17, 2025

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 a short and simple task with the Claude Code Sonnet model, I noticed the message:

Context left until auto-compact: 0%

This made no sense given how small the session was, so I disabled auto-compaction thinking it was a display or logic bug.
Immediately afterward, Claude started showing:

Context low (7% remaining) · Run /compact to compact & continue

However, when I ran /context, it reported accurate values:
34k / 200k tokens (17% usage) — exactly as expected.

So the context usage display in the UI is inconsistent with the real /context output, and Sonnet incorrectly triggers compaction warnings even when there’s plenty of room left.

What Should Happen?

The context usage indicator and auto-compact triggers should reflect the actual token usage reported by /context.
If /context shows only 17% usage, the UI should not warn about 0% or 7% remaining, nor prompt unnecessary manual compaction.
In short, Claude should:

Accurately sync internal context tracking with /context data

Only trigger compaction when the real context buffer is near capacity

Avoid confusing or contradictory warnings when context is clearly sufficient

Error Messages/Logs

Steps to Reproduce

  1. Open a new Claude Code session using the Sonnet model.
  2. Run any short task (for example, a small code generation or edit command).
  3. Observe the message in the output area:
  4. “Context left until auto-compact: 0%”
  5. Disable auto-compact via settings.
  6. Continue the same session or re-run a simple command.
  7. Observe the new warning message:
  8. “Context low (7% remaining) · Run /compact to compact & continue”
  9. Run /context and note the actual usage (around 34k / 200k tokens, ~17%).

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.0.18

Claude Code Version

2.0.19

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

<img width="579" height="558" alt="Image" src="https://github.com/user-attachments/assets/aa4bffe8-3867-47b5-bc0a-d7b5a17cc780" />

<img width="583" height="603" alt="Image" src="https://github.com/user-attachments/assets/085b1b1b-a30e-4073-8655-32db2efbb8f5" />

View original on GitHub ↗

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