Feature Request: Configurable Context Window Compaction Threshold

Resolved 💬 3 comments Opened Dec 29, 2025 by perrywinkle1 Closed Jan 2, 2026

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

  1. Manual /compact only - Works but requires user vigilance and interrupts flow
  2. 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