agentundo · v0.1.5 · PreToolUse hook
你的 agent 刚跑了 rm -rf。
退回去。
每次工具调用前,把项目快照进 ~/.agentundo 的影子 git 仓库。你自己的 git 历史,一次都不会被动。
npx github:mulanxizhizi-png/agentundo#v0.1.5 initGitHub · v0.1.5 · 免费开源
8 条证据
它救回来的,都是真事
有人丢了数据库,有人丢了一天的活。这些不是假设,是 2026 年真实发生过的抱怨。
Claude code deleted the database once for me. It wasn't production, but it did contain data I needed. The good thing was that I made a backup of the database right before running claude. I told it that I made a backup, so it decided to delete the db rather than drop the table.
Claude Code删除了数据库
Told my AI agent to "clean up the project folder" it deleted the tests because they were "failing anyway"
agent按字面理解指令删除测试
I had an AI (Grok/Cursor) throw away a day's work. "Please revert that last change" somehow means to revert the entire file.
小白没有版本管理:一次改动毁掉一天的工作,回不去
who is json? shipping my second app without understanding GitHub, commits, branches, origins, git push git what? I wish I was a vibe coder, just a copy/paste waiter. you just need to know which AI to yell at.
不懂 Git,改坏了不知道怎么回去
Asked Claude Code to add a caching layer. It found the right place, wrote the implementation, updated the tests, and then quietly refactored 3 files I never mentioned. The caching code was fine, but reviewing the parts I didn't
agent 越界改没让改的文件
怎么工作
3 步,全在你机器上。
动手之前先存
PreToolUse 钩子把工作区快照进 ~/.agentundo,不碰你项目里的 .git。
每一步都标上命令
agentundo list 列出每个快照前面跟的是哪条命令,危险命令单独带 ⚠。
一条命令写回去
restore 把文件放回原样,而且这次还原本身也能再撤一次。
诚实的边界
它做不到的事,
一起写在这里。
看别人的工具页,你只能看到“能做什么”。我们把“不能做什么”也列出来 —— 你才知道该不该装。
只能还原项目内的文件。远程数据库、别的目录、装过的包、发出去的请求,都救不回来。
危险命令靠固定规则识别,变量拼出来的命令、脚本文件里的 SQL 可能漏掉。
主要在 Linux 上验证过,macOS 与 Windows 尚未测。
快照会占磁盘,大仓库要留意 ~/.agentundo 的体积。
和 agentreceipt 一起装
一个管“做完没有”,一个管“做坏了能不能退”。两个 hook 互不冲突,建议同时装。