Feature: configurable autoCompactThreshold setting

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 0 comments · opened Aug 8, 2026

Problem

When autoCompactEnabled: true is set, compaction only triggers when context approaches ~85-90% of the limit. However, if a single turn's output (especially from parallel subagents or large tool results) exceeds the remaining headroom, the conversation hits the context limit before auto-compact has a chance to run.

This results in "out of context" errors despite having auto-compact enabled.

Contributing factors

  • Heavy system context from CLAUDE.md files, plugins, and memory injections
  • Subagents returning simultaneously with combined output spiking past the limit
  • No way to trigger compaction earlier to maintain buffer room

Proposed solution

Add an autoCompactThreshold setting in settings.json:

{
  "autoCompactEnabled": true,
  "autoCompactThreshold": 0.70  // compact when context reaches 70%
}

This would allow users to:

  • Set a lower threshold (e.g., 60-70%) for heavy plugin/context setups
  • Maintain buffer room for large single-turn outputs
  • Prevent "out of context" errors entirely

Current workaround

Manually running /compact periodically, but this is error-prone and defeats the purpose of auto-compact.

Environment

  • Claude Code version: 2.1.220
  • OS: macOS
  • Multiple plugins enabled (12 active)
  • Heavy CLAUDE.md and memory context

View original on GitHub ↗