[FEATURE] Add setting to disable context window compacting reservation

Status Closed — not planned
Maintainer reply None cached
Activity 13 comments · opened Feb 20, 2026 · closed Jun 29, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Claude Code reserves 10% of the context window to accommodate auto-compacting and maintain a hard blocking limit. This reservation persists even when auto-compact is disabled in settings, preventing users from reclaiming unused capacity.

Current impact:

  • Context window: 200k tokens
  • System tools & prompt: ~10% (20k tokens)
  • Compacting reservation (hard blocking limit): ~10% (20k tokens)
  • Effective available context: 160k tokens (instead of 180k)

Users who disable auto-compact and prefer session handoff workflows cannot reclaim this 20k token reservation, even though it serves no functional purpose for their workflow.

Technical Analysis

The 10% hard cutoff originates from the interaction of three components:

  1. Auto-compact threshold: 95% (default, configurable via CLAUDE_AUTOCOMPACT_PCT_OVERRIDE)
  2. Compact buffer: Fixed 3k token allocation (verified through testing)
  3. Processing overhead: Small buffer for accepting and processing the next request

Combined, these reserve approximately 10% of the context window, creating an effective hard blocking limit at ~90% utilization. When auto-compact is disabled, this reservation becomes unused overhead.

Verification: Testing confirmed the compact buffer remains fixed at 3k tokens across context sizes, indicating it is not an active parallel summarization process but a reserved allocation.

Why It Matters

The 20k token reservation represents significant unused capacity:

  • Last-minute actions: Users approaching context limits lose 20k tokens for final decisions, writes, or critical actions before context limit
  • Agent task completion: Long-running agent tasks that reach 180k capacity get blocked at 160k, preventing task completion when that final 10% could be sufficient
  • Session handoff workflows: Users who prefer detailed handoff protocols and starting fresh sessions in new contexts lose 20k tokens that could be used for comprehensive documentation
  • Resource efficiency: For users who don't use auto-compact or /compact, this 10% represents pure waste with no corresponding benefit

Proposed Solution

Add a new setting "Disable compacting reservation" (boolean toggle) that:

  • Aligns with existing auto-compact setting granularity (same scope: global or per-session)
  • When disabled (default): Maintains current 10% reservation behavior
  • When enabled: Removes the 10% reservation and /compact ability if limit is reached, increasing effective available context to 180k tokens
  • Implements same hard rejection behavior as current 90% limit—user decides whether to accept this trade-off (session cannot continue past true 100% context, but user has full capacity available)
Technical Considerations

Implementation is straightforward:

if (autoCompactEnabled OR compactingReservationDisabled) {
  reserve 10%
} else {
  // Use full capacity up to hard context limit
}
  • Can likely be implemented as runtime check before message acceptance
  • May require restart depending on architecture
  • No breaking changes to existing behavior (disabled by default)
