maestro-flow 0.5.46 → 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 (237) hide show
  1. package/.agents/skills/domain-add/SKILL.md +9 -0
  2. package/.agents/skills/learn-decompose/SKILL.md +12 -0
  3. package/.agents/skills/learn-follow/SKILL.md +41 -0
  4. package/.agents/skills/learn-investigate/SKILL.md +14 -0
  5. package/.agents/skills/learn-second-opinion/SKILL.md +14 -0
  6. package/.agents/skills/maestro-amend/SKILL.md +11 -0
  7. package/.agents/skills/maestro-companion/SKILL.md +11 -0
  8. package/.agents/skills/maestro-composer/SKILL.md +11 -0
  9. package/.agents/skills/maestro-guard/SKILL.md +25 -0
  10. package/.agents/skills/maestro-init/SKILL.md +28 -0
  11. package/.agents/skills/maestro-overlay/SKILL.md +11 -0
  12. package/.agents/skills/maestro-player/SKILL.md +11 -0
  13. package/.agents/skills/maestro-quick/SKILL.md +29 -0
  14. package/.agents/skills/maestro-swarm-workflow/SKILL.md +25 -0
  15. package/.agents/skills/maestro-tools-execute/SKILL.md +29 -0
  16. package/.agents/skills/maestro-tools-register/SKILL.md +29 -0
  17. package/.agents/skills/maestro-ui-codify/SKILL.md +11 -0
  18. package/.agents/skills/maestro-universal-workflow/SKILL.md +59 -0
  19. package/.agents/skills/maestro-update/SKILL.md +38 -0
  20. package/.agents/skills/manage-codebase-rebuild/SKILL.md +29 -0
  21. package/.agents/skills/manage-drift-realign/SKILL.md +12 -0
  22. package/.agents/skills/manage-harvest/SKILL.md +30 -6
  23. package/.agents/skills/manage-issue/SKILL.md +23 -0
  24. package/.agents/skills/manage-issue-discover/SKILL.md +28 -0
  25. package/.agents/skills/manage-kg-extractors/SKILL.md +27 -1
  26. package/.agents/skills/manage-knowhow/SKILL.md +26 -0
  27. package/.agents/skills/manage-knowhow-capture/SKILL.md +24 -0
  28. package/.agents/skills/manage-knowledge-audit/SKILL.md +13 -0
  29. package/.agents/skills/manage-status/SKILL.md +22 -0
  30. package/.agents/skills/manage-wiki/SKILL.md +28 -0
  31. package/.agents/skills/odyssey-improve/SKILL.md +50 -0
  32. package/.agents/skills/odyssey-planex/SKILL.md +46 -0
  33. package/.agents/skills/odyssey-review-test-fix/SKILL.md +50 -0
  34. package/.agents/skills/odyssey-ui/SKILL.md +50 -0
  35. package/.agents/skills/quality-auto-test/SKILL.md +12 -0
  36. package/.agents/skills/quality-debug/SKILL.md +11 -0
  37. package/.agents/skills/quality-refactor/SKILL.md +11 -0
  38. package/.agents/skills/quality-retrospective/SKILL.md +11 -0
  39. package/.agents/skills/quality-review/SKILL.md +11 -0
  40. package/.agents/skills/quality-sync/SKILL.md +10 -0
  41. package/.agents/skills/quality-test/SKILL.md +12 -0
  42. package/.agents/skills/security-audit/SKILL.md +11 -0
  43. package/.agents/skills/spec-add/SKILL.md +27 -0
  44. package/.agents/skills/spec-load/SKILL.md +25 -0
  45. package/.agents/skills/spec-remove/SKILL.md +26 -0
  46. package/.agents/skills/spec-setup/SKILL.md +30 -0
  47. package/.agy/skills/domain-add/SKILL.md +9 -0
  48. package/.agy/skills/learn-decompose/SKILL.md +12 -0
  49. package/.agy/skills/learn-follow/SKILL.md +41 -0
  50. package/.agy/skills/learn-investigate/SKILL.md +14 -0
  51. package/.agy/skills/learn-second-opinion/SKILL.md +14 -0
  52. package/.agy/skills/maestro-amend/SKILL.md +11 -0
  53. package/.agy/skills/maestro-companion/SKILL.md +11 -0
  54. package/.agy/skills/maestro-composer/SKILL.md +11 -0
  55. package/.agy/skills/maestro-guard/SKILL.md +25 -0
  56. package/.agy/skills/maestro-init/SKILL.md +28 -0
  57. package/.agy/skills/maestro-overlay/SKILL.md +11 -0
  58. package/.agy/skills/maestro-player/SKILL.md +11 -0
  59. package/.agy/skills/maestro-quick/SKILL.md +29 -0
  60. package/.agy/skills/maestro-swarm-workflow/SKILL.md +25 -0
  61. package/.agy/skills/maestro-tools-execute/SKILL.md +29 -0
  62. package/.agy/skills/maestro-tools-register/SKILL.md +29 -0
  63. package/.agy/skills/maestro-ui-codify/SKILL.md +11 -0
  64. package/.agy/skills/maestro-universal-workflow/SKILL.md +59 -0
  65. package/.agy/skills/maestro-update/SKILL.md +38 -0
  66. package/.agy/skills/manage-codebase-rebuild/SKILL.md +29 -0
  67. package/.agy/skills/manage-drift-realign/SKILL.md +12 -0
  68. package/.agy/skills/manage-harvest/SKILL.md +30 -6
  69. package/.agy/skills/manage-issue/SKILL.md +23 -0
  70. package/.agy/skills/manage-issue-discover/SKILL.md +28 -0
  71. package/.agy/skills/manage-kg-extractors/SKILL.md +27 -1
  72. package/.agy/skills/manage-knowhow/SKILL.md +26 -0
  73. package/.agy/skills/manage-knowhow-capture/SKILL.md +24 -0
  74. package/.agy/skills/manage-knowledge-audit/SKILL.md +13 -0
  75. package/.agy/skills/manage-status/SKILL.md +22 -0
  76. package/.agy/skills/manage-wiki/SKILL.md +28 -0
  77. package/.agy/skills/odyssey-improve/SKILL.md +50 -0
  78. package/.agy/skills/odyssey-planex/SKILL.md +46 -0
  79. package/.agy/skills/odyssey-review-test-fix/SKILL.md +50 -0
  80. package/.agy/skills/odyssey-ui/SKILL.md +50 -0
  81. package/.agy/skills/quality-auto-test/SKILL.md +12 -0
  82. package/.agy/skills/quality-debug/SKILL.md +11 -0
  83. package/.agy/skills/quality-refactor/SKILL.md +11 -0
  84. package/.agy/skills/quality-retrospective/SKILL.md +11 -0
  85. package/.agy/skills/quality-review/SKILL.md +11 -0
  86. package/.agy/skills/quality-sync/SKILL.md +10 -0
  87. package/.agy/skills/quality-test/SKILL.md +12 -0
  88. package/.agy/skills/security-audit/SKILL.md +11 -0
  89. package/.agy/skills/spec-add/SKILL.md +27 -0
  90. package/.agy/skills/spec-load/SKILL.md +25 -0
  91. package/.agy/skills/spec-remove/SKILL.md +26 -0
  92. package/.agy/skills/spec-setup/SKILL.md +30 -0
  93. package/.claude/commands/domain-add.md +9 -0
  94. package/.claude/commands/learn-decompose.md +12 -0
  95. package/.claude/commands/learn-follow.md +41 -0
  96. package/.claude/commands/learn-investigate.md +14 -0
  97. package/.claude/commands/learn-second-opinion.md +14 -0
  98. package/.claude/commands/maestro-amend.md +11 -0
  99. package/.claude/commands/maestro-companion.md +11 -0
  100. package/.claude/commands/maestro-composer.md +11 -0
  101. package/.claude/commands/maestro-guard.md +25 -0
  102. package/.claude/commands/maestro-init.md +28 -0
  103. package/.claude/commands/maestro-overlay.md +11 -0
  104. package/.claude/commands/maestro-player.md +11 -0
  105. package/.claude/commands/maestro-quick.md +29 -0
  106. package/.claude/commands/maestro-swarm-workflow.md +25 -0
  107. package/.claude/commands/maestro-tools-execute.md +29 -0
  108. package/.claude/commands/maestro-tools-register.md +29 -0
  109. package/.claude/commands/maestro-ui-codify.md +11 -0
  110. package/.claude/commands/maestro-universal-workflow.md +59 -0
  111. package/.claude/commands/maestro-update.md +38 -0
  112. package/.claude/commands/manage-codebase-rebuild.md +29 -0
  113. package/.claude/commands/manage-drift-realign.md +12 -0
  114. package/.claude/commands/manage-harvest.md +30 -6
  115. package/.claude/commands/manage-issue-discover.md +28 -0
  116. package/.claude/commands/manage-issue.md +23 -0
  117. package/.claude/commands/manage-kg-extractors.md +27 -1
  118. package/.claude/commands/manage-knowhow-capture.md +24 -0
  119. package/.claude/commands/manage-knowhow.md +26 -0
  120. package/.claude/commands/manage-knowledge-audit.md +13 -0
  121. package/.claude/commands/manage-status.md +22 -0
  122. package/.claude/commands/manage-wiki.md +28 -0
  123. package/.claude/commands/odyssey-improve.md +50 -0
  124. package/.claude/commands/odyssey-planex.md +46 -0
  125. package/.claude/commands/odyssey-review-test-fix.md +50 -0
  126. package/.claude/commands/odyssey-ui.md +50 -0
  127. package/.claude/commands/quality-auto-test.md +12 -0
  128. package/.claude/commands/quality-debug.md +11 -0
  129. package/.claude/commands/quality-refactor.md +11 -0
  130. package/.claude/commands/quality-retrospective.md +11 -0
  131. package/.claude/commands/quality-review.md +11 -0
  132. package/.claude/commands/quality-sync.md +10 -0
  133. package/.claude/commands/quality-test.md +12 -0
  134. package/.claude/commands/security-audit.md +11 -0
  135. package/.claude/commands/spec-add.md +27 -0
  136. package/.claude/commands/spec-load.md +25 -0
  137. package/.claude/commands/spec-remove.md +26 -0
  138. package/.claude/commands/spec-setup.md +30 -0
  139. package/.codex/skills/codify-to-knowhow/SKILL.md +2 -0
  140. package/.codex/skills/domain-add/SKILL.md +26 -0
  141. package/.codex/skills/domain-discover/SKILL.md +46 -0
  142. package/.codex/skills/domain-list/SKILL.md +29 -0
  143. package/.codex/skills/learn-decompose/SKILL.md +2 -0
  144. package/.codex/skills/learn-follow/SKILL.md +34 -0
  145. package/.codex/skills/learn-investigate/SKILL.md +33 -0
  146. package/.codex/skills/learn-retro/SKILL.md +33 -0
  147. package/.codex/skills/learn-second-opinion/SKILL.md +30 -0
  148. package/.codex/skills/maestro-amend/SKILL.md +11 -0
  149. package/.codex/skills/maestro-companion/SKILL.md +11 -0
  150. package/.codex/skills/maestro-composer/SKILL.md +11 -0
  151. package/.codex/skills/maestro-guard/SKILL.md +25 -0
  152. package/.codex/skills/maestro-help/SKILL.md +2 -0
  153. package/.codex/skills/maestro-init/SKILL.md +16 -0
  154. package/.codex/skills/maestro-learn/SKILL.md +2 -0
  155. package/.codex/skills/maestro-overlay/SKILL.md +1 -0
  156. package/.codex/skills/maestro-player/SKILL.md +2 -0
  157. package/.codex/skills/maestro-quick/SKILL.md +17 -0
  158. package/.codex/skills/maestro-tools-execute/SKILL.md +31 -0
  159. package/.codex/skills/maestro-tools-register/SKILL.md +29 -0
  160. package/.codex/skills/maestro-ui-codify/SKILL.md +2 -0
  161. package/.codex/skills/maestro-update/SKILL.md +38 -0
  162. package/.codex/skills/manage-codebase-rebuild/SKILL.md +2 -0
  163. package/.codex/skills/manage-codebase-refresh/SKILL.md +11 -0
  164. package/.codex/skills/manage-drift-realign/SKILL.md +2 -0
  165. package/.codex/skills/manage-harvest/SKILL.md +30 -8
  166. package/.codex/skills/manage-issue/SKILL.md +24 -0
  167. package/.codex/skills/manage-issue-discover/SKILL.md +2 -0
  168. package/.codex/skills/manage-knowhow/SKILL.md +26 -0
  169. package/.codex/skills/manage-knowhow-capture/SKILL.md +23 -0
  170. package/.codex/skills/manage-learn/SKILL.md +2 -0
  171. package/.codex/skills/manage-status/SKILL.md +22 -0
  172. package/.codex/skills/manage-wiki/SKILL.md +28 -0
  173. package/.codex/skills/odyssey-debug/SKILL.md +44 -0
  174. package/.codex/skills/odyssey-improve/SKILL.md +49 -0
  175. package/.codex/skills/odyssey-planex/SKILL.md +44 -0
  176. package/.codex/skills/odyssey-review-test-fix/SKILL.md +48 -0
  177. package/.codex/skills/odyssey-ui/SKILL.md +49 -0
  178. package/.codex/skills/quality-auto-test/SKILL.md +2 -0
  179. package/.codex/skills/quality-debug/SKILL.md +2 -0
  180. package/.codex/skills/quality-refactor/SKILL.md +2 -0
  181. package/.codex/skills/quality-retrospective/SKILL.md +2 -0
  182. package/.codex/skills/quality-review/SKILL.md +2 -0
  183. package/.codex/skills/quality-sync/SKILL.md +24 -0
  184. package/.codex/skills/quality-test/SKILL.md +2 -0
  185. package/.codex/skills/security-audit/SKILL.md +30 -0
  186. package/.codex/skills/spec-add/SKILL.md +28 -0
  187. package/.codex/skills/spec-load/SKILL.md +26 -0
  188. package/.codex/skills/spec-map/SKILL.md +1 -0
  189. package/.codex/skills/spec-remove/SKILL.md +28 -0
  190. package/.codex/skills/spec-setup/SKILL.md +28 -0
  191. package/.codex/skills/wiki-connect/SKILL.md +11 -0
  192. package/.codex/skills/wiki-digest/SKILL.md +11 -0
  193. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js +3 -1
  194. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js.map +1 -1
  195. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.d.ts +5 -0
  196. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js +25 -1
  197. package/dashboard/dist-server/dashboard/src/server/wiki/embedding.js.map +1 -1
  198. package/dashboard/dist-server/src/graph/kg/db/queries.d.ts +4 -0
  199. package/dashboard/dist-server/src/graph/kg/db/queries.js +35 -19
  200. package/dashboard/dist-server/src/graph/kg/db/queries.js.map +1 -1
  201. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js +19 -11
  202. package/dashboard/dist-server/src/graph/kg/extraction/orchestrator.js.map +1 -1
  203. package/dist/src/agents/api-explore/config.d.ts +11 -1
  204. package/dist/src/agents/api-explore/config.d.ts.map +1 -1
  205. package/dist/src/agents/api-explore/config.js +17 -16
  206. package/dist/src/agents/api-explore/config.js.map +1 -1
  207. package/dist/src/agents/api-explore/index.js +4 -4
  208. package/dist/src/agents/api-explore/index.js.map +1 -1
  209. package/dist/src/agents/api-explore/llm.d.ts +2 -0
  210. package/dist/src/agents/api-explore/llm.d.ts.map +1 -1
  211. package/dist/src/agents/api-explore/llm.js +16 -4
  212. package/dist/src/agents/api-explore/llm.js.map +1 -1
  213. package/dist/src/agents/api-explore/runner.d.ts.map +1 -1
  214. package/dist/src/agents/api-explore/runner.js +16 -12
  215. package/dist/src/agents/api-explore/runner.js.map +1 -1
  216. package/dist/src/commands/explore.d.ts.map +1 -1
  217. package/dist/src/commands/explore.js +19 -2
  218. package/dist/src/commands/explore.js.map +1 -1
  219. package/dist/src/commands/install.js +7 -28
  220. package/dist/src/commands/install.js.map +1 -1
  221. package/dist/src/commands/moa.d.ts.map +1 -1
  222. package/dist/src/commands/moa.js +17 -2
  223. package/dist/src/commands/moa.js.map +1 -1
  224. package/dist/src/commands/search.d.ts.map +1 -1
  225. package/dist/src/commands/search.js +2 -0
  226. package/dist/src/commands/search.js.map +1 -1
  227. package/dist/src/graph/kg/db/queries.d.ts +4 -0
  228. package/dist/src/graph/kg/db/queries.d.ts.map +1 -1
  229. package/dist/src/graph/kg/db/queries.js +35 -19
  230. package/dist/src/graph/kg/db/queries.js.map +1 -1
  231. package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -1
  232. package/dist/src/graph/kg/extraction/orchestrator.js +19 -11
  233. package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -1
  234. package/dist/src/hooks/plugins/explore-plugin.d.ts.map +1 -1
  235. package/dist/src/hooks/plugins/explore-plugin.js +3 -2
  236. package/dist/src/hooks/plugins/explore-plugin.js.map +1 -1
  237. package/package.json +1 -1
