Loops, polluted context and restarting
The sign of a loop is the same failure message repeating, a saturated context is handled by a targeted compaction or a full clear, and starting over with a hand written summary of the decisions already made beats insisting inside a degraded conversation.
Claude Code interrupts an automatic compaction cycle by itself when it starts repeating endlessly: when the context fills up again right after a compaction, the tool shows the message Autocompact is thrashing: the context refilled to the limit... and stops retrying, rather than continuing to spend API calls for nothing. This is the only loop signal formally documented by Anthropic. The widespread reflex of counting the same failure message repeating remains a matter of common sense, not a named feature of the product.
Reducing context before starting over
Faced with this message, or with any sense of going in circles on the same file, the official documentation offers several options before a full restart. Asking for the file at issue to be read in slices avoids saturating the context all at once. Running a targeted compaction with a focus instruction keeps what matters and discards the rest.
/compact keep only the plan and the diff
Delegating work on a large file to a sub-agent also limits what enters the main context of the current conversation.
Two commands for starting over, and they do not do the same thing
/clear erases everything, conversation and context, keeping nothing. The checkpoint menu, opened with /rewind or a double press of Escape when the input line is empty, instead restores the conversation, the code, or both, to an earlier point in the same session, without losing everything. This system keeps one limit worth knowing: it tracks edits made by Claude's file editing tools, not a change made by a bash command such as rm, mv or cp.
When the conversation is too degraded for a rewind to be enough, /clear remains the right choice, provided it comes with a hand written summary: the decisions already made, what failed and why, the file to resume from. A fresh context without this summary forces everything to be rediscovered. This same checkpoint mechanism comes back, applied to a code fix rather than an entire conversation, in undoing and recovering a change.
From the loop signal to restarting
A developer sees Claude Code display, three times in a row, a message starting with Autocompact is thrashing while he tries to have a large configuration file reread. He presses Escape twice, opens the menu that appears, and chooses to restore the conversation to a point before the file was read.
Write, in one sentence, what this situation establishes, and in one sentence what it does not establish.
What this establishes: The developer recognised the official compaction loop signal and used the checkpoint mechanism to return to an earlier state of the conversation.
What this does not establish: This does not establish that returning to that earlier point solved the difficulty encountered with the large configuration file, nor that the file itself changed.
The three most common miscalibrations
- Too broad The checkpoint menu now prevents any repetition of the same failure message within this session.
- Too narrow This observation proves nothing since the message only appeared three times before the intervention.
- Off target This situation shows that Claude Code itself chooses to count identical failure messages before acting.
- The Autocompact is thrashing message is the only loop signal officially documented by Claude Code, produced when the context fills up again right after a compaction.
- Reading in slices, a targeted compaction with a focus instruction, or delegating to a sub-agent reduce context before considering a full restart.
- The /clear command erases everything with nothing kept, while the checkpoint menu, opened by /rewind or a double Escape, restores the conversation, the code, or both, to an earlier point in the same session.
- The checkpoint system tracks edits made by Claude's file editing tools, not changes made by a bash command such as rm, mv or cp.
- A full restart benefits from being accompanied by a hand written summary of the decisions already made, to avoid rediscovering everything in an empty context.
As soon as you see the same failure message twice, stop the strategy that is failing: press Escape twice to open the checkpoint menu, or run /clear and reopen with a hand written summary of the decisions already made.
Every datable claim in this lesson links here to the public text behind it. A source that does not open proves nothing.
- Claude Code, troubleshooting, looping autocompact and recovery consultée le 2026-09-02
- Claude Code, checkpoints, rewind and tracking limits consultée le 2026-09-02