maestro-flow 0.5.34 → 0.5.35

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.
Files changed (95) hide show
  1. package/.agents/agents/workflow-collab-planner.md +1 -0
  2. package/.agents/agents/workflow-planner.md +2 -0
  3. package/.agents/skills/maestro-help/SKILL.md +1 -1
  4. package/.agents/skills/maestro-help/index/catalog.json +0 -1
  5. package/.agents/skills/maestro-help/phases/01-parse-intent.md +1 -1
  6. package/.agents/skills/maestro-plan/SKILL.md +3 -1
  7. package/.agents/skills/maestro-ralph/SKILL.md +46 -17
  8. package/.agents/skills/maestro-ralph-execute/SKILL.md +51 -10
  9. package/.agents/skills/quality-test/SKILL.md +27 -1
  10. package/.agy/agents/workflow-collab-planner.md +1 -0
  11. package/.agy/agents/workflow-planner.md +2 -0
  12. package/.agy/skills/maestro-help/SKILL.md +1 -1
  13. package/.agy/skills/maestro-help/index/catalog.json +0 -1
  14. package/.agy/skills/maestro-help/phases/01-parse-intent.md +1 -1
  15. package/.agy/skills/maestro-plan/SKILL.md +3 -1
  16. package/.agy/skills/maestro-ralph/SKILL.md +46 -17
  17. package/.agy/skills/maestro-ralph-execute/SKILL.md +51 -10
  18. package/.agy/skills/quality-test/SKILL.md +27 -1
  19. package/.claude/agents/workflow-collab-planner.md +1 -0
  20. package/.claude/agents/workflow-planner.md +2 -0
  21. package/.claude/commands/maestro-plan.md +3 -1
  22. package/.claude/commands/maestro-ralph-execute.md +51 -10
  23. package/.claude/commands/maestro-ralph.md +46 -17
  24. package/.claude/commands/quality-test.md +27 -1
  25. package/.claude/skills/maestro-help/SKILL.md +1 -1
  26. package/.claude/skills/maestro-help/index/catalog.json +0 -1
  27. package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
  28. package/.codex/skills/maestro/SKILL.md +17 -2
  29. package/.codex/skills/maestro-analyze/SKILL.md +20 -3
  30. package/.codex/skills/maestro-brainstorm/SKILL.md +30 -4
  31. package/.codex/skills/maestro-execute/SKILL.md +25 -3
  32. package/.codex/skills/maestro-grill/SKILL.md +9 -0
  33. package/.codex/skills/maestro-plan/SKILL.md +26 -3
  34. package/.codex/skills/maestro-ralph/SKILL.md +6 -0
  35. package/.codex/skills/maestro-ralph-execute/SKILL.md +51 -10
  36. package/.codex/skills/maestro-roadmap/SKILL.md +30 -1
  37. package/.codex/skills/quality-review/SKILL.md +9 -0
  38. package/README.md +28 -5
  39. package/README.zh-CN.md +28 -5
  40. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +82 -0
  41. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +444 -0
  42. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -0
  43. package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +46 -0
  44. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +413 -19
  45. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  46. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +16 -0
  47. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  48. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +13 -0
  49. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +102 -7
  50. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  51. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +42 -0
  52. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  53. package/dashboard/dist-server/src/commands/hooks.d.ts +3 -0
  54. package/dashboard/dist-server/src/commands/hooks.js +11 -8
  55. package/dashboard/dist-server/src/commands/hooks.js.map +1 -1
  56. package/dashboard/dist-server/src/graph/kg/extraction/code/code-extractor.js +1 -1
  57. package/dashboard/dist-server/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  58. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js +2 -6
  59. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js.map +1 -1
  60. package/dist/src/cli.js +1 -0
  61. package/dist/src/cli.js.map +1 -1
  62. package/dist/src/commands/hooks.d.ts +3 -0
  63. package/dist/src/commands/hooks.d.ts.map +1 -1
  64. package/dist/src/commands/hooks.js +11 -8
  65. package/dist/src/commands/hooks.js.map +1 -1
  66. package/dist/src/commands/install.d.ts.map +1 -1
  67. package/dist/src/commands/install.js +42 -9
  68. package/dist/src/commands/install.js.map +1 -1
  69. package/dist/src/commands/search.d.ts +5 -0
  70. package/dist/src/commands/search.d.ts.map +1 -1
  71. package/dist/src/commands/search.js +81 -11
  72. package/dist/src/commands/search.js.map +1 -1
  73. package/dist/src/commands/update.d.ts.map +1 -1
  74. package/dist/src/commands/update.js +37 -21
  75. package/dist/src/commands/update.js.map +1 -1
  76. package/dist/src/core/install-executor.d.ts.map +1 -1
  77. package/dist/src/core/install-executor.js +6 -3
  78. package/dist/src/core/install-executor.js.map +1 -1
  79. package/dist/src/graph/kg/extraction/code/code-extractor.js +1 -1
  80. package/dist/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  81. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  82. package/dist/src/graph/kg/extraction/orchestrator.js +2 -6
  83. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  84. package/dist/src/ralph/cmd-next.d.ts.map +1 -1
  85. package/dist/src/ralph/cmd-next.js +2 -3
  86. package/dist/src/ralph/cmd-next.js.map +1 -1
  87. package/package.json +4 -2
  88. package/workflows/claude-instructions.md +17 -2
  89. package/workflows/codex-instructions.md +85 -14
  90. package/workflows/command-authoring.md +1 -1
  91. package/workflows/plan.md +2 -1
  92. package/.agents/skills/maestro-ralph-beta/SKILL.md +0 -882
  93. package/.agy/skills/maestro-ralph-beta/SKILL.md +0 -878
  94. package/.claude/commands/maestro-ralph-beta.md +0 -880
  95. package/.codex/skills/maestro-ralph-beta/SKILL.md +0 -883
@@ -23,6 +23,7 @@ $ARGUMENTS — intent text, flags, or keywords.
23
23
  **Parse:**
24
24
  ```
25
25
  -y flag → auto_confirm = true
26
+ --roadmap → wants_roadmap = true (强制多发布 roadmap 路径;roadmap 默认 opt-in)
26
27
  .md/.txt path → input_doc (supplementary context only, NEVER substitutes lifecycle stages)
27
28
  Remaining → intent
28
29
  ```
@@ -56,7 +57,7 @@ S_PARSE_ROUTE — 解析参数、路由入口 PERSIST: —
56
57
  S_STATUS — 显示 session 进度 PERSIST: —
57
58
  S_CONTINUE — 恢复执行 PERSIST: —
58
59
  S_RESOLVE_PHASE — 解析 phase + phase_is_new + D-007 milestone PERSIST: session.phase, session.phase_is_new, session.milestone
