The auto-compact threshold does not do what you think
The auto-compact threshold triggers a summary of the conversation when the context reaches it, it is not a wall that closes the window: a value set above the real window of the active model is capped at that window, a documented behaviour whose lack of an on-screen warning still needs to be checked for yourself.
The auto-compact threshold is not a fence that would stop the context from exceeding a given size. It is a trigger point: when the conversation reaches this threshold, Claude Code launches an automatic summary of the history. Nothing in this mechanism closes the window itself, and a threshold value set above the real window of the active model produces no displayed error: it is simply capped at that window.
The cap, with no guaranteed warning
The official documentation states it plainly: the limit that applies is always the model's own, whatever the threshold value configured elsewhere. Setting a threshold to one million tokens while the active model only has a window of two hundred thousand tokens pushes nothing back, the calculation falls back to the real two hundred thousand tokens. The documentation does not explicitly say whether this capping comes with an on-screen warning or not, it only documents the capping itself: checking it on your own machine is worth more than assuming it is silent.
When the summary loops on itself
A second mechanism complicates the picture. After a compaction, if the context fills up again to the limit almost immediately, and this cycle repeats several times in a row, Claude Code stops relaunching compaction and displays an explicit error rather than continuing to loop.
Autocompact is thrashing: the context refilled to the limit...
This opening line, which the documentation itself quotes before cutting off with an ellipsis, signals an anti-thrashing guard, a mechanism that recognises that one summary after another solves nothing as long as the source of the filling, a large file reread on every tool call for example, remains in the conversation. The guard stops after a few attempts and surfaces this error rather than continuing to loop silently.
A compaction you did not start
Since October, a long conversation left idle in the terminal can be compacted shortly before the one hour cache expires, so that the next message does not reprocess the whole conversation. The documentation page on the cache says so and gives the idleCompaction setting to turn it off, and the notices shown after such a compaction say how. A discomfort felt as "the context window" can therefore be this compaction: note each time whether it was manual, at saturation or at rest before touching a threshold. The figure gives the delay and the size taken from the changelog.
Two other changes concern the threshold itself. The /autocompact setting is saved per model, so each model keeps its own when you switch. The CLAUDE_CODE_AUTO_COMPACT_WINDOW variable accepts the k and M suffixes: the value 200k used to silently set a window half the size, and the variable now warns about a value that is out of range or ignored.
What to do about it
First, a custom threshold set higher than the model's window is useless, you need to check the real window of the current model before configuring anything. Second, a session that displays a thrashing error signals a content problem, not a software fault: the right move is to remove what is filling the context rather than relaunching the same action hoping for a different result. The neighbouring lesson on compacting, clearing, reading only what is needed details how to choose between these two commands once this threshold is understood.
The threshold against the model's real window
The auto-compact threshold closes the context window at the configured value, like a hard cap that would block any overrun.
A threshold value set above the real window of the active model is capped at that window, without the documentation specifying whether a message accompanies this capping.
Idle compaction in two figures
An association configures the auto-compact threshold of its Claude Code session to a value well above the real window of the model it is using that day. It then carries on a long documentary research conversation for several hours.
Write in one sentence what this situation establishes, and in one sentence what it does not establish.
What this establishes: This situation establishes that the threshold configured by the association cannot exceed the real window of the active model, whatever value was entered.
What this does not establish: It does not establish at what exact moment an automatic summary was triggered during the conversation, nor whether an anti-thrashing guard stepped in that day.
The three most common miscalibrations
- Trop large This situation proves that Claude Code systematically ignores any threshold setting anyone attempts to configure, whatever its value.
- Trop étroit This situation allows nothing to be affirmed until the exact name of the model used by the association that day is specified.
- À côté This situation mainly shows that the association's documentary research stretched over several hours.
- The auto-compact threshold works as a summary trigger, never as a fence that would stop the context from growing further.
- A threshold value set above the real window of a model is capped at that window; whether this capping comes with an on-screen message or not still needs to be checked for yourself, the documentation does not specify it.
- An anti-thrashing guard stops repeated compaction attempts when the context fills up again right after each summary, and it displays an error rather than continuing to loop.
- The real window of the active model remains the only limit that counts, a custom setting can never widen it.
- A long conversation left idle can be compacted at rest before the cache expires, and the idleCompaction setting turns it off.
Open an active Claude Code session, type /model to read the real window shown for the current model, then type /context to see how much of that window is already used. Note both figures: it is this real window, never a higher custom threshold, that sets the true limit of your session.
These points depend on an interface or a rule that may have changed since this was written. Check them on your own screen before relying on them.
- The default value of the auto-compact threshold shown on your own Claude Code installation: it can vary by model and installed version, read it directly via /context rather than off a figure announced here.
Every datable claim in this lesson links here to the public text behind it. A source that does not open proves nothing.
- Anthropic, Claude Code, model configuration, default auto-compact thresholds consultée le 2026-09-02
- Anthropic, Claude Code, troubleshooting, auto-compact thrashing error consultée le 2026-09-02
- Claude Code, how prompt caching works, idle compaction consultée le 2026-10-24
- Claude Code, model configuration, /autocompact per model consultée le 2026-10-24
- Claude Code changelog, idle compaction and CLAUDE_CODE_AUTO_COMPACT_WINDOW consultée le 2026-10-24