You picked a model with a 1M-token context window so that a long refactor would fit in one conversation. This week your sessions started compacting much earlier, somewhere under 400,000 tokens, and the agent forgot a decision you made an hour ago. You did not change anything. Claude Code did.
The Claude Code changelog entry for 2.1.334, released on December 1, 2026, says it in one line: "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)". Here is what that means, why Anthropic did it, which sessions it skips, and how to choose for yourself.
What changed
Compaction is what Claude Code does when a conversation gets too big. It replaces the message history with a summary, and from then on the summary is all the agent remembers of that part of the work. The point where it does this automatically is the auto-compact window.
Until 2.1.334, a session on a model with a native 1M window compacted near the end of that window. Now the default, called auto, is 400K on those models. The model configuration docs list them: the Fable models, Sonnet 5 and later, Haiku 5.5, and Opus 4.7 and later. On auto, compaction runs at about 367K tokens. With the full window it runs at about 967K.
If the change has reached you, Claude Code tells you once:
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.
You may also get a one-time prompt titled "Autocompact now defaults to 400k tokens". It asks whether to apply the new default to all models, only to the current one, or to keep your saved sizes. If you close it, nothing in your settings changes and models on auto compact near 400K.
The change is still rolling out. With a third-party provider or with telemetry off, it is on already.
Why Anthropic did it
The docs give the reason: "Your later requests are smaller when compaction runs sooner, so long sessions use fewer tokens."
Each turn sends the whole conversation to the model again. Most of it comes from the prompt cache, which is cheaper than fresh input, but it still counts. A turn at 900K tokens resends about two and a half times as much as a turn at 367K. Over a long session with dozens of tool calls per hour, that adds up, in dollars on an API key and in usage limits on a subscription. We wrote about what fills those requests in what your coding agent really sends to the model.
There is also a quality argument, which the docs do not make here. Agents tend to work worse as the window fills: they miss instructions from early in the conversation and repeat work. A summary at 367K can be easier for the model to use than 900K tokens of raw history.
The cost is detail. A summary drops things. If your task depends on a long stack trace from two hours ago, or on the exact wording of a spec you pasted, an earlier compaction makes it more likely that the agent loses it.
Sessions that still run to 1M
The docs list cases where a session goes past 400K before it compacts:
| Case | Window the session uses |
|---|---|
| More than about 180K tokens of system prompt, tools and instruction files on each request | Raised for that conversation |
A resumed conversation that is already past 400K, such as with claude --resume |
1M until it compacts |
| A Desktop scheduled task, a cloud scheduled task, or a session in a self-hosted environment | 1M |
| Claude Code older than 2.1.334 | 1M |
The first row is worth a second look. If you see Raised this conversation's auto-compact window, your tools and CLAUDE.md files are so large that a 400K window would refill right after each compaction. The docs suggest fewer tools or shorter instruction files, not a bigger window.
Sessions on Sonnet 4.6 or Opus 4.6 without the [1m] variant are not affected either. They compact at the 200K boundary as before.
How to keep the full window
auto is Anthropic's recommended setting. If your work fits in a few hundred thousand tokens, or you start a fresh session for each task, there is nothing to do. If you want the old behaviour, the settings section of the docs gives several ways.
For the model you are using now, in this session and later ones:
/autocompact 1M
Claude Code saves that under the current model in modelSettings in your user settings. /autocompact auto goes back to the default, and /autocompact with no value shows what the session uses. Since 2.1.334 there is also an Auto-compact window row in /config.
For one launch, without touching saved settings:
claude --autocompact 1M
For scripts, CI and containers, use the environment variable. It wins over the command, the flag and the settings file:
export CLAUDE_CODE_AUTO_COMPACT_WINDOW=1M
Watch the units. /autocompact 200 means 200,000 tokens, but CLAUDE_CODE_AUTO_COMPACT_WINDOW=200 means 200 tokens, which Claude Code raises to its 100K minimum and warns about. Write 1000000 or 1M (suffixes need 2.1.304 or later).
For a team, an admin can set the window per model in managed settings:
{
"modelSettings": {
"claude-opus-5-5": { "autoCompactWindow": 1000000 }
}
}
That replaces what a developer saved for that model, though --autocompact and the environment variable still override it. In cloud sessions, the same modelSettings entry committed to a repository's .claude/settings.json applies to later sessions on that repository.
Two side effects. If you wrote your own status line, 2.1.336 changed its used_percentage and remaining_percentage to count against the auto-compact window, as /context does. A status line that said 30% at 300K will now say much more. For the share of the full window, the changelog says to use total_input_tokens / context_window_size. And a conversation left idle can still compact below whatever size you set, through idle compaction, which has its own setting.
Deciding with numbers instead of guesses
Whether 400K is right for you depends on two things you can measure: how often your sessions cross it, and what the summary loses when they do.
The second one is easy to miss. The summary lives in Claude Code's transcript file, and the docs on what survives compaction describe the rules: startup content reloads, up to five recently used files are re-read, path-scoped rules and nested CLAUDE.md files are summarized away.
Sessionboxer shows both. The gauge above the prompt box reads the tokens in the window against its size, for example 410k / 1M 41%, and ♻ 2 next to it counts the compactions so far. Each compaction appears in the chat as a marker such as ♻ Context compacted 380k → 45k (automatic). Clicking it opens a dialog with the messages that were compacted away next to the summary they became, read from Claude Code's own transcript in the box. If you see the agent lose something you needed, that dialog shows you whether it was in the summary. It is all on the context feature page, and the context window chapter of the guide has the details.
For Claude Code sessions, Inspect LLM records each request to the Anthropic API, including the compaction request itself, so you can compare the size of turns before and after. The Context pane's breakdown, taken with /context, tells you how much of each request is tools and memory files, which is what decides whether you land in the "raised window" row above.
Sessionboxer does not compact on its own schedule and does not change Claude Code's auto-compact setting. Whatever Claude Code version and settings the box runs decide when compaction happens; Sessionboxer only shows it. If you want a way back after a bad compaction, take a snapshot before a long task. A fork from that snapshot starts from the machine and the conversation as they were.
What to do this week
Run /autocompact with no value in a long session and see what it says. If it is on auto at 400K and your tasks mostly finish below that, leave it. If you run long debugging sessions where the early history matters, set /autocompact 1M for the models you use, or set CLAUDE_CODE_AUTO_COMPACT_WINDOW where Claude Code runs unattended. Check again when you switch to a newer model: the docs say Anthropic keeps evaluating auto per model and may pick a different window.