Opus 4.6 (1M context): autocompact triggers at ~76K tokens — 92% of context window wasted

Open 💬 7 comments Opened Mar 14, 2026 by mackmother

Summary

Claude Code's automatic context compaction fires at approximately 76K tokens even when using Opus 4.6 with a 1M context window. This discards valuable conversation history with 924K tokens of headroom remaining (92% unused). This is a regression compared to 200K model behavior.

Environment

  • Claude Code CLI (latest)
  • Model: Opus 4.6 (1M context) — confirmed via /model command
  • macOS Darwin 24.6.0, zsh

What happened

  1. Started a session on Opus 4.6 (1M context window)
  2. Had a rich multi-step conversation: RFP analysis, 4 research subagents, design spec, 2 council review subagents, code review subagent, implementation, testing, 2 production deploys
  3. At approximately 76,144 input tokens (7.6% of 1M), Claude Code automatically compacted/compressed earlier messages
  4. Lost the entire first half of the conversation — detailed analysis, research findings, and design decisions that were actively being referenced
  5. Our context monitoring script confirmed actual usage at session end: 138,280 / 1,000,000 tokens = 13.8%

The problem

The autocompact threshold appears to use a hardcoded absolute token count calibrated for 200K windows, regardless of the model's actual context window size.

| Window | Compaction at 76K | Headroom wasted |
|--------|------------------|-----------------|
| 200K | 38% — aggressive but defensible | 124K |
| 1M | 7.6% — absurd | 924K |

This means the 1M upgrade actively provides worse conversation retention than 200K — same compaction trigger, 5x the wasted headroom. The entire value proposition of the larger context window is negated.

Expected behavior

The compaction threshold should scale proportionally with the model's context window:

  • On 200K: compact at ~140K-170K (70-85%)
  • On 1M: compact at ~700K-850K (70-85%)

Or alternatively:

  • Expose CLAUDE_AUTOCOMPACT_PCT_OVERRIDE as a documented, first-class setting (not just an undocumented env var)
  • Default it to something reasonable like 80% of the detected window

Workaround found

Setting CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=95 in the shell profile appears to control this behavior. However:

  • This env var is undocumented (found via Claude Chat suggestion)
  • It's unclear if it works as a percentage of the actual context window or of a hardcoded limit
  • Users paying for 1M context shouldn't need to discover undocumented env vars to get the behavior they're paying for

Evidence

# Our monitoring script output (after fixing its own hardcoded 200K bug):
Model:              claude-opus-4-6  
Context window:     1,000,000 tokens
Total input context: 138,280 / 1,000,000 tokens
USAGE: 13.8% | REMAINING: 86.2% | HEALTHY

# Yet messages from the first ~45 minutes of the session were already
# compacted — silently, with no warning, at 7.6% context usage

Impact

  • Critical conversation context silently destroyed mid-session
  • No warning before compaction, no opt-out mechanism
  • Complex multi-step work (research → design → council review → implementation) loses its reasoning chain
  • Users who upgraded specifically for 1M context get worse behavior than 200K
  • Our context monitoring hook (which runs every 10 tool calls) also had a hardcoded 200K limit and never warned us — suggesting this is a systemic assumption throughout the codebase

View original on GitHub ↗

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