@@ -26,9 +26,39 @@ $ARGUMENTS (no arguments expected)
26
26
  - Project must contain source files to scan # (see code: E002)
27
27
  </context>
28
28
 
29
+ <invariants>
30
+ 1. **Non-destructive** — NEVER overwrite existing spec files; if a file already exists, skip it and report as already-initialized
31
+ 2. **Idempotent** — safe to re-run on an initialized project; re-running MUST NOT duplicate entries or corrupt existing content
32
+ 3. **Confirmation gate** — MUST AskUserQuestion showing all files to be created before writing; NEVER write without user confirmation
33
+ 4. **Output boundary** — ALL file writes MUST target .workflow/specs/ (spec files) and .workflow/knowhow/ (recipe knowhow) only. NEVER modify source code, .workflow/state.json, or files outside these paths
34
+ 5. **Core files mandatory** — coding-conventions.md, architecture-constraints.md, and learnings.md MUST always be created (unless they already exist)
35
+ 6. **Signal-driven optionals** — optional spec files (quality-rules.md, test-conventions.md, ui-conventions.md) MUST only be created when corresponding framework/tool signals are detected in the codebase; NEVER create optional files without evidence
36
+ </invariants>
37
+
29
38
  <execution>
30
39
  Follow '~/.maestro/workflows/specs-setup.md' completely.
