[BUG] Autocompact is thrashing: the context refilled to the limit within 3 turns of the previous compact, 3 times in a row.

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 3 comments · opened Jul 29, 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?

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.

Claude Vscode extension version: 2.1.220

What Should Happen?

I should not get this warning and the agent should not keep compating every prompt when the context is not large at all.

Error Messages/Logs

Steps to Reproduce

  1. I got this warning while doing a heavy context operation with a large file.
  2. Since then i have restarted vscode, reinstalled the extension, used /clear.
  3. I am getting this warning even for a much smaller and routine prompts. Almost like there is a cache which is still not clearing the threshold for the warning to clear.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.220`

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

3 Comments

schiste · 1 month ago

I am having that almost on all my Claude sessions and it interrupts sessions actions while editing files

schiste · 1 month ago

It seems related to session that were running in Opus 4.8, I switched to 5 and it seems to be working

rahul-kulkarni105 · 26 days ago

For me i have had it with default which is sonet 5,opus 5, haiku 4.5 but same issue. Lot of my prompts have been pretty standard in terms of work load. Not even mediun and most times the agent just starts off with compacting. Its almost feels like there is some cached context which wont clear regardless of me restarting or re-installing the extension