autoCompact threshold (~70%) is too aggressive for complex agentic sessions — causes thrashing

Resolved 💬 2 comments Opened May 22, 2026 by Evil-Overlord-666 Closed Jun 4, 2026

Problem

The current auto-compact threshold (~70% context usage) is too conservative for power users running complex multi-step agentic workflows with substantial startup context (large CLAUDE.md, session logs, memory files loaded at boot).

In practice: when baseline context footprint is high, the 70% threshold is hit early — often before meaningful work is complete. The compaction summary refills context immediately, triggering another compact, causing thrashing. By end of session the agent is compacting every single turn.

Specific case

  • System: CachyOS Arch Linux, Claude Code 2.1.146
  • Session cost: ~\$9.18 for ~58 minutes wall time
  • Context hit 70% and began compacting before primary task was complete
  • Repeated compaction cycles burned tokens and budget without making progress
  • Effective working window was far shorter than the raw context limit suggests

Requested change

  1. A configurable autoCompactThreshold setting in settings.json — let power users set 85% or 90% if they accept the trade-off
  2. Or raise the default threshold to at least 85%

The 70% floor leaves 30% headroom which may be appropriate for simple tasks, but for agentic sessions doing real work it means the session dies earlier and costs more. Users who understand the risk should be able to opt in to a higher threshold.

Impact

  • Token waste from redundant compaction summaries
  • Session continuity broken repeatedly mid-task
  • Budget burned without proportional work completed

View original on GitHub ↗

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