kata-pause-work
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<objective>
Create `.continue-here.md` handoff file to preserve complete work state across sessions.
Enables seamless resumption in fresh session with full context restoration.
</objective>
<context>
@.planning/STATE.md
</context>
<process>
<step name="detect">
Find current phase directory using universal discovery:
bash
undefined<objective>
创建`.continue-here.md`交接文件,以在不同会话间保存完整的工作状态。
支持在新会话中无缝恢复工作,同时还原全部上下文。
</objective>
<context>
@.planning/STATE.md
</context>
<process>
<step name="detect">
通过通用发现功能查找当前阶段目录:
bash
undefinedGet current phase from STATE.md
Get current phase from STATE.md
CURRENT_PHASE=$(grep -oP 'Phase: \K[0-9]+' .planning/STATE.md 2>/dev/null | head -1)
PADDED=$(printf "%02d" "$CURRENT_PHASE" 2>/dev/null || echo "$CURRENT_PHASE")
PHASE_DIR=""
for state in active pending completed; do
PHASE_DIR=$(find .planning/phases/${state} -maxdepth 1 -type d -name "${PADDED}-" 2>/dev/null | head -1)
[ -z "$PHASE_DIR" ] && PHASE_DIR=$(find .planning/phases/${state} -maxdepth 1 -type d -name "${CURRENT_PHASE}-" 2>/dev/null | head -1)
[ -n "$PHASE_DIR" ] && break
done
CURRENT_PHASE=$(grep -oP 'Phase: \K[0-9]+' .planning/STATE.md 2>/dev/null | head -1)
PADDED=$(printf "%02d" "$CURRENT_PHASE" 2>/dev/null || echo "$CURRENT_PHASE")
PHASE_DIR=""
for state in active pending completed; do
PHASE_DIR=$(find .planning/phases/${state} -maxdepth 1 -type d -name "${PADDED}-" 2>/dev/null | head -1)
[ -z "$PHASE_DIR" ] && PHASE_DIR=$(find .planning/phases/${state} -maxdepth 1 -type d -name "${CURRENT_PHASE}-" 2>/dev/null | head -1)
[ -n "$PHASE_DIR" ] && break
done
Fallback: flat directory (backward compatibility)
Fallback: flat directory (backward compatibility)
if [ -z "$PHASE_DIR" ]; then
PHASE_DIR=$(find .planning/phases -maxdepth 1 -type d -name "${PADDED}-" 2>/dev/null | head -1)
[ -z "$PHASE_DIR" ] && PHASE_DIR=$(find .planning/phases -maxdepth 1 -type d -name "${CURRENT_PHASE}-" 2>/dev/null | head -1)
fi
If universal discovery fails, fall back to most recently modified files.
</step>
<step name="gather">
**Collect complete state for handoff:**
1. **Current position**: Which phase, which plan, which task
2. **Work completed**: What got done this session
3. **Work remaining**: What's left in current plan/phase
4. **Decisions made**: Key decisions and rationale
5. **Blockers/issues**: Anything stuck
6. **Mental context**: The approach, next steps, "vibe"
7. **Files modified**: What's changed but not committed
Ask user for clarifications if needed.
</step>
<step name="write">
**Write handoff to `${PHASE_DIR}/.continue-here.md`:**
```markdown
---
phase: XX-name
task: 3
total_tasks: 7
status: in_progress
last_updated: [timestamp]
---
<current_state>
[Where exactly are we? Immediate context]
</current_state>
<completed_work>
- Task 1: [name] - Done
- Task 2: [name] - Done
- Task 3: [name] - In progress, [what's done]
</completed_work>
<remaining_work>
- Task 3: [what's left]
- Task 4: Not started
- Task 5: Not started
</remaining_work>
<decisions_made>
- Decided to use [X] because [reason]
- Chose [approach] over [alternative] because [reason]
</decisions_made>
<blockers>
- [Blocker 1]: [status/workaround]
</blockers>
<context>
[Mental state, what were you thinking, the plan]
</context>
<next_action>
Start with: [specific first action when resuming]
</next_action>Be specific enough for a fresh Claude to understand immediately.
</step>
<step name="commit">
**Check planning config:**
bash
COMMIT_PLANNING_DOCS=$(cat .planning/config.json 2>/dev/null | grep -o '"commit_docs"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
git check-ignore -q .planning 2>/dev/null && COMMIT_PLANNING_DOCS=falseIf : Skip git operations
COMMIT_PLANNING_DOCS=falseIf (default):
COMMIT_PLANNING_DOCS=truebash
git add ${PHASE_DIR}/.continue-here.md
git commit -m "wip: [phase-name] paused at task [X]/[Y]"Current state:
- Phase: [XX-name]
- Task: [X] of [Y]
- Status: [in_progress/blocked]
- Committed as WIP
To resume: /kata-resume-work
</step>
</process>
<success_criteria>
- [ ] .continue-here.md created in correct phase directory
- [ ] All sections filled with specific content
- [ ] Committed as WIP
- [ ] User knows location and how to resume
</success_criteria>if [ -z "$PHASE_DIR" ]; then
PHASE_DIR=$(find .planning/phases -maxdepth 1 -type d -name "${PADDED}-" 2>/dev/null | head -1)
[ -z "$PHASE_DIR" ] && PHASE_DIR=$(find .planning/phases -maxdepth 1 -type d -name "${CURRENT_PHASE}-" 2>/dev/null | head -1)
fi
如果通用发现失败,则回退到最近修改的文件。
</step>
<step name="gather">
**收集用于交接的完整状态信息:**
1. **当前位置**:处于哪个阶段、哪个计划、哪个任务
2. **已完成工作**:本次会话完成的内容
3. **剩余工作**:当前计划/阶段中尚未完成的部分
4. **已做出的决策**:关键决策及其理由
5. **障碍/问题**:任何停滞的事项
6. **思路上下文**:采用的方法、后续步骤、整体“思路”
7. **已修改文件**:已更改但未提交的文件
如有需要,向用户确认细节。
</step>
<step name="write">
**将交接内容写入`${PHASE_DIR}/.continue-here.md`:**
```markdown
---
phase: XX-name
task: 3
total_tasks: 7
status: in_progress
last_updated: [timestamp]
---
<current_state>
[Where exactly are we? Immediate context]
</current_state>
<completed_work>
- Task 1: [name] - Done
- Task 2: [name] - Done
- Task 3: [name] - In progress, [what's done]
</completed_work>
<remaining_work>
- Task 3: [what's left]
- Task 4: Not started
- Task 5: Not started
</remaining_work>
<decisions_made>
- Decided to use [X] because [reason]
- Chose [approach] over [alternative] because [reason]
</decisions_made>
<blockers>
- [Blocker 1]: [status/workaround]
</blockers>
<context>
[Mental state, what were you thinking, the plan]
</context>
<next_action>
Start with: [specific first action when resuming]
</next_action>内容需足够具体,以便新的Claude能立即理解。
</step>
<step name="commit">
**检查规划配置:**
bash
COMMIT_PLANNING_DOCS=$(cat .planning/config.json 2>/dev/null | grep -o '"commit_docs"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
git check-ignore -q .planning 2>/dev/null && COMMIT_PLANNING_DOCS=false如果: 跳过git操作
COMMIT_PLANNING_DOCS=false如果(默认设置):
COMMIT_PLANNING_DOCS=truebash
git add ${PHASE_DIR}/.continue-here.md
git commit -m "wip: [phase-name] paused at task [X]/[Y]"当前状态:
- 阶段:[XX-name]
- 任务:[X]/[Y]
- 状态:[进行中/受阻]
- 已作为WIP提交
恢复工作:/kata-resume-work
</step>
</process>
<success_criteria>
- [ ] .continue-here.md已在正确的阶段目录中创建
- [ ] 所有部分均已填充具体内容
- [ ] 已作为WIP提交
- [ ] 用户知晓文件位置及恢复方法
</success_criteria>