Feature: configurable auto-compaction threshold
Feature request
Allow users to configure the context window percentage at which auto-compaction triggers, via a setting in settings.json (user or project level).
{
"autoCompactionThreshold": 80
}
If not specified, the current default behavior applies.
Motivation
With the statusLine feature, users can now monitor context window usage in real time. However, there's no way to control when auto-compaction fires. In my experience, compaction triggered at ~76% used (24% remaining) — well before the context window was exhausted.
For long-running sessions with heavy context (architecture decisions, multi-file reviews), earlier compaction discards useful context prematurely. For other workflows, later compaction might risk losing important state.
A configurable threshold would let users tune the trade-off between context preservation and safety margin based on their workflow.
Proposed behavior
- New optional setting:
autoCompactionThreshold(integer, 1–99, percentage of context used) - When context usage reaches the threshold, auto-compaction fires as it does today
- If omitted, current default behavior is unchanged
- Could be set at user level (
~/.claude/settings.json) or project level (.claude/settings.json)
This issue has 12 comments on GitHub. Read the full discussion on GitHub ↗