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