claude-code - 💡(How to fix) Fix [BUG] Autocompact thrashes within 3 turns on fresh sessions — regression in 2.1.144 [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#60485Fetched 2026-05-20 03:57:19
View on GitHub
Comments
3
Participants
3
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×6commented ×3cross-referenced ×1

Error Message

Error Messages/Logs

Fix Action

Fix / Workaround

Workarounds tried

  • /clear — works once, thrashing returns within ~3 turns.
  • /compact <focus> — same.
  • No oversized tool outputs or file reads in the affected sessions.

Code Example

Autocompact is thrashing: the    
  context refilled to the limit within 3 turns of the                                      
    previous compact, 3 times in a row. A file being read or a tool output is likely too   
    large for the context window. Try reading in smaller chunks, or use /clear to start    
    fresh.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Summary

Starting in v2.1.144, the autocompact guard fires "Autocompact is thrashing: the context refilled to the limit within 3 turns of the previous compact, 3 times in a row" on fresh sessions within roughly 3 turns, repeatably. Prior versions on the same project did not exhibit this.

Version

claude --version2.1.144 (Claude Code)

Evidence context bloat is NOT the cause

  • Per-project memory directory: 4 files totalling 9012 bytes, none modified today.
  • Project CLAUDE.md files: ~32 KB combined, unchanged.
  • Total auto-loaded text context ≈ 41 KB — well below anything that should trigger thrashing on a 200K-token window.
  • Symptom started the day 2.1.144 was installed; same project, same files were fine on the previous version.

Impact

Each thrash event breaks the workflow — manual /clear and restart of the task is needed. /compact with a focus argument does not durably help; thrashing resumes within a few turns.

Workarounds tried

  • /clear — works once, thrashing returns within ~3 turns.
  • /compact <focus> — same.
  • No oversized tool outputs or file reads in the affected sessions.

What Should Happen?

Please look at whatever changed in the autocompact heuristic / context-accounting between the previous release and 2.1.144 — the trigger threshold appears to fire on context that should be comfortably small.

Error Messages/Logs

Autocompact is thrashing: the    
  context refilled to the limit within 3 turns of the                                      
    previous compact, 3 times in a row. A file being read or a tool output is likely too   
    large for the context window. Try reading in smaller chunks, or use /clear to start    
    fresh.

Steps to Reproduce

  1. Open a fresh session in a project whose auto-loaded context is normal-sized (~41 KB combined in my case: root CLAUDE.md 24 KB + .claude/CLAUDE.md 8 KB + per-project memory/ 9 KB).
  2. Do a handful of small turns (a couple of Reads, a Bash or two).
  3. Within ~3 turns the autocompact-thrashing banner appears, and keeps recurring after every compact.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.144

Platform

Google Vertex AI

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING