[Bug] Auto-compact triggers prematurely at ~47% of context window on claude-opus-4-8

Open 💬 1 comment Opened Jun 30, 2026 by rshah21

Bug Description
Auto-compact triggers at ~468K tokens on claude-opus-4-8[1m] (1M context) — fires at ~47% of window

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.196
  • Feedback ID: 97ca88c7-4103-4ed0-886e-c78aad60fdde

Errors

[]

What happened

Running Claude Code with the 1M-context Opus variant (model ID claude-opus-4-8[1m]),
automatic compaction triggered while the context was only ~468K tokens — under half
of the model's 1M window. No /compact was issued by the user; the trigger was auto.

Evidence (from the session transcript's compact_boundary event)

{
  "trigger": "auto",
  "preTokens": 468102,
  "postTokens": 28759,
  "cumulativeDroppedTokens": 439343,
  "durationMs": 102385
}
  • CLI version: 2.1.196
  • Model: claude-opus-4-8[1m] (1M context confirmed via model ID suffix)
  • No auto-compact / context-limit overrides in settings.json or env — default behavior.

Expected

With the 1M-context variant active, auto-compact should be anchored to the model's
true ~1M window (firing in the ~90%+ range), not at ~47%.

Actual

Auto-compact fires around 468K tokens, suggesting the compaction threshold is
computed against a baseline (~500K?) well below the active model's real capacity.
This discards ~439K tokens of working context at the halfway mark and cost ~102s.

Impact

Long working sessions lose nearly half their usable window to premature compaction,
forcing reconstruction from a lossy summary far earlier than the 1M capacity implies.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