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. The most common belief treats this threshold as a hard wall, whereas it works as a starting signal for a summary, itself bounded by a limit it does not control.
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.
What to remember
Two practical consequences follow from these two mechanisms. 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.
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.
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