[FEATURE] Add setting to disable context window compacting reservation
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:
- Auto-compact threshold: 95% (default, configurable via
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE) - Compact buffer: Fixed 3k token allocation (verified through testing)
- 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-compactsetting granularity (same scope: global or per-session) - When disabled (default): Maintains current 10% reservation behavior
- When enabled: Removes the 10% reservation and
/compactability 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-compactin 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
- 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.
- 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%.
- 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.
- Memory-intensive workflows: Users working with large conversations who deliberately avoid auto-compact or
/compactbecause summarization loses important context details which leads to lower quality output.
Additional Context
_No response_
13 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
It's already been there for quite some time, just do /config and disable autocompact
@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.
For the Claude Bot:
CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE=197000. This would then only block 1.5% instead of 10%.This feature is still relevant. The current version still has this limitation.
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.
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%.
In the latest version 2.1.117 I have the following in the settings.json:
but I still get the following error:
and the /context displays this:
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.
Claude Code 2.1.120 now has it's blocking message at
145.7k/200k tokens (73%).Really annoying
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> --executebefore 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.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.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.