[BUG] Autocompact thrashes within 3 turns on fresh sessions — regression in 2.1.144

Resolved 💬 3 comments Opened May 19, 2026 by marczeto Closed May 22, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] 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).

  1. Do a handful of small turns (a couple of Reads, a Bash or two).
  2. 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_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