Auto-compaction triggers at ~6% context usage on Opus 4.6 (1M context)

Resolved 💬 10 comments Opened Apr 2, 2026 by jsk5599 Closed Jun 23, 2026

Bug Description

Auto-compaction is triggering far too early on claude-opus-4-6[1m] (1M context window). Conversation context is being compressed when usage is well under 100K tokens — nowhere near the 950K threshold that CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=95 should enforce.

Environment

  • Claude Code version: latest (auto-updates enabled)
  • Model: claude-opus-4-6[1m] (1M context)
  • Platform: macOS (Darwin 25.4.0, Apple Silicon)
  • Terminal: iTerm2
  • Settings:

``json
{
"env": {
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "95"
},
"model": "claude-opus-4-6[1m]"
}
``

Steps to Reproduce

  1. Start a session with claude-opus-4-6[1m] model
  2. Run a moderate conversation (PR reviews with 5 background agents returning results, some bash commands)
  3. Observe that context compression kicks in despite low usage

Evidence

Running /context after the conversation showed:

63.8k/1m tokens (6%)
Messages: 44.1k tokens (4.4%)
Free space: 915.3k (91.5%)
Autocompact buffer: 21k tokens (2.1%)

Yet earlier messages in the conversation were already compressed/summarized, losing the full PR review output and agent results.

Expected Behavior

With CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=95 and a 1M context window, auto-compaction should not trigger until ~950K tokens are consumed.

Actual Behavior

Compaction triggered at what appears to be well under 100K tokens of actual conversation content.

Hypothesis

The autocompact threshold may be calculated against a default context window size (e.g., 200K) rather than the actual 1M window of the claude-opus-4-6[1m] model. 95% of 200K = 190K, which could explain premature triggering if agent results temporarily inflate the token count.

Workaround

Setting DISABLE_AUTO_COMPACT=1 in env and using manual /compact as needed.

View original on GitHub ↗

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