Claude Code: Auto-Compact Now Triggers Near 400K Tokens on 1M Models

Claude CodeView original changelog

Claude Code 2.1.334 changed the per-model automatic auto-compact setting to sit near 400K tokens on most current 1M-context models, including -p and SDK runs. The change is rolling out gradually and is already on for users of third-party providers or with telemetry off. A new Auto-compact window row in /config shows and changes the size that /autocompact sets.

Key Takeaways

  • Auto-compact's automatic window drops to near 400K on most current 1M-context models.
  • The change covers -p and SDK runs, not only interactive sessions.
  • It is rolling out gradually and is already on with third-party providers or telemetry off.
  • A new Auto-compact window row in /config shows and edits the value /autocompact sets.
  • Users may see earlier compaction in long sessions, so heavy users may want to check the setting.
  • Release 2.1.334 also fixed false "Prompt is too long" errors and needless compaction after output-limit stops.

A Changed Default for Long Sessions

Claude Code 2.1.334 changed how the automatic auto-compact setting behaves on large-context models. For most current models with a 1M-token window, the per-model automatic value now sits near 400K tokens instead of tracking the full window. The change applies to non-interactive -p and SDK runs as well as interactive sessions. Anthropic describes it as rolling out, and it is already on for users with third-party providers or with telemetry turned off.

In practice, long sessions on 1M models may now compact earlier than before. Users who relied on the full window before compaction will see this as a behavior change, and can inspect or adjust the value with /autocompact.

Seeing and Changing the Window

The release adds an Auto-compact window row to /config, so the size that /autocompact sets can be viewed and changed from the settings screen.

Related Compaction Fixes

The same release fixed several compaction problems. Needless auto-compaction, or a false "Prompt is too long" error, no longer occurs when a response hits the output token limit before writing any text. /context no longer draws the compact buffer as used space when auto-compact is off. /compact and auto-compact no longer sometimes keep the model's draft notes ahead of the conversation summary. Code Mode scripts' tool calls are no longer counted toward context size, which had caused early compaction.