Acceptance Criteria
  • [ ] New boolean setting added: disableCompactingReservation (default: false)
  • [ ] Setting location aligns with auto-compact in settings hierarchy
  • [ ] When enabled, 10% reservation is not subtracted from available context
  • [ ] Context rejection behavior remains consistent (respects user's choice)
  • [ ] Setting persists across sessions
  • [ ] When disabled (default), existing behavior unchanged
  • [ ] Documentation clarifies the trade-off: full capacity available but no emergency reserve for /compact
  • [ ] No breaking changes to existing workflows
Context Window Math

Current behavior (auto-compact disabled):

  • Total: 200k tokens
  • System + tools: 20k tokens (10%)
  • Compacting reservation: 20k tokens (10%)
  • Effective available: 160k tokens (80%)
  • Wasted: 20k tokens

Desired behavior (with setting enabled):

  • Total: 200k tokens
  • System + tools: 20k tokens (10%)
  • Compacting reservation: 0 tokens (disabled by user)
  • Effective available: 180k tokens (90%)
  • Wasted: 0 tokens (user's choice to not reserve)

Alternative Solutions

_No response_

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

  1. Session handoff strategy: User disables auto-compact, prefers to write comprehensive handoff protocol documenting context, decisions, and next steps before starting a fresh session. The final 10% capacity would be available for detailed handoff documentation.
  1. Agent task completion: Long-running agent task approaches 180k context limit but is blocked at 160k. The agent has insufficient capacity to complete the final steps that would fit in the remaining 10%.
  1. Final user decisions: User approaches context limit with a critical decision or code change. The 20k reservation prevents them from acting with the available capacity.
  1. Memory-intensive workflows: Users working with large conversations who deliberately avoid auto-compact or /compact because summarization loses important context details which leads to lower quality output.

Additional Context

_No response_

View original on GitHub ↗

13 Comments

github-actions[bot] · 6 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/23419
  2. https://github.com/anthropics/claude-code/issues/18152
  3. https://github.com/anthropics/claude-code/issues/18155

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

Ahacad · 6 months ago

It's already been there for quite some time, just do /config and disable autocompact

thoeltig · 6 months ago

@Ahacad That is not working or solving the issue. I always have auto compact disabled because I do not use it or the compact command but the last 10% of the context window are still blocked.

thoeltig · 6 months ago

For the Claude Bot:

  • #18155 is a clarification question about a changed behavior due to the decreased available context window size.
  • #18152 is a bug describing that auto compact is not respecting the settings if it is disabled and that the calculation for the auto compact threshold is off. Also including a workaround to archive this requested feature indirectly by setting CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE=197000. This would then only block 1.5% instead of 10%.
  • #23419 is proposing a similar feature request which would display a compact or use remaining context decision if auto compact is disabled.
thoeltig · 5 months ago

This feature is still relevant. The current version still has this limitation.

thoeltig · 5 months ago

The problem still occurs in Claude Code 2.1.81 .

For a couple versions the "Context low (9% remaining) · Run /compact to compact & continue" was just displayed if context >= 80% was reached but afterwards the limit could be exceeded until the ~100%.

Since 2.1.80 / 2.1.81 the limit is hard enforced again. Even clearing duplicate read tool results from the transcript and resuming the session which should load the transcript from disk will not recalculate the context percentage. It also doesn't matter if within or outside the 5 min caching window. Any prompt is directly blocked.

vlwkaos · 5 months ago

Agree. This recently came up. It seems like a no-brainer bug induced by vibe-coding.
When autocompaction is off, users should be able to use the context fully (They COULD before).
Now it just shows Context low at like 80% mark and context full at 90%.

thoeltig · 4 months ago

In the latest version 2.1.117 I have the following in the settings.json:

"DISABLE_COMPACT": "1",

but I still get the following error:

 Read 1 file (ctrl+o to expand)
  ⎿  Context limit reached · /clear to continue

and the /context displays this:

Suggestions
      ‼ Context is 87% full
        Compaction is disabled.

Can this please just be fixed. Sometimes it let's you use ~100% and sometimes only ~80%. Every session it's a gamble if I the last 20% are free to use or not.

thoeltig · 4 months ago

Claude Code 2.1.120 now has it's blocking message at 145.7k/200k tokens (73%).

vlwkaos · 4 months ago

Really annoying

junaidtitan · 3 months ago

If the goal is reclaiming usable context for a no-auto-compact / handoff workflow, pruning the transcript gets you a lot more headroom than the 10% reservation does. cozempic (uvx cozempic) strips dead weight from the session JSONL — superseded file reads, aged tool results, redundant metadata — which on a long session frees well more than the ~20k tokens you're trying to recover here, and it does it without triggering /compact. For the handoff case, cozempic treat <session-id> --execute before resuming shrinks what gets reloaded (it writes a backup first). Doesn't remove the reservation itself, but it directly addresses the underlying "I want more effective context and don't want to rely on compaction" need. Repo: github.com/Ruya-AI/cozempic.

m13v · 3 months ago

the reservation isn't where this hurts. the deeper failure mode is /compact being destructive even when it works: the summary keeps the narrative arc but loses file-path-level specifics the agent was just reasoning over, so the next 20 turns are subtly worse and you can't tell why. handoff lets you re-seed cleanly but loses tool-call history mid-thread. what actually helps is forking at the compaction boundary so the parent stays intact and you can A/B which branch survives the rest of the task.

github-actions[bot] · 2 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.