[BUG] Claude constantly rushes off working on the wrong thing 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?
After compaction, Claude will tend to leap on the current/next todo item, and rush ahead working on it, even if before compaction we had diverged from strictly following the todos (which, for me, is probably at least 90% of the time).
This relates to what I consider a separate bug/feature gap (#7760), where Claude will mark todos as complete before you give express confirmation, even when being told to seek express confirmation before marking off todos. This means I will often be fine tuning a todo Claude has already marked as complete when compaction happens, and then post compaction Claude will start working on the next todo without me having signed off on the previous one still, and with that earlier work still incomplete.
What Should Happen?
It would be better if it could, instead, look at the most recent chat context.
For me, it would also be better if after compaction it just stopped and said something like "I've just performed compaction, what would you like me to do now?", rather than jumping to conclusions and working on the from thing. Kind of a failsafe, rather than riskily pouncing on the next todo task, when it has lost context, and it might not be what you were working on anyway. I almost instead raised this as a feature request asking for a user settings to enable a "stop and ask" post-compaction mode.
Error Messages/Logs
Steps to Reproduce
- Work with Claude on todos for a while
- As compaction gets closer, diverge from the todos to start discussing/working on something else
- Wait for compaction to happen
- Claude will generally steam ahead working on the next todo item after compaction
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
1.0.117 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
11 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Subjectively, this has gotten worse recently. I think the real issue is that Claude Code needs to make a bigger effort to revise its todos as it discoverers that it needs to do something else - basically, it needs to have a firm rule to never work on anything other than the next item on its todo list, and if it discovered a new thing that it needs to do, they have to go on the list before it attempts to do them. A similar firm rule should be that if it decides that some aspects of the current todo item need to be revisited later, it must add those items to the todo list before marking the current one as completed.
I suspect that the culprit is an incorrect model change at conversation compaction time. These are two conversations I had recently after noticing it going off the rails post compaction.
Last week (September 12th)
Today (September 18th)
Honestly this is wasting so much of my time as the output produced by Sonnet 3.5 is utter garbage.
This is so frustrating, as I'll often move my attention away from Claude code when it is compacting, and then come back to find it has rushed ahead on things without checking.
This time I even had explicit todos to check in with me, and it just went ahead crossing these off, along with other todos, without checking in. It's now burnt through all my credit so I'll have to wait an hour before burning more credit getting it to undo its changes so we can carry on at a controlled pace.
So, after berating Claude for ignoring instructions aI added in
claude.mdto try and stop this behaviour, it revealed it was also receiving implicit instructions telling it to behave just like this that were overriding it.We then worked on adding a hook to add a clear instruction not to continue with what it was working on without asking, but still the default post-compaction message appeared to override this:
this is so frustrating!
OK, I've possibly managed to defeat the default instruction with this hook.
~/.claude/settings.json (snippet)~/.claude/hooks/post-compact.shEDIT: Nope, worked the first time, failed the next. Claude Code is so super frustrating at times!
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
still occurs
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497
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.