maestro-flow 0.5.45 → 0.5.47

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 (310) hide show
  1. package/.agents/agents/ralph-executor.md +51 -6
  2. package/.agents/skills/domain-add/SKILL.md +9 -0
  3. package/.agents/skills/learn-decompose/SKILL.md +12 -0
  4. package/.agents/skills/learn-follow/SKILL.md +41 -0
  5. package/.agents/skills/learn-investigate/SKILL.md +14 -0
  6. package/.agents/skills/learn-second-opinion/SKILL.md +14 -0
  7. package/.agents/skills/maestro-amend/SKILL.md +11 -0
  8. package/.agents/skills/maestro-companion/SKILL.md +11 -0
  9. package/.agents/skills/maestro-composer/SKILL.md +11 -0
  10. package/.agents/skills/maestro-guard/SKILL.md +25 -0
  11. package/.agents/skills/maestro-init/SKILL.md +28 -0
  12. package/.agents/skills/maestro-overlay/SKILL.md +11 -0
  13. package/.agents/skills/maestro-player/SKILL.md +11 -0
  14. package/.agents/skills/maestro-quick/SKILL.md +29 -0
  15. package/.agents/skills/maestro-ralph-v2/SKILL.md +124 -61
  16. package/.agents/skills/maestro-swarm-workflow/SKILL.md +25 -0
  17. package/.agents/skills/maestro-tools-execute/SKILL.md +29 -0
  18. package/.agents/skills/maestro-tools-register/SKILL.md +29 -0
  19. package/.agents/skills/maestro-ui-codify/SKILL.md +11 -0
  20. package/.agents/skills/maestro-universal-workflow/SKILL.md +59 -0
  21. package/.agents/skills/maestro-update/SKILL.md +38 -0
  22. package/.agents/skills/manage-codebase-rebuild/SKILL.md +29 -0
  23. package/.agents/skills/manage-drift-realign/SKILL.md +12 -0
  24. package/.agents/skills/manage-harvest/SKILL.md +30 -6
  25. package/.agents/skills/manage-issue/SKILL.md +23 -0
  26. package/.agents/skills/manage-issue-discover/SKILL.md +28 -0
  27. package/.agents/skills/manage-kg-extractors/SKILL.md +27 -1
  28. package/.agents/skills/manage-knowhow/SKILL.md +26 -0
  29. package/.agents/skills/manage-knowhow-capture/SKILL.md +24 -0
  30. package/.agents/skills/manage-knowledge-audit/SKILL.md +13 -0
  31. package/.agents/skills/manage-status/SKILL.md +22 -0
  32. package/.agents/skills/manage-wiki/SKILL.md +28 -0
  33. package/.agents/skills/odyssey-debug/SKILL.md +338 -253
  34. package/.agents/skills/odyssey-improve/SKILL.md +417 -281
  35. package/.agents/skills/odyssey-planex/SKILL.md +536 -420
  36. package/.agents/skills/odyssey-review-test-fix/SKILL.md +386 -251
  37. package/.agents/skills/odyssey-ui/SKILL.md +382 -247
  38. package/.agents/skills/quality-auto-test/SKILL.md +12 -0
  39. package/.agents/skills/quality-debug/SKILL.md +11 -0
  40. package/.agents/skills/quality-refactor/SKILL.md +11 -0
  41. package/.agents/skills/quality-retrospective/SKILL.md +11 -0
  42. package/.agents/skills/quality-review/SKILL.md +11 -0
  43. package/.agents/skills/quality-sync/SKILL.md +10 -0
  44. package/.agents/skills/quality-test/SKILL.md +12 -0
  45. package/.agents/skills/security-audit/SKILL.md +11 -0
  46. package/.agents/skills/spec-add/SKILL.md +27 -0
  47. package/.agents/skills/spec-load/SKILL.md +25 -0
  48. package/.agents/skills/spec-remove/SKILL.md +26 -0
  49. package/.agents/skills/spec-setup/SKILL.md +30 -0
  50. package/.agy/agents/ralph-executor.md +53 -6
  51. package/.agy/skills/domain-add/SKILL.md +9 -0
  52. package/.agy/skills/learn-decompose/SKILL.md +12 -0
  53. package/.agy/skills/learn-follow/SKILL.md +41 -0
  54. package/.agy/skills/learn-investigate/SKILL.md +14 -0
  55. package/.agy/skills/learn-second-opinion/SKILL.md +14 -0
  56. package/.agy/skills/maestro-amend/SKILL.md +11 -0
  57. package/.agy/skills/maestro-companion/SKILL.md +11 -0
  58. package/.agy/skills/maestro-composer/SKILL.md +11 -0
  59. package/.agy/skills/maestro-guard/SKILL.md +25 -0
  60. package/.agy/skills/maestro-init/SKILL.md +28 -0
  61. package/.agy/skills/maestro-overlay/SKILL.md +11 -0
  62. package/.agy/skills/maestro-player/SKILL.md +11 -0
  63. package/.agy/skills/maestro-quick/SKILL.md +29 -0
  64. package/.agy/skills/maestro-ralph-v2/SKILL.md +123 -61
  65. package/.agy/skills/maestro-swarm-workflow/SKILL.md +25 -0
  66. package/.agy/skills/maestro-tools-execute/SKILL.md +29 -0
  67. package/.agy/skills/maestro-tools-register/SKILL.md +29 -0
  68. package/.agy/skills/maestro-ui-codify/SKILL.md +11 -0
  69. package/.agy/skills/maestro-universal-workflow/SKILL.md +59 -0
  70. package/.agy/skills/maestro-update/SKILL.md +38 -0
  71. package/.agy/skills/manage-codebase-rebuild/SKILL.md +29 -0
  72. package/.agy/skills/manage-drift-realign/SKILL.md +12 -0
  73. package/.agy/skills/manage-harvest/SKILL.md +30 -6
  74. package/.agy/skills/manage-issue/SKILL.md +23 -0
  75. package/.agy/skills/manage-issue-discover/SKILL.md +28 -0
  76. package/.agy/skills/manage-kg-extractors/SKILL.md +27 -1
  77. package/.agy/skills/manage-knowhow/SKILL.md +26 -0
  78. package/.agy/skills/manage-knowhow-capture/SKILL.md +24 -0
  79. package/.agy/skills/manage-knowledge-audit/SKILL.md +13 -0
  80. package/.agy/skills/manage-status/SKILL.md +22 -0
  81. package/.agy/skills/manage-wiki/SKILL.md +28 -0
  82. package/.agy/skills/odyssey-debug/SKILL.md +338 -253
  83. package/.agy/skills/odyssey-improve/SKILL.md +417 -281
  84. package/.agy/skills/odyssey-planex/SKILL.md +536 -420
  85. package/.agy/skills/odyssey-review-test-fix/SKILL.md +386 -251
  86. package/.agy/skills/odyssey-ui/SKILL.md +382 -247
  87. package/.agy/skills/quality-auto-test/SKILL.md +12 -0
  88. package/.agy/skills/quality-debug/SKILL.md +11 -0
  89. package/.agy/skills/quality-refactor/SKILL.md +11 -0
  90. package/.agy/skills/quality-retrospective/SKILL.md +11 -0
  91. package/.agy/skills/quality-review/SKILL.md +11 -0
  92. package/.agy/skills/quality-sync/SKILL.md +10 -0
  93. package/.agy/skills/quality-test/SKILL.md +12 -0
  94. package/.agy/skills/security-audit/SKILL.md +11 -0
  95. package/.agy/skills/spec-add/SKILL.md +27 -0
  96. package/.agy/skills/spec-load/SKILL.md +25 -0
  97. package/.agy/skills/spec-remove/SKILL.md +26 -0
  98. package/.agy/skills/spec-setup/SKILL.md +30 -0
  99. package/.claude/agents/ralph-executor.md +51 -6
  100. package/.claude/commands/domain-add.md +9 -0
  101. package/.claude/commands/learn-decompose.md +12 -0
  102. package/.claude/commands/learn-follow.md +41 -0
  103. package/.claude/commands/learn-investigate.md +14 -0
  104. package/.claude/commands/learn-second-opinion.md +14 -0
  105. package/.claude/commands/maestro-amend.md +11 -0
  106. package/.claude/commands/maestro-companion.md +11 -0
  107. package/.claude/commands/maestro-composer.md +11 -0
  108. package/.claude/commands/maestro-guard.md +25 -0
  109. package/.claude/commands/maestro-init.md +28 -0
  110. package/.claude/commands/maestro-overlay.md +11 -0
  111. package/.claude/commands/maestro-player.md +11 -0
  112. package/.claude/commands/maestro-quick.md +29 -0
  113. package/.claude/commands/maestro-ralph-v2.md +124 -61
  114. package/.claude/commands/maestro-swarm-workflow.md +25 -0
  115. package/.claude/commands/maestro-tools-execute.md +29 -0
  116. package/.claude/commands/maestro-tools-register.md +29 -0
  117. package/.claude/commands/maestro-ui-codify.md +11 -0
  118. package/.claude/commands/maestro-universal-workflow.md +59 -0
  119. package/.claude/commands/maestro-update.md +38 -0
  120. package/.claude/commands/manage-codebase-rebuild.md +29 -0
  121. package/.claude/commands/manage-drift-realign.md +12 -0
  122. package/.claude/commands/manage-harvest.md +30 -6
  123. package/.claude/commands/manage-issue-discover.md +28 -0
  124. package/.claude/commands/manage-issue.md +23 -0
  125. package/.claude/commands/manage-kg-extractors.md +27 -1
  126. package/.claude/commands/manage-knowhow-capture.md +24 -0
  127. package/.claude/commands/manage-knowhow.md +26 -0
  128. package/.claude/commands/manage-knowledge-audit.md +13 -0
  129. package/.claude/commands/manage-status.md +22 -0
  130. package/.claude/commands/manage-wiki.md +28 -0
  131. package/.claude/commands/odyssey-debug.md +352 -267
  132. package/.claude/commands/odyssey-improve.md +431 -295
  133. package/.claude/commands/odyssey-planex.md +550 -434
  134. package/.claude/commands/odyssey-review-test-fix.md +400 -265
  135. package/.claude/commands/odyssey-ui.md +396 -261
  136. package/.claude/commands/quality-auto-test.md +12 -0
  137. package/.claude/commands/quality-debug.md +11 -0
  138. package/.claude/commands/quality-refactor.md +11 -0
  139. package/.claude/commands/quality-retrospective.md +11 -0
  140. package/.claude/commands/quality-review.md +11 -0
  141. package/.claude/commands/quality-sync.md +10 -0
  142. package/.claude/commands/quality-test.md +12 -0
  143. package/.claude/commands/security-audit.md +11 -0
  144. package/.claude/commands/spec-add.md +27 -0
  145. package/.claude/commands/spec-load.md +25 -0
  146. package/.claude/commands/spec-remove.md +26 -0
  147. package/.claude/commands/spec-setup.md +30 -0
  148. package/.codex/skills/codify-to-knowhow/SKILL.md +2 -0
  149. package/.codex/skills/domain-add/SKILL.md +26 -0
  150. package/.codex/skills/domain-discover/SKILL.md +46 -0
  151. package/.codex/skills/domain-list/SKILL.md +29 -0
  152. package/.codex/skills/learn-decompose/SKILL.md +2 -0
  153. package/.codex/skills/learn-follow/SKILL.md +34 -0
  154. package/.codex/skills/learn-investigate/SKILL.md +33 -0
  155. package/.codex/skills/learn-retro/SKILL.md +33 -0
  156. package/.codex/skills/learn-second-opinion/SKILL.md +30 -0
  157. package/.codex/skills/maestro-amend/SKILL.md +11 -0
  158. package/.codex/skills/maestro-companion/SKILL.md +11 -0
  159. package/.codex/skills/maestro-composer/SKILL.md +11 -0
  160. package/.codex/skills/maestro-guard/SKILL.md +25 -0
  161. package/.codex/skills/maestro-help/SKILL.md +2 -0
  162. package/.codex/skills/maestro-init/SKILL.md +16 -0
  163. package/.codex/skills/maestro-learn/SKILL.md +2 -0
  164. package/.codex/skills/maestro-overlay/SKILL.md +1 -0
  165. package/.codex/skills/maestro-player/SKILL.md +2 -0
  166. package/.codex/skills/maestro-quick/SKILL.md +17 -0
  167. package/.codex/skills/maestro-tools-execute/SKILL.md +31 -0
  168. package/.codex/skills/maestro-tools-register/SKILL.md +29 -0
  169. package/.codex/skills/maestro-ui-codify/SKILL.md +2 -0
  170. package/.codex/skills/maestro-update/SKILL.md +38 -0
  171. package/.codex/skills/manage-codebase-rebuild/SKILL.md +2 -0
  172. package/.codex/skills/manage-codebase-refresh/SKILL.md +11 -0
  173. package/.codex/skills/manage-drift-realign/SKILL.md +2 -0
  174. package/.codex/skills/manage-harvest/SKILL.md +30 -8
  175. package/.codex/skills/manage-issue/SKILL.md +24 -0
  176. package/.codex/skills/manage-issue-discover/SKILL.md +2 -0
  177. package/.codex/skills/manage-knowhow/SKILL.md +26 -0
  178. package/.codex/skills/manage-knowhow-capture/SKILL.md +23 -0
  179. package/.codex/skills/manage-learn/SKILL.md +2 -0
  180. package/.codex/skills/manage-status/SKILL.md +22 -0
  181. package/.codex/skills/manage-wiki/SKILL.md +28 -0
  182. package/.codex/skills/odyssey-debug/SKILL.md +44 -0
  183. package/.codex/skills/odyssey-improve/SKILL.md +49 -0
  184. package/.codex/skills/odyssey-planex/SKILL.md +44 -0
  185. package/.codex/skills/odyssey-review-test-fix/SKILL.md +48 -0
  186. package/.codex/skills/odyssey-ui/SKILL.md +49 -0
  187. package/.codex/skills/quality-auto-test/SKILL.md +2 -0
  188. package/.codex/skills/quality-debug/SKILL.md +2 -0
  189. package/.codex/skills/quality-refactor/SKILL.md +2 -0
  190. package/.codex/skills/quality-retrospective/SKILL.md +2 -0
  191. package/.codex/skills/quality-review/SKILL.md +2 -0
  192. package/.codex/skills/quality-sync/SKILL.md +24 -0
  193. package/.codex/skills/quality-test/SKILL.md +2 -0
  194. package/.codex/skills/security-audit/SKILL.md +30 -0
  195. package/.codex/skills/spec-add/SKILL.md +28 -0
  196. package/.codex/skills/spec-load/SKILL.md +26 -0
  197. package/.codex/skills/spec-map/SKILL.md +1 -0
  198. package/.codex/skills/spec-remove/SKILL.md +28 -0
  199. package/.codex/skills/spec-setup/SKILL.md +28 -0
  200. package/.codex/skills/wiki-connect/SKILL.md +11 -0
  201. package/.codex/skills/wiki-digest/SKILL.md +11 -0
  202. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js +3 -1
  203. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js.map +1 -1
  204. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +5 -0
  205. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +28 -4
  206. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -1
  207. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +4 -4
  208. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  209. package/dashboard/dist-server/src/graph/kg/db/queries.d.ts +10 -0
  210. package/dashboard/dist-server/src/graph/kg/db/queries.js +176 -38
  211. package/dashboard/dist-server/src/graph/kg/db/queries.js.map +1 -1
  212. package/dashboard/dist-server/src/graph/kg/extraction/code/svelte-extractor.js +1 -1
  213. package/dashboard/dist-server/src/graph/kg/extraction/code/svelte-extractor.js.map +1 -1
  214. package/dashboard/dist-server/src/graph/kg/extraction/code/tree-sitter.js +2 -2
  215. package/dashboard/dist-server/src/graph/kg/extraction/code/tree-sitter.js.map +1 -1
  216. package/dashboard/dist-server/src/graph/kg/extraction/code/vue-extractor.js +1 -1
  217. package/dashboard/dist-server/src/graph/kg/extraction/code/vue-extractor.js.map +1 -1
  218. package/dashboard/dist-server/src/graph/kg/extraction/code/wasm-stability.js +1 -1
  219. package/dashboard/dist-server/src/graph/kg/extraction/code/wasm-stability.js.map +1 -1
  220. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js +20 -12
  221. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js.map +1 -1
  222. package/dashboard/dist-server/src/graph/kg/surface/hook-injector.js +1 -1
  223. package/dashboard/dist-server/src/graph/kg/surface/hook-injector.js.map +1 -1
  224. package/dashboard/dist-server/src/hooks/keyword-spec-injector.js +35 -0
  225. package/dashboard/dist-server/src/hooks/keyword-spec-injector.js.map +1 -1
  226. package/dashboard/dist-server/src/hooks/spec-analytics.d.ts +1 -0
  227. package/dashboard/dist-server/src/hooks/spec-analytics.js.map +1 -1
  228. package/dashboard/dist-server/src/hooks/wiki-search-bridge.d.ts +32 -0
  229. package/dashboard/dist-server/src/hooks/wiki-search-bridge.js +71 -0
  230. package/dashboard/dist-server/src/hooks/wiki-search-bridge.js.map +1 -0
  231. package/dist/src/agents/api-explore/agent-loop.d.ts +15 -2
  232. package/dist/src/agents/api-explore/agent-loop.d.ts.map +1 -1
  233. package/dist/src/agents/api-explore/agent-loop.js +6 -5
  234. package/dist/src/agents/api-explore/agent-loop.js.map +1 -1
  235. package/dist/src/agents/api-explore/config.d.ts +67 -1
  236. package/dist/src/agents/api-explore/config.d.ts.map +1 -1
  237. package/dist/src/agents/api-explore/config.js +50 -15
  238. package/dist/src/agents/api-explore/config.js.map +1 -1
  239. package/dist/src/agents/api-explore/index.js +4 -4
  240. package/dist/src/agents/api-explore/index.js.map +1 -1
  241. package/dist/src/agents/api-explore/llm.d.ts +7 -1
  242. package/dist/src/agents/api-explore/llm.d.ts.map +1 -1
  243. package/dist/src/agents/api-explore/llm.js +26 -12
  244. package/dist/src/agents/api-explore/llm.js.map +1 -1
  245. package/dist/src/agents/api-explore/moa-cache.d.ts +12 -0
  246. package/dist/src/agents/api-explore/moa-cache.d.ts.map +1 -0
  247. package/dist/src/agents/api-explore/moa-cache.js +50 -0
  248. package/dist/src/agents/api-explore/moa-cache.js.map +1 -0
  249. package/dist/src/agents/api-explore/moa-loop.d.ts +49 -0
  250. package/dist/src/agents/api-explore/moa-loop.d.ts.map +1 -0
  251. package/dist/src/agents/api-explore/moa-loop.js +43 -0
  252. package/dist/src/agents/api-explore/moa-loop.js.map +1 -0
  253. package/dist/src/agents/api-explore/moa-pipeline.d.ts +43 -0
  254. package/dist/src/agents/api-explore/moa-pipeline.d.ts.map +1 -0
  255. package/dist/src/agents/api-explore/moa-pipeline.js +276 -0
  256. package/dist/src/agents/api-explore/moa-pipeline.js.map +1 -0
  257. package/dist/src/agents/api-explore/runner.d.ts +3 -0
  258. package/dist/src/agents/api-explore/runner.d.ts.map +1 -1
  259. package/dist/src/agents/api-explore/runner.js +39 -18
  260. package/dist/src/agents/api-explore/runner.js.map +1 -1
  261. package/dist/src/agents/api-explore/session.d.ts +15 -0
  262. package/dist/src/agents/api-explore/session.d.ts.map +1 -1
  263. package/dist/src/agents/api-explore/session.js.map +1 -1
  264. package/dist/src/cli.js +1 -0
  265. package/dist/src/cli.js.map +1 -1
  266. package/dist/src/commands/explore.d.ts.map +1 -1
  267. package/dist/src/commands/explore.js +34 -2
  268. package/dist/src/commands/explore.js.map +1 -1
  269. package/dist/src/commands/install.js +7 -28
  270. package/dist/src/commands/install.js.map +1 -1
  271. package/dist/src/commands/moa.d.ts +3 -0
  272. package/dist/src/commands/moa.d.ts.map +1 -0
  273. package/dist/src/commands/moa.js +217 -0
  274. package/dist/src/commands/moa.js.map +1 -0
  275. package/dist/src/commands/search.d.ts.map +1 -1
  276. package/dist/src/commands/search.js +2 -0
  277. package/dist/src/commands/search.js.map +1 -1
  278. package/dist/src/graph/kg/db/queries.d.ts +10 -0
  279. package/dist/src/graph/kg/db/queries.d.ts.map +1 -1
  280. package/dist/src/graph/kg/db/queries.js +176 -38
  281. package/dist/src/graph/kg/db/queries.js.map +1 -1
  282. package/dist/src/graph/kg/extraction/code/svelte-extractor.js +1 -1
  283. package/dist/src/graph/kg/extraction/code/svelte-extractor.js.map +1 -1
  284. package/dist/src/graph/kg/extraction/code/tree-sitter.js +2 -2
  285. package/dist/src/graph/kg/extraction/code/tree-sitter.js.map +1 -1
  286. package/dist/src/graph/kg/extraction/code/vue-extractor.js +1 -1
  287. package/dist/src/graph/kg/extraction/code/vue-extractor.js.map +1 -1
  288. package/dist/src/graph/kg/extraction/code/wasm-stability.js +1 -1
  289. package/dist/src/graph/kg/extraction/code/wasm-stability.js.map +1 -1
  290. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  291. package/dist/src/graph/kg/extraction/orchestrator.js +20 -12
  292. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  293. package/dist/src/graph/kg/surface/hook-injector.js +1 -1
  294. package/dist/src/graph/kg/surface/hook-injector.js.map +1 -1
  295. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -1
  296. package/dist/src/hooks/keyword-spec-injector.js +35 -0
  297. package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
  298. package/dist/src/hooks/plugins/explore-plugin.d.ts.map +1 -1
  299. package/dist/src/hooks/plugins/explore-plugin.js +3 -2
  300. package/dist/src/hooks/plugins/explore-plugin.js.map +1 -1
  301. package/dist/src/hooks/spec-analytics.d.ts +1 -0
  302. package/dist/src/hooks/spec-analytics.d.ts.map +1 -1
  303. package/dist/src/hooks/spec-analytics.js.map +1 -1
  304. package/dist/src/hooks/wiki-search-bridge.d.ts +33 -0
  305. package/dist/src/hooks/wiki-search-bridge.d.ts.map +1 -0
  306. package/dist/src/hooks/wiki-search-bridge.js +71 -0
  307. package/dist/src/hooks/wiki-search-bridge.js.map +1 -0
  308. package/dist/src/utils/update-notices.js +12 -0
  309. package/dist/src/utils/update-notices.js.map +1 -1
  310. package/package.json +1 -1
