maestro-flow 0.5.33 → 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 (238) hide show
  1. package/.agents/agents/role-design-author.md +5 -3
  2. package/.agents/agents/workflow-collab-planner.md +1 -0
  3. package/.agents/agents/workflow-planner.md +2 -0
  4. package/.agents/skills/maestro/SKILL.md +8 -1
  5. package/.agents/skills/maestro-help/SKILL.md +39 -10
  6. package/.agents/skills/maestro-help/index/catalog.json +117 -53
  7. package/.agents/skills/maestro-help/phases/01-parse-intent.md +9 -6
  8. package/.agents/skills/maestro-help/phases/02-search-present.md +55 -15
  9. package/.agents/skills/maestro-help/phases/03-workflow-guide.md +35 -2
  10. package/.agents/skills/maestro-plan/SKILL.md +3 -1
  11. package/.agents/skills/maestro-ralph/SKILL.md +55 -19
  12. package/.agents/skills/maestro-ralph-execute/SKILL.md +52 -10
  13. package/.agents/skills/manage-harvest/SKILL.md +3 -0
  14. package/.agents/skills/manage-knowledge-audit/SKILL.md +29 -0
  15. package/.agents/skills/odyssey-debug/SKILL.md +7 -1
  16. package/.agents/skills/odyssey-improve/SKILL.md +7 -1
  17. package/.agents/skills/odyssey-planex/SKILL.md +11 -1
  18. package/.agents/skills/odyssey-review-test-fix/SKILL.md +7 -1
  19. package/.agents/skills/odyssey-ui/SKILL.md +7 -1
  20. package/.agents/skills/quality-review/SKILL.md +3 -0
  21. package/.agents/skills/quality-test/SKILL.md +27 -1
  22. package/.agy/agents/role-design-author.md +5 -3
  23. package/.agy/agents/workflow-collab-planner.md +1 -0
  24. package/.agy/agents/workflow-planner.md +2 -0
  25. package/.agy/skills/maestro/SKILL.md +8 -1
  26. package/.agy/skills/maestro-help/SKILL.md +39 -10
  27. package/.agy/skills/maestro-help/index/catalog.json +117 -53
  28. package/.agy/skills/maestro-help/phases/01-parse-intent.md +9 -6
  29. package/.agy/skills/maestro-help/phases/02-search-present.md +55 -15
  30. package/.agy/skills/maestro-help/phases/03-workflow-guide.md +35 -2
  31. package/.agy/skills/maestro-plan/SKILL.md +3 -1
  32. package/.agy/skills/maestro-ralph/SKILL.md +55 -19
  33. package/.agy/skills/maestro-ralph-execute/SKILL.md +52 -10
  34. package/.agy/skills/manage-harvest/SKILL.md +3 -0
  35. package/.agy/skills/manage-knowledge-audit/SKILL.md +29 -0
  36. package/.agy/skills/odyssey-debug/SKILL.md +7 -1
  37. package/.agy/skills/odyssey-improve/SKILL.md +7 -1
  38. package/.agy/skills/odyssey-planex/SKILL.md +11 -1
  39. package/.agy/skills/odyssey-review-test-fix/SKILL.md +7 -1
  40. package/.agy/skills/odyssey-ui/SKILL.md +7 -1
  41. package/.agy/skills/quality-review/SKILL.md +3 -0
  42. package/.agy/skills/quality-test/SKILL.md +27 -1
  43. package/.claude/agents/role-design-author.md +5 -3
  44. package/.claude/agents/workflow-collab-planner.md +1 -0
  45. package/.claude/agents/workflow-planner.md +2 -0
  46. package/.claude/commands/maestro-plan.md +3 -1
  47. package/.claude/commands/maestro-ralph-execute.md +52 -10
  48. package/.claude/commands/maestro-ralph.md +55 -19
  49. package/.claude/commands/maestro.md +8 -1
  50. package/.claude/commands/manage-harvest.md +3 -0
  51. package/.claude/commands/manage-knowledge-audit.md +29 -0
  52. package/.claude/commands/odyssey-debug.md +7 -1
  53. package/.claude/commands/odyssey-improve.md +7 -1
  54. package/.claude/commands/odyssey-planex.md +11 -1
  55. package/.claude/commands/odyssey-review-test-fix.md +7 -1
  56. package/.claude/commands/odyssey-ui.md +7 -1
  57. package/.claude/commands/quality-review.md +3 -0
  58. package/.claude/commands/quality-test.md +27 -1
  59. package/.claude/skills/maestro-help/SKILL.md +39 -10
  60. package/.claude/skills/maestro-help/index/catalog.json +117 -53
  61. package/.claude/skills/maestro-help/phases/01-parse-intent.md +9 -6
  62. package/.claude/skills/maestro-help/phases/02-search-present.md +55 -15
  63. package/.claude/skills/maestro-help/phases/03-workflow-guide.md +35 -2
  64. package/.codex/skills/maestro/SKILL.md +17 -2
  65. package/.codex/skills/maestro-analyze/SKILL.md +20 -3
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +30 -4
  67. package/.codex/skills/maestro-execute/SKILL.md +25 -3
  68. package/.codex/skills/maestro-grill/SKILL.md +9 -0
  69. package/.codex/skills/maestro-plan/SKILL.md +26 -3
  70. package/.codex/skills/maestro-ralph/SKILL.md +6 -0
  71. package/.codex/skills/maestro-ralph-execute/SKILL.md +51 -10
  72. package/.codex/skills/maestro-roadmap/SKILL.md +30 -1
  73. package/.codex/skills/manage-harvest/SKILL.md +2 -1
  74. package/.codex/skills/quality-review/SKILL.md +13 -2
  75. package/README.md +219 -87
  76. package/README.zh-CN.md +221 -79
  77. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +82 -0
  78. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +444 -0
  79. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -0
  80. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +9 -4
  81. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
  82. package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +54 -5
  83. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +420 -46
  84. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  85. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +16 -0
  86. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  87. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +14 -4
  88. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +130 -49
  89. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  90. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +64 -22
  91. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  92. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js +12 -12
  93. package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js.map +1 -1
  94. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +10 -3
  95. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
  96. package/dashboard/dist-server/src/commands/hooks.d.ts +3 -0
  97. package/dashboard/dist-server/src/commands/hooks.js +11 -8
  98. package/dashboard/dist-server/src/commands/hooks.js.map +1 -1
  99. package/dashboard/dist-server/src/graph/kg/db/types.d.ts +2 -1
  100. package/dashboard/dist-server/src/graph/kg/db/types.js.map +1 -1
  101. package/dashboard/dist-server/src/graph/kg/extraction/code/code-extractor.js +1 -1
  102. package/dashboard/dist-server/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  103. package/dashboard/dist-server/src/graph/kg/extraction/knowledge-extractor-registry.d.ts +22 -0
  104. package/dashboard/dist-server/src/graph/kg/extraction/knowledge-extractor-registry.js +64 -0
  105. package/dashboard/dist-server/src/graph/kg/extraction/knowledge-extractor-registry.js.map +1 -0
  106. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js +14 -104
  107. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js.map +1 -1
  108. package/dashboard/dist-server/src/hooks/keyword-spec-injector.js +5 -2
  109. package/dashboard/dist-server/src/hooks/keyword-spec-injector.js.map +1 -1
  110. package/dashboard/dist-server/src/hooks/wiki-role-loader.js +2 -1
  111. package/dashboard/dist-server/src/hooks/wiki-role-loader.js.map +1 -1
  112. package/dashboard/dist-server/src/tools/domain-loader.js +22 -16
  113. package/dashboard/dist-server/src/tools/domain-loader.js.map +1 -1
  114. package/dashboard/dist-server/src/tools/spec-entry-parser.d.ts +6 -1
  115. package/dashboard/dist-server/src/tools/spec-entry-parser.js +44 -13
  116. package/dashboard/dist-server/src/tools/spec-entry-parser.js.map +1 -1
  117. package/dashboard/dist-server/src/tools/spec-keyword-index.d.ts +2 -0
  118. package/dashboard/dist-server/src/tools/spec-keyword-index.js +4 -9
  119. package/dashboard/dist-server/src/tools/spec-keyword-index.js.map +1 -1
  120. package/dashboard/dist-server/src/tools/spec-loader.js +3 -11
  121. package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -1
  122. package/dashboard/dist-server/src/types/index.d.ts +14 -0
  123. package/dashboard/dist-server/src/utils/frontmatter.d.ts +15 -0
  124. package/dashboard/dist-server/src/utils/frontmatter.js +76 -0
  125. package/dashboard/dist-server/src/utils/frontmatter.js.map +1 -0
  126. package/dist/src/cli.js +1 -0
  127. package/dist/src/cli.js.map +1 -1
  128. package/dist/src/commands/domain.d.ts.map +1 -1
  129. package/dist/src/commands/domain.js +8 -2
  130. package/dist/src/commands/domain.js.map +1 -1
  131. package/dist/src/commands/hooks.d.ts +3 -0
  132. package/dist/src/commands/hooks.d.ts.map +1 -1
  133. package/dist/src/commands/hooks.js +11 -8
  134. package/dist/src/commands/hooks.js.map +1 -1
  135. package/dist/src/commands/install.d.ts.map +1 -1
  136. package/dist/src/commands/install.js +48 -11
  137. package/dist/src/commands/install.js.map +1 -1
  138. package/dist/src/commands/knowhow.d.ts.map +1 -1
  139. package/dist/src/commands/knowhow.js +3 -26
  140. package/dist/src/commands/knowhow.js.map +1 -1
  141. package/dist/src/commands/search.d.ts +6 -1
  142. package/dist/src/commands/search.d.ts.map +1 -1
  143. package/dist/src/commands/search.js +124 -52
  144. package/dist/src/commands/search.js.map +1 -1
  145. package/dist/src/commands/spec.d.ts.map +1 -1
  146. package/dist/src/commands/spec.js +106 -6
  147. package/dist/src/commands/spec.js.map +1 -1
  148. package/dist/src/commands/uninstall.d.ts.map +1 -1
  149. package/dist/src/commands/uninstall.js +12 -3
  150. package/dist/src/commands/uninstall.js.map +1 -1
  151. package/dist/src/commands/update.d.ts.map +1 -1
  152. package/dist/src/commands/update.js +37 -21
  153. package/dist/src/commands/update.js.map +1 -1
  154. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  155. package/dist/src/config/cli-tools-config.js +2 -0
  156. package/dist/src/config/cli-tools-config.js.map +1 -1
  157. package/dist/src/core/extension-loader.d.ts.map +1 -1
  158. package/dist/src/core/extension-loader.js +4 -0
  159. package/dist/src/core/extension-loader.js.map +1 -1
  160. package/dist/src/core/install-executor.d.ts.map +1 -1
  161. package/dist/src/core/install-executor.js +8 -3
  162. package/dist/src/core/install-executor.js.map +1 -1
  163. package/dist/src/graph/analyzers/fs-analyzer.js +2 -2
  164. package/dist/src/graph/analyzers/fs-analyzer.js.map +1 -1
  165. package/dist/src/graph/kg/db/node-kind-registry.d.ts +18 -0
  166. package/dist/src/graph/kg/db/node-kind-registry.d.ts.map +1 -0
  167. package/dist/src/graph/kg/db/node-kind-registry.js +42 -0
  168. package/dist/src/graph/kg/db/node-kind-registry.js.map +1 -0
  169. package/dist/src/graph/kg/db/types.d.ts +2 -1
  170. package/dist/src/graph/kg/db/types.d.ts.map +1 -1
  171. package/dist/src/graph/kg/db/types.js.map +1 -1
  172. package/dist/src/graph/kg/extraction/code/code-extractor.js +1 -1
  173. package/dist/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  174. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.d.ts +23 -0
  175. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.d.ts.map +1 -0
  176. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.js +64 -0
  177. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.js.map +1 -0
  178. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  179. package/dist/src/graph/kg/extraction/orchestrator.js +14 -104
  180. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  181. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -1
  182. package/dist/src/hooks/keyword-spec-injector.js +5 -2
  183. package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
  184. package/dist/src/hooks/wiki-role-loader.d.ts.map +1 -1
  185. package/dist/src/hooks/wiki-role-loader.js +2 -1
  186. package/dist/src/hooks/wiki-role-loader.js.map +1 -1
  187. package/dist/src/index.d.ts +6 -0
  188. package/dist/src/index.d.ts.map +1 -1
  189. package/dist/src/index.js +4 -0
  190. package/dist/src/index.js.map +1 -1
  191. package/dist/src/ralph/cmd-next.d.ts.map +1 -1
  192. package/dist/src/ralph/cmd-next.js +2 -3
  193. package/dist/src/ralph/cmd-next.js.map +1 -1
  194. package/dist/src/tools/domain-loader.d.ts.map +1 -1
  195. package/dist/src/tools/domain-loader.js +22 -16
  196. package/dist/src/tools/domain-loader.js.map +1 -1
  197. package/dist/src/tools/spec-conflict-marker.d.ts +55 -0
  198. package/dist/src/tools/spec-conflict-marker.d.ts.map +1 -0
  199. package/dist/src/tools/spec-conflict-marker.js +228 -0
  200. package/dist/src/tools/spec-conflict-marker.js.map +1 -0
  201. package/dist/src/tools/spec-entry-parser.d.ts +6 -1
  202. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
  203. package/dist/src/tools/spec-entry-parser.js +44 -13
  204. package/dist/src/tools/spec-entry-parser.js.map +1 -1
  205. package/dist/src/tools/spec-keyword-index.d.ts +2 -0
  206. package/dist/src/tools/spec-keyword-index.d.ts.map +1 -1
  207. package/dist/src/tools/spec-keyword-index.js +4 -9
  208. package/dist/src/tools/spec-keyword-index.js.map +1 -1
  209. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  210. package/dist/src/tools/spec-loader.js +3 -11
  211. package/dist/src/tools/spec-loader.js.map +1 -1
  212. package/dist/src/tools/spec-writer.d.ts.map +1 -1
  213. package/dist/src/tools/spec-writer.js +2 -6
  214. package/dist/src/tools/spec-writer.js.map +1 -1
  215. package/dist/src/tools/store-knowhow.d.ts.map +1 -1
  216. package/dist/src/tools/store-knowhow.js +6 -52
  217. package/dist/src/tools/store-knowhow.js.map +1 -1
  218. package/dist/src/tui/uninstall-ui/UninstallFlow.d.ts.map +1 -1
  219. package/dist/src/tui/uninstall-ui/UninstallFlow.js +3 -1
  220. package/dist/src/tui/uninstall-ui/UninstallFlow.js.map +1 -1
  221. package/dist/src/types/index.d.ts +14 -0
  222. package/dist/src/types/index.d.ts.map +1 -1
  223. package/dist/src/utils/frontmatter.d.ts +16 -0
  224. package/dist/src/utils/frontmatter.d.ts.map +1 -0
  225. package/dist/src/utils/frontmatter.js +76 -0
  226. package/dist/src/utils/frontmatter.js.map +1 -0
  227. package/dist/src/utils/migration-registry.d.ts.map +1 -1
  228. package/dist/src/utils/migration-registry.js +14 -1
  229. package/dist/src/utils/migration-registry.js.map +1 -1
  230. package/package.json +5 -3
  231. package/workflows/claude-instructions.md +63 -45
  232. package/workflows/codex-instructions.md +105 -28
  233. package/workflows/command-authoring.md +1 -1
  234. package/workflows/plan.md +2 -1
  235. package/.agents/skills/maestro-ralph-beta/SKILL.md +0 -877
  236. package/.agy/skills/maestro-ralph-beta/SKILL.md +0 -873
  237. package/.claude/commands/maestro-ralph-beta.md +0 -875
  238. package/.codex/skills/maestro-ralph-beta/SKILL.md +0 -883
