Feature: Configurable auto-compact threshold percentage
Summary
Currently, auto-compact triggers at a hardcoded ~95% context window usage. There is no way to configure a custom threshold — only the autoCompactWindow token size is exposed in settings.json.
Requested Feature
Add a configurable autoCompactThreshold setting (percentage, 0–100) to settings.json that controls when auto-compact fires.
Example:
{
"autoCompactThreshold": 60
}
This would trigger auto-compact when context usage reaches 60%, rather than waiting until ~95%.
Use Case
Users working on large, long-running sessions want to compact earlier to preserve more useful context in the summary and avoid hitting the hard limit mid-task. The current 95% threshold leaves very little room to react before the context window is exhausted.
Current Workaround
Manually running /compact at a desired point — there is no automated option.
Additional Notes
- Hooks (
PreCompact) fire only when Claude Code has already decided to compact — they cannot change the threshold. - Hook commands have no access to context usage stats and cannot trigger
/compactprogrammatically.
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