31
40
 
41
+ ### Phase Gates (MANDATORY, BLOCKING)
42
+
43
+ **GATE 1: Precondition → Scan**
44
+ - REQUIRED: .workflow/ directory exists.
45
+ - REQUIRED: Project contains source files to scan.
46
+ - BLOCKED if: E001 (.workflow/ not initialized), E002 (no source files).
47
+
48
+ **GATE 2: Scan → Plan**
49
+ - REQUIRED: Codebase scan completed — framework, language, and tooling signals collected.
50
+ - REQUIRED: Core spec file list determined (always 3: coding-conventions, architecture-constraints, learnings).
51
+ - REQUIRED: Optional spec files determined by detected signals only.
52
+
53
+ **GATE 3: Plan → Write**
54
+ - REQUIRED: User confirmed the full list of files to create via AskUserQuestion (showing core specs, optional specs, recipe knowhow, and detected signals).
55
+ - BLOCKED if: user declines — abort without writing.
56
+
57
+ **GATE 4: Write → Report**
58
+ - REQUIRED: All confirmed files written to .workflow/specs/ and .workflow/knowhow/.
59
+ - REQUIRED: Existing files skipped (not overwritten).
60
+ - REQUIRED: .proposed.md files created when slug collision detected (W003).
61
+
32
62
  **Confirmation gate**: After scanning codebase and determining which files/directories will be created (core specs, optional specs, recipe knowhow), AskUserQuestion showing the full list of files to create with their categories and detected signals. Proceed only on user confirm.
