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
- Claude Code changelog, version 2.1.334: auto-compact's per-model auto setting changed to near 400K on most current 1M models, -p and SDK runs too (rolling out); Auto-compact window row added to /config (checked December 2, 2026), checked 2026-12-02
- GitHub release v2.1.334, published December 1, 2026, 2:12 PM Pacific Time, checked 2026-12-02
- Claude Code docs, model configuration: compaction near 400K on a 1M model, about 367K vs about 967K, the one-time prompt, sessions that run past 400K, and how to set the window (checked December 2, 2026), checked 2026-12-02
- Claude Code docs, context window: what survives compaction (checked December 2, 2026), checked 2026-12-02
- Lydia Hallie (X profile: Claude Code, Anthropic), December 1, 2026: 400K auto-compact rolling out as the default for most 1M models; keep 1M with /autocompact 1m or in /config, checked 2026-12-02
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
- Claude Code pricing full plan breakdown
- Claude Code weekly limit how Pro, Max and Ultra caps work
- How to check Claude Code usage /usage, Settings > Usage and the status line
- Claude Code background subagent usage Nov 4 ClaudeDevs status-update claim
- Claude Code: API or subscription? which way of paying fits you
- Claude Pro vs Max vs Ultra plan prices and multipliers
- Is Claude Code free? which plans include it
- Cursor vs Claude Code editor vs terminal agent
- Can you use Vercel's free Hobby plan for a commercial app?
- Is Railway free?
- Does n8n have a free plan?
- X Super vs Claude Max for coding: should you switch from Claude Code?
- Codex Plus, Claude Pro, Cursor Premium or Google AI Pro: which AI coding subscription is the best value?
- Is Claude Code free?
- What is the Claude Code weekly limit?
- Claude Code: API pricing or a subscription?
- Claude Pro vs Max vs Ultra: which plan for Claude Code?
- Does ChatGPT Pro include API credits? Can you use them in Codex?
- What is the cheapest AI coding subscription?
- How do GitHub Copilot AI credits work, and how much is a credit in dollars?
- Is T3 Code free? What does it actually cost?
- Is Cursor free?
- What are Cursor Live Apps and which plans get them?
- What is Cursor Voice Chat and how is it different from dictation?
- What is Antigravity Voice mode and how is it different from voice dictation?
- Is GitHub Copilot free?
- Is Codex free?
- Is Gemini CLI free?
- Is OpenCode free?
- Will ChatGPT and Codex share usage limits?
- What does OpenAI's Pierre acquisition mean for Codex?
- Meta acquired Conductor — what happens to cloud, local, and what should users do?
- Cursor Voice Chat vs Antigravity Voice mode: which should you use?
- What happened to Claude Code Opus 4.8 fast mode on November 30, 2026?
- Do Claude Code background subagents use less of your usage limit now?
- Which ChatGPT plans include dots, are they available in the EU, and how do they use Codex?
- Are Claude Code plugins and skills safe to install?
- Is Claude Code sabotaging code?
- What is OpenRouter Auto Code, and what does it cost?
- Is Qoder free, and what free offers does it have right now?
- What is the Qoder Developer Pass, and who can get a free month of Qoder Ultra?
- Claude Code vs Codex computer use: which one can control your desktop, and on which plan?
- How do you use Claude Fable 5.2 in Claude Code, what does it cost, and which plans include it?
- Black Friday 2026 AI coding deals on Cursor, Claude Code, GitHub Copilot and Antigravity: which ones ended, and which are still on?
- Is SWE-2.1 free in Devin, and what does it cost after the free period?
- Is SWE-2 Flash still free in Devin, and what does it cost after December 4?
- Can you use Inkling 2 Mini as a free local model in Claude Code or OpenCode?
- What is Claude Ship, and can you use it on a Claude Pro or Max plan?
- How do you use GLM-5.4 in Claude Code, and what does the GLM Coding Plan cost?
- Is Base44 free?
- How do Lovable credits work?
- Do Bolt tokens roll over?
- How do I check my Claude Code usage and limits?
- How much does ChatGPT Sites hosting cost, and when does free hosting end?
- What is Pydantic Pax, and what does it cost if I sign in with ChatGPT or Copilot?
- Is Cursor now Grok Build, and what changes for my plan?
- Can you use GPT-6.2 Astra and Sol in Grok Build (formerly Cursor), and what does it cost?
- Can I use Google Antigravity inside Claude Code, OpenCode or other tools without risking my Google account?
- What does Amazon Ergo cost, and how do you use it in Claude Code, Codex, OpenCode or Kiro?
- AI Coding Cost Cheat Sheet (free PDF) what $0, $20 and $100+ a month gets you
- Affiliate disclosure
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.