我开发了 Ponytrail,一个用于 AI 编程代理编辑内容的本地审计追踪工具。
I built Ponytrail, a local audit trail for AI coding-agent edits

原始链接: https://github.com/0xroylee/ponytrail

**Ponytrail** 是一款 CLI 工具和 Agent 技能,旨在追踪文件变更原因、可视化修改历史并将文件恢复至先前状态。它会在隐藏的 `.pony-trail/` 目录(建议将其从 Git 中排除)内维护一个本地历史树。 **主要功能:** * **快照追踪:** 记录文件状态的快照,包括所执行的操作、摘要及回滚详情。 * **Agent 集成:** 可轻松作为 Agent 技能安装(通过 `npx` 或 `bunx`),以追踪 Claude 或 Copilot 等 AI 工具所执行的操作。 * **版本回退:** 允许将文件恢复至之前的快照。用户可以使用 `--dry-run` 在应用变更前进行预览。该工具能安全处理文件删除,并确保在修改项目前获得人工确认。 * **可审计性:** 提供人类可读(`--details`)和机器可读(`--json`)两种格式的详细历史日志。 通过在本地管理状态,Ponytrail 为你的项目开发工作流提供了一个可靠的“撤销”按钮。

**Ponytrail** 是一款全新的命令行工具,旨在提升 AI 编码代理的透明度与可靠性。虽然像 Git 这样的标准版本控制系统可以追踪文件变更,但它们往往无法捕捉变更背后的意图,或代理决策过程中的具体上下文。 为了弥补这一缺口,Ponytrail 会为代理执行的每一项操作创建本地“审计追踪”。在修改、移动或删除文件之前,该工具会记录代理的操作目的、预期结果及验证计划。操作完成后,它会记录执行结果及具体的变更内容。这些数据以 JSONL 文件、会话树和文件快照的形式本地存储在 `.pony-trail/` 目录下。 通过提供细化到单次操作的意图记录及自动回滚路径,Ponytrail 让开发者能够在漫长的编码过程中检查并回滚特定的代理操作,而不必依赖粒度较粗的 Git 提交。它的定位是作为 Git 的上下文补充,而非替代品。
相关文章

原文

Pony Trail

Every change, on the trail.

Ponytrail is a small CLI and bundled agent skill for recording why files changed, showing those changes as a local history tree, and reverting files from a previous snapshot.

It keeps the trail in .pony-trail/ inside your project. Treat that folder as local runtime state; it should stay out of git.

Install the bundled pony-trail skill into your local agent tools:

npx ponytrail skills install pony-trail

With Bun:

bunx ponytrail skills install pony-trail

The installer records a local skill-install snapshot before writing agent skill files, so the install can be found later in ponytrail history --details.

Show the snapshot tree:

Include action, summary, checks, result, and rollback details:

npx ponytrail history --details

Effect preview:

Snapshot history
* ponytrail-skills
  * skill-install-20260622064256Z-99fa03fd (pre/post)
    action: install skill
    summary: Installed pony-trail skill for claude, copilot, codex
    checks: ponytrail skills install pony-trail --home . --agents claude, copilot, codex
    result: claude:installed, copilot:installed, codex:installed
    rollback: Remove or reinstall the affected agent skill folders, then record another snapshot.

Filter to one session or print machine-readable output:

npx ponytrail history --session <session-id>
npx ponytrail history --json

Snapshots are read from:

.pony-trail/
  snapshots.jsonl
  sessions/<session-id>/tree.md

Preview the planned file actions:

npx ponytrail revert <snapshot-id> --dry-run

Apply the revert:

npx ponytrail revert <snapshot-id>

Ponytrail prints the planned file actions and asks for approval before changing files. In non-interactive environments, it prints the plan and cancels without mutating the project.

Revert restores files from the snapshot's pre state. If a file did not exist before the snapshot, Ponytrail deletes it during the revert.

bun install
bun run build
bun test
bun run check
联系我们 contact @ memedata.com