59
- S_INFER — 基于已解析 phase 推断 lifecycle_position PERSIST: session.lifecycle_position
60
+ S_INFER — 基于已解析 phase 推断 lifecycle_position PERSIST: session.lifecycle_position, session.wants_roadmap
60
61
  S_RESOLVE_SCOPE — 读 macro analyze conclusions.scope_verdict PERSIST: session.scope_verdict, session.analyze_macro_id
61
62
  S_QUALITY_MODE — 决定质量管线模式 PERSIST: session.quality_mode
62
63
  S_PLANNING_MODE — 决定统一/独立规划模式 PERSIST: session.planning_mode
@@ -128,7 +129,7 @@ S_DISPATCH:
128
129
  → END DO: Skill({ skill: "maestro-ralph-execute" })
129
130
 
130
131
  S_DECISION_EVAL: (decision 节点 == `step.decision` 非空,下述 gate 名取自该字段)
131
- → S_APPLY_VERDICT WHEN: quality-gate (post-execute, post-business-test, post-review, post-test)
132
+ → S_APPLY_VERDICT WHEN: quality-gate (post-execute, post-business-test, post-review, post-test, post-frontend-verify)
132
133
  DO: A_DELEGATE_EVALUATE
133
134
  → S_APPLY_VERDICT WHEN: goal-gate (post-goal-audit)
134
135
  DO: A_GOAL_AUDIT_EVALUATE
@@ -215,6 +216,14 @@ resolve_milestone(phase_number):
215
216
  | blueprint / 规格 / 正式文档 / spec-generate / 7-phase | `blueprint` |
216
217
  | broad/medium intent 无数字 phase (重构/全面/重写/迁移/新功能 X) | `analyze-macro` |
217
218
 
219
+ **Roadmap opt-in detection** (设 `session.wants_roadmap`,缺省 `false`):
220
+ ```
221
+ wants_roadmap = (--roadmap flag)
222
+ OR (intent 含多发布信号: 多发布|多版本|分阶段交付|按里程碑发布|v1.*v2|multi-release|roadmap)
223
+ OR (.workflow/roadmap.md 已存在) ← 向后兼容:既有 roadmap 项目行为不变
224
+ ```
225
+ 默认 `false` → large 项目走单一多波次 `plan --from analyze`,不引入 roadmap 横切层;roadmap 仅多发布场景 opt-in。
226
+
218
227
  **Bootstrap detection:**
219
228
 
220
229
  | Condition | Position |
@@ -229,7 +238,7 @@ resolve_milestone(phase_number):
229
238
  | Condition | Position |
230
239
  |-----------|----------|
231
240
  | `phase_is_new == true` (新 phase) | `analyze` |
232
- | no milestones AND no roadmap.md AND has analyze macro artifact | `roadmap` |
241
+ | no milestones AND no roadmap.md AND has analyze macro artifact | `roadmap` if `wants_roadmap` else `plan` (--from analyze) |
233
242
  | no milestones AND no roadmap.md AND no analyze artifact | `analyze-macro` |
234
243
  | `phase == null` (grill/brainstorm/blueprint/init/roadmap/analyze-macro override 已定) | n/a |
235
244
  | phase 已存在 + 无任何 artifact | `analyze` |
@@ -250,9 +259,9 @@ resolve_milestone(phase_number):
250
259
 
251
260
  | scope_verdict | 链路 |
252
261
  |---------------|------|
