Feature: Configurable auto-compact threshold percentage

Resolved 💬 2 comments Opened Apr 5, 2026 by theovit Closed May 16, 2026

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 /compact programmatically.

🤖 Generated with Claude Code

View original on GitHub ↗

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