[BUG] Autocompact thrashing: context fills within 2-4 turns of previous compact, reproducible with a single word on a fresh branch, persists across unrelated sessions/projects

Open 💬 2 comments Opened Jul 1, 2026 by duidet-byte

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?

Autocompact repeatedly thrashes across many independent chats/branches on the same
project. At least 7 independent reproductions in one day across 7 differently-named
sessions. Cleanest repro: a brand-new chat on a fresh branch where I typed only the
single word "axiom" — nothing else — still hit three compactions and then a full
context wall:
"Ran a command, found files, read 2 files" -> compacted (61.9k saved)
-> "Ran a command, found files" -> compacted (71.9k saved)
-> "Ran a command, read a file" -> compacted (57.2k saved)
-> "Read a file, ran a command" -> "Your context window is full."

This rules out "large input/task" as the explanation. An unrelated MCP server was
suspected as a contributing factor and removed — thrashing continued identically
afterward, ruling that out too.

Suspected contributing factor: heavy fixed per-turn overhead in this environment —
project + global CLAUDE.md loaded together, several auto-injected memory files +
memory index re-injected every turn, multiple MCP servers/tools, several enabled
plugins, and a large set of deferred tool/agent definitions.

What Should Happen?

Claude Code should not reach "context window is full" from a single-word prompt on a
fresh branch. If fixed per-turn overhead (CLAUDE.md, memory injection, tool/plugin
definitions) is contributing to hitting the autocompact-thrashing threshold this
easily, that overhead should be reduced or the thrashing detector's threshold should
account for it.

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 Claude Code chat in a project with a large/complex CLAUDE.md file,

multiple auto-loaded memory files, several connected MCP servers, and a few
enabled plugins (this heavy fixed overhead may be a precondition — see "Suspected
contributing factor" above).

  1. Do not give any prior context. Type a single short word as the first message

(e.g. "axiom").

  1. Observe Claude autonomously running a small number of tool calls (e.g. "Ran a

command, found files, read 2 files").

  1. Watch the conversation compact 2-4 times in quick succession, each saving

roughly 50-70k tokens, without the user sending any further messages.

  1. After the last compaction, the session shows "Your context window is full" and

becomes unusable.

Reproduced independently 7 times in one day, across 7 differently-named
sessions/branches in the same project, with varying levels of user input (from a
single word up to normal multi-turn work).

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.195 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Also noticed a side effect: because each new session branches from the same local
git state, unpushed local commits from earlier sessions get silently carried forward
into every subsequent new branch's diff — made it hard to tell "real prior work" from
"session noise" until git log origin/main..HEAD was checked manually.

View original on GitHub ↗

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