recover
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRecover Workflow Context
恢复工作流上下文
Restore workflow state and todo items from checkpoint files after context compaction or session loss.
会话压缩或丢失后,从检查点文件恢复工作流状态和待办事项。
Usage
使用场景
Use this command when:
- Context was compacted and you've lost track of the workflow
- Session was interrupted and needs to resume
- Todo items need to be restored from a checkpoint
- The automatic recovery didn't trigger
在以下情况使用此命令:
- 上下文已被压缩,你无法追踪工作流进度
- 会话被中断,需要恢复
- 需要从检查点恢复待办事项
- 自动恢复未触发
Recovery Process
恢复流程
Step 1: Find Latest Checkpoint
步骤1:查找最新检查点
Look for checkpoint files in the reports directory:
bash
ls -la plans/reports/memory-checkpoint-*.md | tail -5Or search for all recent checkpoints:
bash
find plans -name "memory-checkpoint-*.md" -mmin -60 | head -5在reports目录中查找检查点文件:
bash
ls -la plans/reports/memory-checkpoint-*.md | tail -5或者搜索所有最近60分钟内的检查点:
bash
find plans -name "memory-checkpoint-*.md" -mmin -60 | head -5Step 2: Read Checkpoint File
步骤2:读取检查点文件
Read the most recent checkpoint to understand the saved state:
Read the checkpoint file at: plans/reports/memory-checkpoint-YYMMDD-HHMMSS.md读取最新的检查点文件,了解已保存的状态:
读取路径为以下位置的检查点文件:plans/reports/memory-checkpoint-YYMMDD-HHMMSS.mdStep 3: Extract Recovery Metadata
步骤3:提取恢复元数据
The checkpoint file contains a JSON metadata block at the end:
json
{
"sessionId": "...",
"activePlan": "plans/YYMMDD-slug/",
"workflowType": "feature",
"currentStep": "cook",
"remainingSteps": ["test", "code-review"],
"pendingTodos": [...]
}检查点文件末尾包含一个JSON元数据块:
json
{
"sessionId": "...",
"activePlan": "plans/YYMMDD-slug/",
"workflowType": "feature",
"currentStep": "cook",
"remainingSteps": ["test", "code-review"],
"pendingTodos": [...]
}Step 4: Restore Todo Items
步骤4:恢复待办事项
IMMEDIATELY call TodoWrite with the pending todos from the checkpoint.
立即调用TodoWrite,传入检查点中的待办事项。
Step 5: Read Active Plan (if exists)
步骤5:读取活跃计划(如果存在)
If is set in the metadata, read the plan file.
activePlan如果元数据中设置了,请读取该计划文件。
activePlanStep 6: Continue Workflow
步骤6:继续工作流
Resume from the identified in the metadata. Execute the remaining workflow steps in order.
currentStep从元数据中确定的恢复工作流,按顺序执行剩余的工作流步骤。
currentStepRecovery Checklist
恢复检查清单
- Located most recent checkpoint file
- Read checkpoint content
- Extracted recovery metadata JSON
- Restored todo items via TodoWrite
- Read active plan (if applicable)
- Identified current workflow step
- Ready to continue from interrupted step
- 找到最新的检查点文件
- 读取检查点内容
- 提取恢复元数据JSON
- 通过TodoWrite恢复待办事项
- 读取活跃计划(如适用)
- 确定当前工作流步骤
- 准备从中断步骤继续
Automatic vs Manual Recovery
自动恢复 vs 手动恢复
| Scenario | Recovery Type | Trigger |
|---|---|---|
| Session resume after compact | Automatic | |
| New session in same directory | Manual | This |
| Explicit user request | Manual | This |
| No workflow state found | Manual | This |
| 场景 | 恢复类型 | 触发条件 |
|---|---|---|
| 压缩后恢复会话 | 自动 | |
| 同一目录下启动新会话 | 手动 | 此 |
| 用户明确请求恢复 | 手动 | 此 |
| 未找到工作流状态 | 手动 | 此 |
Related Commands
相关命令
- - Create a manual checkpoint (before expected loss)
/checkpoint - - Manually trigger context compaction
/compact - - Load project context
/context - - Generate progress summary
/watzup
IMPORTANT Task Planning Notes (MUST FOLLOW)
- Always plan and break work into many small todo tasks
- Always add a final review todo task to verify work quality and identify fixes/enhancements
- - 创建手动检查点(在预期丢失前执行)
/checkpoint - - 手动触发上下文压缩
/compact - - 加载项目上下文
/context - - 生成进度摘要
/watzup
重要任务规划注意事项(必须遵守)
- 始终将工作规划并拆分为多个小的待办任务
- 始终添加一个最终审核待办任务,以验证工作质量并确定需要修复/优化的内容