Subscribe

Why does Claude Code now compact at 400K tokens, and how do you keep the full 1M window?

Last updated

Short answer: Claude Code version 2.1.334, released on December 1, 2026, changed the default auto-compact setting to "near 400K on most current 1M models," including -p and SDK runs. Anthropic's changelog says the change is rolling out, and that it is already on for people using third-party providers or with telemetry off. The docs say the goal is cost: "Your later requests are smaller when compaction runs sooner, so long sessions use fewer tokens." On the new default, compaction runs at about 367K tokens instead of about 967K. If you want the full 1M window back for the model you are using, run /autocompact 1M (or change the Auto-compact window row in /config). To go back to Anthropic's tuned default later, run /autocompact auto.

What changed on December 1, 2026

The Claude Code changelog entry for 2.1.334 reads: "Changed auto-compact's per-model auto setting to near 400K on most current 1M models, -p and SDK runs too (rolling out; on now with third-party providers or telemetry off); see /autocompact." GitHub lists the 2.1.334 release at 2:12 PM Pacific Time on December 1. The same release added "an Auto-compact window row to /config to see and change the size that /autocompact sets." That evening, Lydia Hallie, whose X profile lists Claude Code at Anthropic, posted that "400k auto-compact is now rolling out as the default in Claude Code for most 1M models" and that it "should help with your usage if you run longer sessions."

Which models and sessions it affects

Anthropic's model configuration docs (checked December 2, 2026) say the 400K default applies to current models with a native 1M context window: the Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later. Your session uses a setting called auto, which Anthropic tunes per model, and on those models auto is currently 400K. Sonnet 4.6 and Opus 4.6 without extended context still compact at the 200K boundary. The docs also list cases where a session keeps going past 400K: if you send more than about 180K tokens of system prompt, tools and instruction files with each request, the window is raised for that conversation; if you resume a conversation that is already past 400K, it stays at 1M until it compacts; Desktop scheduled tasks, cloud scheduled tasks and self-hosted environments use 1M; and any Claude Code version before 2.1.334 still uses 1M.

Why Anthropic made the change

Every message in a long session carries the whole conversation with it. When compaction runs sooner, each later request is smaller. Anthropic's docs put it this way: "Your later requests are smaller when compaction runs sooner, so long sessions use fewer tokens," and they call auto "the recommended setting." Anthropic has not published a percentage for how much usage this saves, so we are not quoting one. Some users on X have posted their own savings figures, but those are single-user reports and we have not verified them.

How to keep the full 1M window

To use the full 1M on the model you are using, run /autocompact 1M. On your own machine Claude Code saves that size for later sessions on that model version, and compaction then runs at about 967K tokens. You can also set it in the new Auto-compact window row in /config. For one launch only, start Claude Code with claude --autocompact 1M. For every model, put "autoCompactWindow": 1000000 in ~/.claude/settings.json. In scripts and cloud environments, set CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000, which takes precedence over the command, the flag and the setting. Admins can keep 1M for a whole organization with a modelSettings entry per model in managed settings. To return to Anthropic's default, run /autocompact auto. Running /autocompact with no value shows the window your session is using.

The one-time prompt and the notice

Some users will see a one-time prompt titled "Autocompact now defaults to 400k tokens." According to the docs, Apply (all models) moves your native 1M models to auto and drops sizes you saved for them; Apply for the current model moves only that model; and Keep leaves your saved sizes alone and saves 1M for models in your /model picker that were on auto. Closing the prompt changes nothing, so those models compact near 400K. A session on the new default can also show this notice: "This session is on auto, which now autocompacts near 400k tokens instead of 1m to lower the cost of long sessions. To opt out, run /autocompact 1m."

What you lose when it compacts earlier

Compaction replaces the older conversation with a summary. Anthropic's docs say the summary keeps your requests and key code snippets, "but detailed instructions from early in the conversation may be lost," so persistent rules belong in CLAUDE.md. After compaction, the project-root CLAUDE.md, auto memory and the plan from plan mode are re-injected from disk, and Claude Code re-reads up to five of the files it recently read or edited. Invoked skills come back capped at 5,000 tokens each and 25,000 in total. You can steer the summary with a "Compact Instructions" section in CLAUDE.md or with /compact and a focus, such as /compact focus on the API changes.

Should you switch back to 1M?

This part is our own judgment, not Anthropic's. If you are on a Pro or Max plan and you run out of weekly usage before the week ends, the 400K default is probably worth keeping, because Anthropic built it to lower the cost of long sessions. If your work depends on Claude remembering a lot of earlier detail, such as a long refactor across many files, try /autocompact 1M for that model and watch your usage with /usage. A middle setting also works: the docs accept values such as /autocompact 500k, and any window of 100K tokens or more.

Sources

Free PDF: the AI Coding Cost Cheat Sheet. Enter your email to download it, plus one email a week when picks or prices move.

FAQ

When did Claude Code change auto-compact to 400K?

In version 2.1.334, released on December 1, 2026. Anthropic's changelog says the change is rolling out, and it is already on for third-party providers and for anyone with telemetry off.

How do I stop Claude Code compacting at 400K?

Run /autocompact 1M in your session, or change the Auto-compact window row in /config. That saves 1M for the current model on your machine. For a single launch, use claude --autocompact 1M.

At what token count does it actually compact now?

Anthropic's docs say that on auto at 400K, compaction runs at about 367K tokens. With the window set to 1M, it runs at about 967K tokens.

Which models get the 400K default?

Current models with a native 1M context window: the Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later, according to Anthropic's docs. Sonnet 4.6 and Opus 4.6 without extended context still compact at 200K.

Does the 400K default save usage?

Anthropic says it lowers the cost of long sessions because later requests are smaller, and Lydia Hallie said it should help your usage in longer sessions. Anthropic has not published a percentage, so we don't quote one.

How do I go back to the default after setting 1M?

Run /autocompact auto. That returns the current model to the window Anthropic tunes for it, which is 400K on current 1M models today.

Does the change affect claude -p and the Agent SDK?

Yes. The changelog says the new default covers -p and SDK runs too. In scripts, you can pin a size with the CLAUDE_CODE_AUTO_COMPACT_WINDOW environment variable.

Next steps

Spotted an error? Send a correction.

Free: the AI Coding Cost Cheat Sheet (PDF)

What $0, about $20 and $100+ a month gets you across 22 AI coding tools, with prices copied from vendor pages when we wrote it; plans change often, so check each vendor's page before you buy. Enter your email to download it now. You'll also get our free weekly email: what shipped and which picks or prices moved, about a 2-minute read. Unsubscribe anytime.