Summary
Add a user-configurable setting to control when auto-compaction triggers, instead of the hardcoded 95% threshold.
Motivation
The current 95% threshold works for many users, but some workflows benefit from more aggressive compaction:
- Long coding sessions - Users working on complex, multi-file tasks may want earlier compaction to preserve more relevant context before hitting limits
- Cost management - Earlier compaction can help users stay within budget by summarizing sooner
- Context quality - Compacting at 50-70% leaves headroom for the model to retain more nuanced details rather than aggressive summarization under pressure
Proposed Solution
Add a new setting contextCompactionThreshold (or similar) that accepts a percentage value (e.g., 0.5 for 50%).
Configuration via /config:
Auto-compact threshold: 50%
Or via settings file (~/.claude/settings.json):
{
"contextCompactionThreshold": 0.5
}
Suggested Defaults
- Default:
0.95 (current behavior, no breaking change)
- Valid range:
0.25 to 0.95
Alternatives Considered
- Manual
/compact only - Works but requires user vigilance and interrupts flow
- Multiple preset options (e.g., "aggressive", "moderate", "conservative") - Less flexible but simpler UX
Additional Context
This pairs well with the existing custom compaction instructions in CLAUDE.md, giving users full control over both when and how compaction occurs.
Summary
Add a user-configurable setting to control when auto-compaction triggers, instead of the hardcoded 95% threshold.
Motivation
The current 95% threshold works for many users, but some workflows benefit from more aggressive compaction:
Proposed Solution
Add a new setting
contextCompactionThreshold(or similar) that accepts a percentage value (e.g., 0.5 for 50%).Configuration via
/config:Or via settings file (
~/.claude/settings.json):{ "contextCompactionThreshold": 0.5 }Suggested Defaults
0.95(current behavior, no breaking change)0.25to0.95Alternatives Considered
/compactonly - Works but requires user vigilance and interrupts flowAdditional Context
This pairs well with the existing custom compaction instructions in
CLAUDE.md, giving users full control over both when and how compaction occurs.