[BUG] Autocompact in planning mode trashes the plan
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When planning mode is started after completing some task, and auto-compact fires, it pollutes the planning. Apparently both things interact in a bad way causing the plan to end up built to do again what was completed already instead of the plan request.
What Should Happen?
If auto-compact fires in the middle of planning, the summarization should not contain the previous part and confuse the planning. Or summarization should contain parts relevant to the planning. Apparently both things interact in a bad way. Auto-compact should be "smarter" in that case and process in a different way planning vs editing.
Error Messages/Logs
No errors, just the plan ends up not being the one requested.
Steps to Reproduce
Complete a task. Afterwards when context is close to be filled launch planning mode to increase chances for auto-compact to fire. Request a different plan. Could be related or not. At the end of planning if auto-compact fires the plan ends up being the previous completed task.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.0.67
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
No response