Claude Code's undo (labelled rewind for some reason) does not implement undo, it instead drops the entire context and starts a completely new session.
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 contract it breaks. Undo has been a solved problem since 1974 (Xerox PARC Bravo) and is textbook: a LIFO history stack where undo "erases the last change, reverting it to an older state" and satisfies the stable execution property — undoing returns you to the exact state that existed before the command. Word, LibreOffice, Photoshop, DaVinci Resolve, Audacity and literally all software I can think of have all cleared this bar for decades. If Audacity's undo deleted my project instead of stepping back one action, it would be a P0.
What Claude Code does instead. When I undo, it completely wipes all context. All detail is destroyed. There is no warning and no setting to force lossless behavior. This is not a linear undo, a non-linear undo, or a selective undo — it is data loss wearing the Edit-menu label of a feature that is REQUIRED to be non-destructive. I would NEVER ship an undo that destroys the users work completely!
Proof the state was never actually gone. The full conversation lives on disk as an append-only ~/.claude/projects/<proj>/<session>.jsonl. Restoring that single file from a BTRFS/snapper snapshot brings the entire context back, verbatim, and --resume reads it with zero loss. So the correct implementation is trivially available: truncate the transcript to the target turn and re-read it. That's a full-checkpoint / complete-rerun undo (Berlage 1994) and the substrate already supports it. The product chooses to destroy it instead.
Impact. Users lose hours of working context on an action whose entire purpose is to be safe to use. "Rewind" is also the wrong name — winding is positional (tape); undo is transactional. The naming signals the wrong model.
Ask. Implement undo as a truncate-and-reload of the on-disk transcript stack. Make lossless undo the default and guaranteed. This has been reported for years (similar and possibly the same as #13171 altho this is unrelated to 'vibe coding').
With short sessions sometimes undo works, sometimes it does not. With long sessions it has never worked. I've tried Linux, Mac and Windows so it's not platform specific.
What Should Happen?
https://en.wikipedia.org/wiki/Undo
Error Messages/Logs
Steps to Reproduce
Start a session, talk to Claude for a while, choose 'Fork conversation from here' and then enjoy a brand new clean empty session!
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
0
Platform
Anthropic API
Operating System
Other
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_