33
63
  </execution>
34
64
 
@@ -57,6 +57,8 @@ $codify-to-knowhow ".workflow/reference_style/my-style-v1"
57
57
 
58
58
  **Upstream**: `maestro-ui-codify`, `learn-decompose`, or any skill that generates a manifest
59
59
  **Downstream**: `maestro search --category coding`, `maestro load --type spec --keyword <slug>`
60
+
61
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/` (knowhow assets) and `.workflow/specs/` (spec entries) only. NEVER modify source code, manifest files, or files outside these paths.
60
62
  </context>
61
63
 
62
64
  <manifest_schema>
@@ -22,10 +22,36 @@ $ARGUMENTS — `<canonical> <definition>` where canonical is a kebab-case term n
22
22
  **Prerequisites**: `.workflow/domain/` must exist (run `maestro domain init` if missing).
23
23
 
24
24
  **Domain term lifecycle**: discover/manual → register → active → (optional) deprecated → removed
25
+
26
+ **Output boundary**: ALL file writes MUST target `.workflow/domain/glossary.yaml` only. NEVER modify source code or files outside this path.
25
27
  </context>
26
28
 
29
+ <invariants>
30
+ 1. **Single-term atomic operation** — each invocation registers exactly ONE term; NEVER batch-write multiple terms in a single execution
31
+ 2. **Glossary append-only** — existing terms in `glossary.yaml` SHALL NOT be modified or removed; only new entries are appended
32
+ 3. **Duplicate guard** — MUST check for exact canonical name match AND near-matches before writing; NEVER create duplicate entries
33
+ 4. **Confirmation mandatory** — MUST present term details (canonical, definition, aliases, tier, path) via `request_user_input` before any glossary write; NEVER write without user confirmation (unless `--yes`)
34
+ 5. **Schema compliance** — every term entry MUST include canonical name, definition, tier, and at least one alias/keyword; incomplete entries SHALL NOT be persisted
35
+ 6. **Domain directory prerequisite** — `.workflow/domain/` MUST exist before writing; NEVER auto-create the directory without user confirmation (E002 if missing)
36
+ </invariants>
37
+
27
38
  <execution>
28
39
 
40
+ ### Phase Gates (MANDATORY, BLOCKING)
41
+
42
+ **GATE 1: Parse → Validate**
43
+ - REQUIRED: Canonical name and definition both parsed and non-empty.
44
+ - BLOCKED if: either missing (E001).
45
+
46
+ **GATE 2: Validate → Dedup Check**
47
+ - REQUIRED: `.workflow/domain/glossary.yaml` exists and is readable.
48
+ - BLOCKED if: domain directory not initialized (E002).
49
+
50
+ **GATE 3: Dedup → Register**
51
+ - REQUIRED: No exact duplicate found (E003). Near-matches resolved via user confirmation.
52
+ - REQUIRED: User confirmed term details (canonical, definition, aliases, tier) via `request_user_input` (unless `--yes`).
53
+ - BLOCKED if: user declines confirmation.
54
+
29
55
  ### Step 1: Parse Input
30
56
 
31
57
  Extract canonical (first token, kebab-case) and definition (remainder) from arguments.
@@ -11,8 +11,36 @@ Scan codebase for potential domain terms not yet in `.workflow/domain/glossary.y
11
11
  `--auto`: auto-register candidates with confidence ≥ 0.8 without prompting.
