Ask me what skills you need
What are you building?
Tell me what you're working on and I'll find the best agent skills for you.
为 spec-driven-dev 提供流程中断保存与恢复能力。在任意阶段触发 checkpoint 保存当前 Git 快照、迭代状态、Session 元数据和上下文重建包;rollback 命令可将 Git 仓库和 Agent 上下文恢复到任意历史 checkpoint。支持 save_checkpoint-{us_id} 和 rollback {ckpt_id} 触发。
设计前言 — 可行性分析
在实现之前,必须明确 Coding Agent Session 的真实限制,以便选择最可靠的技术路径。
| 问题 | 可行性 | 限制与解法 |
|---|---|---|
| 保存 Git 快照 | ✅ 完全可行 | git commit + git tag ckpt-{id} — 成熟方案,完全可靠 |
| 保存阶段/迭代状态 | ✅ 完全可行 | 写入结构化 Markdown 文件,与 current_iter.md 同等可靠 |
| 捕获 Session ID | ⚠️ 环境依赖 | OpenCode 通过 $OPENCODE_SESSION_ID 暴露;Claude Code CLI 通过 $CLAUDE_SESSION_ID;无法获取时生成本地 fallback UUID |
| 真正恢复对话历史 | ❌ 不可行 | 所有主流 Coding Agent(OpenCode、Claude Code、Cursor)均不支持跨 Session 导入原始对话历史。对话历史存在 Agent 运行时内存中,进程退出即消失,无对外持久化 API |
| 上下文语义恢复 | ✅ 完全可行 | 用「重建 Prompt 包」替代原始历史。将关键决策、修复记录、状态快照压缩为结构化 Markdown,作为新 Session 的首条 context 注入,使新 Session 能精确接续工作 |
真正恢复对话历史在技术层面不可行,但对话历史本身并非目标——目标是让新 Session 知道:
这四点完全可以通过结构化文档重建,效果等同于甚至优于原始对话历史(因为噪音更少)。
| 操作 | 可行性 | 实现 |
|---|---|---|
| Git 仓库回滚 | ✅ | git reset --hard ckpt-{id} 或 git checkout ckpt-{id} |
| 恢复 working tree 文件 | ✅ | 附带 git reset |
| 恢复 Session 上下文 | ✅ | 将 checkpoint 文档作为新 Session 首条 context 注入 |
npx skills add LeoYeAI/openclaw-master-skills --skill spec-driven-checkpointHow clear and easy to understand the SKILL.md instructions are, rated from 1 to 5.
Clear and well structured, with only minor parts that might need a second read.
How directly an agent can act on the SKILL.md instructions, rated from 1 to 5.
Partially actionable with several concrete steps, but still missing important details.