Your coding agent just ran rm -rf.
Undo it.
agentundo is a free, open-source hook for Claude Code and Codex CLI. Before every tool call it snapshots your project into a shadow git repo outside your project, so you can go back to any step with one command.
npx github:mulanxizhizi-png/agentundo#v0.1.3 init
$ agentundo list
ID TURN WHEN AGENT FILES SNAPSHOT TAKEN
1 t0 20s ago - - baseline (agentundo init)
2 t1.1 7s ago claude 0 before rm -rf src ⚠ dangerous
$ agentundo restore 2 --yes
Restored #2: wrote 2, removed 0.
Undo this restore: agentundo restore 3
How it works
- Snapshots before every tool call. A pre-tool-use hook saves your files into a shadow git repo under
~/.agentundo. Your own git history is never touched. - Restore any step.
agentundo listshows each snapshot with the command it preceded.agentundo restore <id>puts files back, and every restore can itself be undone. - Flags dangerous commands.
rm -rf,git reset --hard,git clean, SQLDROP/TRUNCATEalways get their own snapshot, marked ⚠ with the reason.agentundo list --dangerousshows only those. - Warns about remote databases. When the agent writes to a database on another server, you get a warning that a local snapshot can't undo it. It only warns, never blocks, and passwords are shown as
***. - Works with Claude Code and Codex. Runs locally. No account, no proxy, never touches your login tokens.
Honest limits
- It only restores files in your project. It can't undo changes to remote databases, other folders, installed packages, or anything sent over the network.
- Dangerous-command detection uses fixed rules. Commands built from variables, or SQL inside a separate script file, can be missed.
- Tested on Linux. macOS and Windows are untested so far.