12
12
  </purpose>
13
13
 
14
+ <context>
15
+ $ARGUMENTS — optional `--auto` flag.
16
+
17
+ **Output boundary**: ALL file writes MUST target `.workflow/domain/glossary.yaml` only (via `maestro domain add`). NEVER modify source code or files outside this path.
18
+ </context>
19
+
20
+ <invariants>
21
+ 1. **Read-only scan** — NEVER modify source code files during codebase scan; only glossary.yaml is written (via `maestro domain add`)
22
+ 2. **Dedup against existing** — MUST filter all candidates against current glossary before presenting; NEVER show already-registered terms
23
+ 3. **Confidence threshold for auto** — `--auto` MUST only register candidates with confidence ≥ 0.8; candidates below threshold MUST be skipped or presented for manual review
24
+ 4. **User confirmation required** — without `--auto`, MUST present candidates and obtain user selection before any registration; NEVER auto-register in interactive mode
25
+ 5. **Atomic registration** — each accepted candidate MUST be registered via individual `maestro domain add` call; NEVER batch-write directly to glossary.yaml
26
+ </invariants>
27
+
14
28
  <execution>
15
29
 
30
+ ### Phase Gates (MANDATORY, BLOCKING)
31
+
32
+ **GATE 1: Scan → Filter**
33
+ - REQUIRED: Codebase scan completed with at least 1 candidate found.
34
+ - BLOCKED if: no candidates found — report "No new domain terms detected" and exit.
35
+
36
+ **GATE 2: Filter → Present**
37
+ - REQUIRED: All candidates deduplicated against existing glossary.yaml entries.
38
+ - BLOCKED if: glossary.yaml not found (E001) — prompt user to run `maestro domain init`.
39
+
40
+ **GATE 3: Present → Register**
41
+ - REQUIRED: User selection obtained (unless `--auto` with confidence ≥ 0.8).
42
+ - BLOCKED if: user selects "skip" — exit without registration.
43
+
16
44
  ### Step 1: Scan Codebase
