checkpoint-resume

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Checkpoint Resume

检查点恢复

Rate-limit-resilient pipeline orchestrator. Saves progress to
.claude/pipeline-state.json
after every phase so long sessions survive interruptions.
具备抗速率限制能力的管道编排器。每个阶段结束后会将进度保存到
.claude/pipeline-state.json
文件中,确保长时会话在中断后可以恢复。

Quick Reference

快速参考

CategoryRuleImpactKey Pattern
Phase Ordering
${CLAUDE_SKILL_DIR}/rules/ordering-priority.md
CRITICALGitHub issues/commits first, file-heavy phases last
State Writes
${CLAUDE_SKILL_DIR}/rules/state-write-timing.md
CRITICALWrite after every phase, never batch
Mini-Commits
${CLAUDE_SKILL_DIR}/rules/checkpoint-mini-commit.md
HIGHEvery 3 phases, checkpoint commit format
Total: 3 rules across 3 categories
类别规则影响级别核心模式
阶段排序
${CLAUDE_SKILL_DIR}/rules/ordering-priority.md
关键优先处理GitHub Issues/提交,最后处理文件密集型阶段
状态写入
${CLAUDE_SKILL_DIR}/rules/state-write-timing.md
关键每个阶段结束后立即写入,绝不批量处理
小型提交
${CLAUDE_SKILL_DIR}/rules/checkpoint-mini-commit.md
每3个阶段执行一次检查点格式的小型提交
总计:3个类别下的3条规则

On Invocation

调用时处理

If
.claude/pipeline-state.json
exists:
run
scripts/show-status.sh
to display progress, then ask to resume, pick a different phase, or restart. Load
Read("${CLAUDE_SKILL_DIR}/references/resume-decision-tree.md")
for the full decision tree.
If no state file exists: ask the user to describe the task, build an execution plan, write initial state via
scripts/init-pipeline.sh <branch>
, begin Phase 1.
.claude/pipeline-state.json
文件存在:
运行
scripts/show-status.sh
以展示进度,随后询问用户是恢复任务、选择其他阶段还是重新开始。加载
Read("${CLAUDE_SKILL_DIR}/references/resume-decision-tree.md")
查看完整决策树。
若状态文件不存在: 请用户描述任务,构建执行计划,通过
scripts/init-pipeline.sh <branch>
写入初始状态,然后开始第一阶段。

Execution Plan Structure

执行计划结构

json
{
  "phases": [
    { "id": "create-issues", "name": "Create GitHub Issues", "dependencies": [], "status": "pending" },
    { "id": "commit-scaffold", "name": "Commit Scaffold", "dependencies": [], "status": "pending" },
    { "id": "write-source", "name": "Write Source Files", "dependencies": ["commit-scaffold"], "status": "pending" }
  ]
}
Phases with empty
dependencies
may run in parallel via Task sub-agents (when they don't share file writes).
json
{
  "phases": [
    { "id": "create-issues", "name": "Create GitHub Issues", "dependencies": [], "status": "pending" },
    { "id": "commit-scaffold", "name": "Commit Scaffold", "dependencies": [], "status": "pending" },
    { "id": "write-source", "name": "Write Source Files", "dependencies": ["commit-scaffold"], "status": "pending" }
  ]
}
依赖项为空的阶段可通过Task子代理并行执行(当它们不共享文件写入操作时)。

After Each Phase

每个阶段结束后处理

  1. Update
    .claude/pipeline-state.json
    — see
    Read("${CLAUDE_SKILL_DIR}/rules/state-write-timing.md")
  2. Every 3 phases: create a mini-commit — see
    Read("${CLAUDE_SKILL_DIR}/rules/checkpoint-mini-commit.md")
  1. 更新
    .claude/pipeline-state.json
    文件 — 详见
    Read("${CLAUDE_SKILL_DIR}/rules/state-write-timing.md")
  2. 每3个阶段:创建一个小型提交 — 详见
    Read("${CLAUDE_SKILL_DIR}/rules/checkpoint-mini-commit.md")

References

参考资料

Load on demand with
Read("${CLAUDE_SKILL_DIR}/references/<file>")
:
FileContent
references/pipeline-state-schema.md
Full field-by-field schema with examples
references/pipeline-state.schema.json
Machine-readable JSON Schema for validation
references/resume-decision-tree.md
Logic for resuming, picking phases, or restarting
按需通过
Read("${CLAUDE_SKILL_DIR}/references/<file>")
加载:
文件内容
references/pipeline-state-schema.md
带示例的完整逐字段 schema 说明
references/pipeline-state.schema.json
用于验证的机器可读JSON Schema
references/resume-decision-tree.md
恢复、阶段选择或重新开始的逻辑说明

Scripts

脚本

  • scripts/init-pipeline.sh <branch>
    — print skeleton state JSON to stdout
  • scripts/show-status.sh [path]
    — print human-readable pipeline status (requires
    jq
    )
  • scripts/init-pipeline.sh <branch>
    — 将骨架状态JSON输出到标准输出
  • scripts/show-status.sh [path]
    — 输出人类可读的管道状态(需要
    jq
    依赖)

Key Decisions

核心决策建议

DecisionRecommendation
Phase granularityOne meaningful deliverable per phase (a commit, a set of issues, a feature)
ParallelismTask sub-agents only for phases with empty
dependencies
that don't share file writes
Rate limit recoveryState is already saved — re-invoke
/checkpoint-resume
to continue
决策项建议
阶段粒度每个阶段对应一个有意义的交付成果(一次提交、一组Issues、一个功能)
并行执行仅当依赖项为空且不共享文件写入操作的阶段,才使用Task子代理并行执行
速率限制恢复状态已保存 — 重新调用
/checkpoint-resume
即可继续任务