@@ -29,10 +29,40 @@ $ARGUMENTS — target and optional flags.
29
29
  - `--mode consult` — Interactive Q&A session
30
30
 
31
31
  **Output**: `.workflow/knowhow/KNW-opinion-{slug}-{date}.md`
32
+
33
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/KNW-opinion-{slug}-{date}.md` and `.workflow/specs/learnings.md` only. NEVER modify source code or files outside these paths.
32
34
  </context>
33
35
 
36
+ <invariants>
37
+ 1. **Read-only analysis** — NEVER modify source code, wiki entries, or plan files under review; all writes go to `.workflow/` only
38
+ 2. **Agent independence** — in review mode, each persona agent (Pragmatist/Purist/Strategist) MUST operate independently without shared state; NEVER pass one agent's findings to another during wave 1
39
+ 3. **Evidence-backed verdicts** — every finding MUST include a `location` reference (file:line or section); ungrounded opinions SHALL NOT appear in the report
40
+ 4. **Mode contract** — MUST execute exactly the mode specified (review/challenge/consult); NEVER mix mode behaviors within a single execution
41
+ 5. **Append-only learnings** — `.workflow/specs/learnings.md` MUST be appended, NEVER overwritten or truncated
42
+ 6. **Confirmation gate** — MUST present findings and target files via `request_user_input` before any writes
43
+ </invariants>
44
+
34
45
  <execution>
35
46
 
47
+ ### Phase Gates (MANDATORY, BLOCKING)
48
+
49
+ **GATE 1: Resolve → Execute**
50
+ - REQUIRED: Target resolved to concrete content (file, wiki entry, git diff, or phase plan).
51
+ - BLOCKED if: target unresolvable (E001) or unknown mode (E002).
52
+
53
+ **GATE 2: Execute → Synthesize**
54
+ - REQUIRED: Mode-specific analysis completed (review: ≥2 of 3 personas completed; challenge: adversarial agent completed; consult: Q&A session ended).
55
+ - BLOCKED if: all persona agents failed in review mode — skip to degraded synthesis with LOW CONFIDENCE flag.
56
+
57
+ **GATE 3: Synthesize → Persist**
58
+ - REQUIRED: Synthesis produced with agreements, disagreements, verdict, and top 3 recommendations.
59
+ - BLOCKED if: synthesis agent failed — use raw persona outputs as fallback.
60
+
61
+ **GATE 4: Persist → Completion**
62
+ - REQUIRED: `request_user_input` confirmation before writing learnings.
63
+ - REQUIRED: KNW-opinion-{slug}-{date}.md written.
64
+ - BLOCKED if: user declines — offer to adjust findings before retry.
65
+
36
66
  ### Phase 1: Resolve Target + Load Context
37
67
  Resolve target to content. Load specs, `maestro search`, prior lessons for context brief.
38
68
 
@@ -41,8 +41,19 @@ Multiple combinable. No flags + no description → interactive (scan + request_u
41
41
  | `both` | Both paths checked; overlay targets whichever exists |
42
42
 
43
43
  **Output**: `~/.maestro/overlays/amend-{slug}.json` + optional `~/.maestro/overlays/docs/amend-{slug}.md`
44
+
45
+ **Output boundary**: ALL file writes MUST target `~/.maestro/overlays/` (overlay JSON + docs) only. NEVER modify `.claude/commands/*.md` directly — overlay installation is handled by `maestro overlay add`.
44
46
  </context>
45
47
 
48
+ <invariants>
49
+ 1. **Non-invasive only** — amendments MUST use the overlay system (`~/.maestro/overlays/*.json`); direct edits to `.claude/commands/*.md` are NEVER permitted
50
+ 2. **Idempotent patches** — re-running the same amendment MUST produce identical overlay JSON; overlay markers prevent duplicate injection
51
+ 3. **Pristine source reads** — signal diagnosis MUST read from `$PKG_ROOT/.claude/commands/` (untouched originals), not installed copies
52
+ 4. **Code bugs excluded** — signals classified as code bugs MUST be routed to `$maestro-quick` or `$maestro-plan --gaps`, NEVER patched via overlay
53
+ 5. **User confirmation before install** — overlay JSON MUST be previewed and confirmed by the user before `maestro overlay add` runs (unless `-y`)
54
+ 6. **Section existence verified** — target section MUST be confirmed to exist in the pristine source before drafting a patch; missing sections trigger `new-section` mode
55
+ </invariants>
56
+
46
57
  <state_machine>
47
58
 
48
59
  <states>
@@ -61,12 +61,23 @@ $maestro-companion "route what should I do next"
61
61
 
62
62
  Auto-detection: if `--type` not provided, infer from `--task` description keywords.
63
63
 
64
+ **Output boundary**: ALL file writes MUST target `.workflow/.scratchpad/` (companion docs + `.companion-active` pointer) only. Promotion writes (spec/knowhow) are delegated to `spec-add` / `manage-knowhow-capture` skills. NEVER modify source code, `.workflow/state.json`, or files outside `.workflow/.scratchpad/`.
65
+
64
66
  **Companion document:**
65
67
  - Path: `.workflow/.scratchpad/companion-{YYYYMMDD-HHmmss}.md`
66
68
  - Active doc tracking: `.workflow/.scratchpad/.companion-active` (stores path of current companion doc)
67
69
  - Format: YAML frontmatter (rich metadata) + typed sections + timestamped entries
68
70
  </context>
69
71
 
72
+ <invariants>
73
+ 1. **No session creation** — companion NEVER creates workflow sessions, NEVER writes to state.json
74
+ 2. **Side-car only** — companion MUST NOT modify source code or execute implementation tasks; it is strictly a knowledge loading + recording utility
75
+ 3. **One active doc** — only one `.companion-active` pointer SHALL exist at a time; creating a new companion doc MUST clear any stale pointer
76
+ 4. **Append-only entries** — note mode MUST append entries; NEVER overwrite or reorder existing entries
77
+ 5. **Promotion via delegation** — spec/knowhow promotion MUST route through `spec-add` / `manage-knowhow-capture` skills; companion NEVER writes directly to `.workflow/specs/` or `.workflow/knowhow/`
78
+ 6. **Type-template integrity** — context template sections MUST match the resolved `task_type`; NEVER mix templates from different types
79
+ </invariants>
80
+
70
81
  <execution>
71
82
 
72
83
  ## S_BEFORE — Knowledge Loading + Companion Doc Creation
@@ -58,8 +58,19 @@ $ARGUMENTS — natural language workflow description, or flags.
58
58
  1. **Architecture specs**: Run `maestro load --type spec --category arch` to load architecture constraints. Use as context for node resolution — ensures workflow design respects documented patterns.
59
59
  2. **Coding specs**: Run `maestro load --type spec --category coding` to load coding conventions. Informs executor argument defaults and context injection.
60
60
  3. Optional — proceed without if unavailable.
61
+
62
+ **Output boundary**: ALL file writes MUST target `~/.maestro/templates/workflows/` (final templates) and `.workflow/templates/design-drafts/` (in-progress drafts). NEVER modify source code, `.claude/commands/`, or `.codex/skills/`.
61
63
  </context>
62
64
 
65
+ <invariants>
66
+ 1. **Max 20 nodes** — workflow templates MUST NOT exceed 20 nodes; larger workflows MUST be split into sub-workflows
67
+ 2. **Acyclic DAG** — generated template MUST be a directed acyclic graph; cycles MUST be detected and rejected before persistence
68
+ 3. **No orphan nodes** — every node MUST be reachable from at least one edge; unreachable nodes MUST be flagged
69
+ 4. **Confirmation before write** — template JSON MUST be shown to user via request_user_input before writing to `~/.maestro/templates/workflows/`; cancellation saves draft only
70
+ 5. **Draft preservation** — abandoning at any confirmation gate MUST save current progress to design-drafts directory; NEVER discard user's partial work
71
+ 6. **Deferred reading only** — node-catalog and template-schema MUST be read at their designated phases (P2, P5), NEVER loaded eagerly at startup
72
+ </invariants>
73
+
63
74
  <execution>
64
75
 
65
76
  ### Phase 0: Resume / Edit (conditional)
@@ -33,10 +33,35 @@ $ARGUMENTS -- Parse subcommand and optional path argument.
33
33
 
34
34
  **Enforcement:** The `workflow-guard` hook (PreToolUse on Write/Edit) reads this config
35
35
  and blocks operations targeting files outside boundaries. Requires hooks level >= `full`.
36
+
37
+ **Output boundary**: ALL file writes MUST target `.workflow/config.json` (guard section) only. NEVER modify hook files, `.codex/settings.json`, or source code.
36
38
  </context>
37
39
 
40
+ <invariants>
41
+ 1. **Config-only mutation** — guard MUST only modify the `guard` section of `.workflow/config.json`; NEVER touch other config sections or files
42
+ 2. **Non-destructive** — `off` MUST preserve existing paths and mode; NEVER clear the path list when disabling
43
+ 3. **Mode switch confirmation** — switching between allow/deny mode MUST require request_user_input confirmation when existing paths will be cleared
44
+ 4. **Hook dependency** — guard MUST warn when enabled but `workflow-guard` hook is not active (hooks level < full)
45
+ 5. **Path normalization** — all paths MUST use forward slashes with trailing slash for directories; NEVER store raw backslash paths
46
+ </invariants>
47
+
38
48
  <execution>
39
49
 
50
+ ### Phase Gates (MANDATORY, BLOCKING)
51
+
52
+ **GATE 1: Parse → Config Read**
53
+ - REQUIRED: Subcommand parsed (on/off/status/allow/deny) or defaulted to `status`.
54
+ - BLOCKED if: invalid subcommand provided.
55
+
56
+ **GATE 2: Config Read → Execute**
57
+ - REQUIRED: `.workflow/config.json` read successfully or initialized with empty guard section.
58
+ - BLOCKED if: file unreadable and cannot be created (E001).
59
+
60
+ **GATE 3: Execute → Confirm**
61
+ - REQUIRED: Config mutation applied (for on/off/allow/deny) or status displayed (for status).
62
+ - REQUIRED: Mode-switch request_user_input answered (for allow↔deny transitions with existing paths).
63
+ - BLOCKED if: user declines mode switch.
64
+
40
65
  **Step 1: Parse subcommand**
41
66
 
42
67
  Extract from $ARGUMENTS:
@@ -36,6 +36,8 @@ $ARGUMENTS 匹配关键词 → 路由到对应模式:
36
36
  | "cli", "终端", "terminal" | 7 | CLI Reference |
37
37
  | 其他自由文本 | 1 | Fuzzy Search |
38
38
 
39
+ **Output boundary**: This skill is read-only — it MUST NOT write any files. All output is displayed directly to the user via text response.
40
+
39
41
  ## Data Source
40
42
 
41
43
  读取同目录下的 `catalog.json` 作为唯一数据源:
@@ -25,6 +25,7 @@ $maestro-init "--from brainstorm:20260318-brainstorm-auth"
25
25
 
26
26
  **Output**: `.workflow/` directory with project.md, state.json, config.json, specs/
27
27
 
28
+ **Output boundary**: ALL file writes MUST target `.workflow/` (project files, state, config, specs). NEVER modify existing source code or files outside `.workflow/`.
28
29
  </context>
29
30
 
30
31
  <invariants>
@@ -37,6 +38,21 @@ $maestro-init "--from brainstorm:20260318-brainstorm-auth"
37
38
 
38
39
  <execution>
39
40
 
41
+ ### Phase Gates (MANDATORY, BLOCKING)
42
+
43
+ **GATE 1: Parse → Detect**
44
+ - REQUIRED: Arguments parsed; flags extracted.
45
+ - BLOCKED if: `-y` set but no document reference provided (E001).
46
+
47
+ **GATE 2: Detect → Gather**
48
+ - REQUIRED: Project state classified (empty/code/existing).
49
+ - BLOCKED if: existing `.workflow/` detected (E002).
50
+
51
+ **GATE 3: Gather → Write**
52
+ - REQUIRED: All project information gathered (interactive or extracted).
53
+ - REQUIRED: Templates read from `~/.maestro/templates/`.
54
+ - BLOCKED if: templates unreadable.
55
+
40
56
  ### Step 1: Parse Arguments
41
57
 
42
58
  Extract flags from arguments:
@@ -34,6 +34,8 @@ $ARGUMENTS — learning intent text, or flags.
34
34
  | `pattern-catalog` | decompose --save-spec --save-wiki → second-opinion --mode review | Full pattern extraction + review |
35
35
 
36
36
  **Session state:** `.workflow/knowhow/.maestro-learn/{session_id}/status.json`
37
+
38
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/.maestro-learn/{session_id}/` (session state) and delegate to learn-* commands for knowledge writes. NEVER modify source code or files outside `.workflow/`.
37
39
  </context>
38
40
 
39
41
  <execution>
@@ -38,6 +38,7 @@ $maestro-overlay "--remove cli-verify-after-execute"
38
38
  - Shared docs: `~/.maestro/overlays/docs/*.md`
39
39
  - Shipped examples: `~/.maestro/overlays/_shipped/` (read-only)
40
40
 
41
+ **Output boundary**: ALL file writes MUST target `~/.maestro/overlays/` (overlay JSON + docs). NEVER modify `.claude/commands/*.md` or `.codex/skills/` directly — overlay application is handled by `maestro overlay add`.
41
42
  </context>
42
43
 
43
44
  <invariants>
@@ -9,6 +9,8 @@ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request
9
9
  Wave-based template executor via `spawn_agents_on_csv`. Load template → bind variables → topological sort → group into barrier/non-barrier waves → spawn wave-by-wave → read results → report.
10
10
 
11
11
  Session: `.workflow/.maestro/MCP-{YYYYMMDD-HHmmss}/state.json`
12
+
13
+ **Output boundary**: ALL file writes MUST target `.workflow/.maestro/MCP-*/` (session state) and `.workflow/.csv-wave/` (wave CSVs). Template files at `~/.maestro/templates/workflows/` are read-only during playback.
12
14
  </purpose>
13
15
 
14
16
  <invariants>
@@ -28,6 +28,7 @@ $maestro-quick "add dark mode toggle to settings page" --discuss --full
28
28
 
29
29
  **Output**: `.workflow/scratch/{slug}/` with plan.json, execution results, optional verification
30
30
 
31
+ **Output boundary**: ALL metadata writes MUST target `.workflow/scratch/{slug}/`. Source code modifications are scoped to files identified in the plan. NEVER modify unrelated source files or `.workflow/state.json` structure beyond scratch task entries.
31
32
  </context>
32
33
 
33
34
  <invariants>
@@ -40,6 +41,22 @@ $maestro-quick "add dark mode toggle to settings page" --discuss --full
40
41
 
41
42
  <execution>
42
43
 
44
+ ### Phase Gates (MANDATORY, BLOCKING)
45
+
46
+ **GATE 1: Parse → Context**
47
+ - REQUIRED: Task description provided (non-empty).
48
+ - BLOCKED if: empty description (E001).
49
+
50
+ **GATE 2: Analysis → Plan**
51
+ - REQUIRED: Quick analysis completed with related files identified.
52
+ - REQUIRED: Existing patterns found (≥1 similar implementation).
53
+ - BLOCKED if: scratch directory creation failed (E002).
54
+
55
+ **GATE 3: Execute → Report**
56
+ - REQUIRED: All plan tasks attempted and statuses recorded.
57
+ - REQUIRED: `plan.json` updated with task outcomes.
58
+ - BLOCKED if: plan.json missing or no task statuses.
59
+
43
60
  ### Step 1: Parse Arguments
44
61
 
45
62
  Extract from arguments:
@@ -25,10 +25,41 @@ $maestro-tools-execute
25
25
  ```