17
45
 
18
46
  Run `maestro domain discover` to scan TypeScript interfaces, types, enums, const patterns, API routes, and README headings.
@@ -41,3 +69,21 @@ Register? (all | select by number | skip)
41
69
  For each confirmed candidate, run `maestro domain add "<canonical>" "<definition>"`.
42
70
 
43
71
  </execution>
72
+
73
+ <error_codes>
74
+ | Code | Severity | Condition | Recovery |
75
+ |------|----------|-----------|----------|
76
+ | E001 | error | `.workflow/domain/glossary.yaml` not found | Run `maestro domain init` first |
77
+ | E002 | error | Codebase scan failed (no TypeScript/source files found) | Check project structure |
78
+ | W001 | warning | No new candidates after dedup filtering | All potential terms already registered |
79
+ | W002 | warning | `--auto` skipped low-confidence candidates | Review skipped candidates manually |
80
+ </error_codes>
81
+
82
+ <success_criteria>
83
+ - [ ] Codebase scanned for domain term candidates
84
+ - [ ] Existing glossary terms filtered out (no duplicates presented)
85
+ - [ ] Candidates ranked by confidence score
86
+ - [ ] User selection obtained (interactive) or confidence threshold applied (--auto)
87
+ - [ ] Selected candidates registered via `maestro domain add`
88
+ - [ ] Summary displayed with registration count
89
+ </success_criteria>
@@ -9,6 +9,19 @@ allowed-tools: Read, Bash, Glob, Grep
9
9
  List all registered domain terms from `.workflow/domain/glossary.yaml`. Shows canonical name, definition, tier, aliases, and status.
10
10
  </purpose>
11
11
 
12
+ <context>
13
+ $ARGUMENTS — optional `--tier core|extended|peripheral` filter.
14
+
15
+ **Output boundary**: Read-only command — NEVER write any files. Display output to console only.
16
+ </context>
17
+
18
+ <invariants>
19
+ 1. **Strictly read-only** — NEVER modify `glossary.yaml` or any other file; display-only operation
20
+ 2. **Complete listing** — MUST show all registered terms (filtered by --tier if specified); NEVER silently omit entries
21
+ 3. **Tier grouping** — MUST group terms by tier (core → extended → peripheral → deprecated); NEVER display flat unsorted list
22
+ 4. **Graceful absence** — if glossary.yaml does not exist, report "No domain glossary" with init command; NEVER create or auto-initialize
23
+ </invariants>
24
+
12
25
  <execution>
13
26
 
14
27
  ### Step 1: Load Glossary
