kata-track-progress

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<objective> Check project progress, summarize recent work and what's ahead, then intelligently route to the next action - either executing an existing plan or creating the next one.
Provides situational awareness before continuing work. </objective>
<process> <step name="verify"> **Verify planning structure exists:**
Use Bash (not Glob) to check—Glob respects .gitignore but .planning/ is often gitignored:
bash
test -d .planning && echo "exists" || echo "missing"
If no
.planning/
directory:
No planning structure found.

Run /kata-new-project to start a new project.
Exit.
If missing STATE.md: suggest
/kata-new-project
.
If ROADMAP.md missing but PROJECT.md exists:
This means a milestone was completed and archived. Go to Route F (between milestones).
If missing both ROADMAP.md and PROJECT.md: suggest
/kata-new-project
. </step>
<step name="load"> **Load full project context:**
  • Read
    .planning/STATE.md
    for living memory (position, decisions, issues)
  • Read
    .planning/ROADMAP.md
    for phase structure and objectives
  • Read
    .planning/PROJECT.md
    for current state (What This Is, Core Value, Requirements)
  • Read
    .planning/config.json
    for settings (model_profile, workflow toggles)
Load PR workflow config:
bash
PR_WORKFLOW=$(cat .planning/config.json 2>/dev/null | grep -o '"pr_workflow"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "false")
</step> <step name="recent"> **Gather recent work context:**
  • Find the 2-3 most recent SUMMARY.md files
  • Extract from each: what was accomplished, key decisions, any issues logged
  • This shows "what we've been working on" </step>
<step name="position"> **Parse current position:**
  • From STATE.md: current phase, plan number, status
  • Calculate: total plans, completed plans, remaining plans
  • Note any blockers or concerns
  • Check for CONTEXT.md: For phases without PLAN.md files, check if
    {phase}-CONTEXT.md
    exists in phase directory
  • Count pending issues:
    find .planning/issues/open -maxdepth 1 -name "*.md" 2>/dev/null | wc -l
  • Check for active debug sessions:
    find .planning/debug -maxdepth 1 -name "*.md" 2>/dev/null | grep -v resolved | wc -l
    </step>
<step name="report"> **Present rich status report:**
undefined
<objective> 检查项目进度,总结近期工作和后续安排,然后智能引导至下一步操作——要么执行现有规划,要么制定新规划。
在继续工作前提供情境感知。 </objective>
<process> <step name="verify"> **验证规划结构是否存在:**
使用Bash(而非Glob)进行检查——Glob会遵循.gitignore规则,但.planning/目录通常会被git忽略:
bash
test -d .planning && echo "exists" || echo "missing"
如果不存在
.planning/
目录:
未找到规划结构。

运行/kata-new-project以启动新项目。
退出。
如果缺少STATE.md:建议运行
/kata-new-project
如果缺少ROADMAP.md但存在PROJECT.md:
这意味着某个里程碑已完成并归档。进入路径F(里程碑之间的阶段)。
如果同时缺少ROADMAP.md和PROJECT.md:建议运行
/kata-new-project
</step>
<step name="load"> **加载完整项目上下文:**
  • 读取
    .planning/STATE.md
    获取动态记录(当前位置、决策、问题)
  • 读取
    .planning/ROADMAP.md
    获取阶段结构和目标
  • 读取
    .planning/PROJECT.md
    获取当前状态(项目定义、核心价值、需求)
  • 读取
    .planning/config.json
    获取设置(model_profile、工作流开关)
加载PR工作流配置:
bash
PR_WORKFLOW=$(cat .planning/config.json 2>/dev/null | grep -o '"pr_workflow"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "false")
</step> <step name="recent"> **收集近期工作上下文:**
  • 查找2-3个最新的SUMMARY.md文件
  • 从每个文件中提取:已完成工作、关键决策、已记录的问题
  • 以此展示“我们近期在做什么” </step>
<step name="position"> **解析当前位置:**
  • 从STATE.md获取:当前阶段、规划编号、状态
  • 计算:总规划数、已完成规划数、剩余规划数
  • 记录任何阻碍或关注点
  • 检查是否存在CONTEXT.md:对于没有PLAN.md文件的阶段,检查阶段目录中是否存在
    {phase}-CONTEXT.md
  • 统计待处理问题:
    find .planning/issues/open -maxdepth 1 -name "*.md" 2>/dev/null | wc -l
  • 检查活跃调试会话:
    find .planning/debug -maxdepth 1 -name "*.md" 2>/dev/null | grep -v resolved | wc -l
    </step>
<step name="report"> **呈现丰富的状态报告:**
undefined

[Project Name]

[项目名称]

Progress: [████████░░] 8/10 plans complete Profile: [quality/balanced/budget]
进度: [████████░░] 已完成8/10个规划 配置文件: [quality/balanced/budget]

Recent Work

近期工作

  • [Phase X, Plan Y]: [what was accomplished - 1 line]
  • [Phase X, Plan Z]: [what was accomplished - 1 line]
  • [阶段X,规划Y]:[已完成工作概述 - 一行]
  • [阶段X,规划Z]:[已完成工作概述 - 一行]

Current Position

当前位置

Phase [N] of [total]: [phase-name] Plan [M] of [phase-total]: [status] CONTEXT: [✓ if CONTEXT.md exists | - if not]
第[N]/[总阶段数]阶段:[阶段名称] 第[M]/[阶段总规划数]规划:[状态] 上下文:[存在CONTEXT.md则显示✓ | 不存在则显示-]

Key Decisions Made

关键决策

  • [decision 1 from STATE.md]
  • [decision 2]
  • [来自STATE.md的决策1]
  • [决策2]

Blockers/Concerns

阻碍/关注点

  • [any blockers or concerns from STATE.md]
  • [来自STATE.md的阻碍或关注点]

Pending Issues

待处理问题

  • [count] pending — /kata-check-issues to review
  • [数量]个待处理 — 运行/kata-check-issues查看详情

Active Debug Sessions

活跃调试会话

  • [count] active — /kata-debug to continue (Only show this section if count > 0)
  • [数量]个活跃 — 运行/kata-debug继续处理 (仅当数量>0时显示此部分)

PR Status

PR状态

(Only show this section if PR_WORKFLOW is true)
Check for PR on current branch:
bash
if [ "$PR_WORKFLOW" = "true" ]; then
  CURRENT_BRANCH=$(git branch --show-current)
  PR_INFO=$(gh pr list --head "$CURRENT_BRANCH" --json number,state,title,url --jq '.[0]' 2>/dev/null)

  if [ -n "$PR_INFO" ] && [ "$PR_INFO" != "null" ]; then
    PR_NUMBER=$(echo "$PR_INFO" | jq -r '.number')
    PR_STATE=$(echo "$PR_INFO" | jq -r '.state')
    PR_TITLE=$(echo "$PR_INFO" | jq -r '.title')
    PR_URL=$(echo "$PR_INFO" | jq -r '.url')

    # Check if draft
    if [ "$PR_STATE" = "OPEN" ]; then
      IS_DRAFT=$(gh pr view "$PR_NUMBER" --json isDraft --jq '.isDraft' 2>/dev/null)
      if [ "$IS_DRAFT" = "true" ]; then
        STATE_DISPLAY="Draft"
      else
        STATE_DISPLAY="Ready for review"
      fi
    elif [ "$PR_STATE" = "MERGED" ]; then
      STATE_DISPLAY="Merged"
    elif [ "$PR_STATE" = "CLOSED" ]; then
      STATE_DISPLAY="Closed"
    else
      STATE_DISPLAY="$PR_STATE"
    fi
  fi
fi
If PR exists:
undefined
(仅当PR_WORKFLOW为true时显示此部分)
检查当前分支的PR:
bash
if [ "$PR_WORKFLOW" = "true" ]; then
  CURRENT_BRANCH=$(git branch --show-current)
  PR_INFO=$(gh pr list --head "$CURRENT_BRANCH" --json number,state,title,url --jq '.[0]' 2>/dev/null)

  if [ -n "$PR_INFO" ] && [ "$PR_INFO" != "null" ]; then
    PR_NUMBER=$(echo "$PR_INFO" | jq -r '.number')
    PR_STATE=$(echo "$PR_INFO" | jq -r '.state')
    PR_TITLE=$(echo "$PR_INFO" | jq -r '.title')
    PR_URL=$(echo "$PR_INFO" | jq -r '.url')

    # 检查是否为草稿
    if [ "$PR_STATE" = "OPEN" ]; then
      IS_DRAFT=$(gh pr view "$PR_NUMBER" --json isDraft --jq '.isDraft' 2>/dev/null)
      if [ "$IS_DRAFT" = "true" ]; then
        STATE_DISPLAY="Draft"
      else
        STATE_DISPLAY="Ready for review"
      fi
    elif [ "$PR_STATE" = "MERGED" ]; then
      STATE_DISPLAY="Merged"
    elif [ "$PR_STATE" = "CLOSED" ]; then
      STATE_DISPLAY="Closed"
    else
      STATE_DISPLAY="$PR_STATE"
    fi
  fi
fi
如果存在PR:
undefined

PR Status

PR状态

PR #[number]: [title] Status: [Draft | Ready for review | Merged] URL: [url]

**If no PR exists:**
PR #[编号]:[标题] 状态:[Draft | Ready for review | Merged] 链接:[url]

**如果不存在PR:**

PR Status

PR状态

No open PR for current branch. Branch: [current_branch]
undefined
当前分支无开放PR。 分支:[current_branch]
undefined

What's Next

下一步

[Next phase/plan objective from ROADMAP]

</step>

<step name="route">
**Determine next action based on verified counts.**

**Step 1: Find current phase directory and count plans, summaries, and issues**

Find the current phase directory using universal discovery:

```bash
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
[来自ROADMAP.md的下一阶段/规划目标]

</step>

<step name="route">
**根据验证的计数确定下一步操作。**

**步骤1:查找当前阶段目录并统计规划、总结和问题数量**

通过通用发现找到当前阶段目录:

```bash
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)

回退:扁平目录(向后兼容)

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

List files in the current phase directory:

```bash
find "${PHASE_DIR}" -maxdepth 1 -name "*-PLAN.md" 2>/dev/null | wc -l
find "${PHASE_DIR}" -maxdepth 1 -name "*-SUMMARY.md" 2>/dev/null | wc -l
find "${PHASE_DIR}" -maxdepth 1 -name "*-UAT.md" 2>/dev/null | wc -l
State: "This phase has {X} plans, {Y} summaries."
Step 1.5: Check for unaddressed UAT gaps
Check for UAT.md files with status "diagnosed" (has gaps needing fixes).
bash
undefined
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

列出当前阶段目录中的文件:

```bash
find "${PHASE_DIR}" -maxdepth 1 -name "*-PLAN.md" 2>/dev/null | wc -l
find "${PHASE_DIR}" -maxdepth 1 -name "*-SUMMARY.md" 2>/dev/null | wc -l
find "${PHASE_DIR}" -maxdepth 1 -name "*-UAT.md" 2>/dev/null | wc -l
状态提示:“此阶段有{X}个规划,{Y}个总结。”
步骤1.5:检查未解决的UAT差距
检查状态为“diagnosed”(存在需要修复的差距)的UAT.md文件。
bash
undefined

Check for diagnosed UAT with gaps

检查存在待修复差距的已诊断UAT

find "${PHASE_DIR}" -maxdepth 1 -name "*-UAT.md" -exec grep -l "status: diagnosed" {} + 2>/dev/null

Track:
- `uat_with_gaps`: UAT.md files with status "diagnosed" (gaps need fixing)

**Step 2: Route based on counts**

| Condition                       | Meaning                 | Action            |
| ------------------------------- | ----------------------- | ----------------- |
| uat_with_gaps > 0               | UAT gaps need fix plans | Go to **Route E** |
| summaries < plans               | Unexecuted plans exist  | Go to **Route A** |
| summaries = plans AND plans > 0 | Phase complete          | Go to Step 3      |
| plans = 0                       | Phase not yet planned   | Go to **Route B** |

---

**Route A: Unexecuted plan exists**

Find the first PLAN.md without matching SUMMARY.md.
Read its `<objective>` section.

find "${PHASE_DIR}" -maxdepth 1 -name "*-UAT.md" -exec grep -l "status: diagnosed" {} + 2>/dev/null

跟踪:
- `uat_with_gaps`:状态为“diagnosed”的UAT.md文件(存在需要修复的差距)

**步骤2:根据计数选择路径**

| 条件                       | 含义                 | 操作            |
| ------------------------------- | ----------------------- | ----------------- |
| uat_with_gaps > 0               | UAT差距需要修复规划 | 进入**路径E** |
| summaries < plans               | 存在未执行的规划  | 进入**路径A** |
| summaries = plans AND plans > 0 | 阶段已完成          | 进入步骤3      |
| plans = 0                       | 阶段尚未规划   | 进入**路径B** |

---

**路径A:存在未执行的规划**

找到第一个没有对应SUMMARY.md的PLAN.md。
读取其`<objective>`部分。

▶ Next Up

▶ 下一步

{phase}-{plan}: [Plan Name] — [objective summary from PLAN.md] {If PR_WORKFLOW is true AND PR exists: PR #[number] ([state]) — [url]}
/kata-execute-phase {phase}
<sub>
/clear
first → fresh context window</sub>


---

**Route B: Phase needs planning**

Check if `{phase}-CONTEXT.md` exists in phase directory.

**If CONTEXT.md exists:**

{phase}-{plan}: [规划名称] — [来自PLAN.md的目标概述] {如果PR_WORKFLOW为true且存在PR:PR #[编号] ([状态]) — [链接]}
/kata-execute-phase {phase}
<sub>
/clear
先执行 → 刷新上下文窗口</sub>


---

**路径B:阶段需要规划**

检查阶段目录中是否存在`{phase}-CONTEXT.md`。

**如果CONTEXT.md存在:**

▶ Next Up

▶ 下一步

Phase {N}: {Name} — {Goal from ROADMAP.md} <sub>✓ Context gathered, ready to plan</sub>
/kata-plan-phase {phase-number}
<sub>
/clear
first → fresh context window</sub>


**If CONTEXT.md does NOT exist:**

第{N}阶段:{名称} — [来自ROADMAP.md的目标] <sub>✓ 已收集上下文,可开始规划</sub>
/kata-plan-phase {phase-number}
<sub>
/clear
先执行 → 刷新上下文窗口</sub>


**如果CONTEXT.md不存在:**

▶ Next Up

▶ 下一步

Phase {N}: {Name} — {Goal from ROADMAP.md}
/kata-discuss-phase {phase}
— gather context and clarify approach
<sub>
/clear
first → fresh context window</sub>

Also available:
  • /kata-plan-phase {phase}
    — skip discussion, plan directly
  • /kata-listing-phase-assumptions {phase}
    — see Claude's assumptions


---

**Route E: UAT gaps need fix plans**

UAT.md exists with gaps (diagnosed issues). User needs to plan fixes.

第{N}阶段:{名称} — [来自ROADMAP.md的目标]
/kata-discuss-phase {phase}
— 收集上下文并明确方法
<sub>
/clear
先执行 → 刷新上下文窗口</sub>

其他可用命令:
  • /kata-plan-phase {phase}
    — 跳过讨论,直接规划
  • /kata-listing-phase-assumptions {phase}
    — 查看Claude的假设


---

**路径E:UAT差距需要修复规划**

存在包含差距(已诊断问题)的UAT.md文件。用户需要规划修复方案。

⚠ UAT Gaps Found

⚠ 发现UAT差距

{phase}-UAT.md has {N} gaps requiring fixes.
/kata-plan-phase {phase} --gaps
<sub>
/clear
first → fresh context window</sub>

Also available:
  • /kata-execute-phase {phase}
    — execute phase plans
  • /kata-verify-work {phase}
    — run more UAT testing


---

**Step 3: Check milestone status (only when phase complete)**

Read ROADMAP.md and identify:
1. Current phase number
2. All phase numbers in the current milestone section

Count total phases and identify the highest phase number.

State: "Current phase is {X}. Milestone has {N} phases (highest: {Y})."

**Route based on milestone status:**

| Condition                     | Meaning            | Action            |
| ----------------------------- | ------------------ | ----------------- |
| current phase < highest phase | More phases remain | Go to **Route C** |
| current phase = highest phase | Milestone complete | Go to **Route D** |

---

**Route C: Phase complete, more phases remain**

Read ROADMAP.md to get the next phase's name and goal.

{phase}-UAT.md 存在{N}个需要修复的差距。
/kata-plan-phase {phase} --gaps
<sub>
/clear
先执行 → 刷新上下文窗口</sub>

其他可用命令:
  • /kata-execute-phase {phase}
    — 执行阶段规划
  • /kata-verify-work {phase}
    — 运行更多UAT测试


---

**步骤3:检查里程碑状态(仅当阶段完成时)**

读取ROADMAP.md并确定:
1. 当前阶段编号
2. 当前里程碑部分中的所有阶段编号

统计总阶段数并确定最高阶段编号。

状态提示:“当前阶段为{X}。里程碑包含{N}个阶段(最高阶段为{Y})。”

**根据里程碑状态选择路径:**

| 条件                     | 含义            | 操作            |
| ----------------------------- | ------------------ | ----------------- |
| current phase < highest phase | 还有更多阶段未完成 | 进入**路径C** |
| current phase = highest phase | 里程碑已完成 | 进入**路径D** |

---

**路径C:阶段已完成,还有更多阶段**

读取ROADMAP.md获取下一阶段的名称和目标。

✓ Phase {Z} Complete

✓ 第{Z}阶段已完成

▶ Next Up

▶ 下一步

{If PR_WORKFLOW is true AND PR exists: ⚠️ Merge PR #[number] first — [url] Then continue with: } Phase {Z+1}: {Name} — {Goal from ROADMAP.md}
/kata-discuss-phase {Z+1}
— gather context and clarify approach
<sub>
/clear
first → fresh context window</sub>

Also available:
  • /kata-plan-phase {Z+1}
    — skip discussion, plan directly
  • /kata-verify-work {Z}
    — user acceptance test before continuing


---

**Route D: Milestone complete**

{如果PR_WORKFLOW为true且存在PR: ⚠️ 先合并PR #[编号] — [链接] 然后继续: } 第{Z+1}阶段:{名称} — [来自ROADMAP.md的目标]
/kata-discuss-phase {Z+1}
— 收集上下文并明确方法
<sub>
/clear
先执行 → 刷新上下文窗口</sub>

其他可用命令:
  • /kata-plan-phase {Z+1}
    — 跳过讨论,直接规划
  • /kata-verify-work {Z}
    — 继续前执行用户验收测试


---

**路径D:里程碑已完成**

🎉 Milestone Complete

🎉 里程碑已完成

All {N} phases finished!
所有{N}个阶段已完成!

▶ Next Up

▶ 下一步

{If PR_WORKFLOW is true: ⚠️ Merge all phase PRs first before completing milestone Then continue with: } Complete Milestone — archive and prepare for next
/kata-complete-milestone
<sub>
/clear
first → fresh context window</sub>

Also available:
  • /kata-verify-work
    — user acceptance test before completing milestone


---

**Route F: Between milestones (ROADMAP.md missing, PROJECT.md exists)**

A milestone was completed and archived. Ready to start the next milestone cycle.

Read MILESTONES.md to find the last completed milestone version.

---
{如果PR_WORKFLOW为true:⚠️ 完成里程碑前先合并所有阶段PR 然后继续: } 完成里程碑 — 归档并为下一个里程碑做准备
/kata-complete-milestone
<sub>
/clear
先执行 → 刷新上下文窗口</sub>

其他可用命令:
  • /kata-verify-work
    — 完成里程碑前执行用户验收测试


---

**路径F:里程碑之间(ROADMAP.md缺失,PROJECT.md存在)**

某个里程碑已完成并归档。准备启动下一个里程碑周期。

读取MILESTONES.md找到最后一个已完成的里程碑版本。

---

✓ Milestone v{X.Y} Complete

✓ 里程碑v{X.Y}已完成

Ready to plan the next milestone.
准备规划下一个里程碑。

▶ Next Up

▶ 下一步

Start Next Milestone — questioning → research → requirements → roadmap
/kata-add-milestone
<sub>
/clear
first → fresh context window</sub>

</step> <step name="edge_cases"> **Handle edge cases:**
  • Phase complete but next phase not planned → offer
    /kata-plan-phase [next]
  • All work complete → offer milestone completion
  • Blockers present → highlight before offering to continue
  • Handoff file exists → mention it, offer
    /kata-resume-work
    </step>
</process>
<success_criteria>
  • Rich context provided (recent work, decisions, issues)
  • Current position clear with visual progress
  • What's next clearly explained
  • Smart routing: /kata-execute-phase if plans exist, /kata-plan-phase if not
  • User confirms before any action
  • Seamless handoff to appropriate kata command </success_criteria>
启动下一个里程碑 — 问题调研 → 研究 → 需求 → 路线图
/kata-add-milestone
<sub>
/clear
先执行 → 刷新上下文窗口</sub>

</step> <step name="edge_cases"> **处理边缘情况:**
  • 阶段已完成但下一阶段未规划 → 提供
    /kata-plan-phase [next]
    命令
  • 所有工作已完成 → 提供里程碑完成命令
  • 存在阻碍 → 继续前先高亮显示
  • 存在交接文件 → 提及并提供
    /kata-resume-work
    命令 </step>
</process>
<success_criteria>
  • 提供丰富的上下文(近期工作、决策、问题)
  • 清晰展示当前位置和可视化进度
  • 明确说明下一步内容
  • 智能路由:存在规划则引导至/kata-execute-phase,否则引导至/kata-plan-phase
  • 执行任何操作前需用户确认
  • 无缝切换至合适的kata命令 </success_criteria>