@guanlin4924/devflow-pi 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -21
- package/package.json +1 -2
- package/plugins/devflow-core/extensions/devflow-core.ts +1 -3
- package/plugins/devflow-core/skills/workflow-orchestrator/scripts/init_workflow.rb +1 -1
- package/plugins/devflow-core/skills/workflow-orchestrator/scripts/validate_state.rb +9 -10
- package/plugins/devflow-core/skills/workflow-orchestrator/templates/acceptance-remediation.yaml +87 -0
- package/plugins/devflow-core/skills/workflow-orchestrator/templates/feature-development.yaml +29 -98
- package/plugins/devflow-core/skills/workflow-pipeline/SKILL.md +3 -5
- package/plugins/devflow-core/skills/workflow-pipeline/references/pipeline-flow.md +9 -22
- package/plugins/devflow-core/skills/workflow-pipeline/references/slice-safety-guide.md +1 -1
- package/plugins/devflow-implementation/skills/workflow-change-plan/references/output-template.md +2 -2
- package/plugins/devflow-implementation/skills/workflow-execute-phase/references/execute-phase.md +52 -1221
- package/plugins/devflow-intel/skills/workflow-context-sync/SKILL.md +1 -1
- package/plugins/devflow-intel/skills/workflow-update-navigation/SKILL.md +1 -1
- package/plugins/devflow-quality/agents/verification-runner.md +1 -1
- package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/SKILL.md +2 -2
- package/plugins/devflow-quality/skills/workflow-release-closeout/SKILL.md +48 -0
- package/plugins/devflow-quality/skills/workflow-run-acceptance-tests/SKILL.md +2 -2
- package/src/constants.ts +1 -1
- package/templates/commands/start.md +2 -2
- package/templates/omp/config.yml +1 -3
- package/docs/OMP-NATIVE-ARCHITECTURE.md +0 -104
- package/plugins/devflow-core/skills/workflow-orchestrator/templates/uat-remediation.yaml +0 -176
- package/plugins/devflow-quality/skills/workflow-audit-milestone/SKILL.md +0 -31
- package/plugins/devflow-quality/skills/workflow-audit-milestone/references/audit-milestone.md +0 -328
- package/plugins/devflow-quality/skills/workflow-complete-milestone/SKILL.md +0 -132
- package/plugins/devflow-quality/skills/workflow-complete-milestone/assets/milestone-archive.md +0 -123
- package/plugins/devflow-quality/skills/workflow-complete-milestone/references/complete-milestone.md +0 -775
- package/plugins/devflow-quality/skills/workflow-complete-milestone/references/milestone-archive.md +0 -123
- package/plugins/devflow-quality/skills/workflow-verify-work/SKILL.md +0 -112
- package/plugins/devflow-quality/skills/workflow-verify-work/assets/UAT.md +0 -265
- package/plugins/devflow-quality/skills/workflow-verify-work/references/verify-work.md +0 -759
package/plugins/devflow-implementation/skills/workflow-execute-phase/references/execute-phase.md
CHANGED
|
@@ -1,1251 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
Execute all plans in a phase using wave-based parallel execution. Orchestrator stays lean — delegates plan execution to subagents.
|
|
3
|
-
</purpose>
|
|
1
|
+
# Devflow 执行阶段参考
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
Orchestrator coordinates, not executes. Each subagent loads the full execute-plan context. Orchestrator: discover plans → analyze deps → group waves → spawn agents → handle checkpoints → collect results.
|
|
7
|
-
</core_principle>
|
|
3
|
+
## 目的
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
Use OMP's `task` tool and the project agents discovered from `.omp/agents/`. Project
|
|
11
|
-
configuration controls isolation and recursion; do not override those limits in prompts.
|
|
12
|
-
If the `task` tool is unavailable, execute plans sequentially inline. After every task,
|
|
13
|
-
verify filesystem, test, summary, and git evidence before advancing the control plane.
|
|
14
|
-
</runtime_compatibility>
|
|
5
|
+
本参考定义 Devflow 在变更清单冻结后如何执行代码任务。它只描述 Devflow 的受控执行链,不创建独立的人工验收账本,也不依赖外部流程模板。
|
|
15
6
|
|
|
16
|
-
|
|
17
|
-
Read STATE.md before any operation to load project context.
|
|
7
|
+
## 执行前提
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
# context budget guidelines
|
|
21
|
-
# workflow gates
|
|
22
|
-
</required_reading>
|
|
9
|
+
执行器必须读取并校验:
|
|
23
10
|
|
|
11
|
+
- 已确认的需求基线、技术方案和架构约束;
|
|
12
|
+
- 已冻结的变更清单;
|
|
13
|
+
- 与任务绑定的 `TC-*`、`UT-*`、`IT-*` 和测试命令;
|
|
14
|
+
- 项目初始化生成的工具链、代码索引和运行上下文。
|
|
24
15
|
|
|
16
|
+
若任务缺少实现测试、验收用例绑定或执行契约,必须停止并回到变更清单阶段,不得由执行器临时补造范围。
|
|
25
17
|
|
|
26
|
-
|
|
18
|
+
## 任务执行顺序
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
Parse `$ARGUMENTS` before loading any context:
|
|
20
|
+
对每个代码任务按以下顺序处理:
|
|
30
21
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
1. 建立任务快照,记录任务 ID、需求图谱 revision、代码索引 revision 和源文件哈希。
|
|
23
|
+
2. 对 `tdd_required` 任务先运行 RED 命令,确认失败原因是目标行为尚未实现,而不是环境错误。
|
|
24
|
+
3. 编写最小实现;只修改任务声明的文件和必要的测试文件。
|
|
25
|
+
4. 运行同一测试目标的 GREEN 命令。
|
|
26
|
+
5. 运行任务声明的回归命令,并记录 Core-owned machine evidence。
|
|
27
|
+
6. 刷新代码索引;若索引失败或发现边界漂移,任务保持未完成。
|
|
28
|
+
7. 将结果写入任务证据记录。执行器不得以自然语言自述替代命令、退出码、输出摘要哈希和源码快照。
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
</step>
|
|
30
|
+
## TDD 证据要求
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
Load all context in one call:
|
|
32
|
+
`tdd_required` 任务必须存在三段证据:
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
AGENT_SKILLS=$(# (local impl)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
|
|
48
|
-
|
|
49
|
-
**If `response_language` is set:** Include `response_language: {value}` in all spawned subagent prompts so any user-facing output stays in the configured language.
|
|
50
|
-
|
|
51
|
-
Read worktree config:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
USE_WORKTREES=$(# (local impl)
|
|
55
|
-
```
|
|
34
|
+
- `RED`:测试先运行且按预期失败;
|
|
35
|
+
- `GREEN`:同一测试目标在实现后通过;
|
|
36
|
+
- `REGRESSION`:任务完成前约定回归命令通过。
|
|
56
37
|
|
|
57
|
-
|
|
38
|
+
缺任一段、命令目标不一致、失败属于环境问题,或 RED 前已经存在本任务生产代码变更,都不能把任务标记为完成。非 TDD 任务也必须说明测试模式和豁免理由。
|
|
58
39
|
|
|
59
|
-
|
|
40
|
+
## 执行阶段的失败处理
|
|
60
41
|
|
|
61
|
-
|
|
62
|
-
CONTEXT_WINDOW=$(# (local impl)
|
|
63
|
-
```
|
|
42
|
+
失败分为三类:
|
|
64
43
|
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
- This enables cross-phase awareness and history-aware verification
|
|
44
|
+
- **代码失败**:测试断言失败、类型错误或静态检查失败;保持任务未完成,修复后重复证据链。
|
|
45
|
+
- **索引失败**:代码索引无法刷新或项目边界发生变化;先修复索引,再继续测试。
|
|
46
|
+
- **环境阻塞**:依赖服务、浏览器、数据库或测试设备不可用;结果记录为 `blocked`,不能伪装为通过。
|
|
69
47
|
|
|
70
|
-
|
|
71
|
-
**If `plan_count` is 0:** Error — no plans found in phase.
|
|
72
|
-
**If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
|
|
48
|
+
验收失败不在本步骤创建临时报告。编排器应转入 `acceptance-remediation`,依次执行诊断、修复、代码索引刷新和冻结验收测试重跑。
|
|
73
49
|
|
|
74
|
-
|
|
50
|
+
## 阶段完成条件
|
|
75
51
|
|
|
76
|
-
|
|
77
|
-
Confirm the `task` tool and the required project agent are available before starting a wave.
|
|
78
|
-
If either is unavailable, force sequential inline execution regardless of the
|
|
79
|
-
`parallelization` setting.
|
|
52
|
+
执行阶段只负责完成变更清单和实现证据,不负责发布或归档。满足以下条件后才能交给后续质量链:
|
|
80
53
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
# (local impl)
|
|
86
|
-
fi
|
|
87
|
-
```
|
|
88
|
-
</step>
|
|
54
|
+
- 所有代码任务均有完成证据;
|
|
55
|
+
- 所有 TDD 任务 RED/GREEN/REGRESSION 齐全;
|
|
56
|
+
- 代码索引刷新成功;
|
|
57
|
+
- 没有未处理的需求、架构或安全阻塞。
|
|
89
58
|
|
|
90
|
-
|
|
91
|
-
**MANDATORY — Check for blocking anti-patterns before any other work.**
|
|
59
|
+
## 后续质量链
|
|
92
60
|
|
|
93
|
-
|
|
61
|
+
执行完成后由编排器按固定顺序推进:
|
|
94
62
|
|
|
95
|
-
```
|
|
96
|
-
|
|
63
|
+
```text
|
|
64
|
+
execute-phase
|
|
65
|
+
→ code-review
|
|
66
|
+
→ workflow-generate-mainflow-cases(如适用)
|
|
67
|
+
→ workflow-run-acceptance-tests
|
|
68
|
+
→ CP-4 验收结果确认
|
|
69
|
+
→ workflow-release-closeout
|
|
97
70
|
```
|
|
98
71
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
**If one or more `blocking` anti-patterns are found:**
|
|
102
|
-
|
|
103
|
-
This step cannot be skipped. Before proceeding to `check_interactive_mode` or any other step, the agent must demonstrate understanding of each blocking anti-pattern by answering all three questions for each one:
|
|
104
|
-
|
|
105
|
-
1. **What is this anti-pattern?** — Describe it in your own words, not by quoting the handoff.
|
|
106
|
-
2. **How did it manifest?** — Explain the specific failure that caused it to be recorded.
|
|
107
|
-
3. **What structural mechanism (not acknowledgment) prevents it?** — Name the concrete step, checklist item, or enforcement mechanism that stops recurrence.
|
|
108
|
-
|
|
109
|
-
Write these answers inline before continuing. If a blocking anti-pattern cannot be answered from the context in `.continue-here.md`, stop and ask the user for clarification.
|
|
110
|
-
|
|
111
|
-
**If no `.continue-here.md` exists, or no `blocking` rows are found:** Proceed directly to `check_interactive_mode`.
|
|
112
|
-
</step>
|
|
113
|
-
|
|
114
|
-
<step name="check_interactive_mode">
|
|
115
|
-
**Parse `--interactive` flag from $ARGUMENTS.**
|
|
116
|
-
|
|
117
|
-
**If `--interactive` flag present:** Switch to interactive execution mode.
|
|
118
|
-
|
|
119
|
-
Interactive mode executes plans sequentially **inline** (no subagent spawning) with user
|
|
120
|
-
checkpoints between tasks. The user can review, modify, or redirect work at any point.
|
|
121
|
-
|
|
122
|
-
**Interactive execution flow:**
|
|
123
|
-
|
|
124
|
-
1. Load plan inventory as normal (discover_and_group_plans)
|
|
125
|
-
2. For each plan (sequentially, ignoring wave grouping):
|
|
126
|
-
|
|
127
|
-
a. **Present the plan to the user:**
|
|
128
|
-
```
|
|
129
|
-
## Plan {plan_id}: {plan_name}
|
|
130
|
-
|
|
131
|
-
Objective: {from plan file}
|
|
132
|
-
Tasks: {task_count}
|
|
133
|
-
|
|
134
|
-
Options:
|
|
135
|
-
- Execute (proceed with all tasks)
|
|
136
|
-
- Review first (show task breakdown before starting)
|
|
137
|
-
- Skip (move to next plan)
|
|
138
|
-
- Stop (end execution, save progress)
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
b. **If "Review first":** Read and display the full plan file. Ask again: Execute, Modify, Skip.
|
|
142
|
-
|
|
143
|
-
c. **If "Execute":** Read and follow `references/execute-phase.md` **inline**
|
|
144
|
-
(do NOT spawn a subagent). Execute tasks one at a time.
|
|
145
|
-
|
|
146
|
-
d. **After each task:** Pause briefly. If the user intervenes (types anything), stop and address
|
|
147
|
-
their feedback before continuing. Otherwise proceed to next task.
|
|
148
|
-
|
|
149
|
-
e. **After plan complete:** Show results, commit, create SUMMARY.md, then present next plan.
|
|
150
|
-
|
|
151
|
-
3. After all plans: proceed to verification (same as normal mode).
|
|
152
|
-
|
|
153
|
-
**Benefits of interactive mode:**
|
|
154
|
-
- No subagent overhead — dramatically lower token usage
|
|
155
|
-
- User catches mistakes early — saves costly verification cycles
|
|
156
|
-
- Maintains the project's planning/tracking structure
|
|
157
|
-
- Best for: small phases, bug fixes, verification gaps, and learning the workflow
|
|
158
|
-
|
|
159
|
-
**Skip to handle_branching step** (interactive plans execute inline after grouping).
|
|
160
|
-
</step>
|
|
161
|
-
|
|
162
|
-
<step name="handle_branching">
|
|
163
|
-
Check `branching_strategy` from init:
|
|
164
|
-
|
|
165
|
-
**"none":** Skip, continue on current branch.
|
|
166
|
-
|
|
167
|
-
**"phase" or "milestone":** Use pre-computed `branch_name` from init:
|
|
168
|
-
```bash
|
|
169
|
-
git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
All subsequent commits go to this branch. User handles merging.
|
|
173
|
-
</step>
|
|
174
|
-
|
|
175
|
-
<step name="validate_phase">
|
|
176
|
-
From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
|
|
177
|
-
|
|
178
|
-
Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
|
|
179
|
-
|
|
180
|
-
**Update STATE.md for phase start:**
|
|
181
|
-
```bash
|
|
182
|
-
# (local impl)
|
|
183
|
-
```
|
|
184
|
-
This updates Status, Last Activity, Current focus, Current Position, and plan counts in STATE.md so frontmatter and body text reflect the active phase immediately.
|
|
185
|
-
</step>
|
|
186
|
-
|
|
187
|
-
<step name="discover_and_group_plans">
|
|
188
|
-
Load plan inventory with wave grouping in one call:
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
PLAN_INDEX=$(# (local impl)
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
|
|
195
|
-
|
|
196
|
-
**Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If `WAVE_FILTER` is set: also skip plans whose `wave` does not equal `WAVE_FILTER`.
|
|
197
|
-
|
|
198
|
-
**Wave safety check:** If `WAVE_FILTER` is set and there are still incomplete plans in any lower wave that match the current execution mode, STOP and tell the user to finish earlier waves first. Do not let Wave 2+ execute while prerequisite earlier-wave plans remain incomplete.
|
|
199
|
-
|
|
200
|
-
If all filtered: "No matching incomplete plans" → exit.
|
|
201
|
-
|
|
202
|
-
Report:
|
|
203
|
-
```
|
|
204
|
-
## Execution Plan
|
|
205
|
-
|
|
206
|
-
**Phase {X}: {Name}** — {total_plans} matching plans across {wave_count} wave(s)
|
|
207
|
-
|
|
208
|
-
{If WAVE_FILTER is set: `Wave filter active: executing only Wave {WAVE_FILTER}`.}
|
|
209
|
-
|
|
210
|
-
| Wave | Plans | What it builds |
|
|
211
|
-
|------|-------|----------------|
|
|
212
|
-
| 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
|
|
213
|
-
| 2 | 01-03 | ... |
|
|
214
|
-
```
|
|
215
|
-
</step>
|
|
216
|
-
|
|
217
|
-
<step name="execute_waves">
|
|
218
|
-
Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
|
|
219
|
-
|
|
220
|
-
**For each wave:**
|
|
221
|
-
|
|
222
|
-
1. **Intra-wave files_modified overlap check (BEFORE spawning):**
|
|
223
|
-
|
|
224
|
-
Before spawning any agents for this wave, inspect the `files_modified` list of all plans
|
|
225
|
-
in the wave. Check every pair of plans in the wave — if any two plans share even one file
|
|
226
|
-
in their `files_modified` lists, those plans have an implicit dependency and MUST NOT run
|
|
227
|
-
in parallel.
|
|
228
|
-
|
|
229
|
-
**Detection algorithm (pseudocode):**
|
|
230
|
-
```
|
|
231
|
-
seen_files = {}
|
|
232
|
-
overlapping_plans = []
|
|
233
|
-
for each plan in wave_plans:
|
|
234
|
-
for each file in plan.files_modified:
|
|
235
|
-
if file in seen_files:
|
|
236
|
-
overlapping_plans.add(plan, seen_files[file]) # both plans overlap on this file
|
|
237
|
-
else:
|
|
238
|
-
seen_files[file] = plan
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
**If overlap is detected:**
|
|
242
|
-
- Warn the user:
|
|
243
|
-
```
|
|
244
|
-
⚠ Intra-wave files_modified overlap detected in Wave {N}:
|
|
245
|
-
Plan {A} and Plan {B} both modify {file}
|
|
246
|
-
Running these plans sequentially to avoid parallel worktree conflicts.
|
|
247
|
-
```
|
|
248
|
-
- Override `PARALLELIZATION` to `false` for this wave only — run all plans in the wave
|
|
249
|
-
sequentially regardless of the global parallelization setting.
|
|
250
|
-
- This is a safety net for plans that were incorrectly assigned to the same wave.
|
|
251
|
-
The planner should have caught this; flag it as a planning defect so the user can
|
|
252
|
-
replan the phase if desired.
|
|
253
|
-
|
|
254
|
-
**If no overlap:** proceed normally (parallel if `PARALLELIZATION=true`).
|
|
255
|
-
|
|
256
|
-
2. **Describe what's being built (BEFORE spawning):**
|
|
257
|
-
|
|
258
|
-
Read each plan's `<objective>`. Extract what's being built and why.
|
|
259
|
-
|
|
260
|
-
```
|
|
261
|
-
---
|
|
262
|
-
## Wave {N}
|
|
263
|
-
|
|
264
|
-
**{Plan ID}: {Plan Name}**
|
|
265
|
-
{2-3 sentences: what this builds, technical approach, why it matters}
|
|
266
|
-
|
|
267
|
-
Spawning {count} agent(s)...
|
|
268
|
-
---
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
- Bad: "Executing terrain generation plan"
|
|
272
|
-
- Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
|
|
273
|
-
|
|
274
|
-
3. **Spawn executor agents:**
|
|
275
|
-
|
|
276
|
-
Pass paths only — executors read files themselves with their fresh context window.
|
|
277
|
-
For 200k models, this keeps orchestrator context lean (~10-15%).
|
|
278
|
-
For 1M+ models (Opus 4.6, Sonnet 4.6), richer context can be passed directly.
|
|
279
|
-
|
|
280
|
-
**Worktree mode** (`USE_WORKTREES` is not `false`):
|
|
281
|
-
|
|
282
|
-
Before spawning, capture the current HEAD:
|
|
283
|
-
```bash
|
|
284
|
-
EXPECTED_BASE=$(git rev-parse HEAD)
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
**Sequential dispatch for parallel execution (waves with 2+ agents):**
|
|
288
|
-
When spawning multiple agents in a wave, dispatch each `Task()` call **one at a time
|
|
289
|
-
with `run_in_background: true`** — do NOT send all Task calls in a single message.
|
|
290
|
-
`git worktree add` acquires an exclusive lock on `.git/config.lock`, so simultaneous
|
|
291
|
-
calls race for this lock and fail. Sequential dispatch ensures each worktree finishes
|
|
292
|
-
creation before the next begins (the round-trip latency of each tool call provides
|
|
293
|
-
natural spacing), while all agents still **run in parallel** once created.
|
|
294
|
-
|
|
295
|
-
```
|
|
296
|
-
# CORRECT: dispatch one Task() per message, each with run_in_background: true
|
|
297
|
-
# → worktrees created sequentially, agents execute in parallel
|
|
298
|
-
#
|
|
299
|
-
# WRONG: multiple Task() calls in a single message
|
|
300
|
-
# → simultaneous git worktree add → .git/config.lock contention → failures
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
```
|
|
304
|
-
Task(
|
|
305
|
-
,
|
|
306
|
-
description="Execute plan {plan_number} of phase {phase_number}",
|
|
307
|
-
model="{executor_model}",
|
|
308
|
-
isolation="worktree",
|
|
309
|
-
prompt="
|
|
310
|
-
<objective>
|
|
311
|
-
Execute plan {plan_number} of phase {phase_number}-{phase_name}.
|
|
312
|
-
Commit each task atomically. Create SUMMARY.md.
|
|
313
|
-
Do NOT update STATE.md or ROADMAP.md — the orchestrator owns those writes after all worktree agents in the wave complete.
|
|
314
|
-
</objective>
|
|
315
|
-
|
|
316
|
-
<worktree_branch_check>
|
|
317
|
-
FIRST ACTION before any other work: verify this worktree's branch is based on the correct commit.
|
|
318
|
-
|
|
319
|
-
Run:
|
|
320
|
-
```bash
|
|
321
|
-
ACTUAL_BASE=$(git merge-base HEAD {EXPECTED_BASE})
|
|
322
|
-
CURRENT_HEAD=$(git rev-parse HEAD)
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
If `ACTUAL_BASE` != `{EXPECTED_BASE}` (i.e. the worktree branch was created from an older
|
|
326
|
-
base such as `main` instead of the feature branch HEAD), rebase onto the correct base:
|
|
327
|
-
```bash
|
|
328
|
-
git rebase --onto {EXPECTED_BASE} $(git rev-parse --abbrev-ref HEAD~1 2>/dev/null || git rev-parse HEAD^) HEAD 2>/dev/null || true
|
|
329
|
-
# If rebase fails or is a no-op, reset the branch to start from the correct base:
|
|
330
|
-
git reset --soft {EXPECTED_BASE}
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
If `ACTUAL_BASE` == `{EXPECTED_BASE}`: the branch base is correct, proceed immediately.
|
|
334
|
-
|
|
335
|
-
This check fixes a known issue on Windows where `EnterWorktree` creates branches from
|
|
336
|
-
`main` instead of the current feature branch HEAD.
|
|
337
|
-
</worktree_branch_check>
|
|
338
|
-
|
|
339
|
-
<parallel_execution>
|
|
340
|
-
You are running as a PARALLEL executor agent. Use --no-verify on all git
|
|
341
|
-
commits to avoid pre-commit hook contention with other agents. The
|
|
342
|
-
orchestrator validates hooks once after all agents complete.
|
|
343
|
-
For git adds: add --no-verify flag.
|
|
344
|
-
For direct git commits: use git commit --no-verify -m "..."
|
|
345
|
-
</parallel_execution>
|
|
346
|
-
|
|
347
|
-
<execution_context>
|
|
348
|
-
@references/execute-phase.md
|
|
349
|
-
# SUMMARY.md template
|
|
350
|
-
# checkpoint handling
|
|
351
|
-
# task-level testing gate
|
|
352
|
-
</execution_context>
|
|
353
|
-
|
|
354
|
-
<task_testing_gate>
|
|
355
|
-
Before editing each code task, read its test strategy from the change list or plan.
|
|
356
|
-
Required fields: planned test command(s), execution test command placeholder, test files to add/update, and automation skip classification.
|
|
357
|
-
If any required testing field is missing, STOP and report the task blocked for change-list backfill.
|
|
358
|
-
|
|
359
|
-
Tests may be written before code (TDD) or incrementally with the implementation.
|
|
360
|
-
Do not defer task-level unit/integration/component/API tests to a final standalone test wave.
|
|
361
|
-
Before a task is committed or marked done:
|
|
362
|
-
- add/update the tests required by the task strategy, unless skip classification is acceptable or reviewed
|
|
363
|
-
- refine planning-level commands into execution-level commands precise enough to rerun changed tests
|
|
364
|
-
- run execution-level test commands and required build/codegen/mock/DI checks
|
|
365
|
-
- record test files, commands, results, and any skip classification in SUMMARY.md
|
|
366
|
-
|
|
367
|
-
Reject skip reasons such as "too busy", "later", "QA will test", or "manual check is enough" for logic/API/data/state/permission/compatibility/migration/job/external integration changes.
|
|
368
|
-
</task_testing_gate>
|
|
369
|
-
|
|
370
|
-
<files_to_read>
|
|
371
|
-
Read these files at execution start using the Read tool:
|
|
372
|
-
- {phase_dir}/{plan_file} (Plan — task descriptions, must_haves, file paths)
|
|
373
|
-
- .planning/PROJECT.md (Project context — core value, requirements, evolution rules)
|
|
374
|
-
- .planning/STATE.md (State)
|
|
375
|
-
- .planning/config.json (Config, if exists)
|
|
376
|
-
${CONTEXT_WINDOW >= 500000 ? `
|
|
377
|
-
- ${phase_dir}/*-CONTEXT.md (User decisions from discuss-phase — honors locked choices)
|
|
378
|
-
- ${phase_dir}/*-RESEARCH.md (Technical research — pitfalls and patterns to follow)
|
|
379
|
-
- ${prior_wave_summaries} (SUMMARY.md files from earlier waves in this phase — what was already built)
|
|
380
|
-
` : ''}
|
|
381
|
-
- ./AGENTS.md (Portable project instructions, if present)
|
|
382
|
-
- ./.omp/AGENTS.md (OMP-specific execution contract)
|
|
383
|
-
- OMP-discovered project skills (list relevant `skill://<name>` resources and follow only those needed for implementation)
|
|
384
|
-
|
|
385
|
-
### Spec Resolution (MANDATORY — follow the index chain, do not hardcode paths)
|
|
386
|
-
|
|
387
|
-
Spec file locations are discovered through `.context/spec/index.md`, not guessed.
|
|
388
|
-
The index is the project's registry of where specs live; paths vary per project.
|
|
389
|
-
|
|
390
|
-
1. Read `.context/spec/index.md` — this is the SINGLE entry point:
|
|
391
|
-
- "Read Order" section → tells you the resolution priority
|
|
392
|
-
- "Stack Specs" table → maps each codebase (BACKEND, FRONTEND, etc.) to its stack spec path
|
|
393
|
-
- "Codebase Specs" table → maps each codebase to its codebase spec and navigation path
|
|
394
|
-
- "Detailed Spec Packages" table → maps each domain to its index and detailed spec files
|
|
395
|
-
|
|
396
|
-
2. For the files you are about to modify, identify which codebase they belong to (e.g., FRONTEND or BACKEND).
|
|
397
|
-
|
|
398
|
-
3. Resolve through the index:
|
|
399
|
-
- Stack spec → from "Stack Specs" table, column "Spec"
|
|
400
|
-
- Codebase spec → from "Codebase Specs" table, column "Spec"
|
|
401
|
-
- Domain index → from "Detailed Spec Packages" table (e.g., `.context/spec/backend/index.md`)
|
|
402
|
-
- Then read the relevant detailed specs listed in the domain index (e.g., service.md, router.md, model.md)
|
|
403
|
-
|
|
404
|
-
4. At minimum, read the stack spec and codebase spec. If the change list specifies "适用规范" per task, read those specific files too.
|
|
405
|
-
|
|
406
|
-
Example: modifying a Python backend service file →
|
|
407
|
-
1. `.context/spec/index.md` → BACKEND uses stack `python-fastapi-pydantic2-sqlalchemy-playwright` and codebase spec `.context/spec/backend/BACKEND.md`
|
|
408
|
-
2. `.context/spec/stacks/python-fastapi-pydantic2-sqlalchemy-playwright.md` — stack conventions
|
|
409
|
-
3. `.context/spec/backend/BACKEND.md` — project-specific conventions
|
|
410
|
-
4. `.context/spec/backend/index.md` → lists service.md, errors.md, etc.
|
|
411
|
-
5. `.context/spec/backend/service.md` + `.context/spec/backend/errors.md` — layer-specific MUST/SHOULD rules
|
|
412
|
-
</files_to_read>
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
<mcp_tools>
|
|
417
|
-
If project instructions reference MCP tools (e.g. jCodeMunch, context7,
|
|
418
|
-
or other MCP servers), prefer those tools over Grep/Glob for code navigation when available.
|
|
419
|
-
MCP tools often save significant tokens by providing structured code indexes.
|
|
420
|
-
Check tool availability first — if MCP tools are not accessible, fall back to Grep/Glob.
|
|
421
|
-
</mcp_tools>
|
|
422
|
-
|
|
423
|
-
<success_criteria>
|
|
424
|
-
- [ ] All tasks executed
|
|
425
|
-
- [ ] Each code task has task-level test evidence or an accepted/reviewed skip classification
|
|
426
|
-
- [ ] Execution-level test commands were recorded and passed
|
|
427
|
-
- [ ] Each task committed individually
|
|
428
|
-
- [ ] SUMMARY.md created in plan directory
|
|
429
|
-
</success_criteria>
|
|
430
|
-
"
|
|
431
|
-
)
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
**Sequential mode** (`USE_WORKTREES` is `false`):
|
|
435
|
-
|
|
436
|
-
Omit `isolation="worktree"` from the Task call. Replace the `<parallel_execution>` block with:
|
|
437
|
-
|
|
438
|
-
```
|
|
439
|
-
<sequential_execution>
|
|
440
|
-
You are running as a SEQUENTIAL executor agent on the main working tree.
|
|
441
|
-
Use normal git commits (with hooks). Do NOT use --no-verify.
|
|
442
|
-
</sequential_execution>
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
The sequential mode Task prompt uses the same structure as worktree mode but with these differences in success_criteria — since there is only one agent writing at a time, there are no shared-file conflicts:
|
|
446
|
-
|
|
447
|
-
```
|
|
448
|
-
<success_criteria>
|
|
449
|
-
- [ ] All tasks executed
|
|
450
|
-
- [ ] Each code task has task-level test evidence or an accepted/reviewed skip classification
|
|
451
|
-
- [ ] Execution-level test commands were recorded and passed
|
|
452
|
-
- [ ] Each task committed individually
|
|
453
|
-
- [ ] SUMMARY.md created in plan directory
|
|
454
|
-
- [ ] STATE.md updated with position and decisions
|
|
455
|
-
- [ ] ROADMAP.md updated with plan progress (via `roadmap update-plan-progress`)
|
|
456
|
-
</success_criteria>
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
When worktrees are disabled, execute plans **one at a time within each wave** (sequential) regardless of the `PARALLELIZATION` setting — multiple agents writing to the same working tree concurrently would cause conflicts.
|
|
460
|
-
|
|
461
|
-
4. **Wait for all agents in wave to complete.**
|
|
462
|
-
|
|
463
|
-
**Completion evidence fallback:**
|
|
464
|
-
|
|
465
|
-
If a spawned agent does not return a completion signal but appears to have finished
|
|
466
|
-
its work, do NOT block indefinitely. Instead, verify completion via spot-checks:
|
|
467
|
-
|
|
468
|
-
```bash
|
|
469
|
-
# For each plan in this wave, check if the executor finished:
|
|
470
|
-
SUMMARY_EXISTS=$(test -f "{phase_dir}/{plan_number}-{plan_padded}-SUMMARY.md" && echo "true" || echo "false")
|
|
471
|
-
COMMITS_FOUND=$(git log --oneline --all --grep="{phase_number}-{plan_padded}" --since="1 hour ago" | head -1)
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
**If SUMMARY.md exists AND commits are found:** The agent completed successfully —
|
|
475
|
-
treat as done and proceed to step 5. Log: `"✓ {Plan ID} completed (verified via spot-check — completion signal not received)"`
|
|
476
|
-
|
|
477
|
-
**If SUMMARY.md does NOT exist after a reasonable wait:** The agent may still be
|
|
478
|
-
running or may have failed silently. Check `git log --oneline -5` for recent
|
|
479
|
-
activity. If commits are still appearing, wait longer. If no activity, report
|
|
480
|
-
the plan as failed and route to the failure handler in step 6.
|
|
481
|
-
|
|
482
|
-
Apply this fallback whenever an OMP task result is interrupted or ambiguous.
|
|
483
|
-
|
|
484
|
-
5. **Post-wave hook validation (parallel mode only):**
|
|
485
|
-
|
|
486
|
-
When agents committed with `--no-verify`, run pre-commit hooks once after the wave:
|
|
487
|
-
```bash
|
|
488
|
-
# Run project's pre-commit hooks on the current state
|
|
489
|
-
git diff --cached --quiet || git stash # stash any unstaged changes
|
|
490
|
-
git hook run pre-commit 2>&1 || echo "⚠ Pre-commit hooks failed — review before continuing"
|
|
491
|
-
```
|
|
492
|
-
If hooks fail: report the failure and ask "Fix hook issues now?" or "Continue to next wave?"
|
|
493
|
-
|
|
494
|
-
5.5. **Worktree cleanup (when `isolation="worktree"` was used):**
|
|
495
|
-
|
|
496
|
-
When executor agents ran in worktree isolation, their commits land on temporary branches in separate working trees. After the wave completes, merge these changes back and clean up:
|
|
497
|
-
|
|
498
|
-
```bash
|
|
499
|
-
# List worktrees created by this wave's agents
|
|
500
|
-
WORKTREES=$(git worktree list --porcelain | grep "^worktree " | grep -v "$(pwd)$" | sed 's/^worktree //')
|
|
501
|
-
|
|
502
|
-
for WT in $WORKTREES; do
|
|
503
|
-
# Get the branch name for this worktree
|
|
504
|
-
WT_BRANCH=$(git -C "$WT" rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
505
|
-
if [ -n "$WT_BRANCH" ] && [ "$WT_BRANCH" != "HEAD" ]; then
|
|
506
|
-
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
507
|
-
|
|
508
|
-
# --- Orchestrator file protection (#1756) ---
|
|
509
|
-
# Snapshot orchestrator-owned files BEFORE merge. If the worktree
|
|
510
|
-
# branch outlived a milestone transition, its versions of STATE.md
|
|
511
|
-
# and ROADMAP.md are stale. Main always wins for these files.
|
|
512
|
-
STATE_BACKUP=$(mktemp)
|
|
513
|
-
ROADMAP_BACKUP=$(mktemp)
|
|
514
|
-
git show HEAD:.planning/STATE.md > "$STATE_BACKUP" 2>/dev/null || true
|
|
515
|
-
git show HEAD:.planning/ROADMAP.md > "$ROADMAP_BACKUP" 2>/dev/null || true
|
|
516
|
-
|
|
517
|
-
# Snapshot list of files on main BEFORE merge to detect resurrections
|
|
518
|
-
PRE_MERGE_FILES=$(git ls-files .planning/)
|
|
519
|
-
|
|
520
|
-
# Merge the worktree branch into the current branch
|
|
521
|
-
git merge "$WT_BRANCH" --no-edit -m "chore: merge executor worktree ($WT_BRANCH)" 2>&1 || {
|
|
522
|
-
echo "⚠ Merge conflict from worktree $WT_BRANCH — resolve manually"
|
|
523
|
-
rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
|
|
524
|
-
continue
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
# Restore orchestrator-owned files (main always wins)
|
|
528
|
-
if [ -s "$STATE_BACKUP" ]; then
|
|
529
|
-
cp "$STATE_BACKUP" .planning/STATE.md
|
|
530
|
-
fi
|
|
531
|
-
if [ -s "$ROADMAP_BACKUP" ]; then
|
|
532
|
-
cp "$ROADMAP_BACKUP" .planning/ROADMAP.md
|
|
533
|
-
fi
|
|
534
|
-
rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
|
|
535
|
-
|
|
536
|
-
# Detect files deleted on main but re-added by worktree merge
|
|
537
|
-
# (e.g., archived phase directories that were intentionally removed)
|
|
538
|
-
DELETED_FILES=$(git diff --diff-filter=A --name-only HEAD~1 -- .planning/ 2>/dev/null || true)
|
|
539
|
-
for RESURRECTED in $DELETED_FILES; do
|
|
540
|
-
# Check if this file was NOT in main's pre-merge tree
|
|
541
|
-
if ! echo "$PRE_MERGE_FILES" | grep -qxF "$RESURRECTED"; then
|
|
542
|
-
git rm -f "$RESURRECTED" 2>/dev/null || true
|
|
543
|
-
fi
|
|
544
|
-
done
|
|
545
|
-
|
|
546
|
-
# Amend merge commit with restored files if any changed
|
|
547
|
-
if ! git diff --quiet .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || \
|
|
548
|
-
[ -n "$DELETED_FILES" ]; then
|
|
549
|
-
# Only amend the commit with .planning/ files if commit_docs is enabled (#1783)
|
|
550
|
-
COMMIT_DOCS=$(# (local impl)
|
|
551
|
-
if [ "$COMMIT_DOCS" != "false" ]; then
|
|
552
|
-
git add .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || true
|
|
553
|
-
git commit --amend --no-edit 2>/dev/null || true
|
|
554
|
-
fi
|
|
555
|
-
fi
|
|
556
|
-
|
|
557
|
-
# Remove the worktree
|
|
558
|
-
git worktree remove "$WT" --force 2>/dev/null || true
|
|
559
|
-
|
|
560
|
-
# Delete the temporary branch
|
|
561
|
-
git branch -D "$WT_BRANCH" 2>/dev/null || true
|
|
562
|
-
fi
|
|
563
|
-
done
|
|
564
|
-
```
|
|
565
|
-
|
|
566
|
-
**If `workflow.use_worktrees` is `false`:** Agents ran on main working tree — skip this step entirely.
|
|
567
|
-
|
|
568
|
-
**If no worktrees found:** Skip silently — agents may have been spawned without worktree isolation.
|
|
569
|
-
|
|
570
|
-
5.6. **Post-wave shared artifact update (worktree mode only):**
|
|
571
|
-
|
|
572
|
-
When executor agents ran with `isolation="worktree"`, they skipped STATE.md and ROADMAP.md updates to avoid last-merge-wins overwrites. The orchestrator is the single writer for these files. After worktrees are merged back, update shared artifacts once:
|
|
573
|
-
|
|
574
|
-
```bash
|
|
575
|
-
# Update ROADMAP.md for each completed plan in this wave
|
|
576
|
-
for PLAN_ID in ${WAVE_PLAN_IDS}; do
|
|
577
|
-
# (local impl)
|
|
578
|
-
done
|
|
579
|
-
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
Where `WAVE_PLAN_IDS` is the space-separated list of plan IDs that completed in this wave.
|
|
583
|
-
|
|
584
|
-
**If `workflow.use_worktrees` is `false`:** Sequential agents already updated STATE.md and ROADMAP.md themselves — skip this step.
|
|
585
|
-
|
|
586
|
-
6. **Report completion — spot-check claims first:**
|
|
587
|
-
|
|
588
|
-
For each SUMMARY.md:
|
|
589
|
-
- Verify first 2 files from `key-files.created` exist on disk
|
|
590
|
-
- Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
|
|
591
|
-
- Check for `## Self-Check: FAILED` marker
|
|
592
|
-
- Check for task-level test evidence: execution-level command(s), result(s), and test files changed, or an accepted/reviewed automation skip classification
|
|
593
|
-
|
|
594
|
-
If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
|
|
595
|
-
|
|
596
|
-
If pass:
|
|
597
|
-
```
|
|
598
|
-
---
|
|
599
|
-
## Wave {N} Complete
|
|
600
|
-
|
|
601
|
-
**{Plan ID}: {Plan Name}**
|
|
602
|
-
{What was built — from SUMMARY.md}
|
|
603
|
-
{Notable deviations, if any}
|
|
604
|
-
|
|
605
|
-
{If more waves: what this enables for next wave}
|
|
606
|
-
---
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
- Bad: "Wave 2 complete. Proceeding to Wave 3."
|
|
610
|
-
- Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
|
|
611
|
-
|
|
612
|
-
7. **Handle failures:**
|
|
613
|
-
|
|
614
|
-
Report which plan failed → ask "Continue?" or "Stop?" → if continue, dependent plans may also fail. If stop, provide a partial completion report.
|
|
615
|
-
|
|
616
|
-
7b. **Pre-wave dependency check (waves 2+ only):**
|
|
617
|
-
|
|
618
|
-
Before spawning wave N+1, for each plan in the upcoming wave:
|
|
619
|
-
```bash
|
|
620
|
-
# (local impl)
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
If any key-link from a PRIOR wave's artifact fails verification:
|
|
624
|
-
|
|
625
|
-
## Cross-Plan Wiring Gap
|
|
626
|
-
|
|
627
|
-
| Plan | Link | From | Expected Pattern | Status |
|
|
628
|
-
|------|------|------|-----------------|--------|
|
|
629
|
-
| {plan} | {via} | {from} | {pattern} | NOT FOUND |
|
|
630
|
-
|
|
631
|
-
Wave {N} artifacts may not be properly wired. Options:
|
|
632
|
-
1. Investigate and fix before continuing
|
|
633
|
-
2. Continue (may cause cascading failures in wave {N+1})
|
|
634
|
-
|
|
635
|
-
Key-links referencing files in the CURRENT (upcoming) wave are skipped.
|
|
636
|
-
|
|
637
|
-
8. **Execute checkpoint plans between waves** — see `<checkpoint_handling>`.
|
|
638
|
-
|
|
639
|
-
9. **Proceed to next wave.**
|
|
640
|
-
</step>
|
|
641
|
-
|
|
642
|
-
<step name="checkpoint_handling">
|
|
643
|
-
Plans with `autonomous: false` require user interaction.
|
|
644
|
-
|
|
645
|
-
**Auto-mode checkpoint handling:**
|
|
646
|
-
|
|
647
|
-
Read auto-advance config (chain flag + user preference):
|
|
648
|
-
```bash
|
|
649
|
-
AUTO_CHAIN=$(# (local impl)
|
|
650
|
-
AUTO_CFG=$(# (local impl)
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
When executor returns a checkpoint AND (`AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`):
|
|
654
|
-
- **human-verify** → Auto-spawn continuation agent with `{user_response}` = `"approved"`. Log `⚡ Auto-approved checkpoint`.
|
|
655
|
-
- **decision** → Auto-spawn continuation agent with `{user_response}` = first option from checkpoint details. Log `⚡ Auto-selected: [option]`.
|
|
656
|
-
- **human-action** → Present to user (existing behavior below). Auth gates cannot be automated.
|
|
657
|
-
|
|
658
|
-
**Standard flow (not auto-mode, or human-action type):**
|
|
659
|
-
|
|
660
|
-
1. Spawn agent for checkpoint plan
|
|
661
|
-
2. Agent runs until checkpoint task or auth gate → returns structured state
|
|
662
|
-
3. Agent return includes: completed tasks table, current task + blocker, checkpoint type/details, what's awaited
|
|
663
|
-
4. **Present to user:**
|
|
664
|
-
```
|
|
665
|
-
## Checkpoint: [Type]
|
|
666
|
-
|
|
667
|
-
**Plan:** 03-03 Dashboard Layout
|
|
668
|
-
**Progress:** 2/3 tasks complete
|
|
669
|
-
|
|
670
|
-
[Checkpoint Details from agent return]
|
|
671
|
-
[Awaiting section from agent return]
|
|
672
|
-
```
|
|
673
|
-
5. User responds: "approved"/"done" | issue description | decision selection
|
|
674
|
-
6. **Spawn continuation agent (NOT resume)** using continuation-prompt.md template:
|
|
675
|
-
- `{completed_tasks_table}`: From checkpoint return
|
|
676
|
-
- `{resume_task_number}` + `{resume_task_name}`: Current task
|
|
677
|
-
- `{user_response}`: What user provided
|
|
678
|
-
- `{resume_instructions}`: Based on checkpoint type
|
|
679
|
-
7. Continuation agent verifies previous commits, continues from resume point
|
|
680
|
-
8. Repeat until plan completes or user stops
|
|
681
|
-
|
|
682
|
-
**Why fresh agent, not resume:** Resume relies on internal serialization that breaks with parallel tool calls. Fresh agents with explicit state are more reliable.
|
|
683
|
-
|
|
684
|
-
**Checkpoints in parallel waves:** Agent pauses and returns while other parallel agents may complete. Present checkpoint, spawn continuation, wait for all before next wave.
|
|
685
|
-
</step>
|
|
686
|
-
|
|
687
|
-
<step name="aggregate_results">
|
|
688
|
-
After all waves:
|
|
689
|
-
|
|
690
|
-
```markdown
|
|
691
|
-
## Phase {X}: {Name} Execution Complete
|
|
692
|
-
|
|
693
|
-
**Waves:** {N} | **Plans:** {M}/{total} complete
|
|
694
|
-
|
|
695
|
-
| Wave | Plans | Status |
|
|
696
|
-
|------|-------|--------|
|
|
697
|
-
| 1 | plan-01, plan-02 | ✓ Complete |
|
|
698
|
-
| CP | plan-03 | ✓ Verified |
|
|
699
|
-
| 2 | plan-04 | ✓ Complete |
|
|
700
|
-
|
|
701
|
-
### Plan Details
|
|
702
|
-
1. **03-01**: [one-liner from SUMMARY.md]
|
|
703
|
-
2. **03-02**: [one-liner from SUMMARY.md]
|
|
704
|
-
|
|
705
|
-
### Issues Encountered
|
|
706
|
-
[Aggregate from SUMMARYs, or "None"]
|
|
707
|
-
```
|
|
708
|
-
|
|
709
|
-
**Security gate check:**
|
|
710
|
-
```bash
|
|
711
|
-
SECURITY_CFG=$(# (local impl)
|
|
712
|
-
SECURITY_FILE=$(ls "${PHASE_DIR}"/*-SECURITY.md 2>/dev/null | head -1)
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
If `SECURITY_CFG` is `false`: skip.
|
|
716
|
-
|
|
717
|
-
If `SECURITY_CFG` is `true` AND `SECURITY_FILE` is empty (no SECURITY.md yet):
|
|
718
|
-
Include in the next-steps routing output:
|
|
719
|
-
```
|
|
720
|
-
⚠ Security enforcement enabled — run before advancing:
|
|
721
|
-
|
|
722
|
-
```
|
|
723
|
-
|
|
724
|
-
If `SECURITY_CFG` is `true` AND SECURITY.md exists: check frontmatter `threats_open`. If > 0:
|
|
725
|
-
```
|
|
726
|
-
⚠ Security gate: {threats_open} threats open
|
|
727
|
-
|
|
728
|
-
```
|
|
729
|
-
</step>
|
|
730
|
-
|
|
731
|
-
<step name="handle_partial_wave_execution">
|
|
732
|
-
If `WAVE_FILTER` was used, re-run plan discovery after execution:
|
|
733
|
-
|
|
734
|
-
```bash
|
|
735
|
-
POST_PLAN_INDEX=$(# (local impl)
|
|
736
|
-
```
|
|
737
|
-
|
|
738
|
-
Apply the same "incomplete" filtering rules as earlier:
|
|
739
|
-
- ignore plans with `has_summary: true`
|
|
740
|
-
- if `--gaps-only`, only consider `gap_closure: true` plans
|
|
741
|
-
|
|
742
|
-
**If incomplete plans still remain anywhere in the phase:**
|
|
743
|
-
- STOP here
|
|
744
|
-
- Do NOT run phase verification
|
|
745
|
-
- Do NOT mark the phase complete in ROADMAP/STATE
|
|
746
|
-
- Present:
|
|
747
|
-
|
|
748
|
-
```markdown
|
|
749
|
-
## Wave {WAVE_FILTER} Complete
|
|
750
|
-
|
|
751
|
-
Selected wave finished successfully. This phase still has incomplete plans, so phase-level verification and completion were intentionally skipped.
|
|
752
|
-
|
|
753
|
-
/workflow-execute-phase {phase} ${GSD_WS} # Continue remaining waves
|
|
754
|
-
/workflow-execute-phase {phase} --wave {next} ${GSD_WS} # Run the next wave explicitly
|
|
755
|
-
```
|
|
756
|
-
|
|
757
|
-
**If no incomplete plans remain after the selected wave finishes:**
|
|
758
|
-
- continue with the normal phase-level verification and completion flow below
|
|
759
|
-
- this means the selected wave happened to be the last remaining work in the phase
|
|
760
|
-
</step>
|
|
761
|
-
|
|
762
|
-
<step name="code_review_gate" required="true">
|
|
763
|
-
Code review is a separate workflow step in `feature-development.yaml`.
|
|
764
|
-
|
|
765
|
-
Do not invoke `code-review` from inside `workflow-execute-phase`; doing so duplicates the post-execute review gate and can produce conflicting `REVIEW.md` results.
|
|
766
|
-
|
|
767
|
-
Before returning from execute, ensure the execution outputs required by the downstream `code-review` step exist:
|
|
768
|
-
|
|
769
|
-
- `.planning/features/{feature}/PROGRESS.md`
|
|
770
|
-
- `.planning/phases/{phase}/SUMMARY.md`
|
|
771
|
-
|
|
772
|
-
The orchestrator will run `code-review` after `execute` and before `verify`.
|
|
773
|
-
</step>
|
|
774
|
-
|
|
775
|
-
<step name="close_parent_artifacts">
|
|
776
|
-
**For decimal/polish phases only (X.Y pattern):** Close the feedback loop by resolving parent UAT and debug artifacts.
|
|
777
|
-
|
|
778
|
-
**Skip if** phase number has no decimal (e.g., `3`, `04`) — only applies to gap-closure phases like `4.1`, `03.1`.
|
|
779
|
-
|
|
780
|
-
**1. Detect decimal phase and derive parent:**
|
|
781
|
-
```bash
|
|
782
|
-
# Check if phase_number contains a decimal
|
|
783
|
-
if [[ "$PHASE_NUMBER" == *.* ]]; then
|
|
784
|
-
PARENT_PHASE="${PHASE_NUMBER%%.*}"
|
|
785
|
-
fi
|
|
786
|
-
```
|
|
787
|
-
|
|
788
|
-
**2. Find parent UAT file:**
|
|
789
|
-
```bash
|
|
790
|
-
PARENT_INFO=$(# (local impl)
|
|
791
|
-
# Extract directory from PARENT_INFO JSON, then find UAT file in that directory
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
**If no parent UAT found:** Skip this step (gap-closure may have been triggered by VERIFICATION.md instead).
|
|
795
|
-
|
|
796
|
-
**3. Update UAT gap statuses:**
|
|
797
|
-
|
|
798
|
-
Read the parent UAT file's `## Gaps` section. For each gap entry with `status: failed`:
|
|
799
|
-
- Update to `status: resolved`
|
|
800
|
-
|
|
801
|
-
**4. Update UAT frontmatter:**
|
|
802
|
-
|
|
803
|
-
If all gaps now have `status: resolved`:
|
|
804
|
-
- Update frontmatter `status: diagnosed` → `status: resolved`
|
|
805
|
-
- Update frontmatter `updated:` timestamp
|
|
806
|
-
|
|
807
|
-
**5. Resolve referenced debug sessions:**
|
|
808
|
-
|
|
809
|
-
For each gap that has a `debug_session:` field:
|
|
810
|
-
- Read the debug session file
|
|
811
|
-
- Update frontmatter `status:` → `resolved`
|
|
812
|
-
- Update frontmatter `updated:` timestamp
|
|
813
|
-
- Move to resolved directory:
|
|
814
|
-
```bash
|
|
815
|
-
mkdir -p .planning/debug/resolved
|
|
816
|
-
mv .planning/debug/{slug}.md .planning/debug/resolved/
|
|
817
|
-
```
|
|
818
|
-
|
|
819
|
-
**6. Commit updated artifacts:**
|
|
820
|
-
```bash
|
|
821
|
-
# (local impl)
|
|
822
|
-
```
|
|
823
|
-
</step>
|
|
824
|
-
|
|
825
|
-
<step name="regression_gate">
|
|
826
|
-
Run prior phases' test suites to catch cross-phase regressions BEFORE verification.
|
|
827
|
-
|
|
828
|
-
**Skip if:** This is the first phase (no prior phases), or no prior VERIFICATION.md files exist.
|
|
829
|
-
|
|
830
|
-
**Step 1: Discover prior phases' test files**
|
|
831
|
-
```bash
|
|
832
|
-
# Find all VERIFICATION.md files from prior phases in current milestone
|
|
833
|
-
PRIOR_VERIFICATIONS=$(find .planning/phases/ -name "*-VERIFICATION.md" ! -path "*${PHASE_NUMBER}*" 2>/dev/null)
|
|
834
|
-
```
|
|
835
|
-
|
|
836
|
-
**Step 2: Extract test file lists from prior verifications**
|
|
837
|
-
|
|
838
|
-
For each VERIFICATION.md found, look for test file references:
|
|
839
|
-
- Lines containing `test`, `spec`, or `__tests__` paths
|
|
840
|
-
- The "Test Suite" or "Automated Checks" section
|
|
841
|
-
- File patterns from `key-files.created` in corresponding SUMMARY.md files that match `*.test.*` or `*.spec.*`
|
|
842
|
-
|
|
843
|
-
Collect all unique test file paths into `REGRESSION_FILES`.
|
|
844
|
-
|
|
845
|
-
**Step 3: Run regression tests (if any found)**
|
|
846
|
-
|
|
847
|
-
```bash
|
|
848
|
-
# Detect test runner and run prior phase tests
|
|
849
|
-
if [ -f "package.json" ]; then
|
|
850
|
-
# Node.js — use project's test runner
|
|
851
|
-
npx jest ${REGRESSION_FILES} --passWithNoTests --no-coverage -q 2>&1 || npx vitest run ${REGRESSION_FILES} 2>&1
|
|
852
|
-
elif [ -f "Cargo.toml" ]; then
|
|
853
|
-
cargo test 2>&1
|
|
854
|
-
elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
|
|
855
|
-
python -m pytest ${REGRESSION_FILES} -q --tb=short 2>&1
|
|
856
|
-
fi
|
|
857
|
-
```
|
|
858
|
-
|
|
859
|
-
**Step 4: Report results**
|
|
860
|
-
|
|
861
|
-
If all tests pass:
|
|
862
|
-
```
|
|
863
|
-
✓ Regression gate: {N} prior-phase test files passed — no regressions detected
|
|
864
|
-
```
|
|
865
|
-
→ Proceed to verify_phase_goal
|
|
866
|
-
|
|
867
|
-
If any tests fail:
|
|
868
|
-
```
|
|
869
|
-
## ⚠ Cross-Phase Regression Detected
|
|
870
|
-
|
|
871
|
-
Phase {X} execution may have broken functionality from prior phases.
|
|
872
|
-
|
|
873
|
-
| Test File | Phase | Status | Detail |
|
|
874
|
-
|-----------|-------|--------|--------|
|
|
875
|
-
| {file} | {origin_phase} | FAILED | {first_failure_line} |
|
|
876
|
-
|
|
877
|
-
Options:
|
|
878
|
-
1. Fix regressions before verification (recommended)
|
|
879
|
-
2. Continue to verification anyway (regressions will compound)
|
|
880
|
-
3. Abort phase — roll back and re-plan
|
|
881
|
-
```
|
|
882
|
-
|
|
883
|
-
Use ask to present the options.
|
|
884
|
-
</step>
|
|
885
|
-
|
|
886
|
-
<step name="schema_drift_gate">
|
|
887
|
-
Post-execution schema drift detection. Catches false-positive verification where
|
|
888
|
-
build/types pass because TypeScript types come from config, not the live database.
|
|
889
|
-
|
|
890
|
-
**Run after execution completes but BEFORE verification marks success.**
|
|
891
|
-
|
|
892
|
-
```bash
|
|
893
|
-
SCHEMA_DRIFT=$(# (local impl)
|
|
894
|
-
```
|
|
895
|
-
|
|
896
|
-
Parse JSON result for: `drift_detected`, `blocking`, `schema_files`, `orms`, `unpushed_orms`, `message`.
|
|
897
|
-
|
|
898
|
-
**If `drift_detected` is false:** Skip to verify_phase_goal.
|
|
899
|
-
|
|
900
|
-
**If `drift_detected` is true AND `blocking` is true:**
|
|
901
|
-
|
|
902
|
-
Check for override:
|
|
903
|
-
```bash
|
|
904
|
-
SKIP_SCHEMA=$(echo "${GSD_SKIP_SCHEMA_CHECK:-false}")
|
|
905
|
-
```
|
|
906
|
-
|
|
907
|
-
**If `SKIP_SCHEMA` is `true`:**
|
|
908
|
-
|
|
909
|
-
Display:
|
|
910
|
-
```
|
|
911
|
-
⚠ Schema drift detected but GSD_SKIP_SCHEMA_CHECK=true — bypassing gate.
|
|
912
|
-
|
|
913
|
-
Schema files changed: {schema_files}
|
|
914
|
-
ORMs requiring push: {unpushed_orms}
|
|
915
|
-
|
|
916
|
-
Proceeding to verification (database may be out of sync).
|
|
917
|
-
```
|
|
918
|
-
→ Continue to verify_phase_goal.
|
|
919
|
-
|
|
920
|
-
**If `SKIP_SCHEMA` is not `true`:**
|
|
921
|
-
|
|
922
|
-
BLOCK verification. Display:
|
|
923
|
-
|
|
924
|
-
```
|
|
925
|
-
## BLOCKED: Schema Drift Detected
|
|
926
|
-
|
|
927
|
-
Schema-relevant files changed during this phase but no database push command
|
|
928
|
-
was executed. Build and type checks pass because TypeScript types come from
|
|
929
|
-
config, not the live database — verification would produce a false positive.
|
|
930
|
-
|
|
931
|
-
Schema files changed: {schema_files}
|
|
932
|
-
ORMs requiring push: {unpushed_orms}
|
|
933
|
-
|
|
934
|
-
Required push commands:
|
|
935
|
-
{For each unpushed ORM, show the push command from the message}
|
|
936
|
-
|
|
937
|
-
Options:
|
|
938
|
-
1. Run push command now (recommended) — execute the push, then re-verify
|
|
939
|
-
2. Skip schema check (GSD_SKIP_SCHEMA_CHECK=true) — bypass this gate
|
|
940
|
-
3. Abort — stop execution and investigate
|
|
941
|
-
```
|
|
942
|
-
|
|
943
|
-
If `TEXT_MODE` is true, present as a plain-text numbered list. Otherwise use ask.
|
|
944
|
-
|
|
945
|
-
**If user selects option 1:** Present the specific push command(s) to run. After user confirms execution, re-run the schema drift check. If it passes, continue to verify_phase_goal.
|
|
946
|
-
|
|
947
|
-
**If user selects option 2:** Set override and continue to verify_phase_goal.
|
|
948
|
-
|
|
949
|
-
**If user selects option 3:** Stop execution. Report partial completion.
|
|
950
|
-
</step>
|
|
951
|
-
|
|
952
|
-
<step name="verify_phase_goal">
|
|
953
|
-
Verify phase achieved its GOAL, not just completed tasks.
|
|
954
|
-
|
|
955
|
-
```bash
|
|
956
|
-
VERIFIER_SKILLS=$(# (local impl)
|
|
957
|
-
```
|
|
958
|
-
|
|
959
|
-
```
|
|
960
|
-
Task(
|
|
961
|
-
description="Verify phase {phase_number} goal achievement",
|
|
962
|
-
prompt="Verify phase {phase_number} goal achievement.
|
|
963
|
-
Phase directory: {phase_dir}
|
|
964
|
-
Phase goal: {goal from ROADMAP.md}
|
|
965
|
-
Phase requirement IDs: {phase_req_ids}
|
|
966
|
-
Check must_haves against actual codebase.
|
|
967
|
-
Cross-reference requirement IDs from PLAN frontmatter against REQUIREMENTS.md — every ID MUST be accounted for.
|
|
968
|
-
Create VERIFICATION.md.
|
|
969
|
-
|
|
970
|
-
<files_to_read>
|
|
971
|
-
Read these files before verification:
|
|
972
|
-
- {phase_dir}/*-PLAN.md (All plans — understand intent, check must_haves)
|
|
973
|
-
- {phase_dir}/*-SUMMARY.md (All summaries — cross-reference claimed vs actual)
|
|
974
|
-
- .planning/REQUIREMENTS.md (Requirement traceability)
|
|
975
|
-
- .context/spec/index.md (Spec registry — resolve stack spec, codebase spec, and domain specs through the index chain)
|
|
976
|
-
${CONTEXT_WINDOW >= 500000 ? `- {phase_dir}/*-CONTEXT.md (User decisions — verify they were honored)
|
|
977
|
-
- {phase_dir}/*-RESEARCH.md (Known pitfalls — check for traps)
|
|
978
|
-
- Prior VERIFICATION.md files from earlier phases (regression check)
|
|
979
|
-
` : ''}
|
|
980
|
-
</files_to_read>
|
|
981
|
-
|
|
982
|
-
",
|
|
983
|
-
,
|
|
984
|
-
model="{verifier_model}"
|
|
985
|
-
)
|
|
986
|
-
```
|
|
987
|
-
|
|
988
|
-
Read status:
|
|
989
|
-
```bash
|
|
990
|
-
grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
|
|
991
|
-
```
|
|
992
|
-
|
|
993
|
-
| Status | Action |
|
|
994
|
-
|--------|--------|
|
|
995
|
-
| `passed` | → update_roadmap |
|
|
996
|
-
| `human_needed` | Present items for human testing, get approval or feedback |
|
|
997
|
-
| `gaps_found` | Present gap summary, offer `/workflow-pipeline {phase} --gaps ${GSD_WS}` |
|
|
998
|
-
|
|
999
|
-
**If human_needed:**
|
|
1000
|
-
|
|
1001
|
-
**Step A: Persist human verification items as UAT file.**
|
|
1002
|
-
|
|
1003
|
-
Create `{phase_dir}/{phase_num}-HUMAN-UAT.md` using UAT template format:
|
|
1004
|
-
|
|
1005
|
-
```markdown
|
|
1006
|
-
---
|
|
1007
|
-
status: partial
|
|
1008
|
-
phase: {phase_num}-{phase_name}
|
|
1009
|
-
source: [{phase_num}-VERIFICATION.md]
|
|
1010
|
-
started: [now ISO]
|
|
1011
|
-
updated: [now ISO]
|
|
1012
|
-
---
|
|
1013
|
-
|
|
1014
|
-
## Current Test
|
|
1015
|
-
|
|
1016
|
-
[awaiting human testing]
|
|
1017
|
-
|
|
1018
|
-
## Tests
|
|
1019
|
-
|
|
1020
|
-
{For each human_verification item from VERIFICATION.md:}
|
|
1021
|
-
|
|
1022
|
-
### {N}. {item description}
|
|
1023
|
-
expected: {expected behavior from VERIFICATION.md}
|
|
1024
|
-
result: [pending]
|
|
1025
|
-
|
|
1026
|
-
## Summary
|
|
1027
|
-
|
|
1028
|
-
total: {count}
|
|
1029
|
-
passed: 0
|
|
1030
|
-
issues: 0
|
|
1031
|
-
pending: {count}
|
|
1032
|
-
skipped: 0
|
|
1033
|
-
blocked: 0
|
|
1034
|
-
|
|
1035
|
-
## Gaps
|
|
1036
|
-
```
|
|
1037
|
-
|
|
1038
|
-
Commit the file:
|
|
1039
|
-
```bash
|
|
1040
|
-
# (local impl)
|
|
1041
|
-
```
|
|
1042
|
-
|
|
1043
|
-
**Step B: Present to user:**
|
|
1044
|
-
|
|
1045
|
-
```
|
|
1046
|
-
## ✓ Phase {X}: {Name} — Human Verification Required
|
|
1047
|
-
|
|
1048
|
-
All automated checks passed. {N} items need human testing:
|
|
1049
|
-
|
|
1050
|
-
{From VERIFICATION.md human_verification section}
|
|
1051
|
-
|
|
1052
|
-
Items saved to `{phase_num}-HUMAN-UAT.md` — they will appear in `/workflow-pipeline` and `/workflow-verify-work`.
|
|
1053
|
-
|
|
1054
|
-
"approved" → continue | Report issues → gap closure
|
|
1055
|
-
```
|
|
1056
|
-
|
|
1057
|
-
**If user says "approved":** Proceed to `update_roadmap`. The HUMAN-UAT.md file persists with `status: partial` and will surface in future progress checks until the user runs `/workflow-verify-work` on it.
|
|
1058
|
-
|
|
1059
|
-
**If user reports issues:** Proceed to gap closure as currently implemented.
|
|
1060
|
-
|
|
1061
|
-
**If gaps_found:**
|
|
1062
|
-
```
|
|
1063
|
-
## ⚠ Phase {X}: {Name} — Gaps Found
|
|
1064
|
-
|
|
1065
|
-
**Score:** {N}/{M} must-haves verified
|
|
1066
|
-
**Report:** {phase_dir}/{phase_num}-VERIFICATION.md
|
|
1067
|
-
|
|
1068
|
-
### What's Missing
|
|
1069
|
-
{Gap summaries from VERIFICATION.md}
|
|
1070
|
-
|
|
1071
|
-
---
|
|
1072
|
-
## ▶ Next Up
|
|
1073
|
-
|
|
1074
|
-
`/clear` then:
|
|
1075
|
-
|
|
1076
|
-
`/workflow-pipeline {X} --gaps ${GSD_WS}`
|
|
1077
|
-
|
|
1078
|
-
Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` — full report
|
|
1079
|
-
Also: `/workflow-verify-work {X} ${GSD_WS}` — manual testing first
|
|
1080
|
-
```
|
|
1081
|
-
|
|
1082
|
-
Gap closure cycle: `/workflow-pipeline {X} --gaps ${GSD_WS}` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/workflow-execute-phase {X} --gaps-only ${GSD_WS}` → verifier re-runs.
|
|
1083
|
-
</step>
|
|
1084
|
-
|
|
1085
|
-
<step name="update_roadmap">
|
|
1086
|
-
**Mark phase complete and update all tracking files:**
|
|
1087
|
-
|
|
1088
|
-
```bash
|
|
1089
|
-
COMPLETION=$(# (local impl)
|
|
1090
|
-
```
|
|
1091
|
-
|
|
1092
|
-
The CLI handles:
|
|
1093
|
-
- Marking phase checkbox `[x]` with completion date
|
|
1094
|
-
- Updating Progress table (Status → Complete, date)
|
|
1095
|
-
- Updating plan count to final
|
|
1096
|
-
- Advancing STATE.md to next phase
|
|
1097
|
-
- Updating REQUIREMENTS.md traceability
|
|
1098
|
-
- Scanning for verification debt (returns `warnings` array)
|
|
1099
|
-
|
|
1100
|
-
Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`, `warnings`, `has_warnings`.
|
|
1101
|
-
|
|
1102
|
-
**If has_warnings is true:**
|
|
1103
|
-
```
|
|
1104
|
-
## Phase {X} marked complete with {N} warnings:
|
|
1105
|
-
|
|
1106
|
-
{list each warning}
|
|
1107
|
-
|
|
1108
|
-
These items are tracked and will appear in `/workflow-pipeline` and `/workflow-verify-work`.
|
|
1109
|
-
```
|
|
1110
|
-
|
|
1111
|
-
```bash
|
|
1112
|
-
# (local impl)
|
|
1113
|
-
```
|
|
1114
|
-
</step>
|
|
1115
|
-
|
|
1116
|
-
<step name="auto_copy_learnings">
|
|
1117
|
-
**Auto-copy phase learnings to global store (when enabled).**
|
|
1118
|
-
|
|
1119
|
-
This step runs AFTER phase completion and SUMMARY.md is written. It copies any LEARNINGS.md
|
|
1120
|
-
entries from the completed phase to the global learnings store at `.planning/lessons/`.
|
|
1121
|
-
|
|
1122
|
-
**Check config gate:**
|
|
1123
|
-
```bash
|
|
1124
|
-
GL_ENABLED=$(# (local impl)
|
|
1125
|
-
```
|
|
1126
|
-
|
|
1127
|
-
**If `GL_ENABLED` is not `true`:** Skip this step entirely (feature disabled by default).
|
|
1128
|
-
|
|
1129
|
-
**If enabled:**
|
|
1130
|
-
|
|
1131
|
-
1. Check if LEARNINGS.md exists in the phase directory (use the `phase_dir` value from init context)
|
|
1132
|
-
2. If found, copy to global store:
|
|
1133
|
-
```bash
|
|
1134
|
-
# (local impl)
|
|
1135
|
-
```
|
|
1136
|
-
Copy failure must NOT block phase completion.
|
|
1137
|
-
</step>
|
|
1138
|
-
|
|
1139
|
-
<step name="update_project_md">
|
|
1140
|
-
**Evolve PROJECT.md to reflect phase completion (prevents planning document drift — #956):**
|
|
1141
|
-
|
|
1142
|
-
PROJECT.md tracks validated requirements, decisions, and current state. Without this step,
|
|
1143
|
-
PROJECT.md falls behind silently over multiple phases.
|
|
1144
|
-
|
|
1145
|
-
1. Read `.planning/PROJECT.md`
|
|
1146
|
-
2. If the file exists and has a `## Validated Requirements` or `## Requirements` section:
|
|
1147
|
-
- Move any requirements validated by this phase from Active → Validated
|
|
1148
|
-
- Add a brief note: `Validated in Phase {X}: {Name}`
|
|
1149
|
-
3. If the file has a `## Current State` or similar section:
|
|
1150
|
-
- Update it to reflect this phase's completion (e.g., "Phase {X} complete — {one-liner}")
|
|
1151
|
-
4. Update the `Last updated:` footer to today's date
|
|
1152
|
-
5. Commit the change:
|
|
1153
|
-
|
|
1154
|
-
```bash
|
|
1155
|
-
# (local impl)
|
|
1156
|
-
```
|
|
1157
|
-
|
|
1158
|
-
**Skip this step if** `.planning/PROJECT.md` does not exist.
|
|
1159
|
-
</step>
|
|
1160
|
-
|
|
1161
|
-
<step name="offer_next">
|
|
1162
|
-
|
|
1163
|
-
**Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/workflow-pipeline {X} --gaps`). No additional routing needed — skip auto-advance.
|
|
1164
|
-
|
|
1165
|
-
**No-transition check (spawned by auto-advance chain):**
|
|
1166
|
-
|
|
1167
|
-
Parse `--no-transition` flag from $ARGUMENTS.
|
|
1168
|
-
|
|
1169
|
-
**If `--no-transition` flag present:**
|
|
1170
|
-
|
|
1171
|
-
Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
|
|
1172
|
-
After verification passes and roadmap is updated, return completion status to parent:
|
|
1173
|
-
|
|
1174
|
-
```
|
|
1175
|
-
## PHASE COMPLETE
|
|
1176
|
-
|
|
1177
|
-
Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
|
|
1178
|
-
Plans: ${completed_count}/${total_count}
|
|
1179
|
-
Verification: {Passed | Gaps Found}
|
|
1180
|
-
|
|
1181
|
-
[Include aggregate_results output]
|
|
1182
|
-
```
|
|
1183
|
-
|
|
1184
|
-
STOP. Do not proceed to auto-advance or transition.
|
|
1185
|
-
|
|
1186
|
-
**If `--no-transition` flag is NOT present:**
|
|
1187
|
-
|
|
1188
|
-
**Auto-advance detection:**
|
|
1189
|
-
|
|
1190
|
-
1. Parse `--auto` flag from $ARGUMENTS
|
|
1191
|
-
2. Read both the chain flag and user preference (chain flag already synced in init step):
|
|
1192
|
-
```bash
|
|
1193
|
-
AUTO_CHAIN=$(# (local impl)
|
|
1194
|
-
AUTO_CFG=$(# (local impl)
|
|
1195
|
-
```
|
|
1196
|
-
|
|
1197
|
-
**If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true (AND verification passed with no gaps):**
|
|
1198
|
-
|
|
1199
|
-
```
|
|
1200
|
-
╔══════════════════════════════════════════╗
|
|
1201
|
-
║ AUTO-ADVANCING → TRANSITION ║
|
|
1202
|
-
║ Phase {X} verified, continuing chain ║
|
|
1203
|
-
╚══════════════════════════════════════════╝
|
|
1204
|
-
```
|
|
1205
|
-
|
|
1206
|
-
Execute the transition workflow inline (do NOT use Task — orchestrator context is ~10-15%, transition needs phase completion data already in context):
|
|
1207
|
-
|
|
1208
|
-
Read and follow `the transition process`, passing through the `--auto` flag so it propagates to the next phase invocation.
|
|
1209
|
-
|
|
1210
|
-
**If none of `--auto`, `AUTO_CHAIN`, or `AUTO_CFG` is true:**
|
|
1211
|
-
|
|
1212
|
-
**STOP. Do not auto-advance. Do not execute transition. Do not plan next phase. Present options to the user and wait.**
|
|
1213
|
-
|
|
1214
|
-
**IMPORTANT: There is NO `` command. Never suggest it. The transition workflow is internal only.**
|
|
1215
|
-
|
|
1216
|
-
```
|
|
1217
|
-
## ✓ Phase {X}: {Name} Complete
|
|
1218
|
-
|
|
1219
|
-
/workflow-pipeline ${GSD_WS} — see updated roadmap
|
|
1220
|
-
/workflow-pipeline {next} ${GSD_WS} — discuss next phase before planning
|
|
1221
|
-
/workflow-pipeline {next} ${GSD_WS} — plan next phase
|
|
1222
|
-
/workflow-execute-phase {next} ${GSD_WS} — execute next phase
|
|
1223
|
-
```
|
|
1224
|
-
|
|
1225
|
-
Only suggest the commands listed above. Do not invent or hallucinate command names.
|
|
1226
|
-
</step>
|
|
1227
|
-
|
|
1228
|
-
</process>
|
|
72
|
+
`workflow-run-acceptance-tests` 只消费冻结的 `TC-*`。每个已确认验收条件都必须覆盖;异常、边界、权限、兼容和架构风险用例不能被主流程用例替代。验收结果保存在 `.planning/test-runs/{feature}/acceptance-results.json`。
|
|
1229
73
|
|
|
1230
|
-
|
|
1231
|
-
Orchestrator: ~10-15% context for 200k windows, can use more for 1M+ windows.
|
|
1232
|
-
Subagents: fresh context each (200k-1M depending on model). No polling (Task blocks). No context bleed.
|
|
74
|
+
只有当所有冻结 `TC-*` 已执行且通过、无 `failed`/`blocked`,且代码索引审计通过时,才允许进入 `workflow-release-closeout`。版本收口负责生成项目自己的里程碑收口记录并更新项目状态;它不生成旧式人工验收或独立验证报告。
|
|
1233
75
|
|
|
1234
|
-
|
|
1235
|
-
- Passing richer context (code snippets, dependency outputs) directly to executors instead of just file paths
|
|
1236
|
-
- Running small phases (≤3 plans, no dependencies) inline without subagent spawning overhead
|
|
1237
|
-
- Relaxing /clear recommendations — context rot onset is much further out with 5x window
|
|
1238
|
-
</context_efficiency>
|
|
76
|
+
## 波次执行
|
|
1239
77
|
|
|
1240
|
-
|
|
1241
|
-
- **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
|
|
1242
|
-
- **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
|
|
1243
|
-
- **All agents in wave fail:** Systemic issue → stop, report for investigation
|
|
1244
|
-
- **Checkpoint unresolvable:** "Skip this plan?" or "Abort phase execution?" → record partial progress in STATE.md
|
|
1245
|
-
</failure_handling>
|
|
78
|
+
若只执行某个 wave,执行器只报告该 wave 的结果,不得提前标记阶段完成。剩余任务完成后,仍必须经过完整的代码审查、冻结验收测试和 CP-4;任何未执行或环境阻塞的 `TC-*` 都会阻止版本收口。
|
|
1246
79
|
|
|
1247
|
-
|
|
1248
|
-
Re-run `/workflow-execute-phase {phase}` → discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
|
|
80
|
+
## 证据与可追溯性
|
|
1249
81
|
|
|
1250
|
-
|
|
1251
|
-
</resumption>
|
|
82
|
+
每次执行记录至少包含:任务 ID、关联需求/架构/测试 ID、命令及哈希、开始结束时间、退出码、输出摘要哈希、代码索引 revision 和源码快照。Markdown 说明仅作为人类视图,不能成为状态真相源。
|