[BUG] AI given misleading system context after compaction
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?
The system context that is provided to the AI after auto-compaction mentions the last request, which would be great if that request were meaningful.
In my prior experiences, the "request to compact" is considered the "user's last request," which wouldn't be quite right for resuming that task easily.
I do like that it's given access to the full transcript if needed, etc. But just this big is a bit annoying, as the AI frequently says that it's "ready to continue. What's next?" when it was in the process of doing something.
This portion of the context is in the "9. Optional Next Step:" section.
What Should Happen?
The "user's last request" should not be the EXACT last request; instead, it should exclude the compaction request and use the last remaining request.
Error Messages/Logs
Steps to Reproduce
Just let context auto-compact and usually this is the case.
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.152 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