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