26
26
 
27
27
  Empty arguments enters interactive mode: list all tools for user selection.
28
+
29
+ **Output boundary**: File writes are governed by the individual tool's step definitions. This command itself writes NO files beyond what the loaded tool prescribes.
28
30
  </context>
29
31
 
32
+ <invariants>
33
+ 1. **Confirmation before execution** — MUST request_user_input before executing tool steps; NEVER auto-execute without user consent
34
+ 2. **Sequential step execution** — steps MUST be executed in defined order; NEVER skip or reorder steps unless user explicitly requests skip
35
+ 3. **Blocker escalation** — step failure MUST be reported to user with retry/skip/abort options; NEVER silently skip failed steps
36
+ 4. **Read-only tool definition** — tool execution MUST NOT modify the tool's knowhow document or spec entry; only the target codebase is modified per tool steps
37
+ 5. **Progress feedback** — each completed step MUST report `[Step N/M] done — <step_name>`; NEVER execute silently
38
+ 6. **Output boundary** — file writes are governed by the individual tool's step definitions. This command itself writes NO files beyond what the loaded tool prescribes
39
+ </invariants>
40
+
30
41
  <execution>
31
42
 
43
+ ### Phase Gates (MANDATORY, BLOCKING)
44
+
45
+ **GATE 1: Parse → Load**
46
+ - REQUIRED: Tool name, keyword, or --category parsed from arguments (or empty for interactive mode).
47
+ - BLOCKED if: invalid category value.
48
+
49
+ **GATE 2: Load → Confirm**
50
+ - REQUIRED: Exactly one tool resolved (direct match or user selection from candidates).
51
+ - REQUIRED: Tool document loaded and steps extracted (ref entries expanded).
52
+ - BLOCKED if: E001 (no match found), E002 unresolved (multiple matches without user selection).
53
+
54
+ **GATE 3: Confirm → Execute**
55
+ - REQUIRED: User confirmed execution mode via request_user_input (execute / adjust / view only).
56
+ - BLOCKED if: user selects "View only" — display steps and END without execution.
57
+
58
+ **GATE 4: Execute → Report**
59
+ - REQUIRED: All steps attempted (completed, skipped with user approval, or aborted by user).
60
+ - REQUIRED: Results collected for each step (success/skip/fail).
61
+ - BLOCKED if: user chose abort mid-execution — report partial results and END.
62
+
32
63
  ### Step 1: Load Tool
