maestro-flow 0.5.34 → 0.5.36

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 (325) hide show
  1. package/.agents/agents/cli-explore-agent.md +71 -68
  2. package/.agents/agents/workflow-analyzer.md +1 -0
  3. package/.agents/agents/workflow-collab-planner.md +1 -0
  4. package/.agents/agents/workflow-debugger.md +1 -0
  5. package/.agents/agents/workflow-executor.md +1 -0
  6. package/.agents/agents/workflow-planner.md +2 -0
  7. package/.agents/skills/domain-add/SKILL.md +71 -0
  8. package/.agents/skills/maestro/SKILL.md +7 -6
  9. package/.agents/skills/maestro-amend/SKILL.md +0 -2
  10. package/.agents/skills/maestro-analyze/SKILL.md +9 -0
  11. package/.agents/skills/maestro-brainstorm/SKILL.md +10 -1
  12. package/.agents/skills/maestro-collab/SKILL.md +14 -1
  13. package/.agents/skills/maestro-help/SKILL.md +1 -1
  14. package/.agents/skills/maestro-help/index/catalog.json +0 -1
  15. package/.agents/skills/maestro-help/phases/01-parse-intent.md +1 -1
  16. package/.agents/skills/maestro-next/SKILL.md +15 -4
  17. package/.agents/skills/maestro-overlay/SKILL.md +4 -3
  18. package/.agents/skills/maestro-plan/SKILL.md +15 -4
  19. package/.agents/skills/maestro-ralph/SKILL.md +135 -31
  20. package/.agents/skills/maestro-ralph-execute/SKILL.md +51 -10
  21. package/.agents/skills/maestro-tools-register/SKILL.md +0 -6
  22. package/.agents/skills/maestro-ui-codify/SKILL.md +0 -2
  23. package/.agents/skills/manage-kg-extractors/SKILL.md +0 -2
  24. package/.agents/skills/quality-test/SKILL.md +25 -1
  25. package/.agents/skills/spec-load/SKILL.md +0 -1
  26. package/.agents/skills/spec-setup/SKILL.md +0 -1
  27. package/.agents/skills/team-lifecycle-v4/roles/analyst/role.md +13 -7
  28. package/.agents/skills/team-quality-assurance/roles/scout/role.md +15 -11
  29. package/.agents/skills/team-tech-debt/roles/scanner/role.md +1 -1
  30. package/.agents/skills/team-ultra-analyze/roles/explorer/role.md +23 -16
  31. package/.agy/agents/cli-explore-agent.md +71 -68
  32. package/.agy/agents/workflow-analyzer.md +1 -0
  33. package/.agy/agents/workflow-collab-planner.md +1 -0
  34. package/.agy/agents/workflow-debugger.md +1 -0
  35. package/.agy/agents/workflow-executor.md +1 -0
  36. package/.agy/agents/workflow-planner.md +2 -0
  37. package/.agy/skills/domain-add/SKILL.md +68 -0
  38. package/.agy/skills/maestro/SKILL.md +7 -6
  39. package/.agy/skills/maestro-amend/SKILL.md +0 -2
  40. package/.agy/skills/maestro-analyze/SKILL.md +9 -0
  41. package/.agy/skills/maestro-brainstorm/SKILL.md +10 -1
  42. package/.agy/skills/maestro-collab/SKILL.md +14 -1
  43. package/.agy/skills/maestro-help/SKILL.md +1 -1
  44. package/.agy/skills/maestro-help/index/catalog.json +0 -1
  45. package/.agy/skills/maestro-help/phases/01-parse-intent.md +1 -1
  46. package/.agy/skills/maestro-next/SKILL.md +15 -4
  47. package/.agy/skills/maestro-overlay/SKILL.md +4 -3
  48. package/.agy/skills/maestro-plan/SKILL.md +15 -4
  49. package/.agy/skills/maestro-ralph/SKILL.md +135 -31
  50. package/.agy/skills/maestro-ralph-execute/SKILL.md +51 -10
  51. package/.agy/skills/maestro-tools-register/SKILL.md +0 -6
  52. package/.agy/skills/maestro-ui-codify/SKILL.md +0 -2
  53. package/.agy/skills/manage-kg-extractors/SKILL.md +0 -2
  54. package/.agy/skills/quality-test/SKILL.md +25 -1
  55. package/.agy/skills/spec-load/SKILL.md +0 -1
  56. package/.agy/skills/spec-setup/SKILL.md +0 -1
  57. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +13 -7
  58. package/.agy/skills/team-quality-assurance/roles/scout/role.md +15 -11
  59. package/.agy/skills/team-tech-debt/roles/scanner/role.md +1 -1
  60. package/.agy/skills/team-ultra-analyze/roles/explorer/role.md +23 -16
  61. package/.claude/agents/cli-explore-agent.md +71 -68
  62. package/.claude/agents/workflow-analyzer.md +1 -0
  63. package/.claude/agents/workflow-collab-planner.md +1 -0
  64. package/.claude/agents/workflow-debugger.md +1 -0
  65. package/.claude/agents/workflow-executor.md +1 -0
  66. package/.claude/agents/workflow-planner.md +2 -0
  67. package/.claude/commands/domain-add.md +69 -0
  68. package/.claude/commands/maestro-amend.md +0 -2
  69. package/.claude/commands/maestro-analyze.md +9 -0
  70. package/.claude/commands/maestro-brainstorm.md +10 -1
  71. package/.claude/commands/maestro-collab.md +14 -1
  72. package/.claude/commands/maestro-next.md +15 -4
  73. package/.claude/commands/maestro-overlay.md +4 -3
  74. package/.claude/commands/maestro-plan.md +15 -4
  75. package/.claude/commands/maestro-ralph-execute.md +51 -10
  76. package/.claude/commands/maestro-ralph.md +135 -31
  77. package/.claude/commands/maestro-tools-register.md +0 -6
  78. package/.claude/commands/maestro-ui-codify.md +0 -2
  79. package/.claude/commands/maestro.md +7 -6
  80. package/.claude/commands/manage-kg-extractors.md +0 -2
  81. package/.claude/commands/quality-test.md +25 -1
  82. package/.claude/commands/spec-load.md +0 -1
  83. package/.claude/commands/spec-setup.md +0 -1
  84. package/.claude/skills/maestro-help/SKILL.md +1 -1
  85. package/.claude/skills/maestro-help/index/catalog.json +0 -1
  86. package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
  87. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +13 -7
  88. package/.claude/skills/team-quality-assurance/roles/scout/role.md +15 -11
  89. package/.claude/skills/team-tech-debt/roles/scanner/role.md +1 -1
  90. package/.claude/skills/team-ultra-analyze/roles/explorer/role.md +23 -16
  91. package/.codex/skills/domain-add/SKILL.md +79 -0
  92. package/.codex/skills/domain-discover/SKILL.md +43 -0
  93. package/.codex/skills/domain-list/SKILL.md +38 -0
  94. package/.codex/skills/learn-follow/SKILL.md +0 -3
  95. package/.codex/skills/learn-investigate/SKILL.md +0 -3
  96. package/.codex/skills/learn-retro/SKILL.md +0 -2
  97. package/.codex/skills/maestro/SKILL.md +34 -13
  98. package/.codex/skills/maestro-amend/SKILL.md +0 -2
  99. package/.codex/skills/maestro-analyze/SKILL.md +36 -6
  100. package/.codex/skills/maestro-blueprint/SKILL.md +0 -4
  101. package/.codex/skills/maestro-brainstorm/SKILL.md +46 -6
  102. package/.codex/skills/maestro-collab/SKILL.md +14 -1
  103. package/.codex/skills/maestro-companion/SKILL.md +0 -2
  104. package/.codex/skills/maestro-execute/SKILL.md +25 -3
  105. package/.codex/skills/maestro-fork/SKILL.md +0 -2
  106. package/.codex/skills/maestro-grill/SKILL.md +9 -1
  107. package/.codex/skills/maestro-next/SKILL.md +12 -5
  108. package/.codex/skills/maestro-plan/SKILL.md +43 -5
  109. package/.codex/skills/maestro-ralph/SKILL.md +10 -3
  110. package/.codex/skills/maestro-ralph-execute/SKILL.md +51 -10
  111. package/.codex/skills/maestro-roadmap/SKILL.md +30 -3
  112. package/.codex/skills/manage-wiki/SKILL.md +0 -2
  113. package/.codex/skills/odyssey-debug/SKILL.md +0 -2
  114. package/.codex/skills/odyssey-improve/SKILL.md +0 -6
  115. package/.codex/skills/odyssey-review-test-fix/SKILL.md +0 -3
  116. package/.codex/skills/odyssey-ui/SKILL.md +0 -3
  117. package/.codex/skills/quality-review/SKILL.md +9 -0
  118. package/.codex/skills/spec-setup/SKILL.md +0 -2
  119. package/.codex/skills/team-coordinate/SKILL.md +0 -3
  120. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +0 -2
  121. package/README.md +28 -5
  122. package/README.zh-CN.md +28 -5
  123. package/chains/_intent-map.json +36 -0
  124. package/chains/blueprint-driven.json +49 -0
  125. package/chains/grill-driven.json +51 -0
  126. package/dashboard/dist-server/dashboard/src/server/agents/adapter-factory.js +4 -0
  127. package/dashboard/dist-server/dashboard/src/server/agents/adapter-factory.js.map +1 -1
  128. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.d.ts +6 -0
  129. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js +36 -0
  130. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js.map +1 -0
  131. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.d.ts +1 -1
  132. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
  133. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +82 -0
  134. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +444 -0
  135. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -0
  136. package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +47 -1
  137. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +426 -19
  138. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  139. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +16 -0
  140. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  141. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +11 -0
  142. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +492 -1
  143. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  144. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +18 -0
  145. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +192 -9
  146. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  147. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +42 -0
  148. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  149. package/dashboard/dist-server/dashboard/src/shared/constants.js +2 -0
  150. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  151. package/dashboard/dist-server/shared/agent-types.d.ts +1 -1
  152. package/dashboard/dist-server/src/commands/hooks.d.ts +3 -0
  153. package/dashboard/dist-server/src/commands/hooks.js +60 -9
  154. package/dashboard/dist-server/src/commands/hooks.js.map +1 -1
  155. package/dashboard/dist-server/src/graph/kg/extraction/code/code-extractor.js +1 -1
  156. package/dashboard/dist-server/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  157. package/dashboard/dist-server/src/graph/kg/extraction/knowledge/domain-extractor.js +4 -2
  158. package/dashboard/dist-server/src/graph/kg/extraction/knowledge/domain-extractor.js.map +1 -1
  159. package/dashboard/dist-server/src/graph/kg/extraction/knowledge-extractor-registry.js +6 -1
  160. package/dashboard/dist-server/src/graph/kg/extraction/knowledge-extractor-registry.js.map +1 -1
  161. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js +2 -6
  162. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js.map +1 -1
  163. package/dashboard/dist-server/src/hooks/session-context.js +37 -1
  164. package/dashboard/dist-server/src/hooks/session-context.js.map +1 -1
  165. package/dashboard/dist-server/src/search/daemon.d.ts +42 -0
  166. package/dashboard/dist-server/src/search/daemon.js +180 -0
  167. package/dashboard/dist-server/src/search/daemon.js.map +1 -0
  168. package/dashboard/dist-server/src/tools/domain-loader.d.ts +4 -1
  169. package/dashboard/dist-server/src/tools/domain-loader.js +56 -25
  170. package/dashboard/dist-server/src/tools/domain-loader.js.map +1 -1
  171. package/dashboard/dist-server/src/tools/domain-schema.d.ts +1 -1
  172. package/dashboard/dist-server/src/tools/domain-schema.js +1 -1
  173. package/dist/shared/agent-types.d.ts +1 -1
  174. package/dist/shared/agent-types.d.ts.map +1 -1
  175. package/dist/src/agents/api-explore/agent-loop.d.ts +14 -0
  176. package/dist/src/agents/api-explore/agent-loop.d.ts.map +1 -0
  177. package/dist/src/agents/api-explore/agent-loop.js +86 -0
  178. package/dist/src/agents/api-explore/agent-loop.js.map +1 -0
  179. package/dist/src/agents/api-explore/config.d.ts +42 -0
  180. package/dist/src/agents/api-explore/config.d.ts.map +1 -0
  181. package/dist/src/agents/api-explore/config.js +99 -0
  182. package/dist/src/agents/api-explore/config.js.map +1 -0
  183. package/dist/src/agents/api-explore/index.d.ts +2 -0
  184. package/dist/src/agents/api-explore/index.d.ts.map +1 -0
  185. package/dist/src/agents/api-explore/index.js +102 -0
  186. package/dist/src/agents/api-explore/index.js.map +1 -0
  187. package/dist/src/agents/api-explore/llm.d.ts +28 -0
  188. package/dist/src/agents/api-explore/llm.d.ts.map +1 -0
  189. package/dist/src/agents/api-explore/llm.js +48 -0
  190. package/dist/src/agents/api-explore/llm.js.map +1 -0
  191. package/dist/src/agents/api-explore/prompt-parser.d.ts +23 -0
  192. package/dist/src/agents/api-explore/prompt-parser.d.ts.map +1 -0
  193. package/dist/src/agents/api-explore/prompt-parser.js +73 -0
  194. package/dist/src/agents/api-explore/prompt-parser.js.map +1 -0
  195. package/dist/src/agents/api-explore/runner.d.ts +65 -0
  196. package/dist/src/agents/api-explore/runner.d.ts.map +1 -0
  197. package/dist/src/agents/api-explore/runner.js +196 -0
  198. package/dist/src/agents/api-explore/runner.js.map +1 -0
  199. package/dist/src/agents/api-explore/session.d.ts +23 -0
  200. package/dist/src/agents/api-explore/session.d.ts.map +1 -0
  201. package/dist/src/agents/api-explore/session.js +57 -0
  202. package/dist/src/agents/api-explore/session.js.map +1 -0
  203. package/dist/src/agents/api-explore/stream-json-emitter.d.ts +10 -0
  204. package/dist/src/agents/api-explore/stream-json-emitter.d.ts.map +1 -0
  205. package/dist/src/agents/api-explore/stream-json-emitter.js +19 -0
  206. package/dist/src/agents/api-explore/stream-json-emitter.js.map +1 -0
  207. package/dist/src/agents/api-explore/system-prompt.d.ts +2 -0
  208. package/dist/src/agents/api-explore/system-prompt.d.ts.map +1 -0
  209. package/dist/src/agents/api-explore/system-prompt.js +31 -0
  210. package/dist/src/agents/api-explore/system-prompt.js.map +1 -0
  211. package/dist/src/agents/api-explore/tools.d.ts +11 -0
  212. package/dist/src/agents/api-explore/tools.d.ts.map +1 -0
  213. package/dist/src/agents/api-explore/tools.js +168 -0
  214. package/dist/src/agents/api-explore/tools.js.map +1 -0
  215. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  216. package/dist/src/agents/cli-agent-runner.js +3 -0
  217. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  218. package/dist/src/cli.js +4 -0
  219. package/dist/src/cli.js.map +1 -1
  220. package/dist/src/commands/domain.d.ts.map +1 -1
  221. package/dist/src/commands/domain.js +5 -4
  222. package/dist/src/commands/domain.js.map +1 -1
  223. package/dist/src/commands/explore.d.ts +7 -0
  224. package/dist/src/commands/explore.d.ts.map +1 -0
  225. package/dist/src/commands/explore.js +201 -0
  226. package/dist/src/commands/explore.js.map +1 -0
  227. package/dist/src/commands/hooks.d.ts +3 -0
  228. package/dist/src/commands/hooks.d.ts.map +1 -1
  229. package/dist/src/commands/hooks.js +60 -9
  230. package/dist/src/commands/hooks.js.map +1 -1
  231. package/dist/src/commands/install.d.ts.map +1 -1
  232. package/dist/src/commands/install.js +42 -9
  233. package/dist/src/commands/install.js.map +1 -1
  234. package/dist/src/commands/search.d.ts +26 -4
  235. package/dist/src/commands/search.d.ts.map +1 -1
  236. package/dist/src/commands/search.js +359 -93
  237. package/dist/src/commands/search.js.map +1 -1
  238. package/dist/src/commands/update.d.ts.map +1 -1
  239. package/dist/src/commands/update.js +37 -21
  240. package/dist/src/commands/update.js.map +1 -1
  241. package/dist/src/commands/workspace.d.ts.map +1 -1
  242. package/dist/src/commands/workspace.js +9 -3
  243. package/dist/src/commands/workspace.js.map +1 -1
  244. package/dist/src/config/cli-tools-defaults.json +2 -1
  245. package/dist/src/core/install-executor.d.ts.map +1 -1
  246. package/dist/src/core/install-executor.js +6 -3
  247. package/dist/src/core/install-executor.js.map +1 -1
  248. package/dist/src/graph/kg/extraction/code/code-extractor.js +1 -1
  249. package/dist/src/graph/kg/extraction/code/code-extractor.js.map +1 -1
  250. package/dist/src/graph/kg/extraction/knowledge/domain-extractor.d.ts.map +1 -1
  251. package/dist/src/graph/kg/extraction/knowledge/domain-extractor.js +4 -2
  252. package/dist/src/graph/kg/extraction/knowledge/domain-extractor.js.map +1 -1
  253. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.d.ts.map +1 -1
  254. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.js +6 -1
  255. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.js.map +1 -1
  256. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  257. package/dist/src/graph/kg/extraction/orchestrator.js +2 -6
  258. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  259. package/dist/src/graph/kg/surface/cli.d.ts.map +1 -1
  260. package/dist/src/graph/kg/surface/cli.js +5 -2
  261. package/dist/src/graph/kg/surface/cli.js.map +1 -1
  262. package/dist/src/hooks/session-context.d.ts.map +1 -1
  263. package/dist/src/hooks/session-context.js +37 -1
  264. package/dist/src/hooks/session-context.js.map +1 -1
  265. package/dist/src/ralph/cmd-next.d.ts.map +1 -1
  266. package/dist/src/ralph/cmd-next.js +66 -4
  267. package/dist/src/ralph/cmd-next.js.map +1 -1
  268. package/dist/src/ralph/status-schema.d.ts +1 -0
  269. package/dist/src/ralph/status-schema.d.ts.map +1 -1
  270. package/dist/src/search/daemon.d.ts +43 -0
  271. package/dist/src/search/daemon.d.ts.map +1 -0
  272. package/dist/src/search/daemon.js +180 -0
  273. package/dist/src/search/daemon.js.map +1 -0
  274. package/dist/src/tools/__tests__/domain-search-debug.js +3 -1
  275. package/dist/src/tools/__tests__/domain-search-debug.js.map +1 -1
  276. package/dist/src/tools/domain-loader.d.ts +4 -1
  277. package/dist/src/tools/domain-loader.d.ts.map +1 -1
  278. package/dist/src/tools/domain-loader.js +56 -25
  279. package/dist/src/tools/domain-loader.js.map +1 -1
  280. package/dist/src/tools/domain-schema.d.ts +1 -1
  281. package/dist/src/tools/domain-schema.js +1 -1
  282. package/dist/src/utils/update-notices.js +12 -0
  283. package/dist/src/utils/update-notices.js.map +1 -1
  284. package/package.json +5 -1
  285. package/shared/agent-types.ts +1 -1
  286. package/templates/search-tools.md +22 -6
  287. package/workflows/agy-instructions.md +0 -4
  288. package/workflows/analyze.md +2 -2
  289. package/workflows/boundary-grill.md +50 -0
  290. package/workflows/brainstorm.md +6 -5
  291. package/workflows/claude-instructions.md +29 -2
  292. package/workflows/codebase-rebuild.md +0 -1
  293. package/workflows/codex-instructions.md +97 -14
  294. package/workflows/command-authoring.md +1 -1
  295. package/workflows/debug.md +0 -4
  296. package/workflows/domain-add.md +115 -0
  297. package/workflows/execute.md +7 -0
  298. package/workflows/explore-usage.md +128 -0
  299. package/workflows/finish-work.md +2 -6
  300. package/workflows/fork.md +0 -4
  301. package/workflows/grill.md +14 -1
  302. package/workflows/harvest.md +0 -3
  303. package/workflows/impeccable/audit.md +0 -2
  304. package/workflows/impeccable/codex.md +0 -4
  305. package/workflows/init.md +9 -0
  306. package/workflows/interview-mechanics.md +3 -2
  307. package/workflows/issue-analyze.md +0 -5
  308. package/workflows/issue-gaps-analyze.codex.md +0 -6
  309. package/workflows/knowledge-audit.md +0 -4
  310. package/workflows/learn.md +0 -6
  311. package/workflows/maestro.codex.md +0 -4
  312. package/workflows/maestro.md +31 -18
  313. package/workflows/merge.md +0 -4
  314. package/workflows/milestone-complete.md +0 -4
  315. package/workflows/overlays.md +0 -10
  316. package/workflows/plan.md +2 -3
  317. package/workflows/roadmap-common.md +0 -4
  318. package/workflows/tdd.md +0 -2
  319. package/workflows/tools-spec.md +1 -7
  320. package/workflows/ui-codify-extract.md +0 -2
  321. package/workflows/ui-codify-package.md +0 -2
  322. package/.agents/skills/maestro-ralph-beta/SKILL.md +0 -882
  323. package/.agy/skills/maestro-ralph-beta/SKILL.md +0 -878
  324. package/.claude/commands/maestro-ralph-beta.md +0 -880
  325. package/.codex/skills/maestro-ralph-beta/SKILL.md +0 -883
