maestro-flow 0.5.42 → 0.5.43

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 (323) hide show
  1. package/.agents/skills/domain-add/SKILL.md +3 -0
  2. package/.agents/skills/learn-decompose/SKILL.md +7 -4
  3. package/.agents/skills/learn-follow/SKILL.md +4 -2
  4. package/.agents/skills/learn-investigate/SKILL.md +8 -6
  5. package/.agents/skills/learn-second-opinion/SKILL.md +6 -3
  6. package/.agents/skills/maestro/SKILL.md +1 -1
  7. package/.agents/skills/maestro-amend/SKILL.md +1 -1
  8. package/.agents/skills/maestro-analyze/SKILL.md +1 -1
  9. package/.agents/skills/maestro-blueprint/SKILL.md +1 -1
  10. package/.agents/skills/maestro-brainstorm/SKILL.md +4 -1
  11. package/.agents/skills/maestro-collab/SKILL.md +6 -2
  12. package/.agents/skills/maestro-companion/SKILL.md +4 -1
  13. package/.agents/skills/maestro-composer/SKILL.md +4 -2
  14. package/.agents/skills/maestro-execute/SKILL.md +26 -8
  15. package/.agents/skills/maestro-fork/SKILL.md +4 -3
  16. package/.agents/skills/maestro-grill/SKILL.md +1 -1
  17. package/.agents/skills/maestro-guard/SKILL.md +2 -2
  18. package/.agents/skills/maestro-impeccable/SKILL.md +2 -1
  19. package/.agents/skills/maestro-init/SKILL.md +1 -1
  20. package/.agents/skills/maestro-merge/SKILL.md +12 -1
  21. package/.agents/skills/maestro-milestone-audit/SKILL.md +1 -0
  22. package/.agents/skills/maestro-milestone-complete/SKILL.md +8 -3
  23. package/.agents/skills/maestro-milestone-release/SKILL.md +8 -4
  24. package/.agents/skills/maestro-overlay/SKILL.md +9 -0
  25. package/.agents/skills/maestro-plan/SKILL.md +1 -0
  26. package/.agents/skills/maestro-player/SKILL.md +2 -2
  27. package/.agents/skills/maestro-quick/SKILL.md +5 -3
  28. package/.agents/skills/maestro-ralph/SKILL.md +8 -8
  29. package/.agents/skills/maestro-ralph-cli/SKILL.md +665 -0
  30. package/.agents/skills/maestro-ralph-cli-execute/SKILL.md +239 -0
  31. package/.agents/skills/maestro-ralph-execute/SKILL.md +127 -11
  32. package/.agents/skills/maestro-roadmap/SKILL.md +1 -1
  33. package/.agents/skills/maestro-swarm-workflow/SKILL.md +16 -14
  34. package/.agents/skills/maestro-tools-register/SKILL.md +16 -1
  35. package/.agents/skills/maestro-ui-codify/SKILL.md +11 -1
  36. package/.agents/skills/maestro-universal-workflow/SKILL.md +28 -5
  37. package/.agents/skills/maestro-update/SKILL.md +10 -7
  38. package/.agents/skills/manage-codebase-rebuild/SKILL.md +5 -1
  39. package/.agents/skills/manage-drift-realign/SKILL.md +6 -2
  40. package/.agents/skills/manage-harvest/SKILL.md +4 -1
  41. package/.agents/skills/manage-issue-discover/SKILL.md +1 -0
  42. package/.agents/skills/manage-kg-extractors/SKILL.md +5 -1
  43. package/.agents/skills/manage-knowhow-capture/SKILL.md +1 -0
  44. package/.agents/skills/manage-knowledge-audit/SKILL.md +3 -0
  45. package/.agents/skills/manage-wiki/SKILL.md +1 -0
  46. package/.agents/skills/odyssey-debug/SKILL.md +2 -1
  47. package/.agents/skills/odyssey-improve/SKILL.md +2 -2
  48. package/.agents/skills/odyssey-planex/SKILL.md +8 -7
  49. package/.agents/skills/odyssey-review-test-fix/SKILL.md +4 -1
  50. package/.agents/skills/odyssey-ui/SKILL.md +4 -4
  51. package/.agents/skills/quality-auto-test/SKILL.md +11 -1
  52. package/.agents/skills/quality-debug/SKILL.md +16 -2
  53. package/.agents/skills/quality-retrospective/SKILL.md +9 -1
  54. package/.agents/skills/quality-review/SKILL.md +8 -0
  55. package/.agents/skills/quality-sync/SKILL.md +2 -2
  56. package/.agents/skills/quality-test/SKILL.md +9 -1
  57. package/.agents/skills/security-audit/SKILL.md +14 -4
  58. package/.agents/skills/spec-add/SKILL.md +5 -2
  59. package/.agents/skills/spec-load/SKILL.md +1 -1
  60. package/.agents/skills/spec-remove/SKILL.md +1 -1
  61. package/.agents/skills/spec-setup/SKILL.md +3 -0
  62. package/.agy/skills/domain-add/SKILL.md +3 -0
  63. package/.agy/skills/learn-decompose/SKILL.md +7 -4
  64. package/.agy/skills/learn-follow/SKILL.md +4 -2
  65. package/.agy/skills/learn-investigate/SKILL.md +8 -6
  66. package/.agy/skills/learn-second-opinion/SKILL.md +6 -3
  67. package/.agy/skills/maestro/SKILL.md +1 -1
  68. package/.agy/skills/maestro-amend/SKILL.md +1 -1
  69. package/.agy/skills/maestro-analyze/SKILL.md +1 -1
  70. package/.agy/skills/maestro-blueprint/SKILL.md +1 -1
  71. package/.agy/skills/maestro-brainstorm/SKILL.md +4 -1
  72. package/.agy/skills/maestro-collab/SKILL.md +6 -2
  73. package/.agy/skills/maestro-companion/SKILL.md +4 -1
  74. package/.agy/skills/maestro-composer/SKILL.md +4 -2
  75. package/.agy/skills/maestro-execute/SKILL.md +26 -8
  76. package/.agy/skills/maestro-fork/SKILL.md +4 -3
  77. package/.agy/skills/maestro-grill/SKILL.md +1 -1
  78. package/.agy/skills/maestro-guard/SKILL.md +2 -2
  79. package/.agy/skills/maestro-impeccable/SKILL.md +2 -1
  80. package/.agy/skills/maestro-init/SKILL.md +1 -1
  81. package/.agy/skills/maestro-merge/SKILL.md +12 -1
  82. package/.agy/skills/maestro-milestone-audit/SKILL.md +1 -0
  83. package/.agy/skills/maestro-milestone-complete/SKILL.md +8 -3
  84. package/.agy/skills/maestro-milestone-release/SKILL.md +8 -4
  85. package/.agy/skills/maestro-overlay/SKILL.md +9 -0
  86. package/.agy/skills/maestro-plan/SKILL.md +1 -0
  87. package/.agy/skills/maestro-player/SKILL.md +2 -2
  88. package/.agy/skills/maestro-quick/SKILL.md +5 -3
  89. package/.agy/skills/maestro-ralph/SKILL.md +8 -8
  90. package/.agy/skills/maestro-ralph-cli/SKILL.md +661 -0
  91. package/.agy/skills/maestro-ralph-cli-execute/SKILL.md +235 -0
  92. package/.agy/skills/maestro-ralph-execute/SKILL.md +127 -11
  93. package/.agy/skills/maestro-roadmap/SKILL.md +1 -1
  94. package/.agy/skills/maestro-swarm-workflow/SKILL.md +16 -14
  95. package/.agy/skills/maestro-tools-register/SKILL.md +16 -1
  96. package/.agy/skills/maestro-ui-codify/SKILL.md +11 -1
  97. package/.agy/skills/maestro-universal-workflow/SKILL.md +28 -5
  98. package/.agy/skills/maestro-update/SKILL.md +10 -7
  99. package/.agy/skills/manage-codebase-rebuild/SKILL.md +5 -1
  100. package/.agy/skills/manage-drift-realign/SKILL.md +6 -2
  101. package/.agy/skills/manage-harvest/SKILL.md +4 -1
  102. package/.agy/skills/manage-issue-discover/SKILL.md +1 -0
  103. package/.agy/skills/manage-kg-extractors/SKILL.md +5 -1
  104. package/.agy/skills/manage-knowhow-capture/SKILL.md +1 -0
  105. package/.agy/skills/manage-knowledge-audit/SKILL.md +3 -0
  106. package/.agy/skills/manage-wiki/SKILL.md +1 -0
  107. package/.agy/skills/odyssey-debug/SKILL.md +2 -1
  108. package/.agy/skills/odyssey-improve/SKILL.md +2 -2
  109. package/.agy/skills/odyssey-planex/SKILL.md +8 -7
  110. package/.agy/skills/odyssey-review-test-fix/SKILL.md +4 -1
  111. package/.agy/skills/odyssey-ui/SKILL.md +4 -4
  112. package/.agy/skills/quality-auto-test/SKILL.md +11 -1
  113. package/.agy/skills/quality-debug/SKILL.md +16 -2
  114. package/.agy/skills/quality-retrospective/SKILL.md +9 -1
  115. package/.agy/skills/quality-review/SKILL.md +8 -0
  116. package/.agy/skills/quality-sync/SKILL.md +2 -2
  117. package/.agy/skills/quality-test/SKILL.md +9 -1
  118. package/.agy/skills/security-audit/SKILL.md +14 -4
  119. package/.agy/skills/spec-add/SKILL.md +5 -2
  120. package/.agy/skills/spec-load/SKILL.md +1 -1
  121. package/.agy/skills/spec-remove/SKILL.md +1 -1
  122. package/.agy/skills/spec-setup/SKILL.md +3 -0
  123. package/.claude/commands/domain-add.md +3 -0
  124. package/.claude/commands/learn-decompose.md +7 -4
  125. package/.claude/commands/learn-follow.md +4 -2
  126. package/.claude/commands/learn-investigate.md +8 -6
  127. package/.claude/commands/learn-second-opinion.md +6 -3
  128. package/.claude/commands/maestro-amend.md +1 -1
  129. package/.claude/commands/maestro-analyze.md +1 -1
  130. package/.claude/commands/maestro-blueprint.md +1 -1
  131. package/.claude/commands/maestro-brainstorm.md +4 -1
  132. package/.claude/commands/maestro-collab.md +6 -2
  133. package/.claude/commands/maestro-companion.md +4 -1
  134. package/.claude/commands/maestro-composer.md +4 -2
  135. package/.claude/commands/maestro-execute.md +26 -8
  136. package/.claude/commands/maestro-fork.md +4 -3
  137. package/.claude/commands/maestro-grill.md +1 -1
  138. package/.claude/commands/maestro-guard.md +2 -2
  139. package/.claude/commands/maestro-impeccable.md +2 -1
  140. package/.claude/commands/maestro-init.md +1 -1
  141. package/.claude/commands/maestro-merge.md +12 -1
  142. package/.claude/commands/maestro-milestone-audit.md +1 -0
  143. package/.claude/commands/maestro-milestone-complete.md +8 -3
  144. package/.claude/commands/maestro-milestone-release.md +8 -4
  145. package/.claude/commands/maestro-overlay.md +9 -0
  146. package/.claude/commands/maestro-plan.md +1 -0
  147. package/.claude/commands/maestro-player.md +2 -2
  148. package/.claude/commands/maestro-quick.md +5 -3
  149. package/.claude/commands/maestro-ralph-cli-execute.md +237 -0
  150. package/.claude/commands/maestro-ralph-cli.md +663 -0
  151. package/.claude/commands/maestro-ralph-execute.md +127 -11
  152. package/.claude/commands/maestro-ralph.md +8 -8
  153. package/.claude/commands/maestro-roadmap.md +1 -1
  154. package/.claude/commands/maestro-swarm-workflow.md +16 -14
  155. package/.claude/commands/maestro-tools-register.md +16 -1
  156. package/.claude/commands/maestro-ui-codify.md +11 -1
  157. package/.claude/commands/maestro-universal-workflow.md +28 -5
  158. package/.claude/commands/maestro-update.md +10 -7
  159. package/.claude/commands/maestro.md +1 -1
  160. package/.claude/commands/manage-codebase-rebuild.md +5 -1
  161. package/.claude/commands/manage-drift-realign.md +6 -2
  162. package/.claude/commands/manage-harvest.md +4 -1
  163. package/.claude/commands/manage-issue-discover.md +1 -0
  164. package/.claude/commands/manage-kg-extractors.md +5 -1
  165. package/.claude/commands/manage-knowhow-capture.md +1 -0
  166. package/.claude/commands/manage-knowledge-audit.md +3 -0
  167. package/.claude/commands/manage-wiki.md +1 -0
  168. package/.claude/commands/odyssey-debug.md +2 -1
  169. package/.claude/commands/odyssey-improve.md +2 -2
  170. package/.claude/commands/odyssey-planex.md +8 -7
  171. package/.claude/commands/odyssey-review-test-fix.md +4 -1
  172. package/.claude/commands/odyssey-ui.md +4 -4
  173. package/.claude/commands/quality-auto-test.md +11 -1
  174. package/.claude/commands/quality-debug.md +16 -2
  175. package/.claude/commands/quality-retrospective.md +9 -1
  176. package/.claude/commands/quality-review.md +8 -0
  177. package/.claude/commands/quality-sync.md +2 -2
  178. package/.claude/commands/quality-test.md +9 -1
  179. package/.claude/commands/security-audit.md +14 -4
  180. package/.claude/commands/spec-add.md +5 -2
  181. package/.claude/commands/spec-load.md +1 -1
  182. package/.claude/commands/spec-remove.md +1 -1
  183. package/.claude/commands/spec-setup.md +3 -0
  184. package/.codex/skills/codify-to-knowhow/SKILL.md +27 -15
  185. package/.codex/skills/domain-add/SKILL.md +5 -3
  186. package/.codex/skills/learn-decompose/SKILL.md +22 -4
  187. package/.codex/skills/learn-follow/SKILL.md +12 -6
  188. package/.codex/skills/learn-investigate/SKILL.md +11 -6
  189. package/.codex/skills/learn-retro/SKILL.md +12 -6
  190. package/.codex/skills/learn-second-opinion/SKILL.md +11 -3
  191. package/.codex/skills/maestro/SKILL.md +19 -13
  192. package/.codex/skills/maestro-amend/SKILL.md +10 -2
  193. package/.codex/skills/maestro-analyze/SKILL.md +7 -1
  194. package/.codex/skills/maestro-blueprint/SKILL.md +1 -1
  195. package/.codex/skills/maestro-brainstorm/SKILL.md +11 -8
  196. package/.codex/skills/maestro-collab/SKILL.md +5 -5
  197. package/.codex/skills/maestro-companion/SKILL.md +4 -1
  198. package/.codex/skills/maestro-composer/SKILL.md +6 -3
  199. package/.codex/skills/maestro-execute/SKILL.md +11 -8
  200. package/.codex/skills/maestro-fork/SKILL.md +4 -3
  201. package/.codex/skills/maestro-grill/SKILL.md +1 -1
  202. package/.codex/skills/maestro-guard/SKILL.md +1 -1
  203. package/.codex/skills/maestro-impeccable/SKILL.md +5 -5
  204. package/.codex/skills/maestro-init/SKILL.md +3 -2
  205. package/.codex/skills/maestro-milestone-audit/SKILL.md +21 -9
  206. package/.codex/skills/maestro-milestone-complete/SKILL.md +3 -3
  207. package/.codex/skills/maestro-milestone-release/SKILL.md +18 -1
  208. package/.codex/skills/maestro-next/SKILL.md +11 -10
  209. package/.codex/skills/maestro-overlay/SKILL.md +16 -6
  210. package/.codex/skills/maestro-player/SKILL.md +11 -5
  211. package/.codex/skills/maestro-quick/SKILL.md +2 -2
  212. package/.codex/skills/maestro-ralph/SKILL.md +44 -31
  213. package/.codex/skills/maestro-ralph-cli/SKILL.md +394 -0
  214. package/.codex/skills/maestro-ralph-cli-execute/SKILL.md +146 -0
  215. package/.codex/skills/maestro-ralph-execute/SKILL.md +105 -24
  216. package/.codex/skills/maestro-roadmap/SKILL.md +8 -2
  217. package/.codex/skills/maestro-tools-execute/SKILL.md +8 -4
  218. package/.codex/skills/maestro-tools-register/SKILL.md +10 -6
  219. package/.codex/skills/maestro-ui-codify/SKILL.md +14 -9
  220. package/.codex/skills/manage-codebase-rebuild/SKILL.md +36 -14
  221. package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
  222. package/.codex/skills/manage-drift-realign/SKILL.md +15 -12
  223. package/.codex/skills/manage-harvest/SKILL.md +1 -1
  224. package/.codex/skills/manage-issue/SKILL.md +8 -4
  225. package/.codex/skills/manage-issue-discover/SKILL.md +15 -14
  226. package/.codex/skills/manage-knowhow/SKILL.md +3 -2
  227. package/.codex/skills/manage-knowhow-capture/SKILL.md +4 -3
  228. package/.codex/skills/manage-learn/SKILL.md +2 -2
  229. package/.codex/skills/odyssey-debug/SKILL.md +12 -7
  230. package/.codex/skills/odyssey-improve/SKILL.md +11 -6
  231. package/.codex/skills/odyssey-planex/SKILL.md +14 -8
  232. package/.codex/skills/odyssey-review-test-fix/SKILL.md +12 -7
  233. package/.codex/skills/odyssey-ui/SKILL.md +10 -5
  234. package/.codex/skills/quality-auto-test/SKILL.md +13 -5
  235. package/.codex/skills/quality-debug/SKILL.md +18 -11
  236. package/.codex/skills/quality-refactor/SKILL.md +4 -4
  237. package/.codex/skills/quality-retrospective/SKILL.md +5 -6
  238. package/.codex/skills/quality-review/SKILL.md +18 -11
  239. package/.codex/skills/quality-sync/SKILL.md +2 -2
  240. package/.codex/skills/quality-test/SKILL.md +7 -5
  241. package/.codex/skills/security-audit/SKILL.md +7 -5
  242. package/.codex/skills/spec-add/SKILL.md +9 -7
  243. package/.codex/skills/spec-load/SKILL.md +3 -2
  244. package/.codex/skills/spec-map/SKILL.md +10 -1
  245. package/.codex/skills/spec-remove/SKILL.md +3 -2
  246. package/.codex/skills/team-coordinate/SKILL.md +10 -4
  247. package/.codex/skills/team-lifecycle-v4/SKILL.md +33 -26
  248. package/.codex/skills/team-quality-assurance/SKILL.md +43 -0
  249. package/.codex/skills/team-review/SKILL.md +50 -6
  250. package/.codex/skills/team-tech-debt/SKILL.md +53 -7
  251. package/.codex/skills/team-testing/SKILL.md +50 -2
  252. package/.codex/skills/wiki-connect/SKILL.md +3 -1
  253. package/.codex/skills/wiki-digest/SKILL.md +6 -4
  254. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +16 -0
  255. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +419 -44
  256. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -1
  257. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +43 -5
  258. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  259. package/dashboard/dist-server/src/graph/kg/db/types.d.ts +3 -0
  260. package/dashboard/dist-server/src/graph/kg/embedding/code-embedding.d.ts +46 -0
  261. package/dashboard/dist-server/src/graph/kg/embedding/code-embedding.js +329 -0
  262. package/dashboard/dist-server/src/graph/kg/embedding/code-embedding.js.map +1 -0
  263. package/dashboard/dist-server/src/graph/kg/embedding/index.d.ts +2 -0
  264. package/dashboard/dist-server/src/graph/kg/embedding/index.js +3 -0
  265. package/dashboard/dist-server/src/graph/kg/embedding/index.js.map +1 -0
  266. package/dashboard/dist-server/src/graph/kg/engine.d.ts +19 -1
  267. package/dashboard/dist-server/src/graph/kg/engine.js +71 -1
  268. package/dashboard/dist-server/src/graph/kg/engine.js.map +1 -1
  269. package/dashboard/dist-server/src/graph/kg/query/scoring.d.ts +5 -0
  270. package/dashboard/dist-server/src/graph/kg/query/scoring.js +85 -1
  271. package/dashboard/dist-server/src/graph/kg/query/scoring.js.map +1 -1
  272. package/dashboard/dist-server/src/graph/kg/query/search.d.ts +7 -0
  273. package/dashboard/dist-server/src/graph/kg/query/search.js +117 -1
  274. package/dashboard/dist-server/src/graph/kg/query/search.js.map +1 -1
  275. package/dashboard/dist-server/src/graph/kg/surface/mcp-tools.js +49 -0
  276. package/dashboard/dist-server/src/graph/kg/surface/mcp-tools.js.map +1 -1
  277. package/dashboard/dist-server/src/hooks/kg-sync-hook.js +3 -0
  278. package/dashboard/dist-server/src/hooks/kg-sync-hook.js.map +1 -1
  279. package/dist/src/core/plugin-bridge.d.ts.map +1 -1
  280. package/dist/src/core/plugin-bridge.js +17 -0
  281. package/dist/src/core/plugin-bridge.js.map +1 -1
  282. package/dist/src/graph/kg/db/types.d.ts +3 -0
  283. package/dist/src/graph/kg/db/types.d.ts.map +1 -1
  284. package/dist/src/graph/kg/embedding/code-embedding.d.ts +47 -0
  285. package/dist/src/graph/kg/embedding/code-embedding.d.ts.map +1 -0
  286. package/dist/src/graph/kg/embedding/code-embedding.js +329 -0
  287. package/dist/src/graph/kg/embedding/code-embedding.js.map +1 -0
  288. package/dist/src/graph/kg/embedding/index.d.ts +3 -0
  289. package/dist/src/graph/kg/embedding/index.d.ts.map +1 -0
  290. package/dist/src/graph/kg/embedding/index.js +3 -0
  291. package/dist/src/graph/kg/embedding/index.js.map +1 -0
  292. package/dist/src/graph/kg/engine.d.ts +19 -1
  293. package/dist/src/graph/kg/engine.d.ts.map +1 -1
  294. package/dist/src/graph/kg/engine.js +71 -1
  295. package/dist/src/graph/kg/engine.js.map +1 -1
  296. package/dist/src/graph/kg/query/scoring.d.ts +5 -0
  297. package/dist/src/graph/kg/query/scoring.d.ts.map +1 -1
  298. package/dist/src/graph/kg/query/scoring.js +85 -1
  299. package/dist/src/graph/kg/query/scoring.js.map +1 -1
  300. package/dist/src/graph/kg/query/search.d.ts +7 -0
  301. package/dist/src/graph/kg/query/search.d.ts.map +1 -1
  302. package/dist/src/graph/kg/query/search.js +117 -1
  303. package/dist/src/graph/kg/query/search.js.map +1 -1
  304. package/dist/src/graph/kg/surface/mcp-tools.d.ts.map +1 -1
  305. package/dist/src/graph/kg/surface/mcp-tools.js +49 -0
  306. package/dist/src/graph/kg/surface/mcp-tools.js.map +1 -1
  307. package/dist/src/hooks/kg-sync-hook.d.ts.map +1 -1
  308. package/dist/src/hooks/kg-sync-hook.js +3 -0
  309. package/dist/src/hooks/kg-sync-hook.js.map +1 -1
  310. package/dist/src/tools/code-semantic-search.d.ts +10 -0
  311. package/dist/src/tools/code-semantic-search.d.ts.map +1 -0
  312. package/dist/src/tools/code-semantic-search.js +81 -0
  313. package/dist/src/tools/code-semantic-search.js.map +1 -0
  314. package/dist/src/tools/index.d.ts.map +1 -1
  315. package/dist/src/tools/index.js +4 -0
  316. package/dist/src/tools/index.js.map +1 -1
  317. package/dist/src/tools/wiki-search.d.ts +13 -0
  318. package/dist/src/tools/wiki-search.d.ts.map +1 -0
  319. package/dist/src/tools/wiki-search.js +114 -0
  320. package/dist/src/tools/wiki-search.js.map +1 -0
  321. package/dist/src/utils/update-notices.js +12 -0
  322. package/dist/src/utils/update-notices.js.map +1 -1
  323. package/package.json +4 -1
@@ -0,0 +1,665 @@
1
+ ---
2
+ name: maestro-ralph-cli
3
+ description: CLI-delegated lifecycle orchestrator — compose, delegate, analyze, decide in one loop
4
+ argument-hint: "<intent> [-y] [--to <tool>] [--amend [change]] [--roadmap] | status | continue"
5
+ allowed-tools:
6
+ - read_file
7
+ - write_file
8
+ - edit_file
9
+ - shell
10
+ - find_files
11
+ - search
12
+ - invoke_skill
13
+ - ask_user
14
+ ---
15
+ <!-- Open-standard mirror generated by scripts/build-agents-standard.mjs — do not edit; re-run after editing .claude/ source. -->
16
+
17
+ <purpose>
18
+ CLI-delegated variant of maestro-ralph. Same chain-building logic — but this command owns the full orchestration loop: compose prompt → delegate to CLI (via ralph-cli-execute wrapper) → STOP → callback → analyze structured result → mark complete → decide next → loop.
19
+
20
+ Session: `.workflow/.maestro/ralph-cli-{YYYYMMDD-HHmmss}/status.json`
21
+
22
+ Chain building(A_RESOLVE_PHASE → A_INFER_POSITION → A_BUILD_STEPS)、session schema、decomposition(A_DECOMPOSE_TASKS)与 ralph 共用。
23
+ </purpose>
24
+
25
+ <context>
26
+ $ARGUMENTS — intent text, flags, or keywords.
27
+
28
+ **Parse:**
29
+ ```
30
+ -y flag → auto_confirm = true
31
+ --to <tool> → cli_tool (claude|codex|opencode|agy); 默认 claude
32
+ --roadmap → wants_roadmap = true
33
+ --amend / -a → amend_mode = true
34
+ .md/.txt path → input_doc
35
+ status|continue → route keyword
36
+ Remaining → intent (amend_mode 时为 change_request)
37
+ ```
38
+
39
+ **CLI tool selection:**
40
+ 1. `--to <tool>` 显式指定 → 直接使用
41
+ 2. 未指定 → 默认 `claude`
42
+ 3. 校验 `cli-tools.json` 中目标工具 `enabled: true`
43
+ 4. `enabled: false` → E012
44
+
45
+ **State files**:
46
+ - `.workflow/state.json` — artifact registry
47
+ - `.workflow/.maestro/ralph-cli-*/status.json` — session state
48
+ </context>
49
+
50
+ <invariants>
51
+ All ralph invariants (1-16) apply, with the following overrides:
52
+ - **Invariant 1 CLI 语义**: ralph-cli 不直接调用 `invoke_skill()` 执行 step 内容;执行由 delegate 端 cli-execute 完成
53
+ - **Invariant 2 覆盖**: ralph-cli 不调用 `invoke_skill("maestro-ralph-execute")`;invariant 17-21 替代 handoff 机制,ralph-cli 持有完整循环
54
+
55
+ Additionally:
56
+
57
+ 17. **ralph-cli owns the loop** — compose → delegate → analyze → decide 全部在本命令内完成;ralph-cli-execute 只是被委托端的执行包装器
58
+ 18. **Delegate via cli-execute** — delegate prompt 首行为 cli-execute 调用,格式由目标工具决定(见 Invocation Notation)
59
+ 19. **Parse ---RESULT--- block** — delegate 返回后从输出中解析结构化结果块
60
+ 20. **Decision evaluation inline** — decision 节点不 handoff,直接在本循环内评估(仍用 `maestro delegate --to {session.cli_tool} --mode analysis` 做只读分析)
61
+ 21. **No inline skill execution** — 本命令不执行 skill 逻辑;执行由委托端 cli-execute 完成
62
+ </invariants>
63
+
64
+ <state_machine>
65
+
66
+ Chain-building states(S_PARSE_ROUTE through S_CREATE_SESSION)+ 执行循环 states(替代 S_DISPATCH):
67
+
68
+ <states>
69
+ S_PARSE_ROUTE — 解析参数、路由入口
70
+ S_STATUS — 显示 session 进度
71
+ S_CONTINUE — 恢复执行
72
+ S_RESOLVE_PHASE — (共用)
73
+ S_INFER — (共用)
74
+ S_RESOLVE_SCOPE — (共用)
75
+ S_QUALITY_MODE — (共用)
76
+ S_PLANNING_MODE — (共用)
77
+ S_DECOMPOSE — (共用)
78
+ S_BUILD_CHAIN — (共用)
79
+ S_CREATE_SESSION — 写 status.json
80
+ S_CONFIRM — 用户确认
81
+
82
+ S_STEP_LOCATE — 找下一个 pending step PERSIST: —
83
+ S_STEP_RESOLVE — 解析占位符 + 丰富参数 PERSIST: step.args
84
+ S_STEP_LOAD — 加载前序产出 + 发现 PERSIST: —
85
+ S_STEP_COMPOSE — 根据目标 skill 生成适配 prompt PERSIST: —
86
+ S_STEP_DELEGATE — 调 maestro delegate → STOP PERSIST: step.delegate_exec_id, step.status
87
+ S_STEP_ANALYZE — 解析 ---RESULT--- 块 + 分析产物 PERSIST: step.cli_output_summary, session.context
88
+ S_POST_ANALYZE — 产物 vs 目标偏离分析 PERSIST: step.drift_score, step.drift_correction
89
+ S_STEP_COMPLETE — 标记完成 PERSIST: step.completion_*
90
+ S_DECISION_EVAL — 评估 decision 节点 PERSIST: —
91
+ S_APPLY_VERDICT — 应用裁决 PERSIST: session.steps[]
92
+ S_SESSION_DONE — 所有 step 完成 PERSIST: session.status
93
+ S_HANDLE_FAIL — 处理失败 PERSIST: step.status
94
+ S_AMEND_GOAL — 修改 running session 目标 PERSIST: session.task_decomposition, .boundary_contract, .goal_changelog, .steps[]
95
+ S_FALLBACK — 请求用户输入 PERSIST: —
96
+ </states>
97
+
98
+ <transitions>
99
+
100
+ S_PARSE_ROUTE:
101
+ → S_STATUS WHEN: intent == "status"
102
+ → S_CONTINUE WHEN: intent == "continue"
103
+ → S_AMEND_GOAL WHEN: amend_mode == true AND running session exists
104
+ → S_FALLBACK WHEN: amend_mode == true AND no running session
105
+ → S_STEP_LOCATE WHEN: running session with decision step in "running" status
106
+ → S_RESOLVE_PHASE WHEN: intent is non-empty
107
+ → S_FALLBACK WHEN: no intent AND no running session
108
+
109
+ S_STATUS:
110
+ → END DO: A_SHOW_STATUS
111
+
112
+ S_CONTINUE:
113
+ → S_STEP_LOCATE WHEN: running session found
114
+ → S_FALLBACK WHEN: no running session
115
+
116
+ S_AMEND_GOAL:
117
+ → S_STEP_LOCATE WHEN: change applied + user confirmed DO: A_AMEND_GOAL
118
+ → END WHEN: user cancels
119
+ GUARD: RISK_LEVEL=high → auto_confirm 无效
120
+
121
+ S_CREATE_SESSION:
122
+ → S_CONFIRM WHEN: not auto_confirm
123
+ → S_STEP_LOCATE WHEN: auto_confirm
124
+
125
+ S_CONFIRM:
126
+ → S_STEP_LOCATE WHEN: user confirms
127
+ → S_BUILD_CHAIN WHEN: user edits
128
+ → END WHEN: user cancels
129
+
130
+ S_STEP_LOCATE:
131
+ → S_STEP_RESOLVE WHEN: pending execution step found
132
+ → S_DECISION_EVAL WHEN: pending decision step found
133
+ → S_SESSION_DONE WHEN: no pending steps
134
+ → S_FALLBACK WHEN: no running session
135
+
136
+ S_STEP_RESOLVE:
137
+ → S_STEP_LOAD DO: A_RESOLVE_ARGS
138
+
139
+ S_STEP_LOAD:
140
+ → S_STEP_COMPOSE DO: A_LOAD_STEP_CONTEXT
141
+
142
+ S_STEP_COMPOSE:
143
+ → S_STEP_DELEGATE DO: A_COMPOSE_DELEGATION_PROMPT
144
+
145
+ S_STEP_DELEGATE:
146
+ → END DO: A_DISPATCH_DELEGATE (STOP after dispatch)
147
+
148
+ (callback resumes here — re-invocation via continue or automatic)
149
+ S_STEP_LOCATE (on re-entry, finds running step with delegate_exec_id):
150
+ → S_STEP_ANALYZE WHEN: delegate completed
151
+ → S_HANDLE_FAIL WHEN: delegate failed (status != completed AND status != running)
152
+ → END WHEN: delegate still running (STOP)
153
+
154
+ S_STEP_ANALYZE:
155
+ → S_POST_ANALYZE WHEN: result STATUS == DONE|DONE_WITH_CONCERNS DO: A_PARSE_RESULT
156
+ → S_HANDLE_FAIL WHEN: result STATUS == NEEDS_RETRY|BLOCKED DO: A_PARSE_RESULT
157
+
158
+ S_POST_ANALYZE:
159
+ → S_STEP_COMPLETE WHEN: drift_score == ALIGNED|MINOR_DRIFT DO: A_POST_ANALYZE_DRIFT
160
+ → S_STEP_LOAD WHEN: drift_score == MAJOR_DRIFT + not retried DO: A_POST_ANALYZE_DRIFT (re-delegate with correction)
161
+ → S_STEP_COMPLETE WHEN: drift_score == MAJOR_DRIFT + retried DO: A_POST_ANALYZE_DRIFT (proceed with caveats)
162
+
163
+ S_STEP_COMPLETE:
164
+ → S_STEP_LOCATE DO: A_MARK_COMPLETE (loop to next step)
165
+
166
+ S_DECISION_EVAL:
167
+ → S_APPLY_VERDICT WHEN: quality-gate (post-execute, post-business-test, post-review, post-test, post-frontend-verify)
168
+ DO: A_DELEGATE_EVALUATE
169
+ → S_APPLY_VERDICT WHEN: goal-gate (post-goal-audit)
170
+ DO: A_GOAL_AUDIT_EVALUATE
171
+ → S_APPLY_VERDICT WHEN: scope-gate (post-analyze-scope)
172
+ DO: A_SCOPE_EVALUATE
173
+ → S_APPLY_VERDICT WHEN: reground-gate (post-reground)
174
+ DO: A_REGROUND_EVALUATE
175
+ → S_APPLY_VERDICT WHEN: structural (post-milestone, post-debug-escalate)
176
+ DO: A_STRUCTURAL_EVALUATE
177
+
178
+ S_APPLY_VERDICT:
179
+ → S_STEP_LOCATE WHEN: verdict == "proceed" DO: A_APPLY_PROCEED
180
+ → S_STEP_LOCATE WHEN: post-goal-audit + has_unmet DO: A_APPLY_GOAL_FIX
181
+ → S_STEP_LOCATE WHEN: post-goal-audit + all_met + INTENT_ALIGNED=true DO: A_APPLY_GOAL_DONE
182
+ → END WHEN: post-goal-audit + all_met + INTENT_ALIGNED=false DO: A_REGROUND_HALT
183
+ → S_STEP_LOCATE WHEN: post-analyze-scope DO: A_APPLY_SCOPE_VERDICT
184
+ → S_STEP_LOCATE WHEN: verdict == "fix" DO: A_APPLY_FIX
185
+ → S_STEP_LOCATE WHEN: verdict == "escalate" DO: A_APPLY_ESCALATE
186
+ → S_STEP_LOCATE WHEN: post-milestone + standard + next milestone DO: A_ADVANCE_MILESTONE
187
+ → END WHEN: post-milestone + standard + no next milestone
188
+ → END WHEN: post-milestone + adhoc DO: mark completed (adhoc self-contained, set current_milestone = null)
189
+ → END WHEN: post-debug-escalate DO: A_PAUSE_ESCALATE
190
+ → END WHEN: post-reground + drifted + confidence >= 60 DO: A_REGROUND_HALT
191
+ → S_STEP_LOCATE WHEN: post-reground + aligned DO: A_APPLY_PROCEED
192
+ → S_STEP_LOCATE WHEN: post-reground + drifted + confidence < 60 DO: A_APPLY_PROCEED (标 LOW CONFIDENCE)
193
+ GUARD: retry_count >= max_retries → force escalate
194
+ GUARD: confidence_score < 60 AND proceed → override to fix
195
+ GUARD: confidence_score > 95 AND fix AND retry > 0 → suggest proceed
196
+ GUARD: auto_confirm → skip user prompt, apply adjusted verdict
197
+ GUARD: not auto_confirm → ask_user with override options
198
+ GUARD: post-reground + drifted + confidence >= 60 → A_REGROUND_HALT(auto_confirm 不跳过)
199
+
200
+ S_HANDLE_FAIL:
201
+ → S_STEP_LOCATE WHEN: auto + not retried DO: A_RETRY
202
+ → END WHEN: auto + retried DO: A_PAUSE_SESSION
203
+ → S_STEP_LOCATE WHEN: interactive + retry
204
+ → S_STEP_LOCATE WHEN: interactive + skip
205
+ → END WHEN: interactive + abort
206
+
207
+ S_SESSION_DONE:
208
+ → END DO: A_COMPLETE_SESSION
209
+
210
+ </transitions>
211
+
212
+ <actions>
213
+
214
+ ### A_CREATE_SESSION
215
+ 1. `session_id` format: `ralph-cli-{YYYYMMDD-HHmmss}`
216
+ 2. Additional fields: `execution_mode: "cli-delegate"`, `cli_tool: "<selected>"``
217
+ 3. Each step: `delegate_exec_id: null`, `cli_output_summary: null`, `artifacts_produced: []`
218
+ 4. Step mode/role/rule assigned per stage (see Stage Mapping table)
219
+
220
+ ### A_RESOLVE_ARGS
221
+
222
+ - Placeholder substitution: `{phase}`, `{milestone}`, `{intent}`
223
+ - `--from` auto-injection for phase-level artifact chaining
224
+ - Goal context injection (goal_ref → goal_snippet)
225
+ - Write enriched args back to status.json
226
+
227
+ ### A_LOAD_STEP_CONTEXT
228
+
229
+ 主流程加载前序产出和发现,为 prompt 生成准备素材。
230
+
231
+ 1. **Session base** — Read status.json → intent, phase, milestone, boundary_contract
232
+ 2. **Previous step output** — 前一 step 的 `cli_output_summary` + `completion_caveats` + `artifacts_produced` → 关键发现 + 产物路径
233
+ 3. **Artifacts** — 按产物路径逐个 Read,提取与当前 step 相关的内容:
234
+ - `conclusions.json` → scope, key_findings, recommendations
235
+ - `TASK-*.json` → task descriptions, dependencies, wave assignments
236
+ - `verification.json` → pass/fail results, gap details
237
+ - `review.json` → findings, severity, fix suggestions
238
+ - `completion_evidence` → error traces, test failures
239
+ - `grill-report.md` → challenged assumptions, risks
240
+ 4. **Explore if needed** — 产物指向代码位置但缺少上下文 → `maestro explore` 补充(仅 execute/debug/test 且有文件路径引用时)
241
+ 5. **Accumulated signals** — 遍历 ALL completed steps → 聚合 caveats + deferred
242
+
243
+ 输出:`step_context` 结构,供 A_COMPOSE_DELEGATION_PROMPT 消费。
244
+
245
+ ### A_COMPOSE_DELEGATION_PROMPT
246
+
247
+ 根据 `step_context` + 目标 skill 生成适配的 delegate prompt。
248
+
249
+ **Invocation Notation** — 由 `session.cli_tool` 决定:
250
+
251
+ | cli_tool | 首行格式 |
252
+ |----------|---------|
253
+ | claude | `/maestro-ralph-cli-execute --session {session_id}` |
254
+ | codex | `$maestro-ralph-cli-execute --session {session_id}` |
255
+ | opencode, agy | `/maestro-ralph-cli-execute --session {session_id}` |
256
+
257
+ **`<execution_context>` 块格式** — 首行调用后紧跟,cli-execute 解析此块获取 session 上下文:
258
+
259
+ ```xml
260
+ <execution_context>
261
+ <intent>{session.intent}</intent>
262
+ <phase>{session.phase}</phase>
263
+ <milestone>{session.milestone}</milestone>
264
+ <boundary_contract>
265
+ <in_scope>{boundary_contract.in_scope}</in_scope>
266
+ <out_of_scope>{boundary_contract.out_of_scope}</out_of_scope>
267
+ <definition_of_done>{boundary_contract.definition_of_done}</definition_of_done>
268
+ </boundary_contract>
269
+ <execution_criteria>{session.execution_criteria}</execution_criteria>
270
+ <active_goals>{task_decomposition WHERE status != "superseded"}</active_goals>
271
+ <prior_step_context>
272
+ {最近 5 个已完成 step 的 completion_summary + completion_caveats}
273
+ </prior_step_context>
274
+ <accumulated_signals>
275
+ {聚合所有已完成 step 的 caveats + deferred}
276
+ </accumulated_signals>
277
+ <stage_context>
278
+ {Skill-adapted 注入,见下表;仅在有实际内容时加入}
279
+ </stage_context>
280
+ </execution_context>
281
+ ```
282
+
283
+ session_anchor 由 `maestro ralph next` 注入,`<execution_context>` 注入 prior artifacts 摘要,两者不重复。
284
+
285
+ **Skill-adapted `<stage_context>`** — 根据目标 skill 类型选择性注入:
286
+
287
+ | 目标 skill 类型 | 注入重点 |
288
+ |----------------|---------|
289
+ | analyze | intent + scope + boundary |
290
+ | plan | analysis findings + scope_verdict + recommendations |
291
+ | execute | task list + dependencies + wave + caveats from plan |
292
+ | review | changed files + verification results + execution decisions |
293
+ | test | review findings + execution artifacts + coverage data |
294
+ | debug | error details + failing tests + execution trace |
295
+ | brainstorm/grill | challenged assumptions + risks + prior findings |
296
+
297
+ 每段仅在有实际内容时加入,无内容则跳过。
298
+
299
+ ### A_DISPATCH_DELEGATE
300
+
301
+ 1. Build command:
302
+ ```
303
+ maestro delegate "{composed_prompt}"
304
+ --to {session.cli_tool}
305
+ --mode {step.delegate_mode}
306
+ --id {stage_prefix}-{HHmmss}-{rand4}
307
+ ```
308
+
309
+ 2. Write `step.delegate_exec_id`, `step.status = "running"` to status.json
310
+
311
+ 3. `shell({ command: "maestro delegate ...", run_in_background: true })`
312
+
313
+ 4. Display: `[{index}/{total}] ⟶ {step.skill} → delegate:{exec_id} [{cli_tool}]`
314
+
315
+ 5. **STOP**
316
+
317
+ ### A_PARSE_RESULT
318
+
319
+ On callback (re-invocation finds running step with delegate_exec_id):
320
+
321
+ 1. `shell("maestro delegate status {exec_id}")` — still running → STOP
322
+ 2. `shell("maestro delegate output {exec_id}")` — get full output
323
+ 3. Parse `---RESULT---` / `---END---` block:
324
+ ```
325
+ STATUS → completion_status
326
+ SUMMARY → completion_summary (→ --summary)
327
+ ARTIFACTS → artifacts_produced (split by comma)
328
+ EVIDENCE → completion_evidence (→ --evidence)
329
+ DECISIONS → completion_decisions (→ --decisions)
330
+ CAVEATS → completion_caveats (→ --caveats);DONE_WITH_CONCERNS 时同时映射为 --concerns
331
+ DEFERRED → completion_deferred (→ --deferred)
332
+ SIGNALS → parse key=value pairs → update session.context
333
+ ```
334
+ 4. If no `---RESULT---` block found → fallback: STATUS=DONE_WITH_CONCERNS, SUMMARY from last 200 chars of output
335
+ 5. Write parsed data to step in status.json
336
+
337
+ ### A_MARK_COMPLETE
338
+
339
+ **RESULT→complete 映射:** `STATUS→--status`、`SUMMARY→--summary`、`EVIDENCE→--evidence`、`DECISIONS→--decisions`、`CAVEATS→--caveats`(DONE_WITH_CONCERNS 时同时作 `--concerns`)、`DEFERRED→--deferred`。SIGNALS 写入 `status.json.context`,不传给 complete。
340
+
341
+ 1. `shell("maestro ralph complete {index} --status {STATUS} --summary \"{SUMMARY}\" [--evidence ...] [--decisions ...] [--caveats ...] [--deferred ...]")`
342
+ 2. Apply SIGNALS to `session.context`
343
+ 3. Display: `[{index}/{total}] ✓ {step.skill} → {SUMMARY}`
344
+ 4. Loop back to S_STEP_LOCATE
345
+
346
+ ### A_SHOW_STATUS
347
+
348
+ Find latest ralph-cli session, display steps + sub-goals progress.
349
+
350
+ ### A_POST_ANALYZE_DRIFT
351
+
352
+ 产物 vs 目标偏离分析。A_PARSE_RESULT 后、A_MARK_COMPLETE 前执行。
353
+
354
+ **1. 收集对照基准:**
355
+
356
+ | 基准来源 | 取值 |
357
+ |---------|------|
358
+ | `step.goal_ref` → goal.done_when | 子目标的完成条件 |
359
+ | `session.boundary_contract.definition_of_done` | 全局验收标准 |
360
+ | `session.execution_criteria` | 执行准则 |
361
+ | `session.intent` | 原始意图 |
362
+
363
+ **2. 读产物摘要:**
364
+
365
+ 从 A_PARSE_RESULT 已提取的 SUMMARY + DECISIONS + ARTIFACTS + CAVEATS 构建产物画像。
366
+
367
+ **3. 对比评分:**
368
+
369
+ | 维度 | 检查 |
370
+ |------|------|
371
+ | 覆盖度 | 产物是否覆盖了 goal.done_when 的每个条件 |
372
+ | 方向性 | DECISIONS 是否与 intent 和 boundary 一致 |
373
+ | 完整性 | 预期产物类型是否齐全 |
374
+
375
+ **drift_score:**
376
+ - `ALIGNED` — 全部维度通过
377
+ - `MINOR_DRIFT` — 覆盖度/完整性有小缺口
378
+ - `MAJOR_DRIFT` — 方向性偏离或关键产物缺失
379
+
380
+ **4. 修正动作:**
381
+
382
+ | drift_score | 动作 |
383
+ |-------------|------|
384
+ | ALIGNED | 正常进入 S_STEP_COMPLETE |
385
+ | MINOR_DRIFT | 将偏离项追加到 completion_caveats,正常 complete |
386
+ | MAJOR_DRIFT + 未重试 | 写 `step.drift_correction`,回到 S_STEP_LOAD 重新加载 + compose + delegate(drift_correction 作为修正上下文注入 prompt) |
387
+ | MAJOR_DRIFT + 已重试 | 以 DONE_WITH_CONCERNS complete,由后续 decision node 裁决 |
388
+
389
+ **5. 写入:** `step.drift_score`, `step.drift_correction`
390
+
391
+ ### A_DELEGATE_EVALUATE
392
+
393
+ Inline 评估质量门(非 handoff)。Runs `run_in_background` → STOP → callback resume in same loop。
394
+
395
+ 1. Resolve artifact dir: `.workflow/scratch/{artifact.path}/` with fallback glob
396
+ 2. Parse decision metadata: `{ decision, retry_count, max_retries }`
397
+ 3. Map result files:
398
+
399
+ | Decision | Files |
400
+ |----------|-------|
401
+ | post-execute | verification.json |
402
+ | post-business-test | .tests/auto-test/report.json |
403
+ | post-review | review.json |
404
+ | post-test | uat.md, .tests/test-results.json |
405
+ | post-frontend-verify | e2e-results.json |
406
+
407
+ 4. Execute delegate (run_in_background, STOP, wait for callback):
408
+ ```
409
+ maestro delegate "PURPOSE: 评估 {decision} 质量门结果
410
+ TASK: 读取结果 | 分析状态 | 评估严重性 | 给出建议
411
+ EXPECTED: ---VERDICT--- STATUS(PASS|FAIL|PARTIAL|BLOCKED)/REASON/GAP_SUMMARY/CONFIDENCE(high|medium|low)/CONFIDENCE_SCORE(0-100)/WEAKEST_DIMENSION ---END---
412
+ CONSTRAINTS: 只评估 | 置信度<60% 倾向 fix | retry {n}/{max} 达上限必须 escalate"
413
+ --to {session.cli_tool} --mode analysis
414
+ ```
415
+ 5. On callback: parse `---VERDICT---` block — STATUS must match strict enum `PASS|FAIL|PARTIAL|BLOCKED`; any other value → parse failure. If parse fails → fallback STATUS="fix", BUT MUST set `parse_failed: true` and `confidence_score: 0` in decision log (invariant 13). Subsequent steps inherit LOW CONFIDENCE flag.
416
+ 6. Confidence adjustment: <60 + proceed → fix; >95 + fix + retry>0 → suggest proceed
417
+ 7. **Decision log**: Append to `{session_dir}/decisions.ndjson`:
418
+ ```json
419
+ { "id": "DEC-{timestamp}", "timestamp": "{ISO}", "source": "ralph-cli",
420
+ "node_id": "{step.decision}", "type": "quality-gate",
421
+ "verdict": "{adjusted_verdict}", "confidence_score": {N},
422
+ "parse_failed": false,
423
+ "close_call": {N>=50 && N<=70}, "summary": "{REASON}" }
424
+ ```
425
+
426
+ ### A_GOAL_AUDIT_EVALUATE
427
+
428
+ 审计未完成子目标,判定 met / unmet。Delegate `--to {session.cli_tool} --mode analysis`。
429
+
430
+ 追加 `{session_dir}/decisions.ndjson`:`{ "type": "goal-gate", "unmet_count": N, "unmet_ids": [...] }`。
431
+ GUARD: `retry_count >= max_retries AND still unmet → A_APPLY_ESCALATE`。
432
+ Verdict routing: `all_met` + `INTENT_ALIGNED=true` → A_APPLY_GOAL_DONE;`all_met` + `INTENT_ALIGNED=false` → A_REGROUND_HALT;`has_unmet` → A_APPLY_GOAL_FIX。
433
+
434
+ ### A_SCOPE_EVALUATE
435
+
436
+ Read `conclusions.json.scope_verdict` from macro analyze artifact. Write to `session.scope_verdict` + `session.analyze_macro_id`. Append `{session_dir}/decisions.ndjson`:`{ "type": "scope-gate", "verdict": "{scope_verdict}", "analyze_macro_id": "{ANL_ID}" }`。
437
+
438
+ ### A_REGROUND_EVALUATE
439
+
440
+ 意图保真检查(delegate prompt 含 intent + boundary + completed_steps + done_goals + accumulated_deferred + goal_changelog)。Delegate `--to {session.cli_tool} --mode analysis`。
441
+
442
+ Append `{session_dir}/decisions.ndjson`:`{ "type": "reground-gate", "verdict": "{aligned|drifted}", "confidence_score": {N}, "drift_description": "...", "corrective_action": "..." }`。
443
+ Verdict routing: `aligned` → A_APPLY_PROCEED;`drifted` + `confidence >= 60` → A_REGROUND_HALT;`drifted` + `confidence < 60` → A_APPLY_PROCEED(标 LOW CONFIDENCE)。
444
+
445
+ ### A_STRUCTURAL_EVALUATE
446
+
447
+ **post-milestone**: read state.json → determine milestone type → standard: next milestone? insert lifecycle steps / complete. Adhoc: always END.
448
+ **post-debug-escalate**: always STOP → A_PAUSE_ESCALATE.
449
+
450
+ ### A_APPLY_PROCEED / A_APPLY_FIX / A_APPLY_ESCALATE
451
+
452
+ Mark decision completed / insert fix-loop steps / insert debug-escalate.
453
+
454
+ ### A_APPLY_SCOPE_VERDICT
455
+
456
+ Reshape downstream chain based on `scope_verdict`(large+wants_roadmap → keep roadmap;medium/small → collapse to standalone plan)。
457
+
458
+ ### A_APPLY_GOAL_FIX / A_APPLY_GOAL_DONE
459
+
460
+ Insert scoped mini-loops for unmet sub-goals / mark all goals done + `task_decomposition_all_done=true`.
461
+
462
+ ### A_ADVANCE_MILESTONE
463
+
464
+ Update session milestone/phase, insert full lifecycle steps for next milestone, reindex.
465
+
466
+ ### A_REGROUND_HALT
467
+
468
+ Set `session.status = "paused"`, display drift warning. auto_confirm 不跳过.
469
+
470
+ ### A_PAUSE_ESCALATE
471
+
472
+ Set session paused, display "请人工介入", suggest `/maestro-ralph-cli continue`.
473
+
474
+ ### A_AMEND_GOAL
475
+
476
+ 5 步流程(快照→解析→mini grill→确认→应用),deferred_reading: `ralph-amend-goal.md`。RISK_LEVEL=high 时 auto_confirm 无效。
477
+
478
+ ### A_RETRY / A_PAUSE_SESSION / A_COMPLETE_SESSION
479
+
480
+ - **A_RETRY**: `maestro ralph retry {index}` — CLI 清空 `delegate_exec_id`,设 `step.retried = true`、`step.status = "pending"`,清 `active_step_index`;ralph-cli 回到 S_STEP_RESOLVE 重新 compose→delegate
481
+ - **A_PAUSE_SESSION**: 由 `ralph complete N --status BLOCKED --reason "..."` 触发,CLI 写 `session.status = "paused"`
482
+ - **A_COMPLETE_SESSION**: 校验所有 step `completion_confirmed == true` + `task_decomposition_all_done == true`(若存在),通过后写 `session.status = "completed"`
483
+
484
+ </actions>
485
+
486
+ </state_machine>
487
+
488
+ <appendix>
489
+
490
+ ### Stage Mapping
491
+
492
+ | Stage | delegate_mode | delegate_rule |
493
+ |-------|---------------|---------------|
494
+ | analyze, analyze-macro | analysis | `analysis-analyze-code-patterns` |
495
+ | plan | write | `planning-breakdown-task-steps` |
496
+ | execute | write | `development-implement-feature` |
497
+ | review, business-test | analysis | `analysis-review-code-quality` |
498
+ | test, test-gen, frontend-verify | write | — |
499
+ | grill, brainstorm | write | — |
500
+ | debug, quality-debug | write | `analysis-diagnose-bug-root-cause` |
501
+ | blueprint | write | `planning-design-component-spec` |
502
+ | init, spec-setup | write | — |
503
+ | milestone-audit | analysis | `analysis-review-code-quality` |
504
+ | milestone-complete | write | — |
505
+
506
+ Fix-loop 插入的 step 按此表分配 `delegate_mode` + `delegate_rule`。
507
+
508
+ All delegation uses `--to {session.cli_tool}` (not `--role`). The `cli_tool` is resolved from session context.
509
+
510
+ ### Delegate Exec ID Prefix
511
+
512
+ | Stage | Prefix |
513
+ |-------|--------|
514
+ | grill | `grl` |
515
+ | brainstorm | `brn` |
516
+ | analyze-macro | `anm` |
517
+ | analyze | `ana` |
518
+ | plan | `pln` |
519
+ | execute | `exe` |
520
+ | review | `rev` |
521
+ | test | `tst` |
522
+ | debug | `dbg` |
523
+
524
+ ### Session Schema
525
+
526
+ ```json
527
+ {
528
+ "session_id": "ralph-cli-{YYYYMMDD-HHmmss}",
529
+ "source": "ralph", "status": "running",
530
+ "execution_mode": "cli-delegate",
531
+ "cli_tool": "claude",
532
+ "ralph_protocol_version": "2",
533
+ "active_step_index": null,
534
+ "intent": "", "lifecycle_position": "",
535
+ "phase": null, "phase_is_new": false,
536
+ "milestone": "",
537
+ "auto_mode": false,
538
+ "decomposition_owner": "ralph",
539
+
540
+ "quality_mode": "standard",
541
+ "planning_mode": "independent",
542
+ "scope_verdict": null,
543
+ "wants_roadmap": false,
544
+ "analyze_macro_id": null,
545
+ "blueprint_id": null,
546
+ "passed_gates": [],
547
+ "context": { "issue_id": null, "scratch_dir": null, "plan_dir": null,
548
+ "analysis_dir": null, "brainstorm_dir": null, "blueprint_dir": null },
549
+ "steps": [{
550
+ "index": 0,
551
+ "skill": "",
552
+ "args": "",
553
+ "stage": "",
554
+ "scope": null,
555
+ "decision": null,
556
+ "retry_count": 0,
557
+ "max_retries": 2,
558
+ "command_scope": "global|project|missing|null",
559
+ "command_path": "<absolute path resolved by `maestro ralph skills --platform agent --json --quiet`> | null",
560
+ "milestone_id": null,
561
+ "source_artifact_ref": null,
562
+ "status": "pending|running|completed|skipped|failed",
563
+ "goal_ref": null,
564
+ "completion_confirmed": false,
565
+ "completion_status": null,
566
+ "completion_evidence": null,
567
+ "completion_summary": null,
568
+ "completion_decisions": null,
569
+ "completion_caveats": null,
570
+ "completion_deferred": null,
571
+ "completed_at": null,
572
+ "deferred_reads": [],
573
+ "load": null, // { loaded_at, required_files[], deferred_files[], resolve_version } — 由 ralph next (cli-execute 端) 写入
574
+ "delegate_exec_id": null,
575
+ "delegate_mode": "write|analysis",
576
+ "delegate_rule": null,
577
+ "cli_output_summary": null,
578
+ "artifacts_produced": [],
579
+ "drift_score": null,
580
+ "drift_correction": null
581
+ }],
582
+ "waves": [], "current_step": 0,
583
+
584
+ "boundary_contract": {
585
+ "in_scope": [], "out_of_scope": [], "constraints": [], "definition_of_done": ""
586
+ },
587
+ "execution_criteria": [],
588
+ "task_decomposition": [
589
+ { "id": "G1", "goal": "", "boundary": "", "done_when": "",
590
+ "evidence": "", "lifecycle": [], "status": "pending|done|superseded",
591
+ "completion_confirmed": false, "completed_at": null,
592
+ "superseded_by": null, "superseded_at": null, "origin": null }
593
+ ],
594
+ "task_decomposition_all_done": false,
595
+
596
+ "goal_changelog": [
597
+ { "id": "CHG-001", "timestamp": "{ISO}",
598
+ "change_type": "modify|add|remove|boundary",
599
+ "reason": "",
600
+ "impact_assessment": { "risk_level": "low|medium|high",
601
+ "invalidated_steps": [], "new_steps_inserted": 0 },
602
+ "before": { "goals": [{"id":"G1","goal":"...","done_when":"..."}] },
603
+ "after": { "goals": [{"id":"G1v2","goal":"...","done_when":"..."}] } }
604
+ ]
605
+ }
606
+ ```
607
+
608
+ 新增字段可选,缺省=旧行为;既有字段名不删不改。
609
+
610
+ ### Fix-Loop Templates
611
+
612
+ 6 套 fix-loop templates(post-execute / post-business-test / post-review / post-test / post-frontend-verify / post-goal-audit)。Each inserted step is delegated through the same compose → delegate → analyze cycle.
613
+
614
+ ### Error Codes
615
+
616
+ E001–E006, W001–W004 适用。CLI 新增:
617
+
618
+ | Code | Severity | Description | Recovery |
619
+ |------|----------|-------------|----------|
620
+ | E011 | error | Delegate execution failed | Retry once, then BLOCKED |
621
+ | E012 | error | CLI tool not enabled in cli-tools.json | Switch tool or enable |
622
+ | E013 | error | ---RESULT--- block not found in output | Fallback parse, mark LOW CONFIDENCE |
623
+
624
+ ### Success Criteria
625
+
626
+ Ralph success criteria 适用。CLI 新增:
627
+
628
+ - [ ] ralph-cli owns full loop: compose → delegate → STOP → callback → parse → complete → next
629
+ - [ ] Delegation prompt 首行为 cli-execute 调用(`--session {session_id}`,格式由 cli_tool 决定),后接 `<execution_context>`
630
+ - [ ] A_PARSE_RESULT extracts STATUS/SUMMARY/ARTIFACTS/DECISIONS/CAVEATS/DEFERRED/SIGNALS from ---RESULT--- block
631
+ - [ ] SIGNALS parsed as key=value pairs and applied to session.context
632
+ - [ ] Decision evaluation runs inline (no handoff to another command)
633
+ - [ ] ralph-cli-execute 仅通过 delegate 会话加载执行,不直接 invoke_skill() 调用
634
+ - [ ] Sliding window: last 5 completed steps in execution_context
635
+ - [ ] Accumulated caveats/deferred from ALL completed steps
636
+ - [ ] Stage-specific artifact injection in execution_context
637
+ - [ ] CLI tool defaults to claude, overridden by --to
638
+ - [ ] `--roadmap` flag parsed → `wants_roadmap = true`
639
+ - [ ] `.md/.txt path → input_doc` parsed
640
+ - [ ] S_AMEND_GOAL + A_AMEND_GOAL 完整实现(5 步流程,RISK_LEVEL=high 不跳过)
641
+ - [ ] `goal_changelog` 写入路径存在(amend 流程产出)
642
+ - [ ] `blueprint_id` session 字段支持 `--from blueprint:{BLP_ID}` 路径
643
+ - [ ] A_SHOW_STATUS 显示 task_decomposition 子目标进度
644
+ - [ ] A_STRUCTURAL_EVALUATE 处理 post-milestone + post-debug-escalate
645
+ - [ ] A_ADVANCE_MILESTONE 插入下一里程碑 lifecycle steps
646
+ - [ ] A_REGROUND_HALT 漂移熔断(auto_confirm 不跳过)
647
+ - [ ] A_PAUSE_ESCALATE 达到 max_retries 时暂停
648
+ - [ ] A_APPLY_SCOPE_VERDICT 三路径重塑(large+roadmap / medium-small / unknown)
649
+ - [ ] Fix-loop templates(6 套)通过 compose-delegate cycle 执行;插入 step 按 Stage Mapping 表分配 delegate_mode + delegate_rule
650
+ - [ ] re-grounding 3-step 插入规则(build rule 5.5)
651
+ - [ ] spec-setup 预检(build rule 0.5)
652
+ - [ ] Invariant 2(Skill handoff)在 ralph-cli 中被覆盖,由 invariant 17-21 替代
653
+ - [ ] execution_context 块含 intent + phase + boundary_contract + execution_criteria + active_goals + prior_step_context(滑动窗口 5 step)+ accumulated_signals
654
+ - [ ] execution_context 中 boundary_contract 不截断;superseded 目标仅一行标注
655
+ - [ ] A_DELEGATE_EVALUATE 解析 `---VERDICT---` 块,parse 失败 → fallback fix + parse_failed: true + confidence_score: 0
656
+ - [ ] decisions.ndjson 追加:quality-gate / goal-gate / scope-gate / reground-gate 各有完整格式
657
+ - [ ] `completion_summary` 在 STATUS=DONE/DONE_WITH_CONCERNS 时为 MUST(--summary 参数非空)
658
+ - [ ] RESULT 的 EVIDENCE 字段映射到 --evidence;CAVEATS 在 DONE_WITH_CONCERNS 时同时映射 --concerns
659
+ - [ ] post-milestone adhoc 分支:mark completed + set current_milestone = null
660
+ - [ ] post-reground + drifted + confidence < 60 → A_APPLY_PROCEED (LOW CONFIDENCE)
661
+ - [ ] 旧目标标 superseded(superseded_by + superseded_at),新目标 origin: "CHG-xxx"
662
+ - [ ] goal_changelog 含完整 before/after + impact_assessment
663
+
664
+ </appendix>
665
+ </output>