Auto Compact triggering too early

Resolved 💬 4 comments Opened Jan 20, 2026 by yamb0x Closed Feb 28, 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?

Recently I’m seeing auto-compact trigger much earlier than expected, well before the context window is anywhere near full. At first I assumed this was a bug, but after observing it a few times I’m wondering if this is an intentional behavior change? possibly triggered when a large amount of content or multiple documents are ingested early in the session.

Observed behavior:
Auto-compact runs even though the context usage appears low
This happens early in the session, not after long conversations
Leads to unexpected loss of context / summaries kicking in too soon

Is this: a known bug?
an intentional change in auto-compact heuristics?
expected behavior when ingesting many documents at the start of a session?

<img width="824" height="987" alt="Image" src="https://github.com/user-attachments/assets/4c70f94e-7a2c-4393-ab3b-13aef6f77345" />

What Should Happen?

My expectations from the past year working with Claude is that Auto-compact should only trigger when the context window is actually close to being full, or at least much later than what I’m seeing now.

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce

Start a fresh Claude Code session (tested on Claude Code v2.1.12, Opus 4.5 / Claude Max).
Open a medium–large real-world codebase (TypeScript / React in my case).
Ask Claude to review or verify implementation across multiple files (e.g. “check if everything is implemented correctly before testing”).
Allow Claude to sequentially read multiple files,
L
Example observed reads:
~350–450 lines markdown specs
~1k–2k line TS / TSX files
Multiple files in a row, no back-and-forth conversation

Observe that:
Claude successfully reads many files in sequence
Context does not appear close to full (checked multiple times!)
No warning about imminent context exhaustion
While continuing the same task (still mid-review, not idle), auto-compact triggers:

  • Compacting conversation…

This happens mid-task, before the review completes, and results in:
Loss of earlier file context
Task continuation based on a summarized / compacted state

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.12

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Cursor

Additional Information

_No response_

View original on GitHub ↗

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