@@ -36,3 +49,19 @@ Apply optional `--tier` filter. Display terms grouped by tier (core → extended
36
49
  ```
37
50
 
38
51
  </execution>
52
+
53
+ <error_codes>
54
+ | Code | Severity | Condition | Recovery |
55
+ |------|----------|-----------|----------|
56
+ | E001 | error | `.workflow/domain/glossary.yaml` not found | Run `maestro domain init` first |
57
+ | E002 | error | glossary.yaml parse error (invalid YAML) | Check file syntax |
58
+ | W001 | warning | No terms match --tier filter | Show "No terms in tier: {tier}" |
59
+ </error_codes>
60
+
61
+ <success_criteria>
62
+ - [ ] Glossary loaded and parsed successfully
63
+ - [ ] Terms grouped by tier (core → extended → peripheral → deprecated)
64
+ - [ ] Optional --tier filter applied correctly
65
+ - [ ] Each term displayed with canonical name, definition, aliases, keywords
66
+ - [ ] Total count shown
67
+ </success_criteria>
@@ -33,6 +33,8 @@ $ARGUMENTS — target path/module and optional flags.
33
33
  - `--save-wiki`: Create wiki note entries per dimension group
34
34
 
35
35
  **Output**: `.workflow/.csv-wave/{session-id}/` + `.workflow/knowhow/KNW-decompose-{slug}-{date}.md`
36
+
37
+ **Output boundary**: ALL file writes MUST target `.workflow/.csv-wave/{session-id}/`, `.workflow/knowhow/KNW-decompose-{slug}-{date}.md`, and `.workflow/specs/learnings.md` only. NEVER modify source code or files outside these paths.
36
38
  </context>
37
39
 
38
40
  <invariants>
@@ -25,10 +25,44 @@ $ARGUMENTS — target and optional flags.
25
25
  - `--save-wiki` — Create wiki note with reading notes
26
26
 
27
27
  **Output**: `.workflow/knowhow/KNW-follow-{slug}-{date}.md`
28
+
29
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/KNW-follow-{slug}-{date}.md` and `.workflow/specs/learnings.md` only. NEVER modify source code or files outside these paths.
28
30
  </context>
29
31
 
32
+ <invariants>
33
+ 1. **Read-only traversal** — NEVER modify source code or wiki entries under analysis; all writes go to `.workflow/` only
34
+ 2. **Forcing questions mandatory** — each section MUST have all 4 forcing questions applied; NEVER skip questions even for trivial sections
35
+ 3. **Anchor requirement** — every extracted pattern MUST include a `file:line` anchor; unanchored patterns SHALL NOT be persisted to learnings.md
36
+ 4. **Convention cross-ref** — MUST check every finding against `coding-conventions.md` and mark status (documented/candidate); NEVER persist without status tag
37
+ 5. **Append-only learnings** — `.workflow/specs/learnings.md` MUST be appended, NEVER overwritten or truncated
38
+ 6. **Confirmation gate** — unless `-y` is set, MUST present findings and target files via `request_user_input` before any writes
39
+ 7. **Depth contract** — `--depth shallow` MUST NOT descend into function bodies; `--depth deep` MUST cover every branch and sub-expression
40
+ </invariants>
41
+
30
42
  <execution>
31
43
 
44
+ ### Phase Gates (MANDATORY, BLOCKING)
45
+
46
+ **GATE 1: Resolve → Context Building**
47
+ - REQUIRED: Target resolved to a readable source (file path, wiki entry, or search result).
48
+ - BLOCKED if: target unresolvable after user prompt (E001).
49
+
50
+ **GATE 2: Reading → Extraction**
51
+ - REQUIRED: All sections traversed with 4 forcing questions applied per section.
52
+ - REQUIRED: Depth contract honored — shallow stays at top-level, deep covers every branch.
53
+ - BLOCKED if: any section skipped without forcing questions.
54
+
55
+ **GATE 3: Extraction → Persistence**
56
+ - REQUIRED: All extracted patterns have file:line anchors.
57
+ - REQUIRED: Convention cross-ref completed against coding-conventions.md (or marked "unknown status" if W002).
58
+ - BLOCKED if: unanchored patterns remain in extraction results.
59
+
60
+ **GATE 4: Persistence → Completion**
61
+ - REQUIRED: Unless `-y`, `request_user_input` showing files to write and spec-entries to append — user must confirm.
62
+ - REQUIRED: KNW-follow-{slug}-{date}.md written with understanding map.
63
+ - REQUIRED: learnings.md appended (not overwritten) with new spec-entry blocks.
64
+ - BLOCKED if: user declines confirmation — offer to adjust findings before retry.
65
+
32
66
  ### Stage 1: Resolve Target + Load Context Web
33
67
  - File: verify exists, parse imports for dependency files
34
68
  - Wiki ID: fetch + load forward/backlinks
@@ -20,10 +20,43 @@ $ARGUMENTS — question text and optional flags.
20
20
  - `--no-persist` — Skip writing to learnings.md (report.md still written locally)
21
21
 
22
22
  **Output**: `.workflow/knowhow/KNW-investigate-{slug}/` (evidence.ndjson, understanding.md, report.md)
23
+
24
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/KNW-investigate-{slug}/` and `.workflow/specs/learnings.md` only. NEVER modify source code or files outside these paths.
23
25
  </context>
24
26
 
27
+ <invariants>
28
+ 1. **Read-only investigation** — NEVER modify source code files; all writes go to `.workflow/` only
29
+ 2. **Evidence append-only** — `evidence.ndjson` MUST be appended line-by-line; NEVER overwrite or truncate existing evidence entries
30
+ 3. **Scope lock** — once `--scope` is resolved, NEVER expand search scope without explicit user confirmation via escalation
31
+ 4. **Hypothesis cap** — MUST NOT generate more than `--max-hypotheses` (default 3) before triggering escalation; NEVER silently exceed the cap
32
+ 5. **Structured evidence format** — every evidence entry MUST include `{ts, type, source, relevance, content, note}`; incomplete entries SHALL NOT be appended
33
+ 6. **3-strike escalation** — after all hypotheses fail, MUST escalate to user via `request_user_input`; NEVER silently conclude as INCONCLUSIVE without user interaction
34
+ 7. **Confirmation gate** — unless `--no-persist` is set, MUST present report.md path and spec-entries via `request_user_input` before final writes
35
+ </invariants>
36
+
25
37
  <execution>
26
38
 
39
+ ### Phase Gates (MANDATORY, BLOCKING)
40
+
41
+ **GATE 1: Frame → Evidence Collection**
42
+ - REQUIRED: Question parsed, slug generated, investigation directory created.
43
+ - REQUIRED: Prior knowledge search completed (maestro search + learnings.md + debug-notes).
44
+ - BLOCKED if: no question provided (E001) or scope path not found (E002).
45
+
46
+ **GATE 2: Evidence → Hypothesis Formation**
47
+ - REQUIRED: At least 3 evidence items collected in evidence.ndjson.
48
+ - BLOCKED if: fewer than 3 evidence matches (W002 — broaden search before proceeding).
49
+
50
+ **GATE 3: Hypothesis Testing → Report**
51
+ - REQUIRED: All hypotheses tested (up to max-hypotheses) with results recorded.
52
+ - REQUIRED: If all failed, 3-strike escalation triggered via `request_user_input`.
53
+ - BLOCKED if: hypotheses remain untested.
54
+
55
+ **GATE 4: Report → Completion**
56
+ - REQUIRED: report.md written with answer, evidence trail, hypothesis results.
57
+ - REQUIRED: Unless `--no-persist`, user confirmation obtained before learnings append.
58
+ - BLOCKED if: user declines — offer to adjust findings before retry.
59
+
27
60
  ### Stage 1: Frame the Question
28
61
  - Parse question, generate slug, create investigation directory
29
62
  - Load debug specs: `maestro load --type spec --category debug` for known issues and patterns
@@ -21,10 +21,43 @@ $ARGUMENTS — lens selection and scope flags.
21
21
  **Decision flags:** `--phase N`, `--tag <tag>`, `--id <id>`
22
22
 
23
23
  **Output**: `.workflow/knowhow/KNW-retro-{date}.md` + `KNW-retro-{date}.json`
24
+
25
+ **Output boundary**: ALL file writes MUST target `.workflow/knowhow/KNW-retro-{date}.md`, `.workflow/knowhow/KNW-retro-{date}.json`, and `.workflow/specs/learnings.md` only. NEVER modify source code, git history, or files outside these paths.
24
26
  </context>
25
27
 
28
+ <invariants>
29
+ 1. **Read-only analysis** — NEVER modify source code, git history, or wiki entries; all writes go to `.workflow/` only
30
+ 2. **Git data integrity** — git commands MUST be read-only (`git log`, `git diff --stat`); NEVER run `git commit`, `git reset`, or any write-mode git operation
31
+ 3. **Confirmation before agents** — MUST prompt user via `request_user_input` before spawning decision evaluation agents; NEVER auto-spawn without confirmation
32
+ 4. **Append-only learnings** — `.workflow/specs/learnings.md` MUST be appended, NEVER overwritten or truncated
33
+ 5. **Confirmation before persist** — MUST prompt user via `request_user_input` before appending insights to learnings.md
34
+ 6. **Lens contract** — MUST execute exactly the selected lens(es); `--lens git` SHALL NOT trigger decision evaluation and vice versa
35
+ 7. **Prior retro preservation** — existing `KNW-retro-*.json` files MUST NOT be modified; only new files created for current retro
36
+ </invariants>
37
+
26
38
  <execution>
27
39
 
40
+ ### Phase Gates (MANDATORY, BLOCKING)
41
+
42
+ **GATE 1: Parse → Lens Execution**
43
+ - REQUIRED: Lens selection parsed (git/decision/all).
44
+ - REQUIRED: Git repo validated if git lens selected (E001).
45
+ - BLOCKED if: not inside git repo for git lens, or no commits in window (E002).
46
+
47
+ **GATE 2: Git Lens → Decision Lens**
48
+ - REQUIRED: Git metrics computed (commits, LOC, sessions, hotspots).
49
+ - BLOCKED if: git data gathering failed entirely — skip git lens, continue with decision lens only.
50
+
51
+ **GATE 3: Decision Collection → Decision Evaluation**
52
+ - REQUIRED: Decisions collected from wiki/specs/git/phase.
53
+ - REQUIRED: User confirmation obtained via `request_user_input` before spawning evaluation agents.
54
+ - BLOCKED if: no decisions found (E003) or user declines agent spawn.
55
+
56
+ **GATE 4: Report → Persist**
57
+ - REQUIRED: Unified report written to KNW-retro-{date}.md + KNW-retro-{date}.json.
58
+ - REQUIRED: User confirmation obtained via `request_user_input` before learnings append.
59
+ - BLOCKED if: user declines — display summary only, skip persistence.
60
+
28
61
  ### Phase 1: Parse + Select Lenses
29
62
 
30
63
  ### Phase 2: Git Lens (skip if --lens decision)
@@ -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):