AI coding agents are fast. They're also fast at breaking things.
Claude Code has checkpoints, and they're great for edits made through its file tools. But they don't track files changed by shell commands. When the agent runs rm -rf, a sed -i, a codegen script or a formatter, those changes are outside what rewind can bring back.
So I built undoagent: a small CLI that turns every prompt into a checkpoint, whatever the agent used to change your files.
I asked Claude Code to "remove the notes folder using rm -rf and convert app.js to ES modules". It did exactly that. Then:
$ undoagent list
1 17:44 4 Clean up this project: remove the notes folder using rm -rf…
$ undoagent diff --stat
app.js | 2 +-
notes/decisions.md | 1 -
notes/todo.md | 2 --
package.json | 3 +++
$ undoagent undo
✓ Undid #1: Clean up this project: remove the notes folder using rm -rf…
~ app.js
+ notes/decisions.md
+ notes/todo.md
- package.json
The deleted folder is back, app.js is restored, and the package.json the agent added is gone.
undoagent undo 3 reverts only turn 3.undoagent rewind 3.
you submit a prompt → snapshot A
the agent works → edits, shell commands, scripts…
the agent finishes → snapshot B
one turn = the difference between A and B
~/.undoagent, pointed at your project folder. Your own .git is never read or written, and it works in folders that aren't git repos at all.--force..gitignore, skips node_modules, and has zero npm dependencies. Everything stays local.
Inside Claude Code, as a plugin:
/plugin install undoagent --marketplace Ahmed-Manai/undoagent
That adds /undoagent:list, /undoagent:undo, /undoagent:redo, /undoagent:diff and /undoagent:rewind.
Or from a terminal:
npm install -g undoagent
cd your-project
undoagent init
Then use Claude Code (or Codex, or Gemini CLI) as usual, and run undoagent list whenever you want to see or undo what it did.
The code is MIT-licensed on GitHub. Issues and ideas are very welcome.
Has an AI agent ever destroyed work you couldn't get back? What happened, and what would have saved you? I'd love to hear the stories in the comments, because they shape what undoagent handles next.