Building a SaaS tool or MCP server? Get listed or sponsor AgentStackList →
Claude claude By Sarah Mitchell

Your Claude Code session now compacts at 400K tokens, not 1M, here is how to get the million back

Your 1-million-token Claude Code session now summarizes itself when the status line reads about 37 percent. Claude Code 2.1.334, released 1 December, moves the auto-compact default to near 400K tokens on most current 1M models, so long sessions compact around 367K instead of 967K. The change covers interactive sessions, claude -p and SDK runs, and it is already live for third-party providers or with telemetry off, rolling out gradually to everyone else. Source: https://code.claude.com/docs/en/model-config#compaction-near-400k-on-a-1m-model

Why it matters

Every request resends the whole conversation, so a smaller cap makes each turn of a long session cheaper. The tradeoff is more frequent compaction: your session gets summarized more often, and each summary can drop detail you wanted to keep. If one task needs the whole repo in view, a migration or a long log analysis, raise the window to 1M for that session, then return to auto. Two cases still run past 400K: system prompt, tools and instruction files over about 180K tokens raise the window, and a resumed session past 400K keeps 1M until it compacts. See the [Claude Code agent page](https://agentstacklist.com/agents/claude-code/) for its setup and MCP support.

Who it's for

Claude Code users on 1M-context models: Fable, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later. Opus 4.6 and Sonnet 4.6 without the 1M option stay at their 200K boundary. Most useful for anyone running long sessions, claude -p scripts, or SDK jobs.

How to try it

  1. Check which window you have: run `/autocompact` with no arguments. If it says default for this model on a 1M model, auto compacts around 367K. First check your version with `claude --version`; you need 2.1.334 or later.
  2. Get the full million back for one model: run `/autocompact 1m`. It saves the setting for that model only, and the session compacts around 967K from then on.
  3. Or use /config: open it, search for auto-compact, and use the new Auto-compact window row to see and move the same window.
  4. Go back to the recommended setting when the big task is done: run `/autocompact auto`.
  5. For a team or the cloud: in managed settings, add one modelSettings entry per model, such as "claude-opus-5-5": { "autoCompactWindow": 1000000 }. In the cloud, `/autocompact 1m` covers the current session only; for later ones, commit the same entry to the repo's .claude/settings.json, or set CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000 in the environment. Plan and availability: rolling out gradually on Anthropic accounts; already on with third-party providers or telemetry off. Needs 2.1.334 or later.

Source: https://code.claude.com/docs/en/model-config#compaction-near-400k-on-a-1m-model

Written by Sarah Mitchell from the original post. Checked Checked 3 Dec 2026. Features, plans and availability can change, so confirm on the source before you rely on it.

claude-codeauto-compactcontext-window

More Claude tricks

All Claude tricks →