33
64
 
34
65
  **By name** (search all categories first, then filter):
@@ -46,10 +46,39 @@ tool: true
46
46
  ---
47
47
  Step content...
48
48
  ```
49
+
50
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/` (tool documents) and `.workflow/specs/` (ref entries) only. NEVER modify source code or files outside these paths.
49
51
  </context>
50
52
 
53
+ <invariants>
54
+ 1. **Schema validation** — tool knowhow document MUST include `tool: true`, `category`, `keywords/tags`, and `summary` in YAML frontmatter; missing fields → reject write
55
+ 2. **No duplicate names** — tool title MUST be unique within its category; duplicate detection → E002 warning with overwrite/optimize confirmation
56
+ 3. **Category required** — every tool MUST declare exactly one category from: coding, test, review, arch, debug; empty category → E003
57
+ 4. **Confirmation gate** — MUST request_user_input before writing knowhow document and spec ref entry; NEVER persist without user confirmation
58
+ 5. **Promote is in-place** — promote mode MUST update existing knowhow frontmatter; NEVER recreate the document
59
+ 6. **Output boundary** — ALL file writes MUST target `.workflow/knowhow/` (tool documents) and `.workflow/specs/` (ref entries) only. NEVER modify source code or files outside these paths
60
+ 7. **Description format** — first line after `### Title` MUST state "Use when ..." (usage timing); this is critical for ref entry summary visibility
61
+ </invariants>
62
+
51
63
  <execution>
