
Claude Time Machine:Claude Code 的撤销功能,连 Bash 执行的 rm、格式化工具和代码生成器都能还原
一个 Claude Code 插件,在每次工具调用前后给项目拍快照,让 /tm undo 能还原文件,包括 /rewind 覆盖不到、通过 Bash 做的改动。

关于这个 mod
作者介绍 Claude Time Machine,一个在本地运行、采用 MIT 许可的 Claude Code 插件。它在每次工具调用前后给项目拍快照,底层就是普通的 git,不消耗 token。
动机是:代理出现幻觉、用 Bash 执行了破坏性的命令时,/rewind 只能撤销用文件工具做的编辑。
/tm undo 可以还原文件,包括通过 Bash 做的改动,例如 rm、格式化工具和代码生成器。
需求:Claude Code 2.1.287 以上,支持 macOS 或 Linux。安装只要两条命令。仓库在 https://github.com/xzwache/claude-time-machine,帖子附有预览截图。
安装
安装方法请查看原始来源。
原文 / README
Hey folks, I kept running into the same thing: the agent would hallucinate, run something through Bash and break local changes I hadn't pushed yet. /rewind doesn't help there, it only covers edits made with the file tools. I made a small plugin that snapshots the project around every tool call. /tm undo puts the files back, including what was changed through Bash. https://preview.redd.it/l47u6hp3n3uh1.png?width=1080&format=png&auto=webp&s=2f0c17d01c21fa189dbcd45f5b143518173c5a77 How Claude helped: - Generated most of the code, I set the design and reviewed it. - Claude Code in cloud did a lot of testing It's local, plain git underneath, no tokens. Needs Claude Code 2.1.287+, macOS or Linux. Free and open source (MIT). Install is two commands. Repo: https://github.com/xzwache/claude-time-machine Built it with the new Claude Code mods. I'd be glad to hear what you think: what works, what breaks, what's missing submitted by /u/xzwache [link] [comments]
