‹ 首页

checkpoint

@darkroomengineering · 收录于 昨天 · 上游提交 昨天

Mid-task rollback points — save/restore state before risky ops (refactors, migrations, destructive edits). For end-of-session save use `/handoff`. Triggers "checkpoint", "snapshot", "before this risky op", "rollback to", "list checkpoints", pre-refactor save.

适合你,如果经常进行高风险代码修改,需要安全网

/ 通过 npx 安装 校验哈希
npx oh-my-skill add darkroomengineering/cc-settings/checkpoint
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- darkroomengineering/cc-settings/checkpoint
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify darkroomengineering/cc-settings/checkpoint
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
40GitHub stars
~731上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 fa04efc · 表述以原文为准
它做什么

允许你在重大操作前保存当前工作状态(创建检查点),之后可随时恢复到任一保存的状态。

什么时候触发

当你提到“checkpoint”、“snapshot”、“rollback”、“list checkpoints”等关键词,或准备进行重构、迁移等风险操作时触发。

装好后可以这样说
创建新检查点并可选添加标签。
显示当前项目的检查点列表。
恢复文件到最新检查点保存时的状态,未追踪文件不受影响。
技能原文 SKILL.md作者撰写 · MIT · fa04efc

Checkpoint: Save & Restore Task State

Subcommands
save [label]

Save current state with an optional label.

bun ~/.claude/src/scripts/checkpoint.ts save "Completed phase 3 migration"
list

List all checkpoints for the current project.

bun ~/.claude/src/scripts/checkpoint.ts list
show [checkpoint-id]

Show details of a specific checkpoint.

bun ~/.claude/src/scripts/checkpoint.ts show chk-20240115-103000
restore [checkpoint-id] [--force]

Real, opt-in rollback — restores tracked files (working tree + index) to exactly what they were at save time, then reapplies whatever uncommitted changes existed at that moment (captured as a patch when the checkpoint was saved). Untracked files are never touched or deleted; if any existed at save time they're just listed as a warning (their content was never captured). Scope note: restore reconstructs file content only — anything that was staged at save time comes back as unstaged working-tree changes (the patch reapplies to the worktree; index state is intentionally not reconstructed).

Safety rails:

  • Auto safety-checkpoint first. Before anything is touched, the current state is saved as its own checkpoint and its id is printed — restore is itself reversible by restoring that id (with --force).
  • Branch/sha guard. If the current branch or HEAD differs from what the checkpoint recorded, restore refuses and tells you to check out that branch or pass --force.
  • Legacy checkpoints (saved before this patch-capture feature existed) have no recorded diff to restore from. Restoring one prints "legacy checkpoint: metadata only, nothing restored" and falls back to the old print-only behavior — review the dumped JSON and continue manually.
# Restore latest
bun ~/.claude/src/scripts/checkpoint.ts restore

# Restore specific
bun ~/.claude/src/scripts/checkpoint.ts restore chk-20240115-103000

# Restore across a branch/sha mismatch
bun ~/.claude/src/scripts/checkpoint.ts restore chk-20240115-103000 --force
clean

Remove old checkpoints, keeping the last 10.

bun ~/.claude/src/scripts/checkpoint.ts clean
Examples
User: "save a checkpoint"
  -> /checkpoint save

User: "checkpoint before this refactor"
  -> /checkpoint save "Before auth refactor"

User: "list my checkpoints"
  -> /checkpoint list

User: "restore from last checkpoint"
  -> /checkpoint restore

User: "show checkpoint details"
  -> /checkpoint show <id>

User: "clean up old checkpoints"
  -> /checkpoint clean
Storage

Checkpoints are stored at ~/.claude/checkpoints/<project-name>/ as JSON files with a latest symlink pointing to the most recent. Each checkpoint with uncommitted changes at save time also gets a sibling chk-<id>.patch file (git diff HEAD output) — this is what makes restore a real rollback instead of a metadata dump. Checkpoints saved before this feature existed have no patch file and restore in metadata-only (legacy) mode.

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。