
Turnback
io.github.MFaizR77由 GitHub 账号 MFaizR77 发布v0.9.1更新于 Oct 24, 2026
Undo a coding agent turn, including shell commands and untracked files.
概览
Turnback 在每个智能体回合和 shell 命令前对工作区做快照,让助手能列出、对比并恢复自己的回合。
- 可以做什么
- 列出最近的回合及其提示词,查看回合内的每一步编辑和 shell 命令
- 对比某个回合的改动,并在多个回合之间比较或搜索
- 恢复整个回合,或回到某个步骤之前,先给出计划再执行变更
- 找回被删除的单个文件或目录,并查看每一行由哪个回合和提示词写入
- 把任意命令记录为可撤销的回合,并导出历史,包括为拉取请求标注提示词来源
- 适用场景
- 当 AI 编码智能体执行 rm -rf、mv、代码生成器或 git checkout 等破坏性或生成性 shell 命令时适用,因为内置检查点只跟踪编辑工具。也适合在多个智能体之间共用一份撤销历史,或把代码行和分支改动追溯到产生它们的提示词。
- 运行要求
- 以 npm 包 turnback 通过 stdio 在本地运行,需要 Node.js 22+ 和 Git 2.25+。通过命令行或插件市场为各智能体安装钩子和 MCP;未声明任何 API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Turnback,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Undo for AI coding agents, even after rm -rf.
One undo history for Claude Code, Codex, Cursor, Gemini CLI, OpenCode, and Antigravity CLI.
[An agent runs rm -rf src .env; turnback undo brings both back]
A real Turnback run. The agent is simulated with Claude Code's hook payloads; the rm -rf and every Turnback line are real. Recreate it with python scripts/demo/make_demo.py.
Why
Agent checkpoints track the agent's own edit tools. Claude Code's documentation says it plainly: "Checkpointing does not track files modified by Bash commands." So when an agent runs rm -rf, mv, a code generator, or git checkout -- ., rewind cannot bring those files back.
Turnback snapshots the workspace before every shell command and edit, into a shadow git repo under ~/.turnback:
- Undo a whole turn, or go back to just before one step of it.
- Tracked, untracked, and gitignored files (like
.env) up to 5 MB are covered. - Nothing writes to your project's
.gitunless you runturnback export --commit, and hooks never block the agent. - One history across six agents. Through MCP, the agent can list and diff its own turns and restore them in two steps: a plan first, then the change.
Install
In Claude Code:
Then use /turnback:turns, /turnback:diff-turn, /turnback:undo, and /turnback:report.
In Codex (available in the next npm release):
Start a new session, review and trust Turnback's hooks in /hooks, then use $turnback:turns, $turnback:diff-turn, $turnback:undo, and $turnback:report.
The plugin needs Turnback 0.9.1 or later. To try unreleased plugin changes from a checkout, see local testing.
For Codex, Cursor, Gemini CLI, OpenCode, Antigravity CLI, or the CLI on its own (Node.js 22+ and Git 2.25+):
Claude Code, Codex, OpenCode, and Antigravity CLI have been tested live; Gemini CLI and Cursor are covered by tests built from their documented hook payloads. Details per agent: installation.
Compared with Claude Code's /rewind
They work side by side: rewind the conversation with /rewind, and the files with Turnback.
Everyday use
Without an agent
turnback run records any command as a turn, so a code generator, a codemod, or an agent without hooks gets the same undo. blame shows which turn wrote each line, and recover brings back a single file:
All commands, including log, search, report, compare, and export: commands. More: restore, MCP, scope and limits.
How it works
The hook before a mutating tool takes the turn baseline. The hook before a shell command captures the whole tree; later edits capture the affected paths. The end of the turn captures the result. The initial snapshot is warmed in the background on install and session start. Hooks always let the agent continue when recording fails; a failed, skipped, or unprotected state is visible through status.
Tracked, untracked, and gitignored files up to 5 MB are covered. Build output and dependency directories are excluded. Extra rules use gitignore syntax in .turnbackignore; global rules go in ~/.turnback/config.json as {"exclude":["pattern"]}.
Workspaces above 100k files or 2 GB switch to edits-only mode: only paths touched by edit tools are snapshotted, shell commands are recorded as unprotected, and restore touches only recorded paths. Turns older than 7 days and outside the last 50 turns are cleaned up automatically, at most once a day, in every workspace and not only the one in use. Data of a workspace that was deleted is removed after 30 idle days; set {"autoClean": false} in ~/.turnback/config.json to keep it.
Contributing
Issues labeled good first issue are small and say which files they touch, and support for more agents is welcome. Start with CONTRIBUTING.md and the architecture overview. Questions and ideas go to Discussions.
Contributors
Every merged pull request is credited in the release notes.
Development
The benchmark creates a temporary 10k-file repo and reports latency without making it a strict CI gate. CI runs the tests and benchmark on Windows, macOS, and Linux × Node 22/24.
From a clone, run npm ci && npm run build and use node dist/cli.js in place of turnback.
Releasing
Set the same version in package.json and in both version fields of server.json, commit, then push a v<version> tag. The Publish workflow checks that the versions match, runs the tests, publishes to npm through trusted publishing (provenance is attached automatically), and publishes server.json to the MCP registry as io.github.MFaizR77/turnback.
Also update src/core/config.ts, both plugin manifests, and the npm ranges in .claude-plugin/marketplace.json and .agents/plugins/marketplace.json.
npm trusted publishing is configured on the package page at npmjs.com (repository MFaizR77/turnback, workflow publish.yml), which needs the package to exist. The first version is therefore published once by hand with npm publish --access public; pushing its tag afterwards skips npm (the version exists) and only publishes to the MCP registry. Later tags do both.
License
MIT
来源:README.md,提交 2b468da
工具
0版本历史
6- v0.9.1最新Oct 14, 2026
- v0.9.0Oct 1, 2026
- v0.8.0Sep 30, 2026
- v0.5.0Sep 30, 2026
- v0.4.0Sep 30, 2026
- v0.1.0Sep 29, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分