52
64
 
65
+ ### Phase Gates (MANDATORY, BLOCKING)
66
+
67
+ **GATE 1: Parse → Gather**
68
+ - REQUIRED: Mode determined (extract/generate/optimize/promote) from argument parsing.
69
+ - REQUIRED: For optimize/promote modes, target tool/document exists and is loadable.
70
+ - BLOCKED if: empty args without user response to request_user_input.
71
+
72
+ **GATE 2: Gather → Write**
73
+ - REQUIRED: Tool name, category, and usage timing confirmed.
74
+ - REQUIRED: Steps extracted or generated (extract: ≥1 step, generate: user-confirmed scope).
75
+ - REQUIRED: User confirmed via request_user_input (title, category, keywords, summary, step count).
76
+ - BLOCKED if: E001 (`.workflow/specs/` not initialized), E003 (no category), user cancels.
77
+
78
+ **GATE 3: Write → Verify**
79
+ - REQUIRED: Knowhow document written with `tool: true` frontmatter (or updated in-place for promote).
80
+ - BLOCKED if: write failed or spec add returned error.
81
+
53
82
  ### Step 1: Intent Detection
54
83
 
55
84
  Parse $ARGUMENTS to determine mode:
@@ -61,6 +61,8 @@ $maestro-ui-codify "src/styles" --output-dir .workflow/packages --overwrite -y
61
61
  **Output Directory**: `.workflow/.csv-wave/{session-id}/`
