Undo/Checkpoint Feature for Correcting AI-Generated Code
Resolved 💬 83 comments Opened Mar 5, 2025 by cyberpapiii Closed Sep 29, 2025
💡 Likely answer: A maintainer (ashwin-ant, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
NEED AN UNDO OR CHECKPOINT FEATURE SO USERS CAN GO BACK AND REVERSE CODE OR MISTAKES THAT CLAUDE MAKES
Environment Info
- Platform: macos
- Terminal: ghostty
- Version: 0.2.32
- Feedback ID: 175ac8be-c9ab-4955-8051-086d22413551
83 Comments
This is something we're thinking about! How would you imagine it working?
Could maybe integrate it with a prompt edit feature, kinda like cursor. You'd have file state checkpoints created when the user sends a prompt, and then later the user can restore to that checkpoint, which would clear the chat context below it and allow you to edit and resend that prompt.
You could also have checkpoints created each time claude attempts to use the file edit tool, and if the user reverts back to it later (can maybe have some kind of /revert command) it could clear the context below that tool use and just show up as a user interruption to Claude
The file state snapshots could maybe work similarly to the local history feature in some IDEs
You could have /prev and /next commands to navigate up and down the stack of changes maybe
when you run /prev, it makes the last edit's output greyed out so you can still see it but scroll up to the one that is full bright that is currently selected. Maybe people who have the previous summary feature turned on would have the changeset that they just navigated away from with /prev get summarized to be smaller
If you run /prev and then do a different claude prompt, it could clear the rest of the output in front of it since you're overwriting
Personally i would prefer having the changesets not disappear entirely when you run /prev, but i realize that this would make it necessary for you to scroll a lot, and if you run /prev enough you could go up beyond your scrollback buffer
I came here to propose something similar: fast state/context saving & restoration would be super valuable.
At the moment, I decently often have threads where I'm building up the model's context to a point for it to be able to tackle a harder issue.
Unfortunately, as things stand, there's no /fast/ way to then snapshot that state of affairs and come back to it later
This feels like it's a third branch amongst the options of
/clear,/compactand now/save + /restore. The idea being that you could:/save <name>/restore <name>Ideally given a
<name>to save to (or an LLM-generated name), you could/savein one session and then open another session (or sessions) and/restore <name>to pick up from the first.Would love to see something like this!
+1! I'd prefer something simple, just an
/undoto restore any file changes and conversation history back to the last user instruction. And maybe a/revertto go back (restore files) to beforeclaude codewas run. I'd also think it's fine to override any user edits to files between interactions with claude where inverting the diff/merging isn't possible.Basically you could use a set of internal git stashes - this would do it I think.
This is one of the reason I usually use VSCode as my 'terminal' given I git a bit of undo naturally as part of the file updates in vscode but I know the desired first class approach is the strait terminal so a secondary git repo with a history of stashes - which you could name with whatever you use as your internal api interaction index so claude could reference it would likely get you where you need to go.
Also this would help save the 'claude went made and just assume all its magical code would work with no testing or validation of that assumption what so ever' --- sorry my own experiences are showing. LOL
Or maybe the other git worktree?
None of this should be taken as complaint. I have accomplished amazing I love this and will keep doing it but I have been basically doing a daily driver with this now for a solid month or so and like others and turning over a few rocks.
This features and a bit of focused work on active context management will take this to a level or two above its already leveled up status.
Yeah, this feels like the main feature Claude Code is missing as compared to something like Cursor. Manually committing every time you ask Claude to make a new change seems pretty inefficient?
Just simply an /undo
I do also like the checkpoint idea as well though, where chat, code edits, etc reverts back.
This please
Sometimes Claude starts out well, but it's not quite good enough for me to commit. I request some modifications, but on the second try, it goes completely sideways. I really wish I had that original first checkpoint; even though it wasn't committable, it was a pretty good checkpoint.
Agreed, a checkpoint feature would be extremely handy. I can think of two other IDE variants of this kind of project where they do checkpoints after changes have been made to a project, as well as one initially after the user starts a new task. Claude Code needs a checkpoint feature too.
Simple functionality to revert back to any prior prompt of user. Currently, if you are in a conversation and mess up a prompt, you encounter a dilemma, continue with the poisoned history burdening the context and clarity of Claude, or start a new chat and lose all your existing context. Neither options are appealing, but both are appalling. I fail to see any downside to implement what should be a simple and well needed feature. Please open my eyes.
to keep
clauderelatively simple and avoid a whole new state management system, how about using git to manage the state?claudereturns to the user, it runssha=$(git stash create); git update-ref -m "claude $session_id $(date +%F_%H%M%S)" refs/claude-snapshot "$sha"; echo "$sha"claudecould offer a similar interface to the existingesc esc(which currently restores the _conversation_ state), to restore the repo state to a past conversation turngit restore -SW --source=<sha> ., the repo is restored to that statebecause it writes to
refs/claude-snapshot, git will clean up the old snapshots along with its usual cleanups, there's no infinitely accumulating storage. and no need to build an opaque state management system in sqlite etc.one downside is that it wouldn't handle untracked files. it could add these with
--intent-to-add, but that does then make a small change to someone's git index. I'm not sure of a simple way to get around that beyond a workaround to 'add, save, undo add"checkpoints are essential. This has to be a top priority for Claude Code? especially with Sonnet 3.7 going off the rails at times and creating something you never asked for - overwriting entire app pages.
Agree that this is a must, maybe the only thing keeping me from moving off cursor. Maybe check out Codebuff for inspiration
per step checkpoint is necessary. one bad edit would ruin many good changes between commits if git is the only tool at the moment.
My current work around is putting this in the CLAUDE.md (wip but already works pretty well):
I think a possible improvement would be to tell claude to use branches instead of reset --hard, but I haven't tried it yet
it's a must indeed, considering moving exclusively to Cursor because of this...
A must!
The product is not usable without it even. Models make mistakes. That is fine. If you can undo. My way of working:
Agreed here - I would prefer being able to use Shift+Up/Down-arrows to navigate through each user-submitted message - once at the message, <enter> allows you to revert both the conversation and the state of the code to that state.
This in CLAUDE.md rule works pretty well:
https://gist.github.com/sohei1l/f19cc1d91320db9db3a6cb7c63b312e6
I've built a checkpoint feature where you can undo any change. It's a VS Code extension that provides a chat interface for Claude Code as well as the ability to restore checkpoints, try it out!
VS Code Extension: https://marketplace.visualstudio.com/items?itemName=AndrePimenta.claude-code-chat
Github: https://github.com/andrepimenta/claude-code-chat
its really a must . I wont pollute my commit history with random "better save now because its risky " commit . Thats just a crutch in my oppion . Cursor does it perfectly with its restore checkpoints. Once this is added I will be onboard .
Lack of checkpoints is frustrating. This is probably the time to introduce a GUI where adding buttons makes sense.
It looks like spamming the esc key lets you go back in the conversation now. This is already nice even without the file system checkpointing
Something similar to
git rebase -iwould be cool, where you can unselect any recent messages (and replies?) you don't want to keep.Worktrees allow for Parallelization now. amazing! see https://docs.anthropic.com/en/docs/claude-code/common-workflows
I’m glad they appreciated my suggestion
--------
Aaron Lippold
@.***
260-255-4779
twitter/aim/yahoo,etc.
'aaronlippold'
On Fri, Jun 27, 2025 at 03:11 MichielMAnalytics @.***>
wrote:
This is a Gemini CLI feature, where you can
/chat save <name>and then/chat resume <name>within the same session, using their checkpointing functionality.I think the way the checkpoint should work is that when you hit double ESC to go back to previous prompt in the conversation, the changes made after that point you went back to should be reverted.
Please add this!! With this feature and Windows support (WSL is too slow in my PC), I would switch from Cursor.
Please add this feature. Would be highly useful
i made a tool called ccundo that is around this issue!
be sure to check my profile!
@ashwin-ant I made the tool myself, feel free to use the npm package, its called ccundo!
Something I really wish I had — in addition to going back to one of my previous messages, go back to an arbitrary Claude message. Sometimes Claude works for a long time without my supervision, and there's a moment where it started going in the wrong direction and I wish I was there to interrupt it. Could be an extra key press after esc+esc
+1 add please
+1
@ashwin-ant Any rough idea of when we might see checkpoint functionality in CC? Thanks!
+1
I’d like to add a strong +1 to this request.
In day-to-day engineering work, the ability to preview, accept/reject, and roll back AI-generated changes is essential for maintaining code quality and confidence. GitHub Copilot sets a solid precedent here: every suggestion is presented as a clear diff, which can be staged selectively, rejected wholesale, or reverted later with a single click. That workflow keeps experimentation safe while letting developers see exactly how each suggestion affects the codebase.
Claude already excels at generating clean, context-aware code, but without fine-grained undo/checkpoint support many of us hesitate to integrate it into larger projects or CI pipelines. A built-in, version-aware undo mechanism would:
Reduce cognitive load – no need to stash or manually track snippets just in case we change our minds.
Boost trust and adoption – teams can experiment freely, knowing they can always revert.
Align with modern DevOps practices – mirroring the diff-based, review-centric approach developers are accustomed to.
In short, this is not a “nice-to-have” UX polish; it’s a foundational feature that unlocks safe, iterative collaboration with AI. I hope it can be prioritized soon.
+1
+1
+1
manually
/saveing is cumbersome. i want to be able to always go back to step n, where every time i prompt a number is assigned automatically+1
just hit esc twice
I like your confidence
+1
+1
+1
+1
+1
+1
+100
+1
+1
cusor developed a pretty neat version of it as will already know, will be harder to do in cli, but maybe one option is that checkpoints are created before (only needed before first edit in the current session) and after each edit, then there is a slash command to view all checkpoints in the current session with short auto generated summary of the edit, selecting the edit would ideally show two options, revert to to check point and show edits which would show the full list of changes it made previous, like claude code is allreayd doing when making edits,
I feel like the principle of least surprise would follow that the double-escape functionality to browse through previous user inputs would revert to that checkpoint when editing/resubmitting a previous msg? That was my expectation anyway...
+1
+1. This is one of those instances where Cursor nailed the UX. Just copy their implementation and take a file system snapshot at every user message. Double esc should always default to restoring both the prompt + file state at that point of the conversation (that's what most new users expect anyway).
I don't like the idea of telling Claude to make a commit at every message. I don't want to use git operations in a hook for this and pollute my git history either - both solutions feel really hacky.
Maybe using rsync? Does anyone have a working UserPromptSubmit hook they can share as a temporary workaround?
Thanks :)
+n
only reason I pay 200$ cursor ultra and not to claude code is the lack of this feature.
Agree
I command it to roll back the last change, but Claude Code discarded my whole day's work! It's all in one file, it just reverted to the last git commit
strong +1. Main thing I go back to cursor for
Need it so bad. Have to cancel my Claude Max subscription for lack of this feature
Current Workaround Using Hooks:
https://github.com/anthropics/claude-code/issues/6001#issuecomment-3194807412
Any news or plans on this ?
Hi, I actually have created this package for this very reason: https://github.com/p32929/ccheckpoints or https://www.npmjs.com/package/ccheckpoints
Feel free to give it a try. Thanks
Would really want this feature natively
Maybe a command /checkout like git checkout can do the trick
opencode support it:
https://github.com/sst/opencode/issues/375
checkpoint featue = code changes undu + chat history undo.
This is not a thing can be fixed only by git commit.
Checkpoink like a time machine.
It's much better than you to ask it to revert the code.
undo better than fix.
anyone had to stop Claude subscription for this? Why 6 months past and still no response
+1
Do you know if there is any progress on this suggestion?
You guys are the best! Thank you for releasing the feature: https://www.anthropic.com/news/enabling-claude-code-to-work-more-autonomously
Hey everyone - we've just released Claude Code v2.0.0 along with Claude Sonnet 4.5, and with it we are rolling out a checkpointing feature!
You can now restore code and/or conversation in the rewind dialog by hitting
Esctwice, or using the/rewindcommand. You can read more about it in the docs.Please give it a spin and let us know what you think. We're always eager to hear your feedback!
@hackyon-anthropic Awesome job! Thanks! But it's worth mentioning that it works only in the command line, not in the native VS Code extension.
Was this feature disabled in 2.0.1? It briefly worked for me, and now it's not there? And does not seem to be in settings anymore?
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.