@@ -1,880 +0,0 @@
1
- ---
2
- name: maestro-ralph-beta
3
- description: Self-running loop controller for adaptive maestro workflow — build, tick, decide in one skill
4
- argument-hint: "<intent> [-y] | continue | status"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Edit
9
- - Bash
10
- - Glob
11
- - Grep
12
- - Skill
13
- - AskUserQuestion
14
- ---
15
- <purpose>
16
- Self-running closed-loop: routes by session state, executes one tick, self-invokes until done or paused.
17
- Single skill handles build + execute + decision evaluation. Session: `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json`.
18
- </purpose>
19
-
20
- <context>
21
- $ARGUMENTS — intent text, flags, or keywords.
22
-
23
- **Parse:**
24
- ```
25
- -y flag → auto_confirm = true
26
- .md/.txt path → input_doc (supplementary context only, NEVER substitutes lifecycle stages)
27
- "status" → status mode
28
- "continue" → resume mode
29
- Remaining → intent (new session)
30
- ```
31
-
32
- **State files:**
33
- - `.workflow/state.json` — artifact registry, milestones, phases
34
- - `.workflow/roadmap.md` — milestone/phase structure
35
- - `.workflow/.maestro/ralph-*/status.json` — ralph session state
36
- </context>
37
-
38
- <invariants>
39
- 1. **Self-invocation = `Skill("maestro-ralph-beta")`** — 每次 tick 末尾强制自调用;除非 router 命中终止条件
40
- 2. **status.json 是唯一真源;写入权限分层**:
41
- - **Step 级字段**(`step.completion_*`, `step.status` 执行 step running↔completed, `step.load.*`, `step.retried`,以及执行 step 的 `active_step_index` 占用/释放)→ 由 `maestro ralph next/complete/retry` CLI 写入
42
- - **会话级结构**(`session.status`, `passed_gates`, `steps[]` 增删/reindex, `task_decomposition[*]`, `boundary_contract`, `context.*`, `scope_verdict`, `consec_exit2_count`, decision step 的 `status`/`retry_count`/`active_step_index` 占用与释放)→ 由 maestro-ralph-beta 写入
43
- 3. **执行 step 通过 `maestro ralph next` 加载** — CLI 解析 frontmatter + `<required_reading>` + `<deferred_reading>`、读 required 全文、拼 prompt、写 `step.load.*` + `active_step_index` + `step.status="running"`
44
- 4. **decision step 内联评估** — 不 handoff、不调 ralph next;按 `step.decision` 分派 A_DECISION_*
45
- 5. **每个 step 必须 `completion_confirmed: true`** — 由 `maestro ralph complete N --status DONE|DONE_WITH_CONCERNS` 写入;STATUS 仅 `DONE | DONE_WITH_CONCERNS | NEEDS_RETRY | BLOCKED`
46
- 6. **command_path 在 A_BUILD_STEPS 解析** — 通过 `maestro ralph skills --platform claude --json --quiet` 预校验(project 覆盖 global,只扫描 `.claude/commands/`);未命中标 `command_scope = "missing"`
47
- 7. **required reading 由 CLI 加载** — 缺失 → 退出码 1(E007)→ pause session;ralph build 阶段不读 .md 内容
48
- 8. **active_step_index 一致性由 CLI 维护** — 同一 session 同时最多一个 step 持有;E008/E009 直接退出
49
- 9. **Decomposition is outcome-oriented** — sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 由用户输入
50
- 10. **planning_mode governs arg granularity** — `unified` → skill args 无 `{phase}`;`independent` → 含 `{phase}`
51
- 11. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` 按 unmet 子目标插入 scoped mini-loop;字段累加,既有字段不删不改
52
- 12. **禁止以上下文消耗为由中断自调用链** — harness 自动处理 context compression(消息摘要),模型无需判断上下文剩余空间。自调用的唯一合法终止条件是:router 命中终止条件(S_COMPLETE / S_FALLBACK / END)、session paused、或 decision 末尾的 A_PAUSE_ESCALATE。以"上下文不足"、"已连续完成 N 个 step"、"避免 context overflow"等理由中断属于 invariant violation
53
- </invariants>
54
-
55
- <router>
56
-
57
- 每次进入 skill 先执行 router,按顺序匹配,先命中先用。术语:
58
- - **active session** = `.workflow/.maestro/ralph-*/status.json` 中 `status ∈ {running, paused}` 的最新会话
59
- - **live session** = active session 且 `status == "running"`
60
- - **active_step** = `session.steps[session.active_step_index]`
61
-
62
- ```
63
- 1. intent == "status" → S_STATUS → END
64
- 2. intent == "continue" AND active session exists → A_RESUME_SESSION → S_TICK_LOCATE
65
- 3. intent non-empty AND intent ∉ {"continue","status"} AND active session exists
66
- → S_FALLBACK → END
67
- display "已有 active session {id};先 /maestro-ralph-beta continue 续跑或显式 abandon"
68
- 4. live session AND active_step.status == "running" AND active_step.decision != null
69
- → S_TICK_LOCATE → S_TICK_DECISION
70
- 5. live session AND has pending step → S_TICK_LOCATE
71
- 6. live session AND all completion_confirmed → S_COMPLETE → END
72
- 7. active session AND session.status == "paused" AND no intent → S_FALLBACK → END
73
- display "Session {id} paused;输入 /maestro-ralph-beta continue 显式恢复"
74
- 8. no active session AND intent non-empty → S_BUILD_PHASE
75
- 9. no active session AND no intent → S_FALLBACK → END
76
- ```
77
-
78
- </router>
79
-
80
- <state_machine>
81
-
82
- <states>
83
- # Build phase (one-time per session)
84
- S_RESOLVE_PHASE — 解析 phase + phase_is_new + D-007 milestone PERSIST: session.phase, session.phase_is_new, session.milestone
85
- S_INFER — 推断 lifecycle_position PERSIST: session.lifecycle_position
86
- S_RESOLVE_SCOPE — 读 macro analyze conclusions.scope_verdict PERSIST: session.scope_verdict, session.analyze_macro_id
87
- S_QUALITY_MODE — 决定质量管线模式 PERSIST: session.quality_mode
88
- S_PLANNING_MODE — 决定统一/独立规划模式 PERSIST: session.planning_mode
89
- S_DECOMPOSE — 边界澄清、写执行准则+子目标清单 PERSIST: session.boundary_contract, .execution_criteria, .task_decomposition
90
- S_BUILD_CHAIN — 构建步骤链 PERSIST: session.steps[]
91
- S_CREATE_SESSION — 写 status.json PERSIST: session (全量)
92
- S_CONFIRM — 用户确认 PERSIST: —
93
-
94
- # Tick phase (per step)
95
- S_TICK_LOCATE — 定位 session + 找 active step PERSIST: —
96
- S_TICK — 分派执行 step 或 decision step PERSIST: step.status, active_step_index
97
- S_TICK_EXEC — 执行 step:ralph next → inline → ralph complete PERSIST: via CLI
98
- S_TICK_DECISION — decision step:内联评估 + 应用裁决 PERSIST: session.steps[], passed_gates, decisions.ndjson
99
- S_HANDLE_FAIL — 处理执行失败 PERSIST: step.status, session.status
100
-
101
- # Terminal
102
- S_STATUS — 显示 session 进度 PERSIST: —
103
- S_COMPLETE — 收尾 PERSIST: session.status = "completed"
104
- S_FALLBACK — 引导用户输入或退出 PERSIST: —
105
- </states>
106
-
107
- <transitions>
108
-
109
- # === Build phase ===
110
-
111
- S_BUILD_PHASE (entry):
112
- → S_RESOLVE_PHASE
113
-
114
- S_RESOLVE_PHASE:
115
- → S_INFER WHEN: phase resolved or null DO: A_RESOLVE_PHASE
116
- → S_FALLBACK WHEN: ambiguous
117
- GUARD: auto_confirm does NOT skip phase ambiguity
118
-
119
- S_INFER:
120
- → S_RESOLVE_SCOPE WHEN: position resolved DO: A_INFER_POSITION
121
- → S_FALLBACK WHEN: cannot infer
122
-
123
- S_RESOLVE_SCOPE:
124
- → S_QUALITY_MODE DO: A_RESOLVE_SCOPE_VERDICT
125
- GUARD: position ∈ {brainstorm, blueprint, init} → skip (scope_verdict = null)
126
-
127
- S_QUALITY_MODE:
128
- → S_PLANNING_MODE DO: A_DETERMINE_QUALITY_MODE
129
-
130
- S_PLANNING_MODE:
131
- → S_DECOMPOSE DO: A_DETERMINE_PLANNING_MODE
132
- GUARD: lifecycle_position ∈ {brainstorm, blueprint, init, analyze-macro, roadmap} → skip (force independent)
133
-
134
- S_DECOMPOSE:
135
- → S_BUILD_CHAIN DO: A_DECOMPOSE_TASKS
136
- GUARD: broad intent → MUST clarify boundary even if auto_confirm
137
- GUARD: narrow intent → auto-derive, skip questions
138
- GUARD: position ∈ {brainstorm, blueprint, init} → skip decomposition
139
-
140
- S_BUILD_CHAIN:
141
- → S_CREATE_SESSION DO: A_BUILD_STEPS
142
-
143
- S_CREATE_SESSION:
144
- → S_CONFIRM WHEN: not auto_confirm DO: A_CREATE_SESSION
145
- → S_TICK_LOCATE WHEN: auto_confirm DO: A_CREATE_SESSION + Skill("maestro-ralph-beta")
146
-
147
- S_CONFIRM:
148
- → S_TICK_LOCATE WHEN: user selects "Proceed" DO: Skill("maestro-ralph-beta")
149
- → S_BUILD_CHAIN WHEN: user selects "Edit"
150
- → END WHEN: user selects "Cancel"
151
-
152
- # === Tick phase ===
153
-
154
- S_TICK_LOCATE: Entry: A_LOCATE_SESSION
155
- → S_TICK WHEN: next_pending_step != null
156
- → S_COMPLETE WHEN: next_pending_step == null
157
- → S_FALLBACK WHEN: no active session
158
-
159
- S_TICK:
160
- → S_TICK_DECISION WHEN: next_pending_step.decision != null DO: A_CLAIM_DECISION
161
- → S_TICK_EXEC WHEN: next_pending_step.decision == null DO: A_RESOLVE_ARGS
162
-
163
- S_TICK_EXEC: Entry: A_EXEC_STEP
164
- → S_TICK_LOCATE WHEN: ralph complete with DONE|DONE_WITH_CONCERNS DO: Skill("maestro-ralph-beta")
165
- → S_TICK_LOCATE WHEN: ralph next exit == 2 DO: Skill("maestro-ralph-beta")
166
- → S_HANDLE_FAIL WHEN: ralph next exit == 1 OR exit >= 3
167
- → S_HANDLE_FAIL WHEN: ralph complete with NEEDS_RETRY|BLOCKED
168
-
169
- S_TICK_DECISION: (gate 名取自 `step.decision`)
170
- → S_TICK_APPLY WHEN: quality-gate (post-execute, post-business-test, post-review, post-test)
171
- DO: A_DELEGATE_EVALUATE
172
- → S_TICK_APPLY WHEN: goal-gate (post-goal-audit)
173
- DO: A_GOAL_AUDIT_EVALUATE
174
- → S_TICK_APPLY WHEN: scope-gate (post-analyze-scope)
175
- DO: A_SCOPE_EVALUATE
176
- → S_TICK_APPLY WHEN: structural (post-milestone, post-debug-escalate)
177
- DO: A_STRUCTURAL_EVALUATE
178
-
179
- S_TICK_APPLY:
180
- → S_TICK_LOCATE WHEN: verdict == "proceed" DO: A_APPLY_PROCEED + Skill("maestro-ralph-beta")
181
- → S_TICK_LOCATE WHEN: post-goal-audit + unmet sub-goals DO: A_APPLY_GOAL_FIX + Skill("maestro-ralph-beta")
182
- → S_TICK_LOCATE WHEN: post-goal-audit + all sub-goals met DO: A_APPLY_GOAL_DONE + Skill("maestro-ralph-beta")
183
- → S_TICK_LOCATE WHEN: post-analyze-scope DO: A_APPLY_SCOPE_VERDICT + Skill("maestro-ralph-beta")
184
- → S_TICK_LOCATE WHEN: verdict == "fix" DO: A_APPLY_FIX + Skill("maestro-ralph-beta")
185
- → S_TICK_LOCATE WHEN: verdict == "escalate" DO: A_APPLY_ESCALATE + Skill("maestro-ralph-beta")
186
- → S_TICK_LOCATE WHEN: post-milestone + standard + next milestone DO: A_ADVANCE_MILESTONE + Skill("maestro-ralph-beta")
187
- → END WHEN: post-milestone + standard + no next milestone DO: mark completed
188
- → END WHEN: post-milestone + adhoc DO: mark completed (adhoc self-contained)
189
- → END WHEN: post-debug-escalate (always STOP) DO: A_PAUSE_ESCALATE
190
- GUARD: retry_count >= max_retries → force escalate
191
- GUARD: confidence_score < 60 AND proceed → override to fix
192
- GUARD: confidence_score > 95 AND fix AND retry > 0 → suggest proceed
193
- GUARD: auto_confirm → skip user prompt, apply adjusted verdict
194
- GUARD: not auto_confirm → AskUserQuestion with override options
195
-
196
- S_HANDLE_FAIL:
197
- → S_TICK_LOCATE WHEN: auto + not retried DO: A_RETRY + Skill("maestro-ralph-beta")
198
- → END WHEN: auto + retried DO: A_PAUSE_SESSION
199
- → S_TICK_LOCATE WHEN: interactive + user selects retry DO: A_RETRY + Skill("maestro-ralph-beta")
200
- → S_TICK_LOCATE WHEN: interactive + user selects skip DO: A_SKIP_STEP + Skill("maestro-ralph-beta")
201
- → END WHEN: interactive + user selects abort DO: A_PAUSE_SESSION
202
-
203
- # === Terminal ===
204
-
205
- S_STATUS:
206
- → END DO: A_SHOW_STATUS
207
-
208
- S_COMPLETE:
209
- → END DO: A_COMPLETE_SESSION
210
-
211
- S_FALLBACK:
212
- → S_BUILD_PHASE WHEN: user provides intent (no active session) DO: AskUserQuestion
213
- → S_TICK_LOCATE WHEN: user selects "continue active session" DO: A_RESUME_SESSION + Skill("maestro-ralph-beta")
214
- → END WHEN: user cancels OR no active session for resume
215
-
216
- </transitions>
217
-
218
- <actions>
219
-
220
- ### A_SHOW_STATUS
221
-
222
- 1. Find latest ralph session (by created_at)
223
- 2. Display: Session, Status, Position, Progress, Current step
224
- 3. List steps: [✓] completion_confirmed, [▸] current, [ ] pending, [◆] decision(`step.decision` 非空);执行 step 附 `command_scope`(global/project) + `command_path`
225
- 4. If `task_decomposition` present (absent → skip):
226
- ```
227
- Sub-goals ({done}/{total}) source: {session_dir}/status.json#/task_decomposition
228
- [x] G1 done_when={done_when} evidence={evidence} confirmed={completion_confirmed}
229
- [ ] G2 done_when={done_when} evidence={evidence} confirmed=false ◀ unmet
230
- ```
231
-
232
- ### A_RESOLVE_PHASE
233
-
234
- 产出 `phase` + `phase_is_new` + `milestone`(D-007 反查)。
235
-
236
- **Priority:**
237
-
238
- | Step | 行为 | phase_is_new |
239
- |------|------|--------------|
240
- | 1 | intent 匹配 `phase\s*(\d+)` → 取 state.json 对应 phase | false |
241
- | 2 | intent 派生短语 → 在 `state.json.milestones[*].phase_slugs` / `artifacts[*].path` 查找 | false (匹配) / true (无匹配) |
242
- | 3 | 未派生 → 取最新 in-progress artifact 的 phase | false |
243
- | 4 | 仍无 → state.json 首个 incomplete phase | false |
244
- | 5 | position 将是 brainstorm/blueprint/init/roadmap/analyze-macro → phase = null | n/a |
245
- | 6 | 仍模糊 → `AskUserQuestion` | 由用户回答确定 |
246
-
247
- **D-007 Phase→Milestone 反查**(数字 phase 已解析时):
248
- ```
249
- resolve_milestone(phase_number):
250
- for ms in state.json.milestones:
251
- if str(phase_number) in ms.phase_slugs: return ms.id
252
- return state.json.current_milestone # fallback
253
- ```
254
- 写入 `session.milestone`。
255
-
256
- **写入 session**: `phase`, `phase_is_new`, `milestone`。
257
-
258
- **新派生 phase 时 milestone 处理**:
259
- - state.json 当前 milestone 仍 active → 沿用,新增 phase
260
- - intent 派生新 milestone 名 → 写入 session 仅作标签;`state.json.milestones` 由 `maestro-roadmap` / `maestro-milestone-release` 创建
261
-
262
- ### A_INFER_POSITION
263
-
264
- **Intent-based overrides** (按顺序匹配,先命中先用):
265
-
266
- | Pattern | Position |
267
- |---------|----------|
268
- | brainstorm / 头脑风暴 / 探索 / ideate / 设计思路 | `brainstorm` |
269
- | blueprint / 规格 / 正式文档 / spec-generate / 7-phase | `blueprint` |
270
- | broad/medium intent 无数字 phase (重构/全面/重写/迁移/新功能 X) | `analyze-macro` |
271
-
272
- **Bootstrap detection:**
273
-
274
- | Condition | Position |
275
- |-----------|----------|
276
- | No `.workflow/` + no source files | `brainstorm` |
277
- | No `.workflow/` + has source files | `init` |
278
- | Has `.workflow/` but no state.json | `init` |
279
- | Has state.json | → phase-aware artifact inference |
280
-
281
- **Phase-aware artifact inference**(基于 `session.phase` + `session.phase_is_new`,artifact 按 `session.phase` 过滤):
282
-
283
- | Condition | Position |
284
- |-----------|----------|
285
- | `phase_is_new == true` | `analyze` |
286
- | no milestones AND no roadmap.md AND has analyze macro artifact | `roadmap` |
287
- | no milestones AND no roadmap.md AND no analyze artifact | `analyze-macro` |
288
- | `phase == null` | n/a |
289
- | phase 已存在 + 无任何 artifact | `analyze` |
290
- | phase 已存在 + 最新 artifact = analyze | `plan` |
291
- | phase 已存在 + 最新 artifact = plan | `execute` |
292
- | phase 已存在 + 最新 artifact = execute | → refine from post-execute results |
293
-
294
- **Refine from post-execute results:**
295
-
296
- 在 execute artifact 的 scratch dir 中检查结果文件(verification.json 由 execute 内置 gate 产出):
297
-
298
- | Condition | Position |
299
- |-----------|----------|
300
- | 无 verification.json 或 passed==false 或 gaps[] | `execute` (触发 post-execute fix loop) |
301
- | passed==true, no review.json | `business-test` |
302
- | review.json: verdict=="BLOCK" | `review-failed` |
303
- | review.json: verdict!="BLOCK" | `test` |
304
- | uat.md: all passed | `milestone-audit` |
305
- | uat.md: has failures | `test-failed` |
306
-
307
- ### A_RESOLVE_SCOPE_VERDICT
308
-
309
- 仅当 `lifecycle_position ∈ {analyze-macro, roadmap, plan}` 且存在最新 analyze artifact 时执行。
310
-
311
- 1. 定位最新 macro analyze artifact(`type=="analyze"` 且 `scope=="macro"`,按 created_at DESC)→ `session.analyze_macro_id = ANL-xxx`
312
- 2. 读 `{artifact_path}/conclusions.json` 的 `scope_verdict` 字段(`large | medium | small`)
313
- 3. 写入 `session.scope_verdict`;缺失 → `unknown`
314
- 4. 路由建议:
315
-
316
- | scope_verdict | 链路 |
317
- |---------------|------|
318
- | `large` | analyze-macro → roadmap → analyze → plan → execute → ... |
319
- | `medium` / `small` | analyze-macro → plan --from analyze:{ANL_ID} → execute → ... |
320
- | `unknown` | 默认 large;post-analyze-scope 节点再纠正 |
321
-
322
- ### A_DETERMINE_QUALITY_MODE
323
-
324
- 读 `session.quality_mode_override`(CLI `--quality`),无则按规则推断:
325
-
326
- | Condition | Mode | Pipeline (execute 之后) |
327
- |-----------|------|-------------------------|
328
- | Has `specs/REQ-*.md` + 当前 phase 业务范围明确 | `full` | business-test → review → test-gen → test |
329
- | Default | `standard` | review → test-gen (当 coverage<80%) → test |
330
- | `--quality quick` | `quick` | review --tier quick |
331
-
332
- 写入 `session.quality_mode`。
333
-
334
- ### A_DETERMINE_PLANNING_MODE
335
-
336
- **Auto-resolve rules (按优先级):**
337
-
338
- | Condition | Mode |
339
- |-----------|------|
340
- | lifecycle_position ∈ {brainstorm, init, roadmap} | `independent` |
341
- | `phase_is_new == true` | `independent` |
342
- | intent 显式指定 phase 编号(如 "phase 2"、"P3") | `independent` |
343
- | milestone 仅含 1 个 phase | `independent` |
344
- | milestone 含多个 phase + `auto_confirm` | `unified` |
345
- | milestone 含多个 phase + 非 `auto_confirm` | → AskUserQuestion |
346
-
347
- **AskUserQuestion** (仅当 milestone 含 ≥2 phase 且非 auto_confirm):
348
-
349
- ```
350
- question: "当前里程碑含 {N} 个 phase,选择规划模式?"
351
- options:
352
- - label: "统一规划 (Recommended)"
353
- description: "一次性分析+规划整个里程碑所有 phase,analyze/plan 走里程碑级,适合 phase 间关联紧密"
354
- - label: "独立规划"
355
- description: "逐个 phase 走完整生命周期(analyze→plan→execute→...),适合 phase 间独立性高"
356
- ```
357
-
358
- 写入 `session.planning_mode`(`"unified"` 或 `"independent"`)。
359
-
360
- ### A_DECOMPOSE_TASKS
361
-
362
- **1. Classify intent breadth:**
363
-
364
- | Pattern | Breadth | Clarify? |
365
- |---------|---------|----------|
366
- | 重构/全面/重写/重做/整体/迁移 · overhaul/migrate/rewrite/revamp | broad | MUST (ignores auto_confirm) |
367
- | named single file/function/bug, "fix X", "add Y to Z" | narrow | skip — auto-derive |
368
- | otherwise | medium | clarify unless auto_confirm |
369
-
370
- **2. Clarify boundary** (broad/medium) — `AskUserQuestion`, ≤3 rounds, options pre-filled from intent + a quick Glob/Grep scan of the target module:
371
-
372
- | Round | Question | Drives |
373
- |-------|----------|--------|
374
- | Scope | 哪些目录/文件/层在范围内?明确排除什么? | boundary_contract.in_scope / out_of_scope |
375
- | Constraints | 必须向后兼容?公共 API 冻结?行为/性能预算?测试门槛? | boundary_contract.constraints + execution_criteria |
376
- | Done | 什么可观测结果算"完成"?(如:测试全绿 + 行为零变更 + X 指标) | boundary_contract.definition_of_done |
377
-
378
- narrow → derive defaults from intent + codebase, skip questions.
379
-
380
- **3. Derive `execution_criteria`**: backward-compat、scope-freeze、test/coverage bar、fix-don't-hide、incremental commit。
381
-
382
- **4. Derive `task_decomposition`** (子目标清单 — outcome-oriented, NOT lifecycle stages). Each entry:
383
- ```json
384
- { "id": "G1", "goal": "<deliverable>", "boundary": "<in/out note>",
385
- "done_when": "<objectively checkable condition>",
386
- "evidence": "verification.json|review.json|uat.md|<test path>",
387
- "lifecycle": ["analyze","execute"], "status": "pending" }
388
- ```
389
- `done_when` 必须客观可验证,且引用 ralph 已产出的 artifact;`lifecycle` 字段映射到产出 evidence 的生命周期 stage。
390
-
391
- **5. Persist**: `boundary_contract`, `execution_criteria`, `task_decomposition`。每个 sub-goal 初始化 `status: "pending"` + `completion_confirmed: false`。
392
-
393
- **6. Stage** the Goal Prompt (Appendix) for A_CREATE_SESSION to emit.
394
-
395
- ### A_BUILD_STEPS
396
-
397
- 从 `session.lifecycle_position` 生成 steps 到 `milestone-complete`。
398
-
399
- | Stage | Skill (independent) | Skill (unified) | Decision after | quality_mode |
400
- |-------|---------------------|-----------------|----------------|--------------|
401
- | brainstorm | `maestro-brainstorm "{intent}"` | *(same)* | — | all |
402
- | blueprint | `maestro-blueprint "{intent}"` | *(same)* | — | all |
403
- | init | `maestro-init` | *(same)* | — | all |
404
- | analyze-macro | `maestro-analyze "{intent}"` | *(same)* | `post-analyze-scope` | all |
405
- | roadmap | `maestro-roadmap --from analyze:{analyze_macro_id}` | *(same)* | — | all |
406
- | analyze | `maestro-analyze {phase}` | `maestro-analyze` | — | all |
407
- | plan | `maestro-plan {phase}` *(scope=phase)* / `maestro-plan --from analyze:{analyze_macro_id}` *(scope=standalone)* / `maestro-plan --from blueprint:{blueprint_id}` *(scope=standalone)* | `maestro-plan` | — | all |
408
- | execute | `maestro-execute {phase}` | `maestro-execute` | `post-execute` | all |
409
- | business-test | `quality-auto-test {phase}` | `quality-auto-test` | `post-business-test` | full only |
410
- | review | `quality-review {phase}` | `quality-review` | `post-review` | all (quick: append `--tier quick`) |
411
- | test-gen | `quality-auto-test {phase}` | `quality-auto-test` | — | full / standard if coverage<80% |
412
- | test | `quality-test {phase}` | `quality-test` | `post-test` | full, standard |
413
- | milestone-audit | `maestro-milestone-audit` | *(same)* | — | all |
414
- | goal-audit | *(decision-only)* | *(same)* | `post-goal-audit` | all (only if decomposed) |
415
- | milestone-complete | `maestro-milestone-complete` | *(same)* | `post-milestone` | all |
416
-
417
- **Build rules (按顺序应用):**
418
-
419
- 0. **planning_mode 选列**:`unified` → Skill (unified) 列;`independent` → Skill (independent) 列
420
- 1. **起点**:从 `session.lifecycle_position` 开始
421
- 2. **跳过已完成**:跳过当前 milestone+phase 下已有 completed artifact 的 stage(按 `session.phase` 过滤);unified 按 milestone 过滤
422
- 3. **quality_mode 过滤**:按 `session.quality_mode` 排除不匹配 stage
423
- 4. **决策节点**:每个 Decision after 非空的 stage 之后插入 `{ decision: "<gate>", retry_count: 0, max_retries: 2, command_scope: null, command_path: null }`
424
- 5. **goal-audit 插入**:`task_decomposition` 存在时,在最后一个 evidence-producing stage(execute/review/test)之后、`milestone-complete` 之前插入 `decision:post-goal-audit`
425
- 6. **终点硬约束**:chain 以 `milestone-complete` 结尾
426
- 7. **goal_ref 传播**:`task_decomposition` 存在时,每个 step 按 `step.stage ∈ g.lifecycle` 匹配 `step.goal_ref = g.id`(多匹配取字典序最小);decision 节点不打 goal_ref
427
- 8. **占位符**:independent 保留 `{phase}` `{intent}`;unified 不带 `{phase}`
428
- 9. **command_path 解析**(执行 step):
429
- - skill 名 = args 前的第一个 token
430
- - `Bash("maestro ralph skills --platform claude --json --quiet")` 拉取 global + project(project 覆盖 global),匹配 skill 名:
431
- - 命中 → `command_scope = "global" | "project"`,`command_path = <绝对路径>`
432
- - 未命中 → `command_scope = "missing"`, `command_path = null` → A_CREATE_SESSION raise E006
433
- 10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`, `deferred_reads: []`, `load: null`
434
- 11. **scope_verdict gating**(仅当 chain 起点 = `analyze-macro`):
435
- - `scope_verdict ∈ {medium, small}` → 跳过 `roadmap` + `analyze` 两 stage;`plan` 选 standalone 列(`--from analyze:{analyze_macro_id}`),不带 `{phase}`
436
- - `scope_verdict == large` → 保留 `roadmap` + `analyze`;`plan` 选 phase 列(`{phase}`)
437
- - `scope_verdict == unknown` → 默认 large 路径;由 `post-analyze-scope` 决策节点在 macro analyze 完成后纠正(A_APPLY_SCOPE_VERDICT)
438
- 12. **--from 自动注入**:
439
- - `analyze_macro_id` 存在且当前 step 是 `roadmap` → args 改为 `--from analyze:{analyze_macro_id}`
440
- - `analyze_macro_id` 存在且 `scope_verdict ∈ {medium, small}` 且当前 step 是 `plan` → args 改为 `--from analyze:{analyze_macro_id}`
441
- - `blueprint_id` 存在 → 当前 step 是 `plan` → args 改为 `--from blueprint:{blueprint_id}`(优先级低于 phase 数字参数)
442
- - 写入 `step.source_artifact_ref` 以便审计
443
- 13. **Milestone-ref**:含 `{phase}` 占位符的 step → `step.milestone_id = session.milestone`
444
- 14. **动态插入步骤**(A_APPLY_*)同样应用规则 7-13
445
-
446
- ### A_CREATE_SESSION
447
-
448
- 1. 校验所有 step 的 `command_scope != "missing"`;否则 raise E006 + 列出缺失 skill
449
- 2. Write `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json`
450
- 3. Display chain overview:每步显示 `{index}. {skill} [{command_scope}]`
451
- 4. **Goal Prompt 显示(强制)**:`task_decomposition` 存在时,chain overview 之后**必须逐字显示** Goal Prompt block(Appendix),不得省略或摘要。显示后继续进入 tick
452
-
453
- ### A_LOCATE_SESSION
454
-
455
- 1. If session_id provided → load `.workflow/.maestro/{session_id}/status.json`
456
- 2. Else: scan `.workflow/.maestro/*/status.json`, filter `status ∈ {"running","paused"}`, sort DESC by created_at, take first
457
- 3. Extract: session_id, source, steps[], phase, milestone, intent, auto_mode, context, cli_tool, active_step_index, status
458
- 4. 预探测 `next_pending_step`(瞬态,不持久化):
459
- - 若 `active_step_index != null` 且 `steps[active_step_index].status == "running"` → `steps[active_step_index]`
460
- - 否则 `steps[]` 中 `status == "pending"` 的最小 index
461
- - 都无 → `null`
462
-
463
- ### A_RESUME_SESSION
464
-
465
- 1. A_LOCATE_SESSION 加载 active session
466
- 2. 清理 active_step_index:若 `active_step_index != null` 且 `steps[active_step_index].status ∈ {"completed","skipped","failed"}` → `active_step_index = null`;其余保留
467
- 3. If `session.status == "paused"` → `session.status = "running"`
468
- 4. `session.consec_exit2_count = 0`
469
- 5. Display: `↻ Resume {session_id}`
470
-
471
- ### A_CLAIM_DECISION
472
-
473
- 1. 校验 `session.active_step_index ∈ {null, next_pending_step.index}`,否则 raise E008
474
- 2. `session.active_step_index = next_pending_step.index`
475
- 3. `steps[next_pending_step.index].status = "running"`
476
- 4. Display: `[{index}/{total}] ◆ {step.decision} Retry: {retry}/{max}`
477
-
478
- ### A_RESOLVE_ARGS
479
-
480
- **Placeholder substitution:**
481
-
482
- | Placeholder | Source |
483
- |-------------|--------|
484
- | `{phase}` | session.phase |
485
- | `{milestone}` | session.milestone |
486
- | `{intent}` | session.intent |
487
- | `{description}` | session.intent (alias) |
488
- | `{scratch_dir}` | session.context.scratch_dir or latest artifact path |
489
- | `{plan_dir}` | session.context.plan_dir |
490
- | `{analysis_dir}` | session.context.analysis_dir |
491
- | `{issue_id}` | session.context.issue_id |
492
- | `{milestone_num}` | session.context.milestone_num |
493
-
494
- **Per-skill enrichment** (when args empty or minimal):
495
-
496
- | Skill | Required context | Source |
497
- |-------|-----------------|--------|
498
- | maestro-brainstorm | topic | `"{intent}"` |
499
- | maestro-roadmap | description | `"{intent}"` |
500
- | maestro-analyze | phase or topic | `{phase}` or `"{intent}"` |
501
- | maestro-plan | phase or --dir | `{phase}`, or `--dir {scratch_dir}` |
502
- | maestro-execute | phase or --dir | `{phase}`, or `--dir {scratch_dir}` |
503
- | quality-debug | gap context | Read previous step's error/gap |
504
- | quality-* | phase | `{phase}` |
505
-
506
- **Artifact dir resolution for --dir:**
507
- ```
508
- Read state.json → filter artifacts by milestone + phase
509
- plan commands: latest type=="analyze" → --dir .workflow/scratch/{path}
510
- execute commands: latest type=="plan" → --dir .workflow/scratch/{path}
511
- ```
512
-
513
- Write enriched args back to status.json.
514
-
515
- ### A_EXEC_STEP
516
-
517
- 1. **Load** — `Bash("maestro ralph next")`
518
- - exit 0 → `session.consec_exit2_count = 0`,按 stdout 内联执行(进入步骤 2)
519
- - exit 2 → `session.consec_exit2_count += 1`;≥ 2 时抛 E010 → S_HANDLE_FAIL;否则 → S_TICK_LOCATE
520
- - exit 1 → E007 → S_HANDLE_FAIL
521
- - exit ≥ 3 → E008 → S_HANDLE_FAIL
522
- 2. **Inline execution** — 按 stdout 执行;deferred_reading 按需 Read
523
- 3. **Complete**:
524
- - `Bash("maestro ralph complete N --status DONE [--evidence <path>]")`
525
- - `Bash("maestro ralph complete N --status DONE_WITH_CONCERNS --concerns \"...\"")`
526
- - `Bash("maestro ralph retry N")`
527
- - `Bash("maestro ralph complete N --status BLOCKED --reason \"...\"")`
528
- 4. **Propagate context signals** — `PHASE: N` / `scratch_dir: path` / `BLP-xxx` 写入 `status.json.context`
529
-
530
- ### A_DELEGATE_EVALUATE
531
-
532
- 1. Resolve artifact dir: `.workflow/scratch/{artifact.path}/` with fallback glob
533
- 2. Parse decision metadata: `{ decision, retry_count, max_retries }`
534
- 3. Map result files:
535
- | Decision | Files |
536
- |----------|-------|
537
- | post-execute | verification.json |
538
- | post-business-test | .tests/auto-test/report.json |
539
- | post-review | review.json |
540
- | post-test | uat.md, .tests/test-results.json |
541
- 4. Check artifact for confidence section → include as signal
542
- 5. Execute delegate (run_in_background, STOP, wait for callback):
543
- ```
544
- maestro delegate "PURPOSE: 评估 {decision} 质量门结果
545
- TASK: 读取结果 | 分析状态 | 评估严重性 | 给出建议
546
- EXPECTED: ---VERDICT--- STATUS/REASON/GAP_SUMMARY/CONFIDENCE(high|medium|low)/CONFIDENCE_SCORE(0-100)/WEAKEST_DIMENSION ---END---
547
- CONSTRAINTS: 只评估 | 置信度<60% 倾向 fix | retry {n}/{max} 达上限必须 escalate"
548
- --role analyze --mode analysis
549
- ```
550
- 6. On callback: parse verdict; if parse fails → fallback STATUS="fix"
551
- 7. Confidence adjustment: <60 + proceed → fix; >95 + fix + retry>0 → suggest proceed
552
- 8. **Decision log**: Append to `{session_dir}/decisions.ndjson`:
553
- ```json
554
- { "id": "DEC-{timestamp}", "timestamp": "{ISO}", "source": "ralph",
555
- "node_id": "{step.decision}", "type": "quality-gate",
556
- "verdict": "{adjusted_verdict}", "confidence_score": {N},
557
- "close_call": {N>=50 && N<=70}, "summary": "{REASON}" }
558
- ```
559
-
560
- ### A_STRUCTURAL_EVALUATE
561
-
562
- **post-milestone:**
563
- 1. Read state.json → 取已完成 milestone 对象
564
- 2. `milestone_obj.type` (default `"standard"`)
565
- 3. `type == "standard"`:next milestone 存在 → insert lifecycle steps;否则 → END
566
- 4. `type == "adhoc"`:END,`current_milestone = null`
567
-
568
- **post-debug-escalate:** STOP → paused,display "请人工介入"
569
-
570
- ### A_SCOPE_EVALUATE
571
-
572
- 由 `post-analyze-scope` 触发。
573
-
574
- 1. 定位刚完成的 macro analyze artifact → `analyze_macro_id`, `conclusions_path = {artifact_path}/conclusions.json`
575
- 2. 读取 `conclusions.scope_verdict`(`large | medium | small`),缺失 → `unknown`
576
- 3. 写入 `session.scope_verdict` + `session.analyze_macro_id`
577
- 4. Append `{session_dir}/decisions.ndjson`:
578
- ```json
579
- { "id": "DEC-{timestamp}", "type": "scope-gate",
580
- "source": "ralph", "node_id": "post-analyze-scope",
581
- "verdict": "{scope_verdict}", "analyze_macro_id": "{ANL_ID}" }
582
- ```
583
- 5. → A_APPLY_SCOPE_VERDICT
584
-
585
- ### A_GOAL_AUDIT_EVALUATE
586
-
587
- 仅当 `task_decomposition` 存在。
588
-
589
- 1. Read `session.task_decomposition`
590
- 2. For each sub-goal `status != "done"`:resolve `evidence` artifact
591
- 3. Delegate read-only audit (run_in_background, STOP, wait):
592
- ```
593
- maestro delegate "PURPOSE: 审计未完成子目标,判定 met / unmet
594
- TASK:
595
- 1. 读取 status.json.task_decomposition 中 status!=done 的子目标
596
- 2. 打开 evidence 产物,对照 done_when 严格判定
597
- 3. 输出 met / unmet,unmet 给出 gap + target_phase
598
- CONTEXT:
599
- status.json = {session_dir}/status.json
600
- evidence = {evidence artifacts}
601
- execution_criteria = {execution_criteria}
602
- boundary_contract = {boundary_contract}
603
- EXPECTED:
604
- ---VERDICT---
605
- STATUS=all_met|has_unmet
606
- UNMET=[{id:G2,gap:'...',target_phase:execute}, ...]
607
- CONFIDENCE_SCORE=0-100
608
- ---END---
609
- CONSTRAINTS:
610
- - 只评估,不修改文件
611
- - 严格按 done_when 判定;evidence 缺失 → unmet
612
- - 不得建议超出 boundary_contract 的修改
613
- "
614
- --role analyze --mode analysis
615
- ```
616
- 4. On callback: 对每个 met 子目标,set `task_decomposition[i].status="done"` + `completion_confirmed=true` + `completed_at=now`
617
- 5. Append `{session_dir}/decisions.ndjson` with `"type": "goal-gate"`, `unmet_count`, `unmet_ids`
618
- 6. Verdict: `all_met` → A_APPLY_GOAL_DONE; `has_unmet` → A_APPLY_GOAL_FIX
619
- GUARD: retry_count >= max_retries AND still unmet → A_APPLY_ESCALATE
620
-
621
- > **A_APPLY_\* release 协议**(所有 A_APPLY_* 末尾统一应用):
622
- > - 完成分支(proceed / goal-done / scope applied / structural advanced):`step.status = "completed"`, `step.completion_confirmed = true`, `session.active_step_index = null`
623
- > - 重评分支(fix / escalate / goal-fix):`step.status = "pending"`, `step.completion_confirmed = false`, `session.active_step_index = null`, `step.retry_count += 1`
624
-
625
- ### A_APPLY_PROCEED
626
-
627
- 1. release 协议 — 完成分支
628
- 2. Append decisions.ndjson with verdict
629
- 3. Display: ◆ Decision: {type} → proceed ({reason})
630
-
631
- ### A_APPLY_FIX
632
-
633
- 1. Insert fix-loop commands after current step (Appendix: Fix-Loop Templates)
634
- 2. release 协议 — 重评分支;reindex steps
635
- 3. Display: ◆ Decision: {type} → fix, +{N} commands inserted
636
-
637
- ### A_APPLY_ESCALATE
638
-
639
- 1. Insert `[quality-debug "{gap_summary}", decision:post-debug-escalate]`
640
- 2. release 协议 — 重评分支;reindex
641
-
642
- ### A_APPLY_SCOPE_VERDICT
643
-
644
- 由 `post-analyze-scope` 触发。
645
-
646
- 1. 读 `session.scope_verdict`
647
- 2. `large`:为后续 `roadmap` step 注入 `--from analyze:{analyze_macro_id}`;后续 `plan` step 选 phase 列
648
- 3. `medium` / `small`:
649
- - 删除 `goal-audit` 之前未完成的 `roadmap` + `analyze` (phase) step
650
- - 下一个未完成的 `plan` step → `maestro-plan --from analyze:{analyze_macro_id}`,去掉 `{phase}`,`source_artifact_ref = analyze:{analyze_macro_id}`
651
- - 后续 `execute` 等沿用同一 standalone scope
652
- 4. `unknown`:非 auto_confirm → AskUserQuestion 二选一(large / medium-small);auto_confirm → 默认 large
653
- 5. release 协议 — 完成分支;reindex
654
- 6. Display: ◆ Scope verdict: {verdict} → {kept|collapsed to standalone via analyze:{ANL_ID}}
655
-
656
- ### A_APPLY_GOAL_FIX
657
-
658
- 1. 对每个 unmet 子目标 `G{n}`(按 `target_phase` 分组去重):在 `goal-audit` 节点前插入 scoped mini-loop(Appendix: post-goal-audit),每条 step `goal_ref: "G{n}"`
659
- 2. 追加 `decision:post-goal-audit {retry+1}`
660
- 3. release 协议 — 重评分支;reindex
661
- 4. Display: ◆ Goal audit: {k} unmet → +{N} steps inserted (G{ids}), retry {r}/{max}
662
-
663
- ### A_APPLY_GOAL_DONE
664
-
665
- 1. 每个 `task_decomposition[*]` → `status="done"`, `completion_confirmed=true`, `completed_at=now`;顶层 `task_decomposition_all_done=true`
666
- 2. release 协议 — 完成分支;proceed to `milestone-complete`
667
- 3. Display: ◆ Goal audit: all met ✓
668
-
669
- ### A_ADVANCE_MILESTONE
670
-
671
- 1. Update session: milestone, phase, reset passed_gates
672
- 2. Insert full lifecycle steps for next milestone
673
- 3. release 协议 — 完成分支;reindex
674
-
675
- ### A_RETRY
676
-
677
- 1. `Bash("maestro ralph retry N")`
678
- 2. Display: `[{index}/{total}] ↻ {step.skill} retry`
679
-
680
- ### A_SKIP_STEP
681
-
682
- 手动编辑 status.json:`step.status = "skipped"`, `step.completion_confirmed = false`,若 `active_step_index == step.index` 则置 null。
683
-
684
- ### A_PAUSE_SESSION
685
-
686
- `session.status = "paused"` (CLI 通过 `ralph complete N --status BLOCKED` 自动写;手动场景直接编辑)
687
- Display: `[{index}/{total}] ✗ {step.skill} 失败,会话已暂停。/maestro-ralph-beta continue 恢复。`
688
-
689
- ### A_PAUSE_ESCALATE
690
-
691
- 1. `session.status = "paused"`
692
- 2. Display: ◆ 已达最大重试次数,debug 已执行。请人工介入。
693
- 3. Display: /maestro-ralph-beta continue 恢复
694
-
695
- ### A_COMPLETE_SESSION
696
-
697
- 1. 校验:所有 step `completion_confirmed == true`(除 skipped);task_decomposition 存在时校验 `task_decomposition_all_done == true`
698
- 2. 任一校验失败 → 不标 completed,回 S_TICK_LOCATE 或 pause
699
- 3. `session.status = "completed"`, write status.json
700
- 4. Display completion report:
701
- ```
702
- ============================================================
703
- SESSION COMPLETE
704
- ============================================================
705
- Session: {session_id} [{source}]
706
- Steps: {completed}/{total} confirmed: {confirmed}/{completed}
707
-
708
- [✓] 0. maestro-plan 1 [global]
709
- [✓] 1. maestro-execute 1 [project]
710
- [✓] 2. ◆ post-execute [decision]
711
- ...
712
- ============================================================
713
- ```
714
- Icons: `✓` confirmed, `—` skipped, `✗` failed, `◆` decision
715
-
716
- </actions>
717
-
718
- </state_machine>
719
-
720
- <appendix>
721
-
722
- ### Session Schema
723
-
724
- ```json
725
- {
726
- "session_id": "ralph-{YYYYMMDD-HHmmss}",
727
- "source": "ralph", "status": "running",
728
- "ralph_protocol_version": "2",
729
- "active_step_index": null,
730
- "intent": "", "lifecycle_position": "",
731
- "phase": null, "phase_is_new": false,
732
- "milestone": "", // D-007 反查结果
733
- "auto_mode": false,
734
- "quality_mode": "standard", // "full" | "standard" | "quick"
735
- "planning_mode": "independent", // "unified" | "independent"
736
- "scope_verdict": null, // "large" | "medium" | "small" | "unknown" | null
737
- "analyze_macro_id": null, // "ANL-xxx"
738
- "blueprint_id": null, // "BLP-xxx"
739
- "cli_tool": "claude", "passed_gates": [],
740
- "consec_exit2_count": 0,
741
-
742
- "context": { "issue_id": null, "scratch_dir": null, "plan_dir": null,
743
- "analysis_dir": null, "brainstorm_dir": null, "blueprint_dir": null },
744
- "steps": [{
745
- "index": 0,
746
- "skill": "", // 执行 step 有值;decision 节点为空字符串/null
747
- "args": "",
748
- "stage": "", // brainstorm|blueprint|init|analyze-macro|roadmap|analyze|plan|execute|...
749
- "scope": null, // "phase"|"standalone"|"milestone"|null(plan 等需要)
750
- "decision": null, // null = 执行 step;非 null = decision step (值为 gate 名)
751
- "retry_count": 0, // decision step
752
- "max_retries": 2, // decision step
753
- "command_scope": "global|project|missing|null",
754
- "command_path": "<absolute path> | null",
755
- "milestone_id": null, // 仅含 {phase} 占位符的 step
756
- "source_artifact_ref": null, // "analyze:ANL-xxx" | "blueprint:BLP-xxx" | null
757
- "status": "pending|running|completed|skipped|failed",
758
- "goal_ref": null,
759
- "completion_confirmed": false,
760
- "completion_status": null,
761
- "completion_evidence": null,
762
- "completed_at": null,
763
- "deferred_reads": [],
764
- "load": null // { loaded_at, required_files[], deferred_files[], resolve_version }
765
- }],
766
- "current_step": 0,
767
-
768
- "boundary_contract": {
769
- "in_scope": [], "out_of_scope": [], "constraints": [], "definition_of_done": ""
770
- },
771
- "execution_criteria": [],
772
- "task_decomposition": [
773
- { "id": "G1", "goal": "", "boundary": "", "done_when": "",
774
- "evidence": "", "lifecycle": [], "status": "pending|done",
775
- "completion_confirmed": false, "completed_at": null }
776
- ],
777
- "task_decomposition_all_done": false
778
- }
779
- ```
780
-
781
- ### Fix-Loop Templates
782
-
783
- 插入的执行 step 按 A_BUILD_STEPS 规则 9 解析 `command_path` + `command_scope`;`decision:*` 条目为 decision 节点。
784
-
785
- **post-execute:**
786
- ```
787
- quality-debug "{gap_summary}"
788
- maestro-plan --gaps {phase}
789
- maestro-execute {phase}
790
- decision:post-execute {retry+1}
791
- ```
792
-
793
- **post-business-test:**
794
- ```
795
- quality-debug --from-business-test "{gap_summary}"
796
- maestro-plan --gaps {phase}
797
- maestro-execute {phase}
798
- decision:post-execute {retry: 0}
799
- quality-auto-test {phase}
800
- decision:post-business-test {retry+1}
801
- ```
802
-
803
- **post-review:**
804
- ```
805
- quality-debug "{gap_summary}"
806
- maestro-plan --gaps {phase}
807
- maestro-execute {phase}
808
- quality-review {phase}
809
- decision:post-review {retry+1}
810
- ```
811
-
812
- **post-test:**
813
- ```
814
- quality-debug --from-uat "{gap_summary}"
815
- maestro-plan --gaps {phase}
816
- maestro-execute {phase}
817
- decision:post-execute {retry: 0}
818
- quality-auto-test {phase}
819
- decision:post-business-test {retry: 0}
820
- quality-review {phase}
821
- decision:post-review {retry: 0}
822
- quality-auto-test {phase}
823
- quality-test {phase}
824
- decision:post-test {retry+1}
825
- ```
826
-
827
- **post-goal-audit:** (per unmet sub-goal group)
828
- ```
829
- # for each unmet sub-goal G{n}, scoped to target_phase:
830
- maestro-plan --gaps {target_phase} "G{n}: {gap}" [goal_ref: G{n}]
831
- maestro-execute {target_phase} [goal_ref: G{n}]
832
- # after all unmet groups inserted:
833
- decision:post-goal-audit {retry+1}
834
- ```
835
-
836
- ### Goal Prompt Template
837
-
838
- decomposition 产出后,链路概览之后逐字显示:
839
-
840
- ```
841
- 📋 任务分解完成。可随时复制以下 /goal 设定终止条件:
842
-
843
- /goal 完成以下子目标:
844
- {for each G in task_decomposition:}
845
- - {G.id}: {G.goal} — 完成条件: {G.done_when}
846
- {end for}
847
- 直到 {session_dir}/status.json 的 task_decomposition[*] 与 steps[*] 全部 completion_confirmed=true 才停。每轮以 status.json 为唯一行动手册,通过 /maestro-ralph-beta 推进 tick;decision 节点由 ralph 内联评估。禁止手动执行 skill 或修改 boundary_contract.out_of_scope。
848
- ```
849
-
850
- ### Error Codes
851
-
852
- | Code | Severity | Description | Recovery |
853
- |------|----------|-------------|----------|
854
- | E001 | error | No intent and no running session | Prompt for intent |
855
- | E002 | error | Cannot infer lifecycle position | Show raw state, ask |
856
- | E003 | error | Artifact dir not found for decision | Show glob, ask |
857
- | E004 | error | Delegate verdict parse failed | Fallback: "fix" |
858
- | E005 | error | Delegate execution failed | Fallback: "fix" |
859
- | E006 | error | command_scope == "missing" for one or more steps | List missing skills, abort build |
860
- | E007 | error | required_reading 引用文件缺失 | `ralph next` 拒绝;CLI stderr 列出缺失路径 |
861
- | E008 | error | `ralph complete` idx ≠ active_step_index | 编辑 status.json 修正一致性 |
862
- | E009 | error | `ralph complete` step.status ≠ running | 重复 complete 或非法跳跃;编辑 status.json |
863
- | E010 | error | status.json schema 损坏 OR A_EXEC_STEP exit=2 熔断(连续 ≥2 次空转) | `ralph check` 显示损坏字段;熔断需人工核对 next_pending_step 与 router 路由是否一致 |
864
- | W001 | warning | Decision expanded chain | Auto-handled |
865
- | W002 | warning | Max retries, escalating | Auto-handled |
866
- | W003 | warning | Multiple running sessions | Use latest, warn |
867
- | W004 | warning | Low delegate confidence | Show warning |
868
- | W005 | warning | active_step_index 指向已 completed step | `ralph next` 自动清理后继续 |
869
- | W007 | warning | step.skill ≠ command .md frontmatter.name | 提示但不阻塞 |
870
-
871
- ### Success Criteria
872
-
873
- - [ ] Tick 末尾自调用 `Skill("maestro-ralph-beta")`,直到全部 `completion_confirmed` 或 paused
874
- - [ ] 同一 session 同时仅一个 step 持 `active_step_index`;切换前必经 release
875
- - [ ] Decision step 全程不调 `maestro ralph next` / `complete`,由 maestro-ralph-beta 内联评估并 release
876
- - [ ] `task_decomposition` 存在时,chain 含 `decision:post-goal-audit`,且最终 `task_decomposition_all_done == true` 才允许 S_COMPLETE
877
- - [ ] Chain 以 `milestone-complete` 结尾;A_APPLY_* 修改 steps[] 后均 reindex
878
- - [ ] 连续 2 次 `ralph next` exit=2 → E010 pause(防 router 错路由空转)
879
-
880
- </appendix>