Allow configurable auto-compact threshold for main conversation
Feature Request
Problem
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE currently only applies to subagents. The main conversation auto-compacts at a hardcoded ~95% context capacity threshold with no way to configure it.
For long sessions (complex multi-file features, debugging, etc.), by the time compaction kicks in at 95%, valuable context has already been competing for space and the compaction can be aggressive. Users who prefer earlier, gentler compaction have no option other than manually running /compact.
Proposed Solution
Extend CLAUDE_AUTOCOMPACT_PCT_OVERRIDE (or introduce a new setting like autoCompactThreshold) to also apply to the main conversation, not just subagents.
For example:
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=60
or in settings.json:
{
"autoCompactThreshold": 60
}
This would trigger auto-compaction at 60% context capacity for both the main conversation and subagents.
Why This Matters
- Proactive compaction at a lower threshold keeps conversations more focused and avoids the "cliff edge" at 95%
- Consistency — users expect the env var to apply globally, not just to subagents
- Long sessions benefit from earlier compaction since it can preserve more relevant context when there's still headroom
Current Workaround
Manually running /compact periodically, which interrupts flow and requires the user to remember to do it.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