@@ -123,18 +123,45 @@ const taskPatterns = [
123
123
  4. `/quality-auto-test [phase] --re-run` — 重跑失败场景
124
124
  ```
125
125
 
126
+ **Odyssey 长周期循环** (深度自主):
127
+
128
+ ```markdown
129
+ ## Odyssey 长周期循环
130
+
131
+ 适用于需要深度考古、多轮诊断/修复/验证、知识泛化和持久化的复杂任务。
132
+ 每个 odyssey 命令都是自含闭环,自主循环直到完成。
133
+
134
+ ### 调试类
135
+ 1. `/odyssey-debug "问题描述"` — 考古→诊断→修复→确认→泛化→知识持久化
136
+
137
+ ### 代码改进
138
+ 1. `/odyssey-improve "改进目标"` — 多维审计→深度诊断→定向修复→验证→泛化
139
+
140
+ ### 审查修复
141
+ 1. `/odyssey-review-test-fix "审查范围"` — 考古→探索→多维审查→修复→泛化
142
+
143
+ ### 需求迭代
144
+ 1. `/odyssey-planex "需求描述"` — 计划→执行→严格验证→修复循环(直到验收通过)
145
+
146
+ ### UI 优化
147
+ 1. `/odyssey-ui "优化目标"` — 视觉调研→多维审计→发散探索→修复→验证
148
+ ```
149
+
126
150
  #### Step 4.3: 工作流全景图
127
151
 
128
152
  对需要全景视角的用户,展示 Mermaid 图:
129
153
 
130
154
  ```
131
- 上游起源: brainstorm(发散) | blueprint(收敛) → 可选
155
+ 上游起源: brainstorm(发散) | blueprint(收敛) | grill(压力测试) → 可选
132
156
  理解层: analyze "topic"(宏观) → scope_verdict 路由
133
157
  编排层: roadmap(可选,仅 scope_verdict=large 时建议)
134
158
  执行层: plan → execute → quality → milestone-audit → milestone-complete
135
159
  快速渠道: maestro-quick → (直接完成)
136
160
  Issue 闭环: discover → create → analyze --gaps → plan --gaps → execute → close
137
- 全自动: /maestro -y → (自动路由)
161
+ 全自动: /maestro -y → (自动路由)
162
+ Odyssey: odyssey-debug / odyssey-improve / odyssey-planex / odyssey-ui → (自主循环)
163
+ 并行加速: swarm-workflow / universal-workflow → (多 agent 并发)
164
+ 智能导航: /maestro-next → (检测状态推荐下一步)
138
165
  ```
139
166
 
140
167
  #### Step 4.4: 关键概念说明
@@ -156,6 +183,11 @@ Issue 闭环: discover → create → analyze --gaps → plan --gaps → execute
156
183
  - **Spec**: 项目约束规则(coding/arch/debug/test),自动注入到工作流
157
184
  - **Wiki**: 知识图谱,存储详细技术文档
158
185
  - **Ralph**: 自适应决策引擎,动态调整执行链
186
+ - **Odyssey**: 长周期自主循环命令族(debug/improve/planex/ui/review-test-fix),自含考古→诊断→修复→泛化→知识持久化
187
+ - **Swarm Workflow**: 将任务路由到固定 Workflow 脚本进行多 agent 并发执行
188
+ - **Universal Workflow**: 动态生成对抗性 Workflow 脚本,支持复用和持久化
189
+ - **Grill**: 在 brainstorm 之前的压力测试,用代码库现实检验想法/需求
190
+ - **Next**: 智能导航,检测工作流状态并推荐最优下一步命令
159
191
  ```
160
192
 
161
193
  ### Mode 5: Beginner Onboarding
@@ -180,6 +212,7 @@ Issue 闭环: discover → create → analyze --gaps → plan --gaps → execute
180
212
  | 7 | `/maestro-plan` | 规划 | 分析完成后生成执行计划,支持 `--from analyze:ANL-xxx` 直达 |
181
213
  | 8 | `/maestro-execute` | 执行 | 计划完成后,执行实现 |
182
214
  | 9 | `/maestro-quick` | 快速任务 | 简单任务跳过管线 |
215
+ | 10 | `/maestro-next` | 智能导航 | 不确定下一步时,自动检测状态推荐 |
183
216
  ```
184
217
 
185
218
  #### Step 5.2: 快速入门路径
@@ -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>
@@ -128,19 +128,44 @@ S_FALLBACK:
128
128
  | maestro-brainstorm | topic | `"{intent}"` |
129
129
  | maestro-roadmap | description | `"{intent}"` |
130
130
  | maestro-analyze | phase or topic | `{phase}` or `"{intent}"` |
131
- | maestro-plan | phase or --dir | `{phase}`, or `--dir {scratch_dir}` |
132
- | maestro-execute | phase or --dir | `{phase}`, or `--dir {scratch_dir}` |
131
+ | maestro-plan | phase, --from, or --dir | see --from auto-injection below |
132
+ | maestro-execute | phase or --dir | see --from auto-injection below |
133
133
  | quality-debug | gap context | Read previous step's error/gap |
134
134
  | quality-* | phase | `{phase}` |
135
135
 
136
- **Artifact dir resolution for --dir:**
136
+ **--from auto-injection (phase-level artifact chaining):**
137
+
138
+ Phase-level steps 在 build 阶段无法预知前序 artifact ID。A_RESOLVE_ARGS 运行时从 state.json 查找并注入显式引用,打通 analyze→plan→execute 数据管道:
139
+
137
140
  ```
138
- Read state.json filter artifacts by milestone + phase
139
- plan commands: latest type=="analyze" --dir .workflow/scratch/{path}
140
- execute commands: latest type=="plan" → --dir .workflow/scratch/{path}
141
+ Read state.json.artifacts(含 milestone_history 内归档 artifacts
142
+ filter by milestone={session.milestone} + phase={session.phase} + status=="completed"
143
+
144
+ plan step(含 {phase} 占位符,args 无 --from 且无 --dir):
145
+ 1. 查同 phase+milestone 最新 completed type=="analyze" artifact → id = ANL-xxx
146
+ 2. 命中 → args 追加 --from analyze:{id}
147
+ 3. 写 step.source_artifact_ref = "analyze:{id}"
148
+
149
+ execute step(含 {phase} 占位符,args 无 --dir):
150
+ 1. 查同 phase+milestone 最新 completed type=="plan" artifact → id = PLN-xxx, path = scratch/...
151
+ 2. 命中 → args 追加 --dir .workflow/scratch/{path}
152
+ 3. 写 step.source_artifact_ref = "plan:{id}"
141
153
  ```
142
154
 
143
- Write enriched args back to status.json.
155
+ 兜底:查询无结果 不注入,由命令自身 discovery 逻辑处理。已有 `--from` 或 `--dir` 的 step 不覆盖。
156
+
157
+ **Goal context injection:**
158
+
159
+ 当 step.goal_ref 非空且 session.task_decomposition 存在时:
160
+ ```
161
+ goal = session.task_decomposition.find(g => g.id == step.goal_ref)
162
+ if goal:
163
+ goal_snippet = { id: goal.id, goal: goal.goal, done_when: goal.done_when,
164
+ boundary: goal.boundary, evidence: goal.evidence }
165
+ → 传递给 A_EXEC_STEP 用于 inline execution 前注入(见 step 2 goal context pre-injection)
166
+ ```
167
+
168
+ Write enriched args + source_artifact_ref back to status.json.
144
169
 
145
170
  ### A_EXEC_DECISION
146
171
 
@@ -156,13 +181,24 @@ Write enriched args back to status.json.
156
181
  - 退出码 2 → 交给 S_LOCATE
157
182
  - 退出码 3 → active_step_index 已被占用
158
183
  - 退出码 1 → pause session
159
- 2. **Inline execution** — stdout 执行;deferred_reading 按需 Read
160
- 3. **Complete**:
184
+ 2. **Goal context pre-injection** — A_RESOLVE_ARGS 产出了 `goal_snippet`(step.goal_ref 非空),在 ralph next stdout prompt **顶部前置**以下 block,使执行命令感知当前子目标和执行约束:
185
+ ```
186
+ <goal_context>
187
+ Sub-goal: {goal.id} — {goal.goal}
188
+ Done when: {goal.done_when}
189
+ Boundary: {goal.boundary}
190
+ Evidence target: {goal.evidence}
191
+ Execution criteria: {session.execution_criteria joined by '; '}
192
+ </goal_context>
193
+ ```
194
+ 无 goal_snippet 时跳过此步。goal_context block 不替换 ralph next 的 stdout 内容,仅在其前方拼接。
195
+ 3. **Inline execution** — 按 stdout(含 goal_context 前置)执行;deferred_reading 按需 Read
196
+ 4. **Complete**:
161
197
  - `Bash("maestro ralph complete N --status DONE [--evidence <path>]")`
162
198
  - `Bash("maestro ralph complete N --status DONE_WITH_CONCERNS --concerns \"...\"")`
163
199
  - `Bash("maestro ralph retry N")`
164
200
  - `Bash("maestro ralph complete N --status BLOCKED --reason \"...\"")`
165
- 4. **Propagate context signals** — 关键信号 (`PHASE: N` / `scratch_dir: path` / `BLP-xxx`) 写入 `status.json.context`
201
+ 5. **Propagate context signals** — 关键信号 (`PHASE: N` / `scratch_dir: path` / `BLP-xxx`) 写入 `status.json.context`
166
202
 
167
203
  完成后 S_LOCATE 触发 `$maestro-ralph-execute` 直调自调用。
168
204
 
@@ -240,5 +276,10 @@ Display: `[{index}/{total}] ✗ {step.skill} 失败,会话已暂停。$maestro
240
276
  - [ ] Auto mode: retry 一次后 pause;interactive 提供 retry/skip/abort
241
277
  - [ ] 自调用持续到全部 completion_confirmed 或 paused
242
278
  - [ ] 只处理 session.platform == "codex" 的会话
279
+ - [ ] --from auto-injection:phase-level plan step 运行时从 state.json 查找同 phase+milestone 最新 completed analyze artifact → 注入 `--from analyze:{id}`,写 `source_artifact_ref`
280
+ - [ ] --from auto-injection:phase-level execute step 运行时查找同 phase+milestone 最新 completed plan artifact → 注入 `--dir`,写 `source_artifact_ref`
281
+ - [ ] Goal context injection:step.goal_ref 非空时从 task_decomposition 提取 goal_snippet,A_EXEC_STEP 在 ralph next stdout 顶部前置 `<goal_context>` block
282
+ - [ ] Goal context 包含 sub-goal description、done_when、boundary、evidence、execution_criteria
283
+ - [ ] 已有 `--from` 或 `--dir` 的 step 不被 auto-injection 覆盖
243
284
 
244
285
  </appendix>
@@ -29,6 +29,11 @@ $ARGUMENTS -- requirement/idea text or @file reference, plus optional flags.
29
29
 
30
30
  **Session**: `.workflow/.csv-wave/{YYYYMMDD}-roadmap-{slug}/`
31
31
  **Output**: tasks.csv, results.csv, discoveries.ndjson, context.md, `.workflow/roadmap.md`
32
+
33
+ ### Pre-load (runs unconditionally, including -y auto mode)
34
+ 1. **Architecture specs**: `maestro spec load --category arch` — load architecture constraints for phase decomposition
35
+ 2. **Wiki search**: `maestro search "{requirement keywords}" --json` → prior knowledge for dependency and scope analysis
36
+ 3. All optional — proceed without if unavailable (log warning)
32
37
  </context>
33
38
 
34
39
  <interview_protocol>
@@ -176,7 +181,22 @@ Assembly agent produces roadmap.md with Milestone > Phase hierarchy (goal, depen
176
181
  3. Generate context.md (summary + analysis findings + roadmap stats)
177
182
  4. Write .workflow/roadmap.md with Milestone > Phase hierarchy
178
183
  5. Update state.json milestones + current_milestone
179
- 6. Next-step routing: need analysis -> maestro-analyze; ready to plan -> maestro-plan; UI first -> maestro-impeccable build; need formal specs -> maestro-blueprint
184
+ 6. **Generate context-package.json** (schema `context-package/1.0`):
185
+ ```jsonc
186
+ {
187
+ "$schema": "context-package/1.0",
188
+ "source": { "type": "roadmap", "artifact_id": "RDM-{id}", "session_path": "...", "generated_at": "..." },
189
+ "requirements": [], // from milestone phase goals → { id, title, acceptance }
190
+ "constraints": [], // from scope decisions → locked items
191
+ "domain": {}, // inherit from upstream --from context-package if loaded
192
+ "non_goals": [], // deferred scope items
193
+ "insights": [], // from risk analysis and dependency findings
194
+ "open_questions": [], // unresolved scope areas
195
+ "references": [{ "type": "roadmap", "path": "roadmap.md" }]
196
+ }
197
+ ```
198
+ Register `context_package` path in RDM artifact entry so downstream `--from roadmap:ID` can resolve.
199
+ 7. Next-step routing: need analysis -> maestro-analyze; ready to plan -> maestro-plan; UI first -> maestro-impeccable build; need formal specs -> maestro-blueprint
180
200
 
181
201
  </actions>
182
202
 
@@ -215,5 +235,14 @@ Protocol: read before analysis, append-only, dedup by type+key.
215
235
  - [ ] context.md generated
216
236
  - [ ] Uncertainty assessed, strategy selected, milestones with phases + success criteria
217
237
  - [ ] Artifact registered in state.json with milestone entries
238
+ - [ ] Ralph-invoked: `maestro ralph complete <idx> --status {STATUS}` called with correct verdict
218
239
  </success_criteria>
240
+
241
+ <ralph_completion>
242
+ When invoked as a ralph session step, end by calling the CLI (no standalone report):
243
+ ```
244
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
245
+ ```
246
+ Status verdicts: **DONE** (normal), **DONE_WITH_CONCERNS** (caveats; pass `--concerns`), **NEEDS_RETRY** (transient error), **BLOCKED** (hard blocker; pass `--reason`).
247
+ </ralph_completion>
219
248
  </output>
@@ -57,6 +57,7 @@ Follow '~/.maestro/workflows/harvest.md' Stages 1–8 (standard mode) or Stage 9
57
57
  4. **Never modify source artifacts** — purely extractive
58
58
  5. **Confidence filtering** — below threshold logged but not routed
59
59
  6. **Spec format enforcement** — all spec routing must use `<spec-entry>` closed-tag format with `title`, `description`, `keywords`, `date`, `source="harvest"` attributes
60
+ 7. **Conflict pre-check on spec routing** — when routing to spec, compare new entry against existing specs with same keywords/category. If semantic conflict detected, set `confidence="low"` on the new entry and log conflict note. Use `maestro spec conflict mark` if contradiction is clear
60
61
 
61
62
  **Routing rules:**
62
63
  - Universal design patterns → `coding` or `arch` category
@@ -66,7 +67,7 @@ Follow '~/.maestro/workflows/harvest.md' Stages 1–8 (standard mode) or Stage 9
66
67
  - Spec: `maestro wiki append spec-<file> --body "<content>" --keywords "<kws>"` (unified write path) or `$spec-add "<category> <content>"`
67
68
  - Issue: append to `issues.jsonl` matching canonical schema, with `source: "harvest"` field (distinguishes from `manage-issue-discover`, which uses `source: "discover"` — required for cross-skill dedup when both write concurrently)
68
69
 
69
- **Next steps:** `$manage-wiki health`, `maestro search --type note`, `$wiki-connect --fix`, `$wiki-digest`, `$manage-issue list --source harvest`
70
+ **Next steps:** `$manage-wiki health`, `maestro search --type note`, `$wiki-connect --fix`, `$wiki-digest`, `$manage-issue list --source harvest`, `$manage-knowledge-audit --scope spec` (when specs extracted, check for conflicts)
70
71
 
71
72
  **Prune mode** (`--prune`): Classifies artifacts (active/graduated/stale/protected), graduates harvested artifacts to wiki knowhow, archives from `artifacts[]` → `artifact_archive[]`, prunes resolved entries from accumulated_context. Files on disk are never deleted. Always backs up state.json before writing.
72
73
  </execution>
@@ -197,7 +197,7 @@ Session folder: `.workflow/.csv-wave/{sessionId}/` — create via `mkdir -p`
197
197
 
198
198
  If `--dimensions` flag provided, override with explicit list.
199
199
 
200
- 6. **Specs loading**: Run `maestro spec load --category review` to load review standards, checklists, AND discoverable knowhow tools (unless `--skip-specs`)
200
+ 6. **Specs loading**: Run `maestro spec load --category review` to load review standards, checklists, AND discoverable knowhow tools (unless `--skip-specs`). Also run `maestro spec conflict list` to load existing conflict markers (review should prioritize verifying contested entries against code)
201
201
  7. **CSV generation**: One row per dimension + one aggregation row
202
202
 
203
203
  **Wave computation**: Simple 2-wave -- all dimension tasks = wave 1, aggregation = wave 2.
@@ -352,11 +352,13 @@ Generate `context.md`:
352
352
  | standard | critical + high |
353
353
  | deep | critical + high + medium |
354
354
 
355
+ **Spec conflict check**: If any finding directly contradicts a loaded spec entry (code behavior ≠ spec rule), suggest `maestro spec conflict mark <file> <line> --note "<evidence>"` on the spec entry. Code is the single source of truth. Log spec conflicts in review.json as `spec_conflicts[]`.
356
+
355
357
  **Phase index update**: Update `{artifact_dir}/index.json` with review status.
356
358
 
357
359
  **Register artifact**: Append to `state.json.artifacts[]` with `type: "review"`, `id: REV-NNN`, `path: "scratch/{YYYYMMDD}-review-P{N}-{slug}"`, `depends_on: exec_art.id`. Output directory is independent scratch, not shared with plan.
358
360
 
359
- Display summary.
361
+ Display summary. If spec conflicts detected, suggest: `maestro spec conflict list` → `$manage-knowledge-audit --scope spec`.
360
362
 
361
363
  ### Shared Discovery Board Protocol
362
364
 
@@ -411,4 +413,13 @@ echo '{"ts":"<ISO>","worker":"{id}","type":"vulnerability","data":{"location":"s
411
413
  - [ ] Issues auto-created for qualifying severity findings
412
414
  - [ ] Phase index.json updated with review status
413
415
  - [ ] discoveries.ndjson append-only throughout
416
+ - [ ] Ralph-invoked: `maestro ralph complete <idx> --status {STATUS}` called with correct verdict
414
417
  </success_criteria>
418
+
419
+ <ralph_completion>
420
+ When invoked as a ralph session step, end by calling the CLI (no standalone report):
421
+ ```
422
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
423
+ ```
424
+ Status verdicts: **DONE** (normal), **DONE_WITH_CONCERNS** (caveats; pass `--concerns`), **NEEDS_RETRY** (transient error), **BLOCKED** (hard blocker; pass `--reason`).
425
+ </ralph_completion>