agentundo · v0.1.5 · PreToolUse hook

你的 agent 刚跑了 rm -rf。
退回去。

每次工具调用前,把项目快照进 ~/.agentundo 的影子 git 仓库。你自己的 git 历史,一次都不会被动。

$npx github:mulanxizhizi-png/agentundo#v0.1.5 init

GitHub · v0.1.5 · 免费开源

8 条证据

它救回来的,都是真事

有人丢了数据库,有人丢了一天的活。这些不是假设,是 2026 年真实发生过的抱怨。

P013Hacker News

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删除了数据库

看原帖 ↗ 2026-04-27
P08036氪

它会毫无征兆地删掉本地目录的文档。有一次版本升级,甚至把我电脑系统目录里很多东西都删了。

agent无征兆删除本地文件

P083V2EX

用 cursor 的 gemini 模型时把我本地代码的测试数据库清空了,毛都没了,由于没有 git ,还原都还原不了

agent清空本地数据库无法恢复

P085X

Told my AI agent to "clean up the project folder" it deleted the tests because they were "failing anyway"

agent按字面理解指令删除测试

P082V2EX

让他改个算法代码,把我代码给删错了,导致整个工程出现不可控问题

AI改代码误删关键代码

R2-B08X

I had an AI (Grok/Cursor) throw away a day's work. "Please revert that last change" somehow means to revert the entire file.

小白没有版本管理:一次改动毁掉一天的工作,回不去

看原帖 ↗ 2026-09-16
R5-B09X

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,改坏了不知道怎么回去

看原帖 ↗ 2026-09-10
R5-A08X

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 越界改没让改的文件

看原帖 ↗ 2026-08-25

怎么工作

3 步,全在你机器上。

01

动手之前先存

PreToolUse 钩子把工作区快照进 ~/.agentundo,不碰你项目里的 .git。

02

每一步都标上命令

agentundo list 列出每个快照前面跟的是哪条命令,危险命令单独带 ⚠。

03

一条命令写回去

restore 把文件放回原样,而且这次还原本身也能再撤一次。

诚实的边界

它做不到的事,
一起写在这里。

看别人的工具页,你只能看到“能做什么”。我们把“不能做什么”也列出来 —— 你才知道该不该装。

只能还原项目内的文件。远程数据库、别的目录、装过的包、发出去的请求,都救不回来。

危险命令靠固定规则识别,变量拼出来的命令、脚本文件里的 SQL 可能漏掉。

主要在 Linux 上验证过,macOS 与 Windows 尚未测。

快照会占磁盘,大仓库要留意 ~/.agentundo 的体积。

和 agentreceipt 一起装

一个管“做完没有”,一个管“做坏了能不能退”。两个 hook 互不冲突,建议同时装。

看 agentreceipt