# “Autocompact is thrashing” in Claude Code: reproduced it on purpose and tested 4 fixes — retained record

> Retained reddit record from reddit:ClaudeCode.

Canonical: https://highsignal.app/data/records/4a42fbab3773d434

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:ClaudeCode)  published 2026-11-17 08:03 ingested 2026-11-18 02:42

[original source ↗](https://www.reddit.com/r/ClaudeCode/comments/1xyer2z/autocompact_is_thrashing_in_claude_code/)

## retained text



```
If you’ve hit this one, it means a single file or tool output is too big for your context window. Claude Code compacts, the same big content fills the window again, and after 3 rounds it gives up. It’s a circuit breaker, not a crash.

We triggered it for real on v2.1.325, with a 30,000-line fake log and a small auto-compact window (`--autocompact 100k`, Haiku) to keep the test cheap. Asking Claude to read the whole file thrashed out after 1 minute and 3 seconds without ever answering.

What fixed it:

* **Read less.** A grep count answered the same question in 5 seconds (889 ERROR lines, which we checked).
* **Focused /compact.** `/compact keep only my question about counting ERROR lines` dropped the Messages row from 36.4k to 9.2k tokens, right after auto-compact had given up.
* **Subagent.** It read 1,500 lines in its own context and returned one number in 19 seconds.
* **/clear.** It took the Messages row back to 130 tokens.

These numbers are from one session with a forced 100k window. With the default window you need a much bigger file to hit this, but the fixes are the same.

The article also covers “Compaction failed · conversation could not be reduced below the context limit”. We couldn’t trigger that one safely, so that part is explained from the message and the docs.

[https://aiparabellum.com/claude-code-autocompact-is-thrashing-compaction-failed-fix/](https://aiparabellum.com/claude-code-autocompact-is-thrashing-compaction-failed-fix/)
```



document fetched 2026-11-18 00:44 · canonical https://reddit.com/r/ClaudeCode/comments/1xyer2z/autocompact_is_thrashing_in_claude_code