253
- | `large` | analyze-macro → roadmap → analyze → plan → execute → ... |
254
- | `medium` / `small` | analyze-macro → plan --from analyze:{ANL_ID} → execute → ...(跳过 roadmap + analyze-phase |
255
- | `unknown` | 默认走 large 路径,post-analyze-scope 决策节点再纠正 |
262
+ | `large` + `wants_roadmap` | analyze-macro → roadmap → analyze → plan → execute → ...(多发布 opt-in) |
263
+ | `large`(默认)/ `medium` / `small` | analyze-macro → plan --from analyze:{ANL_ID} → execute → ...(跳过 roadmap + analyze-phase;单一多波次计划) |
264
+ | `unknown` | 默认走 standalone(plan --from analyze)路径,post-analyze-scope 决策节点再纠正 |
256
265
 
257
266
  **Refine from post-execute results:**
258
267
 
@@ -335,10 +344,10 @@ narrow → derive defaults from intent + codebase, skip questions.
335
344
  ```json
336
345
  { "id": "G1", "goal": "<deliverable>", "boundary": "<in/out note>",
337
346
  "done_when": "<objectively checkable condition>",
338
- "evidence": "verification.json|review.json|uat.md|<test path>",
347
+ "evidence": "verification.json|review.json|uat.md|e2e-results.json|<test path>",
339
348
  "lifecycle": ["analyze","execute"], "status": "pending" }
340
349
  ```
341
- `done_when` 必须客观可验证,且引用 ralph 已产出的 artifact;`lifecycle` 字段映射到产出 evidence 的生命周期 stage
350
+ `done_when` 必须客观可验证,且引用 ralph 已产出的 artifact;`lifecycle` 字段映射到产出 evidence 的生命周期 stage。涉及前端可用性的子目标,`done_when` 应引用 `e2e-results.json`(frontend-verify 门产出),不得仅以后端 API/build 证据判定可用。
342
351
 
343
352
  **5. Persist** (additive): `boundary_contract`, `execution_criteria`, `task_decomposition`。每个 sub-goal 含 `status: "pending"` + `completion_confirmed: false`。
344
353
 
@@ -364,6 +373,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
364
373
  | review | `quality-review {phase}` | `quality-review` | `post-review` | all (quick: append `--tier quick`) |
365
374
  | test-gen | `quality-auto-test {phase}` | `quality-auto-test` | — | full / standard if coverage<80% |
366
375
  | test | `quality-test {phase}` | `quality-test` | `post-test` | full, standard |
376
+ | frontend-verify | `quality-test {phase} --frontend-verify` | `quality-test --frontend-verify` | `post-frontend-verify` | all(**仅当 phase 交付 UI 时插入**:检出 `dashboard/` 或 UI 关键词 `landing\|page\|dashboard\|frontend\|UI\|component\|界面`) |
367
377
  | milestone-audit | `maestro-milestone-audit` | *(same)* | — | all |
368
378
  | goal-audit | *(decision-only)* | *(same)* | `post-goal-audit` | all (only if decomposed) |
369
379
  | milestone-complete | `maestro-milestone-complete` | *(same)* | `post-milestone` | all |
@@ -378,6 +388,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
378
388
  2. **跳过已完成**:跳过当前 milestone+phase 下已有 completed artifact 的 stage(按 `session.phase` 过滤);unified 按 milestone 过滤
379
389
  3. **quality_mode 过滤**:按 `session.quality_mode` 排除不匹配 stage
380
390
  3.5. **grill auto_confirm 跳过**:`auto_confirm == true` 时删除 `grill` stage(grill 为交互式苏格拉底拷问,不支持自动模式);brainstorm args 不含 `--from grill:*`
391
+ 3.6. **frontend-verify UI 门控**:仅当当前 phase 交付前端(检出 `dashboard/` 目录,或 phase 目标/计划含 UI 关键词 `landing|page|dashboard|frontend|UI|component|界面`)时保留 `frontend-verify` stage + `post-frontend-verify` decision;纯后端 phase 删除该 stage
381
392
  4. **决策节点**:每个 Decision after 非空的 stage 之后插入 `{ decision: "<gate>", retry_count: 0, max_retries: 2, command_scope: null, command_path: null }`
382
393
  5. **goal-audit 插入**:`task_decomposition` 存在时,在最后一个 evidence-producing stage(execute/review/test)之后、`milestone-complete` 之前插入 `decision:post-goal-audit`
383
394
  6. **终点硬约束**:chain 以 `milestone-complete` 结尾
@@ -392,13 +403,16 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
392
403
  - **不在 build 阶段读取 .md 内容**;`<required_reading>` / `<deferred_reading>` 解析与加载由 `maestro ralph next` CLI 在执行期完成
393
404
  10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`, `deferred_reads: []`, `load: null`(由 `ralph next` 写入)
394
405
  11. **scope_verdict gating**(仅当 chain 起点 = `analyze-macro`):
395
- - `scope_verdict {medium, small}` → 跳过 `roadmap` + `analyze` 两 stage;`plan` 选 standalone 列(`--from analyze:{analyze_macro_id}`),不带 `{phase}`
396
- - `scope_verdict == large` 保留 `roadmap` + `analyze`;`plan` 选 phase 列(`{phase}`)
397
- - `scope_verdict == unknown` → 默认 large 路径;由 `post-analyze-scope` 决策节点在 macro analyze 完成后纠正(A_APPLY_SCOPE_VERDICT)
406
+ - `scope_verdict == large` **且** `wants_roadmap`保留 `roadmap` + `analyze`;`plan` 选 phase 列(`{phase}`)
407
+ - 其余(`medium` / `small`,或 `large` 但非 `wants_roadmap`)→ 跳过 `roadmap` + `analyze` 两 stage;`plan` 选 standalone 列(`--from analyze:{analyze_macro_id}`),不带 `{phase}`
408
+ - `scope_verdict == unknown` → 默认 standalone(非 roadmap)路径;由 `post-analyze-scope` 决策节点在 macro analyze 完成后纠正(A_APPLY_SCOPE_VERDICT)
398
409
  12. **--from 自动注入**:
399
410
  - `analyze_macro_id` 存在且当前 step 是 `roadmap` → args 改为 `--from analyze:{analyze_macro_id}`
400
- - `analyze_macro_id` 存在且 `scope_verdict {medium, small}` 且当前 step `plan` args 改为 `--from analyze:{analyze_macro_id}`
411
+ - `analyze_macro_id` 存在且当前 `plan` step 处于 standalone 列(即非 wants_roadmap 路径:`medium`/`small`,或 `large` 但非 `wants_roadmap`)→ args 改为 `--from analyze:{analyze_macro_id}`
401
412
  - `blueprint_id` 存在 → 当前 step 是 `plan` → args 改为 `--from blueprint:{blueprint_id}`(优先级低于 phase 数字参数)
413
+ - **phase-level deferred chaining**(独立模式,step 含 `{phase}` 占位符):build 阶段前序 artifact 尚未产出,由 A_RESOLVE_ARGS(ralph-execute)运行时从 state.json 查找同 phase+milestone 最新 completed artifact 注入:
414
+ - `plan` step → `--from analyze:{phase_analyze_id}`,写 `source_artifact_ref`
415
+ - `execute` step → `--dir {plan_path}`(现有逻辑),写 `source_artifact_ref = "plan:{id}"`
402
416
  - 写入 `step.source_artifact_ref` 以便审计
403
417
  13. **D-007 Milestone-ref 标注**:每个含 `{phase}` 占位符的 step → `step.milestone_id = session.milestone`(由 A_RESOLVE_PHASE 反查得出),禁止读 `current_milestone`
404
418
  14. **动态插入步骤**(A_APPLY_*)同样应用规则 7-13
@@ -421,6 +435,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
421
435
  | post-business-test | .tests/auto-test/report.json |
422
436
  | post-review | review.json |
423
437
  | post-test | uat.md, .tests/test-results.json |
438
+ | post-frontend-verify | e2e-results.json |
424
439
  4. Check artifact for confidence section → include as signal
425
440
  5. Execute delegate (run_in_background, STOP, wait for callback):
426
441
  ```
@@ -522,14 +537,14 @@ Runs only when `task_decomposition` present.
522
537
 
523
538
  由 `post-analyze-scope` 触发,依据 `session.scope_verdict` 重塑下游链路。
524
539
 
525
- 1. 读 `session.scope_verdict`
526
- 2. 路径 A(`large`):保持当前链;为后续 `roadmap` step 注入 `--from analyze:{analyze_macro_id}`;为后续 `plan` step 选 phase 列;继续推进
527
- 3. 路径 B(`medium` / `small`):
540
+ 1. 读 `session.scope_verdict` + `session.wants_roadmap`
541
+ 2. 路径 A(`large` `wants_roadmap`):保持当前链(roadmap+analyze);为后续 `roadmap` step 注入 `--from analyze:{analyze_macro_id}`;为后续 `plan` step 选 phase 列;继续推进
542
+ 3. 路径 B(`medium` / `small`,或 `large` 但非 `wants_roadmap`):
528
543
  - 删除 `goal-audit` 之前所有未完成的 `roadmap` + `analyze` (phase) step
529
544
  - 把下一个未完成的 `plan` step 改为 `maestro-plan --from analyze:{analyze_macro_id}`,去掉 `{phase}`,`source_artifact_ref = analyze:{analyze_macro_id}`
530
545
  - 后续 `execute` 等沿用同一 standalone scope(不带 `{phase}`,由 plan 写出的 task 列表驱动)
531
546
  4. 路径 C(`unknown`):
532
- - 非 auto_confirm → AskUserQuestion 二选一(large / medium-small);auto_confirm → 默认 large
547
+ - 非 auto_confirm → AskUserQuestion 二选一(roadmap 多发布 / 单一计划);auto_confirm → 默认路径 B(单一计划,不引入 roadmap)
533
548
  5. Reindex steps,标 decision completed,write status.json
534
549
  6. Display: ◆ Scope verdict: {verdict} → {kept|collapsed to standalone via analyze:{ANL_ID}}
535
550
 
@@ -579,6 +594,7 @@ Runs only when `task_decomposition` present.
579
594
  "quality_mode": "standard", // "full" | "standard" | "quick"
580
595
  "planning_mode": "independent", // "unified" | "independent"
581
596
  "scope_verdict": null, // "large" | "medium" | "small" | "unknown" | null
597
+ "wants_roadmap": false, // roadmap opt-in:--roadmap | 多发布 intent | roadmap.md 已存在
582
598
  "analyze_macro_id": null, // "ANL-xxx" 来自最新 macro analyze
583
599
  "blueprint_id": null, // "BLP-xxx" 若存在
584
600
  "cli_tool": "claude", "passed_gates": [],
@@ -670,6 +686,15 @@ quality-test {phase}
670
686
  decision:post-test {retry+1}
671
687
  ```
672
688
 
689
+ **post-frontend-verify:** (UI 写端点未接线/不可用时)
690
+ ```
691
+ quality-debug --from-frontend-verify "{gap_summary}"
692
+ maestro-plan --gaps {phase}
693
+ maestro-execute {phase}
694
+ quality-test {phase} --frontend-verify
695
+ decision:post-frontend-verify {retry+1}
696
+ ```
697
+
673
698
  **post-goal-audit:** (per unmet sub-goal group)
674
699
  ```
675
700
  # for each unmet sub-goal G{n}, scoped to target_phase:
@@ -718,12 +743,13 @@ decision:post-goal-audit {retry+1}
718
743
  - [ ] Intent overrides 识别 grill / brainstorm / blueprint / analyze-macro
719
744
  - [ ] auto_confirm=true 时 grill stage 跳过(交互式拷问不支持自动模式)
720
745
  - [ ] A_RESOLVE_SCOPE_VERDICT 读 macro analyze conclusions.scope_verdict,写入 session.scope_verdict + analyze_macro_id
721
- - [ ] 链路起点 = analyze-macro 时:large→roadmap+analyze+plan(phase)medium/small→直跳 plan --from analyze:{ANL_ID}(跳过 roadmap+analyze)
746
+ - [ ] 链路起点 = analyze-macro 时:large+wants_roadmap→roadmap+analyze+plan(phase);其余(含 large 默认/medium/small)→直跳 plan --from analyze:{ANL_ID}(跳过 roadmap+analyze)
722
747
  - [ ] post-analyze-scope decision 节点在 macro analyze 之后插入;A_SCOPE_EVALUATE/A_APPLY_SCOPE_VERDICT 重塑链路
723
748
  - [ ] plan step args 支持三路径:`{phase}` / `--from analyze:{ANL_ID}` / `--from blueprint:{BLP_ID}`,写入 step.source_artifact_ref
724
749
  - [ ] roadmap step args 自动注入 `--from analyze:{analyze_macro_id}`(若存在)
725
750
  - [ ] artifact 过滤按 session.phase;unified 按 milestone
726
751
  - [ ] quality_mode 由 A_DETERMINE_QUALITY_MODE 决定,过滤 build steps
752
+ - [ ] frontend-verify stage 仅在 phase 交付 UI 时插入(test 后、milestone-audit 前);post-frontend-verify 走 quality-gate 评估,evidence=e2e-results.json
727
753
  - [ ] Decomposition: broad intent ≤3 question clarify;narrow auto-derive
728
754
  - [ ] status.json 唯一真源:boundary_contract + execution_criteria + task_decomposition;无外部清单
729
755
  - [ ] 执行 step 含 `command_scope` + `command_path`(通过 `maestro ralph skills --platform claude --json --quiet` 预校验,project 覆盖 global);decision step 通过 `step.decision` 字段标识
@@ -737,5 +763,8 @@ decision:post-goal-audit {retry+1}
737
763
  - [ ] Chain 必须以 `milestone-complete` 结尾
738
764
  - [ ] Decision nodes 由 maestro delegate --role analyze 评估
739
765
  - [ ] Ralph 不执行 step,只 evaluate;Skill("maestro-ralph-execute") handoff
766
+ - [ ] Phase-level deferred chaining:plan/execute step 的 `--from`/`--dir` 注入由 A_RESOLVE_ARGS(ralph-execute)运行时完成;build 阶段标记意图,不预知 artifact ID
767
+ - [ ] Phase-level plan step 运行时获得 `--from analyze:{phase_analyze_id}`(由 ralph-execute 从 state.json 查找注入)
768
+ - [ ] Phase-level execute step 运行时获得 `source_artifact_ref = "plan:{id}"`
740
769
 
741
770
  </appendix>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: quality-test
3
3
  description: Use when implementation needs user acceptance testing with interactive verification and gap closure
4
- argument-hint: "[phase] [--smoke] [--auto-fix]"
4
+ argument-hint: "[phase] [--smoke] [--auto-fix] [--frontend-verify]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -27,6 +27,31 @@ Flags, artifact context resolution, and output directory format defined in workf
27
27
  </context>
28
28
 
29
29
  <execution>
30
+ **Mode select:** `--frontend-verify` → 走下方 **Frontend Verify Mode**(确定性浏览器 smoke,**不是**对话式 UAT);否则 Follow '~/.maestro/workflows/test.md' completely.
31
+
32
+ ### Frontend Verify Mode (`--frontend-verify`)
33
+
34
+ 补 ralph 链路缺失的运行时可用性门:确定性验证每个用户可观测能力真正经 UI 可触发,避免"后端绿灯=完成"。
35
+
36
+ 1. **Resolve targets**: 读 phase 的 `plan.json` / `.task/TASK-*.json`,提取所有 `[UI-observable]` convergence.criteria(plan 阶段产出);缺失则枚举后端写端点(POST/PUT/PATCH/DELETE)作为待验证清单。
37
+ 2. **Start app**: `next start`(或从 dashboard/package.json 解析的既有启动脚本);启动失败 → E003。
38
+ 3. **Drive browser**: 用 chrome-devtools MCP(`mcp__claude_dms3-chrome-devtools__*`:navigate / click / fill / take_snapshot / list_network_requests)逐条执行每个 `[UI-observable]` 流程,断言:UI 入口存在且可触发 → 对应写请求返回 2xx → DOM 出现预期结果。
39
+ 4. **Write evidence**: 产出 `e2e-results.json`(结构见下),逐条记 pass/fail + 证据(网络状态码、快照引用)。**确定性断言,禁止"无人应答=全过"**。
40
+ 5. **Verdict**: 任一 `[UI-observable]` fail 或写端点无 UI 入口 → STATUS=NEEDS_RETRY(ralph 经 post-frontend-verify 触发 Fix-Loop);全过 → DONE。
41
+
42
+ ```json
43
+ // e2e-results.json
44
+ { "phase": "{phase}", "app_url": "http://localhost:3000",
45
+ "checks": [ { "criterion": "[UI-observable] ...", "ui_entry": "<selector/route>",
46
+ "request": "POST /api/notes", "status": 201, "dom_assert": "list shows new item",
47
+ "passed": true } ],
48
+ "summary": { "total": 0, "passed": 0, "failed": 0 }, "verdict": "pass|fail" }
49
+ ```
50
+
51
+ Ralph-invoked 完成:`maestro ralph complete <idx> --status {STATUS} --evidence e2e-results.json`。
52
+
53
+ ---
54
+
30
55
  Follow '~/.maestro/workflows/test.md' completely.
31
56
 
32
57
  ### Phase Gates (MANDATORY, BLOCKING)
@@ -144,4 +169,5 @@ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
144
169
  - [ ] Gaps updated with root_cause, fix_direction, affected_files
145
170
  - [ ] Gap-fix loop triggered if --auto-fix (max 2 iterations)
146
171
  - [ ] Next step routed (phase-transition if pass, verify if auto-fix success, debug --from-uat if issues, test-gen if low coverage)
172
+ - [ ] `--frontend-verify`: 每条 [UI-observable] criterion 经真实浏览器断言,产出 e2e-results.json;任一 fail → NEEDS_RETRY(不放行)
147
173
  </success_criteria>
@@ -269,7 +269,7 @@ Odyssey 长周期循环(独立路径)
269
269
  odyssey-debug / odyssey-improve / odyssey-review-test-fix / odyssey-planex / odyssey-ui
270
270
 
271
271
  自适应引擎(高级)
272
- ralph / ralph-beta → 自运行决策循环
272
+ ralph → 自运行决策循环
273
273
  swarm-workflow / universal-workflow → 多 agent 并行执行
274
274
  ```
275
275
 
@@ -68,7 +68,6 @@
68
68
 
69
69
  {"name": "maestro-ralph", "command": "/maestro-ralph", "category": "ralph", "description": "Ralph 引擎 — 自适应生命周期决策节点管理", "source": "../../commands/maestro-ralph.md"},
70
70
  {"name": "maestro-ralph-execute", "command": "/maestro-ralph-execute", "category": "ralph", "description": "Ralph 执行 — 运行自适应决策链", "source": "../../commands/maestro-ralph-execute.md"},
71
- {"name": "maestro-ralph-beta", "command": "/maestro-ralph-beta", "category": "ralph", "description": "Ralph Beta — 自运行循环控制器,单 skill 完成 build/tick/decide", "source": "../../commands/maestro-ralph-beta.md"},
72
71
 
73
72
  {"name": "maestro-impeccable", "command": "/maestro-impeccable", "category": "ui", "description": "UI 生产 — 设计系统生成 + impeccable 链式编排 + 质量门控", "source": "../../commands/maestro-impeccable.md"},
74
73
  {"name": "maestro-ui-codify", "command": "/maestro-ui-codify", "category": "ui", "description": "UI 固化 — 将设计产出转化为知识资产", "source": "../../commands/maestro-ui-codify.md"},
@@ -61,7 +61,7 @@ const knownCommands = [
61
61
  "maestro", "analyze", "plan", "execute", "init", "roadmap",
62
62
  "brainstorm", "blueprint", "quick", "overlay", "amend", "fork", "merge", "collab",
63
63
  "milestone-audit", "milestone-complete", "milestone-release",
64
- "composer", "guard", "player", "ralph", "ralph-execute", "ralph-beta",
64
+ "composer", "guard", "player", "ralph", "ralph-execute",
65
65
  "grill", "next", "swarm-workflow", "universal-workflow", "companion",
66
66
  "impeccable", "ui-codify", "update",
67
67
  "tools-register", "tools-execute",
@@ -293,7 +293,7 @@ Read `.workflow/state.json` and route by condition:
293
293
  "scope_verdict": null, "analyze_macro_id": null, "blueprint_id": null,
294
294
  "auto_mode": false,
295
295
  "context": { "issue_id": null, "scratch_dir": null, "plan_dir": null,
296
- "analysis_dir": null, "brainstorm_dir": null, "blueprint_dir": null },
296
+ "analysis_dir": null, "brainstorm_dir": null, "blueprint_dir": null, "grill_id": null },
297
297
  "steps": [{
298
298
  "index": 0, "type": "skill|decision",
299
299
  "skill": "", "args": "",
@@ -328,12 +328,27 @@ Read `.workflow/state.json` and route by condition:
328
328
 
329
329
  Direct in-context skill invocation — **replaces the old spawn/wave/CSV mechanism**.
330
330
 
331
- 1. **buildSkillCall**: replace placeholders `{phase}`/`{plan_dir}`/`{analysis_dir}`/`{brainstorm_dir}`/`{spec_session_id}`; append auto-yes flag if `auto_mode` (see Appendix: Auto-Yes Flag Map)
331
+ 1. **buildSkillCall**: replace placeholders + append auto-yes flag if `auto_mode` (see Appendix: Auto-Yes Flag Map):
332
+
333
+ | Placeholder | Source |
334
+ |-------------|--------|
335
+ | `{phase}` | session.phase |
336
+ | `{plan_dir}` | session.context.plan_dir |
337
+ | `{analysis_dir}` | session.context.analysis_dir |
338
+ | `{brainstorm_dir}` | session.context.brainstorm_dir |
339
+ | `{spec_session_id}` | session.context.spec_session_id |
340
+ | `{GRL}` | session.context.grill_id |
341
+ | `{ANL}` | session.analyze_macro_id |
342
+ | `{BLP}` | session.blueprint_id |
343
+ | `{intent}` | session.intent |
344
+
345
+ **--from auto-injection**: 当 step 是 `maestro-plan`,args 含 `{phase}` 但无 `--from` 且无 `--dir`,且 `session.context.analysis_dir` 已填充 → 查 state.json 同 phase+milestone 最新 completed analyze artifact → 注入 `--from analyze:{id}`,写 `step.source_artifact_ref`
332
346
  2. Mark step `status="running"`, persist status.json + `update_plan` (this step → in_progress)
333
347
  3. **Invoke the skill directly**: execute `$skill {resolved_args}` in coordinator context (NO spawn). Read its produced artifacts directly
334
348
  4. On success: capture summary; mark step `status="done"`. **Barrier-context update** (when step is a context-producing skill):
335
349
  | Skill | Read | Context Updates |
336
350
  |-------|------|-----------------|
351
+ | maestro-grill | grill-report.md, state.json | grill_id |
337
352
  | maestro-analyze | context.md, state.json | analysis_dir, gaps, phase |
338
353
  | maestro-plan | plan.json, .task/TASK-*.json | plan_dir, task_count |
339
354
  | maestro-brainstorm | .brainstorming/ | brainstorm_dir, features |
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro-analyze
3
3
  description: Use when a topic needs structured multi-dimensional investigation before planning or decision-making
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] [--from <source>] \"<phase|topic> [-q|--quick] [--gaps [ISS-ID]]\""
4
+ argument-hint: "[-y|--yes] [--concurrency N] [-c|--continue] [--from <source>] \"<phase|topic> [-q|--quick] [--gaps [ISS-ID]]\""
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
 
@@ -23,14 +23,22 @@ $ARGUMENTS -- phase number, topic text, and optional flags.
23
23
 
24
24
  **Flags**:
25
25
  - `-y, --yes`: Skip all confirmations (auto mode)
26
- - `-c, --concurrency N`: Max concurrent agents per wave (default: 6)
26
+ - `--concurrency N`: Max concurrent agents per wave (default: 6)
27
+ - `-c, --continue`: Resume existing session
27
28
  - `--continue`: Resume existing session
28
29
  - `-q, --quick`: Skip exploration + scoring, Wave 3 only
29
30
  - `--gaps [ISS-ID]`: Issue root cause analysis. If ISS-ID: single issue. If omitted: all open/registered from issues.jsonl.
30
- - `--from <source>`: Load upstream context package (brainstorm:ID, analyze:ID, @file, or path). Resolves to context-package.json for upstream context inheritance.
31
+ - `--from <source>`: Load upstream context package (grill:ID, brainstorm:ID, analyze:ID, blueprint:BLP-xxx, @file, or path). Resolves to context-package.json via state.json artifact lookup for typed references, or direct path for @file/path.
31
32
 
32
33
  **Session**: `.workflow/.csv-wave/{YYYYMMDD}-analyze-{slug}/`
33
34
  **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md, context-package.json (all modes), analysis.md + conclusions.json (full mode AND quick mode; quick writes minimal conclusions.json with `scope_verdict` + `implementation_scope[]` only)
35
+
36
+ ### Pre-load (runs unconditionally, including -y auto mode)
37
+ 1. **Codebase docs**: IF `.workflow/codebase/doc-index.json` exists → Read ARCHITECTURE.md for module boundaries
38
+ 2. **Specs**: `maestro spec load --category arch` — load architecture constraints
39
+ 3. **Wiki search**: `maestro search "{topic keywords}" --json` → top 5-10 entries as prior knowledge
40
+ 4. **Role Knowledge**: `maestro search --category debug` → select relevant → `maestro wiki load`
41
+ 5. All optional — proceed without if unavailable (log warning)
34
42
  </context>
35
43
 
36
44
  <interview_protocol>
@@ -310,8 +318,17 @@ Protocol: read before analysis, append-only, dedup by type+key.
310
318
  - [ ] discoveries.ndjson append-only throughout
311
319
  - [ ] Next step routed (plan for Go, brainstorm for No-Go, plan --gaps for Gaps)
312
320
  - [ ] Session sealed via finish-work (archive.json written, optional spec/knowhow extraction)
321
+ - [ ] Ralph-invoked: `maestro ralph complete <idx> --status {STATUS}` called with correct verdict
313
322
  </success_criteria>
314
323
 
324
+ <ralph_completion>
325
+ When invoked as a ralph session step, end by calling the CLI (no standalone report):
326
+ ```
327
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
328
+ ```
329
+ Status verdicts: **DONE** (normal), **DONE_WITH_CONCERNS** (caveats; pass `--concerns`), **NEEDS_RETRY** (transient error), **BLOCKED** (hard blocker; pass `--reason`).
330
+ </ralph_completion>
331
+
315
332
  <on_complete>
316
333
  @~/.maestro/workflows/finish-work.md — SESSION_DIR=OUTPUT_DIR, SESSION_TYPE=analyze, SESSION_ID={artifact_id}, LINKED_MILESTONE={target_milestone or null}
317
334
  </on_complete>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro-brainstorm
3
3
  description: Use when exploring ideas, evaluating approaches, or needing multi-perspective analysis before implementation
4
- argument-hint: "[topic] [-y|--yes] [-c|--concurrency N] [--continue] [--count N] [--skip-questions] [--review-only]"
4
+ argument-hint: "[topic] [-y|--yes] [--concurrency N] [-c|--continue] [--count N] [--skip-questions] [--review-only]"
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
 
@@ -15,14 +15,31 @@ Wave 3 compares Decision Digests from each role's `analysis.md` §2 and patches
15
15
  <context>
16
16
  $ARGUMENTS — topic text and optional flags.
17
17
 
18
- **Flags**: `-y` (auto), `-c N` (concurrency, default 6), `--continue` (resume), `--count N` (roles, default 3 max 9), `--skip-questions`, `--review-only` (skip Wave 1/2; run Wave 3 only against existing */analysis.md)
18
+ **Flags**: `-y` (auto), `--concurrency N` (default 6), `-c`/`--continue` (resume), `--count N` (roles, default 3 max 9), `--skip-questions`, `--review-only` (skip Wave 1/2; run Wave 3 only against existing */analysis.md), `--from <source>` (load upstream context package)
19
+
20
+ **--from resolution** (upstream context loading):
21
+ ```
22
+ --from grill:ID → state.json.artifacts[type=grill, id=ID].context_package → load context-package.json
23
+ --from blueprint:ID → state.json.artifacts[type=blueprint, id=ID].context_package → load
24
+ --from @file → load file directly as context-package.json
25
+ --from path/ → load path/context-package.json
26
+ ```
27
+ When loaded, pre-seed guidance-specification.md with:
28
+ - `constraints[status=locked]` → §4 locked decisions (skip in interview)
29
+ - `domain.terminology[]` → §2 Concepts & Terminology (seed)
30
+ - `non_goals[]` → §3 Non-Goals (seed)
31
+ - `open_questions[]` → interview priority topics
32
+ - `insights[]` → W2 role analysis context
33
+
34
+ When `--from` is absent, auto-discover from state.json: latest `type=grill` artifact in same milestone → load its `context_package` if available. No match → proceed without upstream context.
19
35
 
20
36
  **9 valid roles**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
21
37
 
22
- ### Pre-load specs
38
+ ### Pre-load
23
39
  1. **Architecture specs**: `maestro spec load --category arch` — load architecture constraints as context for multi-role design (roles respect documented decisions).
24
40
  2. **Role Knowledge**: `maestro search --category arch` → identify relevant entries → `maestro wiki load <id1> [id2...]`
25
- 3. Both optional proceed without if unavailable.
41
+ 3. **Project context**: Read `.workflow/project.md` (if exists) → Validated requirements (already shipped) as constraints, Active requirements as current scope. Read `state.json.accumulated_context` → deferred items as brainstorming seeds, key_decisions as locked constraints.
42
+ 4. All optional — proceed without if unavailable.
26
43
 
27
44
  **Session**: `.workflow/.csv-wave/{YYYYMMDD}-brainstorm-{slug}/`
28
45
 
@@ -432,8 +449,17 @@ Protocol: read before analysis, append-only, dedup by type+key.
432
449
  - [ ] discoveries.ndjson append-only throughout
433
450
  - [ ] context.md aggregates session results with next-step routing
434
451
  - [ ] Session sealed via finish-work (auto mode only)
452
+ - [ ] Ralph-invoked: `maestro ralph complete <idx> --status {STATUS}` called with correct verdict
435
453
  </success_criteria>
436
454
 
455
+ <ralph_completion>
456
+ When invoked as a ralph session step, end by calling the CLI (no standalone report):
457
+ ```
458
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
459
+ ```
460
+ Status verdicts: **DONE** (normal), **DONE_WITH_CONCERNS** (caveats; pass `--concerns`), **NEEDS_RETRY** (transient error), **BLOCKED** (hard blocker; pass `--reason`).
461
+ </ralph_completion>
462
+
437
463
  <on_complete>
438
464
  @~/.maestro/workflows/finish-work.md — SESSION_DIR={output_dir}, SESSION_TYPE=brainstorm, SESSION_ID={artifact_id}, LINKED_MILESTONE=null
439
465
  </on_complete>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro-execute
3
3
  description: Use when a confirmed plan is ready for implementation
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase> [--auto-commit] [--method agent|cli] [--dir <path>]\""
4
+ argument-hint: "[-y|--yes] [--concurrency N] [-c|--continue] \"<phase> [--auto-commit] [--method agent|cli] [--dir <path>]\""
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
 
@@ -75,8 +75,8 @@ $maestro-execute --continue "20260318-execute-P3-phase3"
75
75
 
76
76
  **Flags**:
77
77
  - `-y, --yes`: Skip all confirmations (auto mode)
78
- - `-c, --concurrency N`: Max concurrent agents within each wave (default: 5)
79
- - `--continue`: Resume existing session
78
+ - `--concurrency N`: Max concurrent agents within each wave (default: 5)
79
+ - `-c, --continue`: Resume existing session
80
80
 
81
81
  **Inner flags** (passed inside quotes):
82
82
  - `--auto-commit`: Atomic git commit after each task completion
@@ -335,6 +335,28 @@ After each wave: if blocked tasks exist, prompt user to continue or stop (AUTO_Y
335
335
 
336
336
  Blocked/failed tasks cascade: mark all downstream dependents as `skipped` with error "Dependency {dep_id} blocked/failed".
337
337
 
338
+ ### Phase 2.5: Verification Gate
339
+
340
+ **Objective**: Cross-validate execution results against convergence criteria using external model perspective.
341
+
342
+ 1. **Collect verification targets**: For each completed task, read `.summaries/TASK-{NNN}-summary.md` + convergence criteria from `.task/TASK-{NNN}.json`
343
+ 2. **Delegate verification**: Run `maestro delegate` with accumulated evidence:
344
+ ```
345
+ maestro delegate "PURPOSE: 验证执行结果是否满足 convergence criteria
346
+ TASK: 逐项检查 | 对照 criteria | 标注 pass/fail | 汇总 gaps
347
+ CONTEXT: @.summaries/ @.task/
348
+ EXPECTED: verification.json { tasks: [{ id, criteria_met: bool, gaps: [] }], overall_pass: bool }
349
+ CONSTRAINTS: 只验证不修改" --role analyze --mode analysis
350
+ ```
351
+ 3. **Write verification.json** to plan directory with per-task pass/fail and gap list
352
+ 4. **Gate decision**:
353
+ - `overall_pass == true` → proceed to Phase 3
354
+ - Critical gaps (task criteria all failed) → log warning, mark affected tasks as `needs_retry`
355
+ - Non-critical gaps → record as `concerns` in verification.json, proceed
356
+ 5. **Register VRF artifact**: `{ id: "VRF-{next}", type: "verify", scope, path: verification.json, depends_on: "EXC-{id}" }`
357
+
358
+ Skip Phase 2.5 when `--skip-verify` flag present or task count == 0.
359
+
338
360
  ### Phase 3: Results Aggregation
339
361
 
340
362
  **Objective**: Update all state files and generate execution report.
@@ -110,8 +110,17 @@ Resume routing:
110
110
  - [ ] `context-package.json` generated with schema "context-package/1.0"
111
111
  - [ ] Artifact registered in state.json (type=grill, id=GRL-xxx)
112
112
  - [ ] Session sealed via finish-work
113
+ - [ ] Ralph-invoked: `maestro ralph complete <idx> --status {STATUS}` called with correct verdict
113
114
  </success_criteria>
114
115
 
116
+ <ralph_completion>
117
+ When invoked as a ralph session step, end by calling the CLI (no standalone report):
118
+ ```
119
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
120
+ ```
121
+ Status verdicts: **DONE** (normal), **DONE_WITH_CONCERNS** (caveats; pass `--concerns`), **NEEDS_RETRY** (transient error), **BLOCKED** (hard blocker; pass `--reason`).
122
+ </ralph_completion>
123
+
115
124
  <on_complete>
116
125
  @~/.maestro/workflows/finish-work.md — SESSION_DIR={output_dir}, SESSION_TYPE=grill, SESSION_ID={artifact_id}, LINKED_MILESTONE=null
117
126
  </on_complete>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro-plan
3
3
  description: Use when creating, revising, or verifying an execution plan for a phase or task
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase> [--dir <path>] [--from <source>] [--gaps] [--spec SPEC-xxx] [--collab]\""
4
+ argument-hint: "[-y|--yes] [--concurrency N] [-c|--continue] \"<phase> [--dir <path>] [--from <source>] [--gaps] [--spec SPEC-xxx] [--collab]\""
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
6
  ---
7
7
 
@@ -65,7 +65,7 @@ All mean: **follow the cycle anyway**.
65
65
  <context>
66
66
  $ARGUMENTS — phase number/text and optional flags.
67
67
 
68
- **Flags**: `-y` (auto), `-c N` (concurrency, default 4), `--continue` (resume), `--dir <path>`, `--from <source>` (load upstream context directly: analyze:ANL-xxx, blueprint:BLP-xxx, brainstorm:ID, @file, path), `--gaps` (issue-linked), `--spec SPEC-xxx`, `--collab`, `--revise`, `--check`, `--tdd` (RED-GREEN-REFACTOR task chains)
68
+ **Flags**: `-y` (auto), `--concurrency N` (default 4), `-c`/`--continue` (resume), `--dir <path>`, `--from <source>` (load upstream context directly: analyze:ANL-xxx, blueprint:BLP-xxx, brainstorm:ID, @file, path), `--gaps` (issue-linked), `--spec SPEC-xxx`, `--collab`, `--revise`, `--check`, `--tdd` (RED-GREEN-REFACTOR task chains)
69
69
 
70
70
  **Scope routing** (priority, per redesign §5.2):
71
71
  1. `--from analyze:ANL-xxx` → CONTEXT_DIR = ANL artifact path; scope=`standalone`
@@ -89,6 +89,14 @@ Write resolved milestone into PLN artifact registration and `plan.json.milestone
89
89
  **Scratch**: `.workflow/scratch/{YYYYMMDD}-plan-P{N}-{slug}/` (.task/ subdir)
90
90
 
91
91
  **Pre-load** (optional): context-package.json (via `--from`, takes precedence), context.md (prior analyze), conclusions.json, codebase ARCHITECTURE.md, `maestro search`, `maestro spec load --category arch`, team preflight `maestro collab preflight`.
92
+
93
+ **D-008 Ad-hoc Milestone Auto-Creation**: When scope resolves to `standalone` via standard resolution (routes 6 or 7, NOT via `--from`), and `state.json.current_milestone == null`, auto-create an adhoc milestone:
94
+ ```
95
+ milestone_id = "ADH-{YYYYMMDD}-{slug}"
96
+ state.json.milestones.push({ id: milestone_id, name: "{intent slug}", type: "adhoc", status: "active", phase_slugs: [] })
97
+ state.json.current_milestone = milestone_id
98
+ ```
99
+ **Exception**: `--from analyze:ANL-xxx` or `--from blueprint:BLP-xxx` → skip adhoc creation (upstream artifact provides milestone context or is intentionally milestone-free).
92
100
  </context>
93
101
 
94
102
  <csv_schema>
@@ -197,7 +205,22 @@ Each explores one angle: architecture (module boundaries, deps), patterns (simil
197
205
  Consumes all exploration findings + context.md + specs. Produces:
198
206
  - `plan.json`: summary, approach, task_ids, waves (with phase labels), confidence section
199
207
  - `.task/TASK-*.json`: each with read_first[], convergence.criteria[] (grep-verifiable), concrete action/implementation
200
- - Deep Work Rules: every task has read_first with file being modified + source of truth files
208
+
209
+ **Deep Work Rules** (MANDATORY for every task):
210
+ 1. `read_first[]`: MUST contain the file being modified + source-of-truth files (tests, interfaces, schemas)
211
+ 2. `convergence.criteria[]`: MUST be grep-verifiable (e.g., `"src/auth.ts contains export function verifyToken("`) — no subjective language ("well-structured", "properly implemented")
212
+ 3. `action`: concrete implementation verb (create/modify/delete/refactor) + target path
213
+ 4. `implementation[]`: ordered steps with file:change pairs — each step < 60 min
214
+ - Anti-pattern: `"Implement the feature"` (vague). Correct: `"Create src/auth.ts with verifyToken() and generateToken() functions using jsonwebtoken"`
215
+ - Anti-pattern: `read_first: []` (empty). Every file change requires reading the target first.
216
+
217
+ **Anti-splitting Rules**:
218
+ 1. One feature = one task (don't split "create auth module" into "create file" + "add exports")
219
+ 2. Group trivial changes (< 5 min each) into a single task
220
+ 3. `depends_on` only for genuine data/API dependencies, not arbitrary sequencing
221
+ 4. Task count guards: simple scope → 1-2 tasks, medium → 2-4, complex → 4-8
222
+
223
+ **UI-observable criteria**: If plan touches UI paths (components/, pages/, styles/) or frontend keywords, at least 1 convergence criterion per delivery wave MUST be UI-observable (e.g., `"page renders without console errors"`, `"button click triggers API call"`).
201
224
 
202
225
  Verifies plan.json and every .task/*.json exists on disk before reporting completed; else report blocked.
203
226
 
@@ -426,6 +426,9 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
426
426
  - `analyze_macro_id` 存在且当前 step 是 `roadmap` → args 改为 `--from analyze:{analyze_macro_id}`
427
427
  - `analyze_macro_id` 存在且 `scope_verdict ∈ {medium, small}` 且当前 step 是 `plan` → args 改为 `--from analyze:{analyze_macro_id}`
428
428
  - `blueprint_id` 存在 → 当前 step 是 `plan` → args 改为 `--from blueprint:{blueprint_id}`(优先级低于 phase 数字参数)
429
+ - **phase-level deferred chaining**(独立模式,step 含 `{phase}` 占位符):build 阶段前序 artifact 尚未产出,由 A_RESOLVE_ARGS(ralph-execute)运行时从 state.json 查找同 phase+milestone 最新 completed artifact 注入:
430
+ - `plan` step → `--from analyze:{phase_analyze_id}`,写 `source_artifact_ref`
431
+ - `execute` step → `--dir {plan_path}`(现有逻辑),写 `source_artifact_ref = "plan:{id}"`
429
432
  - 写入 `step.source_artifact_ref` 以便审计
430
433
  13. **D-007 Milestone-ref 标注**:每个含 `{phase}` 占位符的 step → `step.milestone_id = session.milestone`(由 A_RESOLVE_PHASE 反查得出),禁止读 `current_milestone`
431
434
  14. **动态插入步骤**(A_APPLY_*)同样应用规则 7-13
@@ -761,5 +764,8 @@ decision:post-goal-audit {retry+1}
761
764
  - [ ] Decision nodes 由 maestro delegate --role analyze 评估
762
765
  - [ ] Ralph 不执行 step,只 evaluate;`$maestro-ralph-execute` 直调 handoff
763
766
  - [ ] session.platform = "codex";所有 CLI 调用携带 `--platform codex`
767
+ - [ ] Phase-level deferred chaining:plan/execute step 的 `--from`/`--dir` 注入由 A_RESOLVE_ARGS(ralph-execute)运行时完成;build 阶段标记意图,不预知 artifact ID
768
+ - [ ] Phase-level plan step 运行时获得 `--from analyze:{phase_analyze_id}`(由 ralph-execute 从 state.json 查找注入)
769
+ - [ ] Phase-level execute step 运行时获得 `source_artifact_ref = "plan:{id}"`
764
770
 
765
771
  </appendix>