[FEATURE] Auto-compact currently triggers mid-execution of CLI commands, causing unnecessary token re-reads and increased costs.
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
---
Title: Auto-compact should wait for command completion to optimize token usage
Description:
Issue
Auto-compact currently triggers mid-execution of CLI commands, causing unnecessary token
re-reads and increased costs.
Current Behavior
- User runs a CLI command
- Conversation is read (tokens used)
- Command begins executing
- Auto-compact triggers during execution
- Next response re-reads conversation (tokens used again)
Expected Behavior
Auto-compact should wait until the current command completes before triggering, since:
- Context is already loaded for the executing command
- Compacting mid-execution adds overhead
- Waiting until completion would be more token-efficient
Impact
- Unnecessary token usage (double conversation reads)
- Increased API costs
- Reduced performance during long-running commands
Proposed Solution
Defer auto-compact triggers until after the current command/tool execution completes.
Environment
- Platform: Windows (MSYS_NT-10.0-26100)
- Claude Code version: [latest]
---
Proposed Solution
Expected Behavior
Auto-compact should wait until the current command completes before triggering, since:
Context is already loaded for the executing command
Compacting mid-execution adds overhead
Waiting until completion would be more token-efficient
Alternative Solutions
_No response_
Priority
Low - Nice to have
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