[BUG] Auto-compact threshold silently regressed — fires at ~73% context used, previously ~83%

Status Open
Reported on v2.1.204
Maintainer reply ✓ Yes — bcherny
Activity 2 comments · opened Aug 15, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

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?

I do long agentic sessions where I'm actively building Claude's reasoning context. Compaction destroys that context, so I manage sessions manually — I watch the token percentage and wrap up before compaction fires.

This workflow depends on knowing when compaction will fire. It used to fire consistently at ~83% context used. Today it fired at ~73% with no warning. That's a 10-point shift that invalidated my session boundary habits mid-session.

The problem isn't the number — it's that it changed silently. No changelog, no announcement, no setting I touched. I can't maintain a consistent workflow if this threshold moves without notice.

Expected: threshold stays stable, or breaking changes to session behavior appear in the changelog
Actual: threshold shifted ~10% downward, discovered only when compaction fired earlier than expected

This isn't a request to make it configurable — it's a request to stop changing it without telling people.

What Should Happen?

If the threshold changed intentionally, document it in the changelog
If it changed unintentionally, revert it
Either way, treat session behavior changes as breaking changes that warrant an announcement

Error Messages/Logs

Steps to Reproduce

Start a session
Use context until ~73% consumed
Observe auto-compaction fires — previously did not fire until ~83%

No error message — compaction fires silently, which is the point. The bug is behavioral, not a crash.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

I don't know. I am busy trying to corral Claude.

Claude Code Version

2.1.204 (Claude Code)

Platform

Other

Operating System

Windows

Terminal/Shell

Other

Additional Information

Compaction doesn't end the session — it silently rewrites the context and lets you continue, which makes it more dangerous than a hard stop. You don't always notice it fired. By the time you do, Claude's reasoning context has already been corrupted. That's why I manage session boundaries manually — to avoid compaction entirely.

View original on GitHub ↗

3 Comments

bcherny collaborator · 1 month ago

Thanks for the detailed report. I looked into this on the current release (2.1.233) rather than trying to fill a ~150K-token session, since the trigger point is deterministic once you know the inputs.

What we found: the compaction trigger isn't a fixed percentage. It's the session's auto-compact window minus a fixed safety buffer, and the auto-compact window depends on your model, plan, and configuration — and the default window for a model can be tuned on our side without a Claude Code release. On a 200K window the default works out to about 83% of the context bar, which matches what you were seeing before; a lower default window for your model/plan would move it down to roughly what you're seeing now. The math in the app itself did not change between 2.1.204 and 2.1.233. Docs: https://code.claude.com/docs/en/model-config#default-auto-compact-thresholds and https://code.claude.com/docs/en/context-window

We agree it's confusing to have that boundary move without notice. Two things you can do today: pin the window yourself so it can't move — run /autocompact <tokens> (for example /autocompact 160k; requires 2.1.221+, so please update from 2.1.204) or set CLAUDE_CODE_AUTO_COMPACT_WINDOW; and run /context to see the current buffer and free space. See https://code.claude.com/docs/en/model-config#set-the-auto-compact-window.

On our side we're considering showing the effective auto-compact threshold directly in /context / the status line, and documenting that the default window is server-tuned. If you can share your claude doctor output, model shown in /status, and whether you set any autocompact env vars or settings, we can confirm which window your sessions are getting.

🤖 Generated with Claude Code

bartanderson · 1 month ago

I only had it happen that one time, but I was so mad that it happened I
responded. I and claude try to keep a better watch because I never want a
compaction.

On Sun, Aug 16, 2026, 7:29 PM Boris Cherny @.***> wrote:

bcherny left a comment (anthropics/claude-code#86863) <https://github.com/anthropics/claude-code/issues/86863#issuecomment-5310504874> Thanks for the detailed report. I looked into this on the current release (2.1.233) rather than trying to fill a ~150K-token session, since the trigger point is deterministic once you know the inputs. What we found: the compaction trigger isn't a fixed percentage. It's the session's auto-compact window minus a fixed safety buffer, and the auto-compact window depends on your model, plan, and configuration — and the default window for a model can be tuned on our side without a Claude Code release. On a 200K window the default works out to about 83% of the context bar, which matches what you were seeing before; a lower default window for your model/plan would move it down to roughly what you're seeing now. The math in the app itself did not change between 2.1.204 and 2.1.233. Docs: https://code.claude.com/docs/en/model-config#default-auto-compact-thresholds and https://code.claude.com/docs/en/context-window We agree it's confusing to have that boundary move without notice. Two things you can do today: pin the window yourself so it can't move — run /autocompact <tokens> (for example /autocompact 160k; requires 2.1.221+, so please update from 2.1.204) or set CLAUDE_CODE_AUTO_COMPACT_WINDOW; and run /context to see the current buffer and free space. See https://code.claude.com/docs/en/model-config#set-the-auto-compact-window. On our side we're considering showing the effective auto-compact threshold directly in /context / the status line, and documenting that the default window is server-tuned. If you can share your claude doctor output, model shown in /status, and whether you set any autocompact env vars or settings, we can confirm which window your sessions are getting. 🤖 Generated with Claude Code <https://claude.ai/code> — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/86863?email_source=notifications&email_token=AAMXAKGPCI3K73SITNZ365L5KJGX7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZRGA2TANBYG42KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5310504874>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAMXAKCO4R2J657YYLOGGJT5KJGX7AVCNFSNUABFKJSXA33TNF2G64TZHM4TGNZSGUZTINZVHNEXG43VMU5TKMJVHAZDQMZYGUYKC5QC> . Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS <https://github.com/notifications/mobile/ios/AAMXAKDSZYKWQI5RL4OMFHD5KJGX7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZRGA2TANBYG42KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG> and Android <https://github.com/notifications/mobile/android/AAMXAKAF67CA6JVMT5ZGOID5KJGX7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMZRGA2TANBYG42KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>. Download it today! You are receiving this because you authored the thread.Message ID: @.***>
samvallad33 · 1 month ago

Auto-compact fired at 73 percent with no warning and the reasoning context was already gone. I ingest the decision before the threshold. Silent earlier compact cannot wipe a written fact.

https://github.com/samvallad33/vestige