62
62
  **Core Output**: `tasks.csv` (master state) + `results.csv` (final)
63
63
  **Package Output**: `{output-dir}/{package-name}/` with design-tokens.json, layout-templates.json, animation-tokens.json, preview.html, preview.css, knowhow-manifest.json
64
+
65
+ **Output boundary**: ALL file writes MUST target `.workflow/.csv-wave/{session-id}/` (wave state), `{output-dir}/{package-name}/` (reference package), `.workflow/knowhow/` (knowledge assets), and `.workflow/specs/` (spec entries). NEVER modify source code files in the scanned directory.
64
66
  </context>
65
67
 
66
68
  <csv_schema>
@@ -27,10 +27,38 @@ $ARGUMENTS — optional flags.
27
27
  - `--setup-only` -- Skip schema migration, run only the setup for current version
28
28
 
29
29
  **Version source:** `.workflow/state.json` → `version` field
30
+
31
+ **Output boundary**: ALL file writes MUST target `.workflow/state.json` (version bump), `.workflow/state.json.backup-*` (backup), and `.workflow/` config files touched by version-specific setup. NEVER modify source code or `src/migrations/` files.
30
32
  </context>
31
33
 
34
+ <invariants>
35
+ 1. **Backup before migration** — a timestamped backup of `.workflow/state.json` MUST be created before any schema migration runs; NEVER execute migration without backup
36
+ 2. **Idempotent** — running update when already on latest version MUST be a no-op (display "up to date"); NEVER re-apply migrations
37
+ 3. **Confirmation before execute** — migration diff MUST be displayed and user MUST confirm via request_user_input before execution (unless `--force`); NEVER silently apply schema changes
38
+ 4. **Migration diff always visible** — even with `--force`, the migration diff MUST be displayed for audit visibility; NEVER skip diff display
39
+ 5. **Restore path on failure** — if migration fails, the backup restore command MUST be displayed; NEVER leave user without recovery instructions
40
+ 6. **Sequential migration** — all intermediate version steps MUST be applied in order by the schema registry; NEVER skip intermediate versions
41
+ </invariants>
42
+
32
43
  <execution>
33
44
 
45
+ ### Phase Gates (MANDATORY, BLOCKING)
46
+
47
+ **GATE 1: Detect → Check**
48
+ - REQUIRED: Current version read from `.workflow/state.json`.
49
+ - BLOCKED if: state.json missing or unreadable (E001).
50
+
51
+ **GATE 2: Check → Execute**
52
+ - REQUIRED: Dry-run migration check completed; target version identified.
53
+ - REQUIRED: User confirmation via request_user_input (unless `--force`).
54
+ - BLOCKED if: already up to date (display message and exit) or user cancels.
55
+
56
+ **GATE 3: Execute → Summary**
57
+ - REQUIRED: Backup created at `.workflow/state.json.backup-v{current}-{timestamp}`.
58
+ - REQUIRED: Schema migration completed successfully.
59
+ - REQUIRED: Version-specific setup doc followed (if exists).
60
+ - BLOCKED if: migration failed — display restore command and exit.
61
+
34
62
  ### Step 1: Detect Version
35
63
 
