[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_
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