[FEATURE] Compact before starting a new plan step instead of in the middle of code changes
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
Compaction happening during code changes bear lower-quality code being written, compared to when we compact once a step has been completed before starting a new one.
Proposed Solution
In VS Code extension, it tends to trigger compaction around 80%, so starting at 65%, it should look into triggering compaction if there are still planned steps to complete.
Two ways this could be done:
- Inject context window percentage into system reminders for model-aware compaction. And then it's a claude.md guidance each user would add.
- Native option, handled by Claude without system reminders. Downside of this is that you guys at Anthropic tend to prioritize CLI over VS Code extension for new feature delivery, and I use VS Code extension...
Alternative Solutions
I wish I could have done this with hooks, but hooks are not supported yet by the VSCode extension (tracked under https://github.com/anthropics/claude-code/issues/8985).
Side note that the feature category drop-down for a new feature request in the repo only has "CLI commands and flags", and nothing about the VSCode extension.
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
Provided as part of the proposed solution.
Additional Context
No response
I forgot another benefit: if compaction happens right after publishing a plan or a response to the user, we lose less time since we read while compaction is happening.
Found 2 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/9971
- https://github.com/anthropics/claude-code/issues/7627
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
This issue has been automatically closed as a duplicate of #9971.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with Claude Code
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.