36
64
  ```
@@ -68,6 +96,16 @@ Display version change, backup path, next steps.
68
96
 
69
97
  </execution>
70
98
 
99
+ <error_codes>
100
+ | Code | Severity | Condition | Recovery |
101
+ |------|----------|-----------|----------|
102
+ | E001 | error | `.workflow/state.json` missing or unreadable | Run `$maestro-init` first |
103
+ | E002 | error | Migration script execution failed | Display backup restore command |
104
+ | E003 | error | Version-specific setup doc not found | Skip setup, display manual steps |
105
+ | W001 | warning | Already up to date | No action needed |
106
+ | W002 | warning | Setup doc unavailable for target version | Continue without setup |
107
+ </error_codes>
108
+
71
109
  <success_criteria>
72
110
  - [ ] Version detected, schema migration run, setup doc followed
73
111
  - [ ] --setup-only, --dry-run, --force flags handled
@@ -74,6 +74,8 @@ When `--yes` or `-y`: Auto-confirm rebuild (implies --force), skip all prompts.
74
74
  **Output Directory**: `.workflow/.csv-wave/{session-id}/`
75
75
  **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
76
76
  **Target**: `.workflow/codebase/` (doc-index.json, tech-registry/, feature-maps/)
77
+
78
+ **Output boundary**: ALL file writes MUST target `.workflow/codebase/`, `.workflow/state.json`, or `.workflow/project.md` (Tech Stack section only). NEVER modify source code or files outside these paths.
77
79
  </context>
78
80
 
79
81
  <csv_schema>
@@ -22,8 +22,19 @@ $manage-codebase-refresh "--since 3d --deep"
22
22
  **Flags**:
23
23
  - `--since <date>` -- Override change detection window (ISO date or relative like `3d`)
24
24
  - `--deep` -- Force deeper re-scan even for minor changes
25
+
26
+ **Output boundary**: ALL file writes MUST target `.workflow/codebase/` (doc files, doc-index.json) and `.workflow/state.json` (codebase_last_refreshed timestamp) only. NEVER modify source code or files outside these paths.
25
27
  </context>
26
28
 
29
+ <invariants>
30
+ 1. **Incremental only** — MUST NOT clear or rebuild .workflow/codebase/; for full rebuild use `$manage-codebase-rebuild`
31
+ 2. **Change-driven** — MUST only update doc entries affected by detected git changes; NEVER refresh unchanged docs
32
+ 3. **Baseline resolution** — MUST resolve change baseline via --since flag > state.json timestamp > 7-day fallback; NEVER scan entire history
33
+ 4. **Doc-index alignment** — doc-index.json timestamps MUST be updated for every refreshed entry
34
+ 5. **KG impact awareness** — if knowledge-graph.json exists, MUST run kg diff-wiki and log affected wiki entries as warnings
35
+ 6. **No-op safety** — if no changes detected (W001), MUST exit cleanly without modifying any files
36
+ </invariants>
37
+
27
38
  <execution>
28
39
 
29
40
  ### Step 1: Validate Preconditions
@@ -81,6 +81,8 @@ $manage-drift-realign --continue "20260624-drift-realign"
81
81
  **Core Output**: `tasks.csv` + `results.csv` + `discoveries.ndjson` + `context.md`
82
82
  **Report Output**: `.workflow/.drift-realign/drift-report-{date}.md` + `drift-log.jsonl`
83
83
 
84
+ **Output boundary**: ALL file writes MUST target `.workflow/` metadata files (specs, codebase docs, roadmap.md, state.json, issues.jsonl) or `.workflow/.trash/drift-realign-{timestamp}/` (backups) or `.workflow/.drift-realign/` (session details). NEVER modify source code files.
85
+
84
86
  **State files read**:
85
87
  - `.workflow/state.json` — project state + artifact registry
86
88
  - `.workflow/roadmap.md` — milestone/phase roadmap
@@ -34,6 +34,8 @@ $ARGUMENTS — session-id, path, or empty for scan mode.
34
34
  - `--prune` — State hygiene mode: classify artifacts, graduate harvested → knowhow, archive from state.json, prune accumulated_context
35
35
  - `--age N` — Graduation age threshold in days (default: 14). Used with `--prune`
36
36
 
37
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/`, `.workflow/specs/`, `.workflow/issues/`, `.workflow/wiki/`, `.workflow/harvest/`, or `.workflow/state.json` only. NEVER modify source code, source artifacts, or files outside these paths.
38
+
37
39
  **Source registry:**
38
40
  | Source | Scan Path | Key Files |
39
41
  |--------|-----------|-----------|
@@ -47,17 +49,37 @@ $ARGUMENTS — session-id, path, or empty for scan mode.
47
49
  | learning | `.workflow/specs/` | learnings.md |
48
50
  </context>
49
51
 
52
+ <invariants>
53
+ 1. **Read-only until routing** — extraction and classification happen in-memory; no files written until Stage 6
54
+ 2. **Never modify source artifacts** — harvest is purely extractive; source files remain untouched
55
+ 3. **Dedup before write** — MUST check harvest-log.jsonl and existing stores before each write to prevent duplicates
56
+ 4. **Source tagging** — MUST set `source: "harvest"` on every issues.jsonl row so concurrent writers can be distinguished
57
+ 5. **Conflict pre-check on spec routing** — when routing to spec, MUST compare against existing specs with same keywords/category; set `confidence="low"` and log conflict note if semantic conflict detected
58
+ 6. **Provenance tracking** — every routed item MUST be logged in harvest-log.jsonl with fragment ID, target store, and timestamp
59
+ 7. **Dry-run safety** — `--dry-run` MUST NOT write any files; preview only
60
+ </invariants>
61
+
50
62
  <execution>
51
63
  Follow '~/.maestro/workflows/harvest.md' Stages 1–8 (standard mode) or Stage 9 (`--prune` mode).
52
64
 
53
- **Key invariants:**
54
- 1. **Read-only until Stage 6** — extraction/classification in-memory only
55
- 2. **Dedup before write** check harvest-log.jsonl + existing stores
56
- 3. **Stable fragment IDs** `HRV-{8 hex}` from `hash(source_id + content_hash)`
57
- 4. **Never modify source artifacts** purely extractive
58
- 5. **Confidence filtering** below threshold logged but not routed
59
- 6. **Spec format enforcement** — all spec routing must use `<spec-entry>` closed-tag format with `title`, `description`, `keywords`, `date`, `source="harvest"` attributes
60
- 7. **Conflict pre-check on spec routing** when routing to spec, compare new entry against existing specs with same keywords/category. If semantic conflict detected, set `confidence="low"` on the new entry and log conflict note. Use `maestro spec conflict mark` if contradiction is clear
65
+ ### Phase Gates (MANDATORY, BLOCKING)
66
+
67
+ **GATE 1: Discovery → Extraction** (Stages 1-3 Stage 4)
68
+ - REQUIRED: Source artifacts discovered and mode resolved (scan/session/path).
69
+ - REQUIRED: User selected artifact(s) to harvest (or auto-selected via session/path mode, or `-y`).
70
+ - BLOCKED if no harvestable artifacts found (W001) or invalid source (E004/E005).
71
+
72
+ **GATE 2: Extraction Routing** (Stage 4 Stage 5-6)
73
+ - REQUIRED: All files in selected artifacts loaded and parsed.
74
+ - REQUIRED: Knowledge fragments extracted with category, confidence, and tags.
75
+ - REQUIRED: Fragments filtered by `--min-confidence`.
76
+ - BLOCKED if extraction produces zero fragments.
77
+
78
+ **GATE 3: Routing → Write** (Stage 6 → Stage 7-8)
79
+ - REQUIRED: Routing classification applied (auto or forced by `--to`).
80
+ - REQUIRED: Dedup check passed against harvest-log.jsonl and existing stores.
81
+ - REQUIRED: If `--dry-run`: preview displayed, no files written — GATE blocks further writes.
82
+ - BLOCKED if dedup check fails or store paths unresolvable.
61
83
 
62
84
  **Routing rules:**
63
85
  - Universal design patterns → `coding` or `arch` category
@@ -29,10 +29,34 @@ $manage-issue "link ISS-20260318-001 --task TASK-003"
29
29
  ```
30
30
 
31
31
  **Subcommands**: `create`, `list`, `status`, `update`, `close`, `link`.
32
+
33
+ **Output boundary**: ALL file writes MUST target `.workflow/issues/issues.jsonl`, `.workflow/issues/issue-history.jsonl`, or `.workflow/issues/` directory only. NEVER modify source code or files outside these paths.
32
34
  </context>
33
35
 
36
+ <invariants>
37
+ 1. **Schema compliance** — every issue record MUST conform to the canonical issue.json template schema
38
+ 2. **ID uniqueness** — issue IDs (ISS-XXXXXXXX-NNN) MUST be unique across issues.jsonl and issue-history.jsonl
39
+ 3. **Close moves to history** — `close` subcommand MUST move the record from issues.jsonl to issue-history.jsonl, NEVER delete without archiving
40
+ 4. **Bidirectional links** — `link` subcommand MUST create references in both the issue and the linked task
41
+ 5. **Confirmation on destructive ops** — `close` and bulk `update` MUST require user confirmation unless `-y` flag is set
42
+ 6. **Append-only audit** — NEVER overwrite existing issue records; updates MUST preserve all prior fields and add `updated_at` timestamp
43
+ </invariants>
44
+
34
45
  <execution>
35
46
 
47
+ ### Phase Gates (MANDATORY, BLOCKING)
48
+
49
+ **GATE 1: Parse → Execute** (Subcommand routing)
50
+ - REQUIRED: Subcommand parsed and validated against valid set (create/list/status/update/close/link).
51
+ - REQUIRED: `.workflow/issues/` directory exists (auto-create with empty issues.jsonl if missing).
52
+ - BLOCKED if E_NO_SUBCOMMAND or E_INVALID_SUBCOMMAND.
53
+
54
+ **GATE 2: Execute → Write** (For mutating subcommands: create/update/close/link)
55
+ - REQUIRED: Target issue exists for update/close/link operations.
56
+ - REQUIRED: User confirmation for close operations (unless -y).
57
+ - REQUIRED: For link: both issue and task validated before any writes.
58
+ - BLOCKED if target not found or confirmation denied.
59
+
36
60
  ### Step 1: Parse Subcommand
37
61
 
38
62
  Extract first token as subcommand. Valid: `create`, `list`, `status`, `update`, `close`, `link`.
@@ -72,6 +72,8 @@ When `--yes` or `-y`: Auto-confirm perspective selection, skip interactive valid
72
72
 
73
73
  **Output Directory**: `.workflow/.csv-wave/{session-id}/`
74
74
  **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report) + issues appended to `.workflow/issues/issues.jsonl`
75
+
76
+ **Output boundary**: ALL file writes MUST target `.workflow/issues/issues.jsonl` or `.workflow/issues/discoveries/{SESSION_ID}/` only. NEVER modify source code or files outside these paths.
75
77
  </context>
76
78
 
77
79
  <csv_schema>
@@ -32,10 +32,36 @@ $manage-knowhow "prune --before 2026-01-01 --type tip --dry-run"
32
32
  - `--before <date>` / `--after <date>` — Date filters for prune
33
33
  - `--dry-run` — Preview prune without deleting (default for prune — use `--execute` to actually delete)
34
34
  - `--execute` — Required to actually perform prune deletions (prune defaults to dry-run)
35
+
36
+ **Output boundary**: Workflow store writes MUST target `.workflow/knowhow/` only. System store writes MUST target `~/.claude/projects/*/memory/` only. NEVER modify source code or files outside these paths.
35
37
  </context>
36
38
 
39
+ <invariants>
40
+ 1. **MEMORY.md protected** — NEVER delete MEMORY.md; only editable via `edit` subcommand
41
+ 2. **MEMORY.md line limit** — MUST warn (W003) when MEMORY.md exceeds 200 lines; content beyond 200 lines will be truncated at load
42
+ 3. **Confirmation on destructive ops** — `delete` and `prune` MUST require user confirmation unless `--confirm` flag is set
43
+ 4. **Store isolation** — `prune` operates on workflow store only; NEVER prune system memory files
44
+ 5. **Reference integrity** — `delete` MUST check for references from other entries before removing; warn if orphaned references would result
45
+ 6. **Dry-run safety** — `--dry-run` MUST NOT write any files; preview destructive operations only
46
+ 7. **Index consistency** — after delete/prune, workflow index MUST be updated to reflect removals
47
+ </invariants>
48
+
37
49
  <execution>
38
50
 
51
+ ### Phase Gates (MANDATORY, BLOCKING)
52
+
53
+ **GATE 1: Parse → Execute** (Subcommand routing)
54
+ - REQUIRED: Subcommand parsed from first token (list/search/view/edit/delete/prune).
55
+ - REQUIRED: Both store paths resolved (workflow + system).
56
+ - BLOCKED if E001 (no memory stores found) or invalid subcommand.
57
+
58
+ **GATE 2: Execute → Mutate** (For destructive subcommands: delete/prune/edit)
59
+ - REQUIRED: Target entry/file resolved and exists (E002 if not found).
60
+ - REQUIRED: MEMORY.md protected from deletion (E004 — use `edit` instead).
61
+ - REQUIRED: For `prune`: at least one filter provided (E003).
62
+ - REQUIRED: User confirmation before delete/prune unless `--confirm` flag set.
63
+ - BLOCKED if target unresolvable or confirmation denied.
64
+
39
65
  ### Step 1: Resolve Store Paths
40
66
 
41
67
  - **Workflow store**: `.workflow/knowhow/` (entries: `KNW-*.md`, `TIP-*.md`, `TPL-*.md`, `RCP-*.md`, `REF-*.md`, `DCS-*.md`, indexed in `.workflow/wiki-index.json`)
@@ -33,10 +33,33 @@ $manage-knowhow-capture "decision Use PostgreSQL over MongoDB --status accepted"
33
33
  - `--code-paths <paths>` — Related source paths for asset/blueprint (comma-separated)
34
34
  - `--description <desc>` — One-line description for search results (falls back to content[:240])
35
35
  - `--category <cat>` — Spec category for agent discovery (coding, arch, test, debug, review, learning)
36
+
37
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/` only. NEVER modify source code or files outside this path.
36
38
  </context>
37
39
 
40
+ <invariants>
41
+ 1. **Description required** — every entry MUST have a `description` field in frontmatter (under 120 chars) for search indexing
42
+ 2. **Tags language match** — tags MUST match content language (Chinese content → Chinese tags, English → English)
43
+ 3. **ID uniqueness** — generated file names ({PREFIX}-{YYYYMMDD}-{slug}.md) MUST be unique; NEVER overwrite existing entries
44
+ 4. **Frontmatter completeness** — YAML frontmatter MUST include: title, description, type, category, created, tags, status
45
+ 5. **Type-specific validation** — each type MUST populate all its required fields before writing (template needs code block, recipe needs steps, etc.)
46
+ 6. **Idempotent naming** — same content captured twice MUST produce same slug, enabling dedup detection
47
+ </invariants>
48
+
38
49
  <execution>
39
50
 
51
+ ### Phase Gates (MANDATORY, BLOCKING)
52
+
53
+ **GATE 1: Type Detection → Content Collection** (Type routing → Content extraction)
54
+ - REQUIRED: Type detected from first token or selected via request_user_input.
55
+ - REQUIRED: Type maps to a valid prefix (KNW-/TPL-/RCP-/REF-/DCS-/TIP-/AST-/BLP-/DOC-/INS-).
56
+ - BLOCKED if type unresolvable after interactive prompt.
57
+
58
+ **GATE 2: Content Collection → Write** (Content extraction → File write)
59
+ - REQUIRED: All type-specific required fields populated (e.g., template needs code block, recipe needs steps).
60
+ - REQUIRED: Description generated or provided (under 120 chars).
61
+ - BLOCKED if required fields missing after prompt.
62
+
40
63
  ### Step 1: Validate
41
64
 
42
65
  Verify `.workflow/` exists (E001). Create `.workflow/knowhow/` if missing.
@@ -44,6 +44,8 @@ $manage-learn "\"Zod v4 breaks z.object().strict() API\" --category gotcha --tag
44
44
  **Storage**:
45
45
  - `.workflow/specs/learnings.md` — append-only store (shared with `quality-retrospective`)
46
46
  - Index auto-maintained by WikiIndexer (no manual index file needed)
47
+
48
+ **Output boundary**: ALL file writes MUST target `.workflow/specs/learnings.md` only. NEVER modify source code or files outside this path. Bootstrap (creating `.workflow/specs/` directory and `learnings.md`) is the only exception.
47
49
  </context>
48
50
 
49
51
  <invariants>