maestro-flow 0.5.35 → 0.5.36

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 (269) hide show
  1. package/.agents/agents/cli-explore-agent.md +71 -68
  2. package/.agents/agents/workflow-analyzer.md +1 -0
  3. package/.agents/agents/workflow-debugger.md +1 -0
  4. package/.agents/agents/workflow-executor.md +1 -0
  5. package/.agents/skills/domain-add/SKILL.md +71 -0
  6. package/.agents/skills/maestro/SKILL.md +7 -6
  7. package/.agents/skills/maestro-amend/SKILL.md +0 -2
  8. package/.agents/skills/maestro-analyze/SKILL.md +9 -0
  9. package/.agents/skills/maestro-brainstorm/SKILL.md +10 -1
  10. package/.agents/skills/maestro-collab/SKILL.md +14 -1
  11. package/.agents/skills/maestro-next/SKILL.md +15 -4
  12. package/.agents/skills/maestro-overlay/SKILL.md +4 -3
  13. package/.agents/skills/maestro-plan/SKILL.md +12 -3
  14. package/.agents/skills/maestro-ralph/SKILL.md +89 -14
  15. package/.agents/skills/maestro-tools-register/SKILL.md +0 -6
  16. package/.agents/skills/maestro-ui-codify/SKILL.md +0 -2
  17. package/.agents/skills/manage-kg-extractors/SKILL.md +0 -2
  18. package/.agents/skills/quality-test/SKILL.md +0 -2
  19. package/.agents/skills/spec-load/SKILL.md +0 -1
  20. package/.agents/skills/spec-setup/SKILL.md +0 -1
  21. package/.agents/skills/team-lifecycle-v4/roles/analyst/role.md +13 -7
  22. package/.agents/skills/team-quality-assurance/roles/scout/role.md +15 -11
  23. package/.agents/skills/team-tech-debt/roles/scanner/role.md +1 -1
  24. package/.agents/skills/team-ultra-analyze/roles/explorer/role.md +23 -16
  25. package/.agy/agents/cli-explore-agent.md +71 -68
  26. package/.agy/agents/workflow-analyzer.md +1 -0
  27. package/.agy/agents/workflow-debugger.md +1 -0
  28. package/.agy/agents/workflow-executor.md +1 -0
  29. package/.agy/skills/domain-add/SKILL.md +68 -0
  30. package/.agy/skills/maestro/SKILL.md +7 -6
  31. package/.agy/skills/maestro-amend/SKILL.md +0 -2
  32. package/.agy/skills/maestro-analyze/SKILL.md +9 -0
  33. package/.agy/skills/maestro-brainstorm/SKILL.md +10 -1
  34. package/.agy/skills/maestro-collab/SKILL.md +14 -1
  35. package/.agy/skills/maestro-next/SKILL.md +15 -4
  36. package/.agy/skills/maestro-overlay/SKILL.md +4 -3
  37. package/.agy/skills/maestro-plan/SKILL.md +12 -3
  38. package/.agy/skills/maestro-ralph/SKILL.md +89 -14
  39. package/.agy/skills/maestro-tools-register/SKILL.md +0 -6
  40. package/.agy/skills/maestro-ui-codify/SKILL.md +0 -2
  41. package/.agy/skills/manage-kg-extractors/SKILL.md +0 -2
  42. package/.agy/skills/quality-test/SKILL.md +0 -2
  43. package/.agy/skills/spec-load/SKILL.md +0 -1
  44. package/.agy/skills/spec-setup/SKILL.md +0 -1
  45. package/.agy/skills/team-lifecycle-v4/roles/analyst/role.md +13 -7
  46. package/.agy/skills/team-quality-assurance/roles/scout/role.md +15 -11
  47. package/.agy/skills/team-tech-debt/roles/scanner/role.md +1 -1
  48. package/.agy/skills/team-ultra-analyze/roles/explorer/role.md +23 -16
  49. package/.claude/agents/cli-explore-agent.md +71 -68
  50. package/.claude/agents/workflow-analyzer.md +1 -0
  51. package/.claude/agents/workflow-debugger.md +1 -0
  52. package/.claude/agents/workflow-executor.md +1 -0
  53. package/.claude/commands/domain-add.md +69 -0
  54. package/.claude/commands/maestro-amend.md +0 -2
  55. package/.claude/commands/maestro-analyze.md +9 -0
  56. package/.claude/commands/maestro-brainstorm.md +10 -1
  57. package/.claude/commands/maestro-collab.md +14 -1
  58. package/.claude/commands/maestro-next.md +15 -4
  59. package/.claude/commands/maestro-overlay.md +4 -3
  60. package/.claude/commands/maestro-plan.md +12 -3
  61. package/.claude/commands/maestro-ralph.md +89 -14
  62. package/.claude/commands/maestro-tools-register.md +0 -6
  63. package/.claude/commands/maestro-ui-codify.md +0 -2
  64. package/.claude/commands/maestro.md +7 -6
  65. package/.claude/commands/manage-kg-extractors.md +0 -2
  66. package/.claude/commands/quality-test.md +0 -2
  67. package/.claude/commands/spec-load.md +0 -1
  68. package/.claude/commands/spec-setup.md +0 -1
  69. package/.claude/skills/team-lifecycle-v4/roles/analyst/role.md +13 -7
  70. package/.claude/skills/team-quality-assurance/roles/scout/role.md +15 -11
  71. package/.claude/skills/team-tech-debt/roles/scanner/role.md +1 -1
  72. package/.claude/skills/team-ultra-analyze/roles/explorer/role.md +23 -16
  73. package/.codex/skills/domain-add/SKILL.md +79 -0
  74. package/.codex/skills/domain-discover/SKILL.md +43 -0
  75. package/.codex/skills/domain-list/SKILL.md +38 -0
  76. package/.codex/skills/learn-follow/SKILL.md +0 -3
  77. package/.codex/skills/learn-investigate/SKILL.md +0 -3
  78. package/.codex/skills/learn-retro/SKILL.md +0 -2
  79. package/.codex/skills/maestro/SKILL.md +17 -11
  80. package/.codex/skills/maestro-amend/SKILL.md +0 -2
  81. package/.codex/skills/maestro-analyze/SKILL.md +16 -3
  82. package/.codex/skills/maestro-blueprint/SKILL.md +0 -4
  83. package/.codex/skills/maestro-brainstorm/SKILL.md +16 -2
  84. package/.codex/skills/maestro-collab/SKILL.md +14 -1
  85. package/.codex/skills/maestro-companion/SKILL.md +0 -2
  86. package/.codex/skills/maestro-fork/SKILL.md +0 -2
  87. package/.codex/skills/maestro-grill/SKILL.md +0 -1
  88. package/.codex/skills/maestro-next/SKILL.md +12 -5
  89. package/.codex/skills/maestro-plan/SKILL.md +17 -2
  90. package/.codex/skills/maestro-ralph/SKILL.md +4 -3
  91. package/.codex/skills/maestro-roadmap/SKILL.md +0 -2
  92. package/.codex/skills/manage-wiki/SKILL.md +0 -2
  93. package/.codex/skills/odyssey-debug/SKILL.md +0 -2
  94. package/.codex/skills/odyssey-improve/SKILL.md +0 -6
  95. package/.codex/skills/odyssey-review-test-fix/SKILL.md +0 -3
  96. package/.codex/skills/odyssey-ui/SKILL.md +0 -3
  97. package/.codex/skills/spec-setup/SKILL.md +0 -2
  98. package/.codex/skills/team-coordinate/SKILL.md +0 -3
  99. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +0 -2
  100. package/chains/_intent-map.json +36 -0
  101. package/chains/blueprint-driven.json +49 -0
  102. package/chains/grill-driven.json +51 -0
  103. package/dashboard/dist-server/dashboard/src/server/agents/adapter-factory.js +4 -0
  104. package/dashboard/dist-server/dashboard/src/server/agents/adapter-factory.js.map +1 -1
  105. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.d.ts +6 -0
  106. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js +36 -0
  107. package/dashboard/dist-server/dashboard/src/server/agents/api-explore-adapter.js.map +1 -0
  108. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.d.ts +1 -1
  109. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
  110. package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +1 -1
  111. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +13 -0
  112. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  113. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +11 -0
  114. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +492 -1
  115. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  116. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +6 -1
  117. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +92 -4
  118. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  119. package/dashboard/dist-server/dashboard/src/shared/constants.js +2 -0
  120. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  121. package/dashboard/dist-server/shared/agent-types.d.ts +1 -1
  122. package/dashboard/dist-server/src/commands/hooks.js +49 -1
  123. package/dashboard/dist-server/src/commands/hooks.js.map +1 -1
  124. package/dashboard/dist-server/src/graph/kg/extraction/knowledge/domain-extractor.js +4 -2
  125. package/dashboard/dist-server/src/graph/kg/extraction/knowledge/domain-extractor.js.map +1 -1
  126. package/dashboard/dist-server/src/graph/kg/extraction/knowledge-extractor-registry.js +6 -1
  127. package/dashboard/dist-server/src/graph/kg/extraction/knowledge-extractor-registry.js.map +1 -1
  128. package/dashboard/dist-server/src/hooks/session-context.js +37 -1
  129. package/dashboard/dist-server/src/hooks/session-context.js.map +1 -1
  130. package/dashboard/dist-server/src/search/daemon.d.ts +42 -0
  131. package/dashboard/dist-server/src/search/daemon.js +180 -0
  132. package/dashboard/dist-server/src/search/daemon.js.map +1 -0
  133. package/dashboard/dist-server/src/tools/domain-loader.d.ts +4 -1
  134. package/dashboard/dist-server/src/tools/domain-loader.js +56 -25
  135. package/dashboard/dist-server/src/tools/domain-loader.js.map +1 -1
  136. package/dashboard/dist-server/src/tools/domain-schema.d.ts +1 -1
  137. package/dashboard/dist-server/src/tools/domain-schema.js +1 -1
  138. package/dist/shared/agent-types.d.ts +1 -1
  139. package/dist/shared/agent-types.d.ts.map +1 -1
  140. package/dist/src/agents/api-explore/agent-loop.d.ts +14 -0
  141. package/dist/src/agents/api-explore/agent-loop.d.ts.map +1 -0
  142. package/dist/src/agents/api-explore/agent-loop.js +86 -0
  143. package/dist/src/agents/api-explore/agent-loop.js.map +1 -0
  144. package/dist/src/agents/api-explore/config.d.ts +42 -0
  145. package/dist/src/agents/api-explore/config.d.ts.map +1 -0
  146. package/dist/src/agents/api-explore/config.js +99 -0
  147. package/dist/src/agents/api-explore/config.js.map +1 -0
  148. package/dist/src/agents/api-explore/index.d.ts +2 -0
  149. package/dist/src/agents/api-explore/index.d.ts.map +1 -0
  150. package/dist/src/agents/api-explore/index.js +102 -0
  151. package/dist/src/agents/api-explore/index.js.map +1 -0
  152. package/dist/src/agents/api-explore/llm.d.ts +28 -0
  153. package/dist/src/agents/api-explore/llm.d.ts.map +1 -0
  154. package/dist/src/agents/api-explore/llm.js +48 -0
  155. package/dist/src/agents/api-explore/llm.js.map +1 -0
  156. package/dist/src/agents/api-explore/prompt-parser.d.ts +23 -0
  157. package/dist/src/agents/api-explore/prompt-parser.d.ts.map +1 -0
  158. package/dist/src/agents/api-explore/prompt-parser.js +73 -0
  159. package/dist/src/agents/api-explore/prompt-parser.js.map +1 -0
  160. package/dist/src/agents/api-explore/runner.d.ts +65 -0
  161. package/dist/src/agents/api-explore/runner.d.ts.map +1 -0
  162. package/dist/src/agents/api-explore/runner.js +196 -0
  163. package/dist/src/agents/api-explore/runner.js.map +1 -0
  164. package/dist/src/agents/api-explore/session.d.ts +23 -0
  165. package/dist/src/agents/api-explore/session.d.ts.map +1 -0
  166. package/dist/src/agents/api-explore/session.js +57 -0
  167. package/dist/src/agents/api-explore/session.js.map +1 -0
  168. package/dist/src/agents/api-explore/stream-json-emitter.d.ts +10 -0
  169. package/dist/src/agents/api-explore/stream-json-emitter.d.ts.map +1 -0
  170. package/dist/src/agents/api-explore/stream-json-emitter.js +19 -0
  171. package/dist/src/agents/api-explore/stream-json-emitter.js.map +1 -0
  172. package/dist/src/agents/api-explore/system-prompt.d.ts +2 -0
  173. package/dist/src/agents/api-explore/system-prompt.d.ts.map +1 -0
  174. package/dist/src/agents/api-explore/system-prompt.js +31 -0
  175. package/dist/src/agents/api-explore/system-prompt.js.map +1 -0
  176. package/dist/src/agents/api-explore/tools.d.ts +11 -0
  177. package/dist/src/agents/api-explore/tools.d.ts.map +1 -0
  178. package/dist/src/agents/api-explore/tools.js +168 -0
  179. package/dist/src/agents/api-explore/tools.js.map +1 -0
  180. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  181. package/dist/src/agents/cli-agent-runner.js +3 -0
  182. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  183. package/dist/src/cli.js +3 -0
  184. package/dist/src/cli.js.map +1 -1
  185. package/dist/src/commands/domain.d.ts.map +1 -1
  186. package/dist/src/commands/domain.js +5 -4
  187. package/dist/src/commands/domain.js.map +1 -1
  188. package/dist/src/commands/explore.d.ts +7 -0
  189. package/dist/src/commands/explore.d.ts.map +1 -0
  190. package/dist/src/commands/explore.js +201 -0
  191. package/dist/src/commands/explore.js.map +1 -0
  192. package/dist/src/commands/hooks.d.ts.map +1 -1
  193. package/dist/src/commands/hooks.js +49 -1
  194. package/dist/src/commands/hooks.js.map +1 -1
  195. package/dist/src/commands/search.d.ts +21 -4
  196. package/dist/src/commands/search.d.ts.map +1 -1
  197. package/dist/src/commands/search.js +289 -93
  198. package/dist/src/commands/search.js.map +1 -1
  199. package/dist/src/commands/workspace.d.ts.map +1 -1
  200. package/dist/src/commands/workspace.js +9 -3
  201. package/dist/src/commands/workspace.js.map +1 -1
  202. package/dist/src/config/cli-tools-defaults.json +2 -1
  203. package/dist/src/graph/kg/extraction/knowledge/domain-extractor.d.ts.map +1 -1
  204. package/dist/src/graph/kg/extraction/knowledge/domain-extractor.js +4 -2
  205. package/dist/src/graph/kg/extraction/knowledge/domain-extractor.js.map +1 -1
  206. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.d.ts.map +1 -1
  207. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.js +6 -1
  208. package/dist/src/graph/kg/extraction/knowledge-extractor-registry.js.map +1 -1
  209. package/dist/src/graph/kg/surface/cli.d.ts.map +1 -1
  210. package/dist/src/graph/kg/surface/cli.js +5 -2
  211. package/dist/src/graph/kg/surface/cli.js.map +1 -1
  212. package/dist/src/hooks/session-context.d.ts.map +1 -1
  213. package/dist/src/hooks/session-context.js +37 -1
  214. package/dist/src/hooks/session-context.js.map +1 -1
  215. package/dist/src/ralph/cmd-next.js +64 -1
  216. package/dist/src/ralph/cmd-next.js.map +1 -1
  217. package/dist/src/ralph/status-schema.d.ts +1 -0
  218. package/dist/src/ralph/status-schema.d.ts.map +1 -1
  219. package/dist/src/search/daemon.d.ts +43 -0
  220. package/dist/src/search/daemon.d.ts.map +1 -0
  221. package/dist/src/search/daemon.js +180 -0
  222. package/dist/src/search/daemon.js.map +1 -0
  223. package/dist/src/tools/__tests__/domain-search-debug.js +3 -1
  224. package/dist/src/tools/__tests__/domain-search-debug.js.map +1 -1
  225. package/dist/src/tools/domain-loader.d.ts +4 -1
  226. package/dist/src/tools/domain-loader.d.ts.map +1 -1
  227. package/dist/src/tools/domain-loader.js +56 -25
  228. package/dist/src/tools/domain-loader.js.map +1 -1
  229. package/dist/src/tools/domain-schema.d.ts +1 -1
  230. package/dist/src/tools/domain-schema.js +1 -1
  231. package/dist/src/utils/update-notices.js +12 -0
  232. package/dist/src/utils/update-notices.js.map +1 -1
  233. package/package.json +5 -3
  234. package/shared/agent-types.ts +1 -1
  235. package/templates/search-tools.md +22 -6
  236. package/workflows/agy-instructions.md +0 -4
  237. package/workflows/analyze.md +2 -2
  238. package/workflows/boundary-grill.md +50 -0
  239. package/workflows/brainstorm.md +6 -5
  240. package/workflows/claude-instructions.md +12 -0
  241. package/workflows/codebase-rebuild.md +0 -1
  242. package/workflows/codex-instructions.md +12 -0
  243. package/workflows/debug.md +0 -4
  244. package/workflows/domain-add.md +115 -0
  245. package/workflows/execute.md +7 -0
  246. package/workflows/explore-usage.md +128 -0
  247. package/workflows/finish-work.md +2 -6
  248. package/workflows/fork.md +0 -4
  249. package/workflows/grill.md +14 -1
  250. package/workflows/harvest.md +0 -3
  251. package/workflows/impeccable/audit.md +0 -2
  252. package/workflows/impeccable/codex.md +0 -4
  253. package/workflows/init.md +9 -0
  254. package/workflows/interview-mechanics.md +3 -2
  255. package/workflows/issue-analyze.md +0 -5
  256. package/workflows/issue-gaps-analyze.codex.md +0 -6
  257. package/workflows/knowledge-audit.md +0 -4
  258. package/workflows/learn.md +0 -6
  259. package/workflows/maestro.codex.md +0 -4
  260. package/workflows/maestro.md +31 -18
  261. package/workflows/merge.md +0 -4
  262. package/workflows/milestone-complete.md +0 -4
  263. package/workflows/overlays.md +0 -10
  264. package/workflows/plan.md +0 -2
  265. package/workflows/roadmap-common.md +0 -4
  266. package/workflows/tdd.md +0 -2
  267. package/workflows/tools-spec.md +1 -7
  268. package/workflows/ui-codify-extract.md +0 -2
  269. package/workflows/ui-codify-package.md +0 -2
@@ -39,6 +39,7 @@ You perform structured multi-dimensional analysis of technical topics, proposals
39
39
  - Comparison alternatives (if applicable)
40
40
  - **Codebase docs** (if `.workflow/codebase/` exists) — `ARCHITECTURE.md` and `CONCERNS.md` as evidence sources for feasibility/risk/dependency dimensions
41
41
  - **Wiki prior knowledge** (if `maestro wiki` available) — `maestro wiki search "<subject keywords>"` for prior decisions and analyses on related topics
42
+ - **Codebase search** — prefer `maestro explore "FIND: <analysis target> SCOPE: src/ EXPECTED: file:line evidence"` over raw Grep for gathering multi-file evidence across dimensions
42
43
 
43
44
  ## Output
44
45
  `analysis.md`:
@@ -49,6 +49,7 @@ Each line in evidence.ndjson:
49
49
  - **Project specs** — `maestro spec load --category debug`: known issues, root causes, workarounds. Check before forming hypotheses to avoid re-investigating known problems.
50
50
  - **Codebase docs** (if `.workflow/codebase/` exists) — Read `ARCHITECTURE.md` for module boundaries to scope impact analysis and form better hypotheses
51
51
  - **Wiki prior knowledge** (if `maestro wiki` available) — `maestro wiki search "<symptom keywords>"` for prior investigations on similar issues; skip already-documented root causes
52
+ - **Codebase search** — prefer `maestro explore "FIND: <symptom> SCOPE: src/ ATTENTION: <error context>"` over raw Grep for multi-file evidence gathering
52
53
 
53
54
  ## Output
54
55
  - Debug session directory with:
@@ -66,6 +66,7 @@ You implement a single task from the execution plan. Each task is executed atomi
66
66
  - Codebase access for implementation
67
67
  - **Codebase docs** (if `.workflow/codebase/` exists) — Read `ARCHITECTURE.md` for module boundaries and component relationships before implementing cross-module changes
68
68
  - **Wiki prior knowledge** (if `maestro wiki` available) — `maestro wiki search "<task keywords>"` for related decisions/constraints that may affect implementation approach
69
+ - **Codebase search** — prefer `maestro explore "FIND: <pattern> SCOPE: src/ EXCLUDE: tests"` over raw Grep when searching for implementation patterns or integration points
69
70
 
70
71
  ## Output
71
72
  - Code changes (the actual implementation)
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: domain-add
3
+ description: Register a domain term into project glossary
4
+ argument-hint: <canonical> \"<definition>\"
5
+ allowed-tools:
6
+ - grep_search
7
+ - run_command
8
+ - view_file
9
+ - write_to_file
10
+ ---
11
+ <purpose>
12
+ Register a domain term into `.workflow/domain/glossary.yaml`. Domain terms are automatically injected into agent context via hooks (domain-compact for all prompts, domain-expanded on keyword match).
13
+ </purpose>
14
+
15
+ <required_reading>
16
+ @~/.maestro/workflows/domain-add.md
17
+ </required_reading>
18
+
19
+ <context>
20
+ $ARGUMENTS -- expects `<canonical> "<definition>"`
21
+
22
+ **Examples:**
23
+ ```bash
24
+ /domain-add auth-token "Short-lived credential for API authentication"
25
+ /domain-add event-bus "Central pub-sub message broker for cross-module communication"
26
+ /domain-add 会话上下文 "Runtime state container for active workflow session"
27
+ ```
28
+
29
+ Domain term lifecycle: discover/manual → register → active → (optional) deprecated → removed.
30
+
31
+ **Related commands:**
32
+ - `maestro domain list` — list all registered terms
33
+ - `maestro domain discover` — scan codebase for term candidates
34
+ - `maestro domain show <canonical>` — show term details
35
+ - `maestro domain deprecate <canonical> --successor <new>` — deprecate a term
36
+ </context>
37
+
38
+ <execution>
39
+ Follow '~/.maestro/workflows/domain-add.md' completely.
40
+ </execution>
41
+
42
+ <error_codes>
43
+ | Code | Severity | Description | Stage |
44
+ |------|----------|-------------|-------|
45
+ | E001 | fatal | Canonical name and definition are both required | parse_input |
46
+ | E002 | fatal | `.workflow/domain/` not initialized — run `maestro domain init` first | validate |
47
+ | E003 | fatal | Term already registered with same canonical name | duplicate_check |
48
+ | E004 | warning | Near-match found — confirm merge or create new | duplicate_check |
49
+ </error_codes>
50
+
51
+ <success_criteria>
52
+ - [ ] Canonical name and definition parsed and validated
53
+ - [ ] No duplicate term in glossary (or user confirmed near-match)
54
+ - [ ] Aliases and keywords auto-extracted from definition
55
+ - [ ] Term written to glossary.yaml with tier and relationships
56
+ - [ ] Confirmation displayed with term details and verify command
57
+ </success_criteria>
58
+
59
+ <completion>
60
+ ### Next-step routing
61
+
62
+ | Condition | Suggestion |
63
+ |-----------|-----------|
64
+ | Verify term added | `maestro domain show <canonical>` |
65
+ | Add more terms | `/domain-add <canonical> "<definition>"` |
66
+ | Discover candidates | `maestro domain discover` |
67
+ | List all terms | `maestro domain list` |
68
+ </completion>
@@ -40,17 +40,18 @@ $ARGUMENTS — user intent text, or special keywords.
40
40
  1. **All chains dispatch via maestro-ralph-execute** — maestro never executes steps directly
41
41
  2. **Session before execution** — status.json created before any step runs
42
42
  3. **Auto flag pass-through** — 仅当用户传入 `-y` 时透传 `-y` 到 skill args
43
- 4. **Decomposition contract shared with maestro-ralph** — broad/lifecycle intents run S_DECOMPOSE producing the SAME additive block (`boundary_contract`, `execution_criteria`, `task_decomposition`)Reference maestro-ralph `A_DECOMPOSE_TASKS`
43
+ 4. **Decomposition contract maestro owns** — `source=="maestro"` session maestro 拥有分解契约(`decomposition_owner="maestro"`):S_DECOMPOSE 产出 additive block (`boundary_contract`, `execution_criteria`, `task_decomposition`),下游 ralph 只消费不覆盖(ralph A_DECOMPOSE_TASKS step 0 ownership guard 跳过二次提问)。Reference maestro-ralph `A_DECOMPOSE_TASKS`
44
44
  5. **status.json 唯一真源** — 不生成 `goal-checklist.md` 或外部清单
45
45
  6. **执行步骤统一通过 `maestro ralph next` 加载** — `command_scope`/`command_path` 由 `maestro ralph skills --platform agy --json --quiet` 预校验(project 覆盖 global,限定 `.claude/`);decision 节点不走 CLI,走 `Skill("maestro-ralph")` handoff
46
46
  7. **Topology awareness** — chain catalog 含 grill / brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / ...;scope_verdict 由 ralph 在 `post-analyze-scope` 决定
47
- 8. **Grill is interactive-only** — `-y` auto mode MUST skip grill stage and route directly to brainstorm; grill requires Socratic Q&A with the user
47
+ 8. **Grill `-y` 透传** — `-y` auto mode 透传 `-y` grill args(grill 自身 Auto mode 用代码代答),不删除 grill stage;grill 仍产出 grill-report/terminology/context-package 供下游 brainstorm
48
48
  9. **D-007 milestone 反查** — 数字 phase 的 `milestone_id` 由 `state.json.milestones[].phase_slugs` 反查
49
49
  10. **每个 step 必须 `completion_confirmed: true`** — 由 `maestro ralph complete N --status DONE|DONE_WITH_CONCERNS` 写入
50
50
  11. **schema** — `ralph_protocol_version: "1"` 标记 CLI-driven session;新增字段全部可选
51
51
  12. **Invariant violation = BLOCK** — 违反上述任一 invariant 即阻断当前操作,不可绕过。特别是 invariant 1(dispatch via ralph-execute)和 invariant 2(session before execution)和 invariant 10(completion_confirmed 由 CLI 写入)为硬约束。
52
52
  14. **禁止以上下文消耗为由中断执行** — harness 自动处理 context compression,以"上下文不足"或"避免 context overflow"为由中断属于 invariant violation
53
53
  13. **Classification evidence** — S_CLASSIFY 的 chain 选择决策 MUST 记录到 status.json 的 `classification_rationale` 字段:匹配了哪个 pattern、排除了哪些备选、confidence level。无记录的分类不可进入 S_CREATE。
54
+ 15. **控制权优先级(范式治理)** — FSM(maestro/maestro-ralph)独占 session 生命周期 + step 排序 + cross-step decision 节点;Pipeline(plan/execute/analyze)只拥有自身 artifact GATE,由 ralph dispatch 时 GATE 失败 → `complete BLOCKED|NEEDS_RETRY`、自身 GATE 全过 → DONE;Router(maestro-next)只单次推荐,不得出现在 FSM step 内。
54
55
  </invariants>
55
56
 
56
57
  <state_machine>
@@ -129,7 +130,7 @@ S_FALLBACK:
129
130
  1. Read `~/.maestro/workflows/maestro.md` from deferred_reading
130
131
  2. Match intent to task_type via chain catalog (semantic)
131
132
  3. Select chain from chainMap,遵循拓扑约束:
132
- - 压力测试/拷问/验证假设/grill/stress-test → `grill`(**-y 模式跳过 grill,直接走 brainstorm**)
133
+ - 压力测试/拷问/验证假设/grill/stress-test → `grill`(**-y 模式透传 `-y` 到 grill,grill 以 Auto mode 执行,不跳过**)
133
134
  - 头脑风暴/探索 → `brainstorm`
134
135
  - 学习/阅读代码/跟读/follow → `Skill("learn-follow")`;调查/为什么/investigate → `Skill("learn-investigate")`;分解/模式/decompose → `Skill("learn-decompose")`;评审/挑战/second-opinion → `Skill("learn-second-opinion")`;回顾/retro → `Skill("quality-retrospective")`
135
136
  - 正式规格/spec-generate/7-phase → `blueprint`
@@ -147,7 +148,7 @@ S_FALLBACK:
147
148
 
148
149
  ### A_DECOMPOSE_TASKS
149
150
 
150
- maestro-ralph `A_DECOMPOSE_TASKS` 共享分解契约。Condensed:
151
+ `session.decomposition_owner = "maestro"`。下游 ralph 只消费不二次提问(invariant 4)。Condensed:
151
152
 
152
153
  1. 分类意图广度。narrow / 单步 / `{status,init,quick}` 链跳过
153
154
  2. broad/medium → `ask_question` ≤3 轮:Scope / Constraints / Definition of Done
@@ -176,7 +177,7 @@ S_FALLBACK:
176
177
  "ralph_protocol_version": "1", "active_step_index": null,
177
178
  "phase", "phase_is_new": false, "milestone": "",
178
179
  "scope_verdict": null, "analyze_macro_id": null, "blueprint_id": null,
179
- "auto_mode": false, "cli_tool": "claude",
180
+ "auto_mode": false, "decomposition_owner": "maestro", "cli_tool": "claude",
180
181
  "context": { "scratch_dir": null, "plan_dir": null, "analysis_dir": null,
181
182
  "brainstorm_dir": null, "blueprint_dir": null, "issue_id": null },
182
183
  "steps": [{
@@ -221,7 +222,7 @@ S_FALLBACK:
221
222
 
222
223
  - [ ] Intent classified with task_type, complexity, clarity_score
223
224
  - [ ] Chain catalog 覆盖 grill / brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / quality pipeline
224
- - [ ] `-y` 模式不触发 grill(交互式压力测试不支持自动模式,跳过直接走 brainstorm)
225
+ - [ ] `-y` 模式透传 `-y` 到 grill(grill 以 Auto mode 代码代答执行,stage 不跳过)
225
226
  - [ ] D-007: 数字 phase 步骤的 `milestone_id` 通过 `state.json.milestones[].phase_slugs` 反查
226
227
  - [ ] macro analyze 后跟 `decision:post-analyze-scope`(由 ralph 评估 scope_verdict 决定下游链路)
227
228
  - [ ] plan 支持 `{phase}` / `--from analyze:{ANL_ID}` / `--from blueprint:{BLP_ID}` 三路径;`source_artifact_ref` 写入 step
@@ -11,8 +11,6 @@ allowed-tools:
11
11
  ---
12
12
  <purpose>
13
13
  Signal-driven overlay generator — collect workflow deficiency signals from multiple sources, diagnose which commands need amendment, batch-generate targeted overlays. All amendments use overlay system (`~/.maestro/overlays/*.json`) — non-invasive, idempotent, survives reinstall.
14
-
15
- Differs from `/maestro-overlay` (single explicit intent). This command **discovers** what needs amending by analyzing workflow artifacts.
16
14
  </purpose>
17
15
 
18
16
  <required_reading>
@@ -25,6 +25,7 @@ Multi-dimensional analysis of a proposal, decision, or architecture choice via C
25
25
  <deferred_reading>
26
26
  - [state.json](~/.maestro/templates/state.json) — read when registering artifact
27
27
  - [issue-gaps-analyze.md](~/.maestro/workflows/issue-gaps-analyze.md) — read when --gaps is triggered
28
+ - [boundary-grill.md](~/.maestro/workflows/boundary-grill.md) — read when boundary conflicts detected (between Phase 4 and Phase 5)
28
29
  </deferred_reading>
29
30
 
30
31
  <context>
@@ -96,6 +97,12 @@ Every decision MUST trace to independently gathered evidence. Manual Read/Grep i
96
97
 
97
98
  Decisions without CLI/agent-sourced evidence MUST be flagged as LOW CONFIDENCE.
98
99
 
100
+ ### Boundary Grill (Step 5 → Step 6)
101
+
102
+ After discussion rounds, BEFORE synthesis: run boundary grill per `~/.maestro/workflows/boundary-grill.md`.
103
+ Input: discussion.md decisions + exploration-codebase.json. Scope guard: "only analyze decisions; do not prejudge plan/execute concerns".
104
+ IF conflicts → results to `analysis.md` § Boundary Grill Results + update `context.md` Locked/Free/Deferred.
105
+
99
106
  ### Standard Mode Gates
100
107
 
101
108
  Gates 1-4 are defined in `analyze.md`. NEVER skip gates. NEVER substitute manual Read/Grep for agent/CLI exploration.
@@ -195,6 +202,8 @@ Full mode:
195
202
  - [ ] Confidence tracking initialized (Step 4.6) and re-scored each round (Step 5.8)
196
203
  - [ ] Readiness gate checked before synthesis (Step 5.10)
197
204
  - [ ] Pressure pass completed ≥ 1 time before Step 6
205
+ - [ ] Boundary grill executed between Phase 4 and Phase 5 (skip if no conflicts detected)
206
+ - [ ] Boundary grill results written to analysis.md § Boundary Grill Results (if conflicts found)
198
207
  - [ ] Confidence summary with factor decomposition written to analysis.md
199
208
 
200
209
  Gaps mode:
@@ -27,6 +27,7 @@ Pipeline: grill (optional) → **brainstorm** → roadmap / analyze / blueprint.
27
27
  - [scratch-index.json](~/.maestro/templates/scratch-index.json) — read when operating in scratch mode
28
28
  - [index.json](~/.maestro/templates/index.json) — read when operating in phase mode
29
29
  - [brainstorm-visualize.md](~/.maestro/workflows/brainstorm-visualize.md) — read when html-prototypes/ produced and user wants to browse them
30
+ - [boundary-grill.md](~/.maestro/workflows/boundary-grill.md) — read when boundary conflicts detected (in cross-role review)
30
31
  </deferred_reading>
31
32
 
32
33
  <context>
@@ -90,8 +91,14 @@ These gates apply to Auto mode (full pipeline). Do NOT advance past a gate until
90
91
  - REQUIRED: Per-feature files `{role}/analysis-F-*.md` written for each feature in §10.
91
92
  - BLOCKED if missing: complete all role analyses before spawning cross-role-reviewer.
92
93
 
93
- **GATE 3: Cross-Role Review → Completion** (Step 4.5 → Report)
94
+ **GATE 2.5: Cross-Role Review → Boundary Grill** (Step 4.5 → Step 4.6)
95
+ Run boundary grill per `~/.maestro/workflows/boundary-grill.md` after cross-role-reviewer output.
96
+ Input: reviewer findings + role Decision Digests. Scope guard: "only brainstorm decisions; do not pre-resolve roadmap/plan choices".
97
+ IF conflicts → results to `guidance-specification.md` §12.5 + feed into GATE 3. NON-BLOCKING.
98
+
99
+ **GATE 3: Cross-Role Review → Completion** (Step 4.5/4.6 → Report)
94
100
  - REQUIRED: Cross-role-reviewer output received with `patch_targets[]`.
101
+ - REQUIRED: Boundary grill completed (if conflicts detected, results logged).
95
102
  - REQUIRED: If findings > 0, resolutions applied via Edit AND logged in `guidance-specification.md` §12.
96
103
  - REQUIRED: If findings == 0, final report explicitly states "No cross-role issues detected".
97
104
  - BLOCKED if missing: complete review synthesis before reporting.
@@ -193,6 +200,8 @@ Status verdicts:
193
200
  - [ ] `ui-designer/analysis.md` references DESIGN.md visual constraints when ui-designer is selected
194
201
  - [ ] Each `{role}/analysis.md` §2 Decisions table has ≥ 1 row per feature
195
202
  - [ ] Cross-role review (Step 4.5) executed; reviewer compares §2 Decision Digests; output includes `patch_targets[]` for every finding
203
+ - [ ] Boundary grill executed after cross-role review (skip if no conflicts detected)
204
+ - [ ] Boundary grill results written to guidance-specification.md §12.5 (if conflicts found)
196
205
  - [ ] If findings exist: each accepted resolution applied via replace_file_content(annotate / strikeout / append) AND logged in `guidance-specification.md` §12 "Cross-Role Resolutions"
197
206
  - [ ] If zero findings: final report explicitly states "No cross-role issues detected"; guidance §12 unchanged
198
207
  - [ ] Heading-drift patch failures surfaced in final report (if any)
@@ -75,7 +75,12 @@ S_COLLECT:
75
75
  GUARD: 1+ succeeded → continue with partial results (W001)
76
76
 
77
77
  S_CROSS_VERIFY:
78
- S_SYNTHESIZE DO: A_CLASSIFY_FINDINGS
78
+ S_BOUNDARY_GRILL DO: A_CLASSIFY_FINDINGS
79
+
80
+ S_BOUNDARY_GRILL:
81
+ → S_SYNTHESIZE WHEN: no boundary conflicts detected DO: —
82
+ → S_SYNTHESIZE WHEN: conflicts detected + resolved DO: A_BOUNDARY_GRILL
83
+ GUARD: max 3 conflicts × 3 questions; non-blocking
79
84
 
80
85
  S_SYNTHESIZE:
81
86
  → S_REGISTER DO: A_GENERATE_OUTPUTS
@@ -136,6 +141,12 @@ Read all per-tool outputs. For each finding:
136
141
  consensus_level = consensus_count / total_findings * 100.
137
142
  If consensus_level < 40%: W003.
138
143
 
144
+ ### A_BOUNDARY_GRILL
145
+
146
+ Run boundary grill per `~/.maestro/workflows/boundary-grill.md`.
147
+ Input: classified CONFLICT findings + per-tool outputs. Check upstream scope if `--from` used.
148
+ IF conflicts → tag with resolution, feed into A_GENERATE_OUTPUTS. No conflicts → pass through.
149
+
139
150
  ### A_GENERATE_OUTPUTS
140
151
 
141
152
  Resolve conflicts via evidence-weighted voting:
@@ -162,6 +173,8 @@ Write 3 files:
162
173
  <success_criteria>
163
174
  - [ ] All delegates launched in parallel via run_command(run_in_background: true), STOP after launch
164
175
  - [ ] Cross-verification: consensus/conflict/unique classification with consensus_level
176
+ - [ ] Boundary grill executed on CONFLICT items (skip if no boundary conflicts detected)
177
+ - [ ] Boundary grill results written to collab-report.md § Boundary Grill Results (if conflicts found)
165
178
  - [ ] 3 output files produced (collab-report.md, context.md, conclusions.json)
166
179
  - [ ] CLB artifact registered in state.json
167
180
  - [ ] Partial degradation: continued if 1+ tools succeeded
@@ -90,9 +90,9 @@ S_FALLBACK:
90
90
  读 project state 推断 `lifecycle_position`(核心信号):
91
91
 
92
92
  ```bash
93
- cat .workflow/state.json 2>$null # phase / milestone / artifacts
94
- ls -la .workflow/scratch/ 2>$null | head -10 # 最近 artifact (mtime DESC)
95
- ls -la .workflow/.maestro/ 2>$null | head -5 # 进行中的 session
93
+ cat .workflow/state.json 2>/dev/null # phase / milestone / artifacts
94
+ ls -la .workflow/scratch/ 2>/dev/null | head -10 # 最近 artifact (mtime DESC)
95
+ ls -la .workflow/.maestro/ 2>/dev/null | head -5 # 进行中的 session
96
96
  ```
97
97
 
98
98
  **项目状态 → lifecycle_position → 自然下一步:**
@@ -108,7 +108,8 @@ ls -la .workflow/.maestro/ 2>$null | head -5 # 进行中的 session
108
108
  | 最新 artifact = plan | execute | `maestro-execute {phase}` |
109
109
  | 最新 artifact = execute | review | `quality-review {phase}` |
110
110
  | review verdict=PASS | test-gen | `quality-auto-test {phase}` |
111
- | 测试全绿 | milestone-audit | `maestro-milestone-audit` |
111
+ | 测试全绿 + current_milestone 存在 | milestone-audit | `maestro-milestone-audit` |
112
+ | 测试全绿 + current_milestone=null (standalone) | review-done | 回退到 `quality-review` 或 `manage-status`(无 milestone 上下文时不推荐 milestone 命令) |
112
113
  | 当前 milestone 全 phase 完成 | milestone-complete | `maestro-milestone-complete` |
113
114
  | 任一 stage 产物含 gaps/failed | debug | `quality-debug {gap}` |
114
115
 
@@ -131,6 +132,16 @@ brainstorm → blueprint → init → analyze-macro → roadmap
131
132
  | `name` 关键词命中 intent | 中 | intent 含 "test" → quality-test/quality-auto-test 加分 |
132
133
  | Workflow 簇匹配 | 中 | intent 涉及学习/知识/issue 等场景触发对应簇 |
133
134
  | Recent activity 反向避免 | 低 | 刚完成的 stage 短期内降权 |
135
+ | **前置条件不满足** | **禁止** | 候选命令的前置条件未满足时,直接从候选池移除(如 `maestro-milestone-*` 在 `current_milestone=null` 时移除) |
136
+
137
+ **前置条件检查(评分前执行,不满足则移除候选):**
138
+
139
+ | 命令 | 前置条件 |
140
+ |------|---------|
141
+ | `maestro-milestone-audit` | `current_milestone` 存在且非 null |
142
+ | `maestro-milestone-complete` | `current_milestone` 存在且非 null |
143
+ | `maestro-milestone-release` | `current_milestone` 存在且非 null |
144
+ | `maestro-merge` | 存在活跃的 fork 分支 |
134
145
 
135
146
  **特殊意图处理:**
136
147
 
@@ -20,7 +20,10 @@ Turn natural-language instructions into command overlays — JSON patch files th
20
20
  </required_reading>
21
21
 
22
22
  <context>
23
- **Overlay model** — an overlay is a JSON file with a `name`, one or more `targets` (command names without `.md`), and a list of `patches`. Each patch targets an XML section (`execution`, `required_reading`, `context`, `success_criteria`, etc.), a mode (`append`, `prepend`, `replace`, `new-section`), and `content`. On apply, the patcher wraps the content in hashed HTML-comment markers so re-apply is idempotent and removal is surgical.
23
+ **Overlay model**:
24
+ - JSON file: `name`, `targets[]` (command names), `patches[]`
25
+ - Patch: `section` (XML tag), `mode` (append/prepend/replace/new-section), `content`
26
+ - Apply: hashed HTML-comment markers (idempotent, surgical removal)
24
27
 
25
28
  **Where overlays live**
26
29
  - User overlays: `~/.maestro/overlays/*.json` — created by this skill
@@ -138,8 +141,6 @@ Run:
138
141
  maestro overlay add ~/.maestro/overlays/<slug>.json
139
142
  ```
140
143
 
141
- This validates the overlay, copies it into place (idempotent), and applies it across all known install scopes. On validation failure, fix the JSON and re-run.
142
-
143
144
  ### 5. Report
144
145
 
145
146
  Show the user:
@@ -27,6 +27,7 @@ Produces plan.json + TASK files; registers PLN artifact in state.json.
27
27
  - [plan.json](~/.maestro/templates/plan.json) — read when generating plan output
28
28
  - [task.json](~/.maestro/templates/task.json) — read when generating task files
29
29
  - [state.json](~/.maestro/templates/state.json) — read when registering artifact
30
+ - [boundary-grill.md](~/.maestro/workflows/boundary-grill.md) — read when boundary conflicts detected (in P4)
30
31
  </deferred_reading>
31
32
 
32
33
  <context>
@@ -52,7 +53,7 @@ Scope routing, base flags (`--collab`, `--spec`, `-y`, `--gaps`, `--dir`), outpu
52
53
 
53
54
  **Ad-hoc milestone (D-008):** When scope resolves to "standalone" via the standard standalone resolution (no `--from` source), and `current_milestone == null`, plan auto-creates an adhoc milestone (`type: "adhoc"`) in state.json before proceeding. This ensures downstream milestone-audit/complete have a valid milestone context. See workflow plan.md § "Ad-hoc Milestone Auto-Creation".
54
55
 
55
- **Exception (`--from analyze:ANL-xxx` / `blueprint:BLP-xxx`):** When scope is set to "standalone" by `--from`, skip adhoc milestone auto-creation — the upstream analyze/blueprint artifact already provides the milestone context (or is intentionally milestone-free). Adhoc creation in this path would conflict with the `--from` semantic of "this is a one-shot plan rooted in an existing artifact".
56
+ **`--from analyze:*` / `blueprint:*`**: scope=standalone skip adhoc milestone auto-creation.
56
57
 
57
58
  ### Role Knowledge
58
59
  `maestro search --category arch` → select relevant → `maestro wiki load`
@@ -86,8 +87,15 @@ Follow '~/.maestro/workflows/plan.md' completely.
86
87
  - REQUIRED: Main flow inline planning is FORBIDDEN (see P3 Agent Constraint below).
87
88
  - BLOCKED if missing: plan.json or TASK files not produced by planner agent — do not proceed to checking.
88
89
 
90
+ **GATE P3.5 → P4: Boundary Grill → Plan Check**
91
+ Run boundary grill per `~/.maestro/workflows/boundary-grill.md`.
92
+ Input: plan.json tasks + convergence criteria + upstream context. Scope guard: "only plan scope; do not re-analyze or re-scope".
93
+ IF conflicts → results to plan.json `boundary_grill` section + affected TASK files. DEC conflicts add `boundary_warning` to confidence.
94
+ NON-BLOCKING: warnings, not hard stops.
95
+
89
96
  **GATE P4 → P5: Plan Check → User Confirmation**
90
97
  - REQUIRED: Plan-checker passed (or minor issues acknowledged).
98
+ - REQUIRED: Boundary grill completed (conflicts resolved or accepted as risks).
91
99
  - REQUIRED: Confidence scored with 5-dimension factor model.
92
100
  - REQUIRED: Pressure pass completed on highest-complexity task.
93
101
  - REQUIRED: If plan touches UI (检出 `dashboard/` 或 UI 关键词 `landing|page|dashboard|frontend|UI|component|界面`), each delivery wave has ≥1 `[UI-observable]` convergence criterion (vertical-slice delivery, not backend-only).
@@ -153,8 +161,6 @@ For each created TASK-{NNN}.json that has issue_id:
153
161
  Append history entry: { action: "planned", at: <ISO>, by: "maestro-plan", summary: "Linked to TASK-{NNN}" }
154
162
  ```
155
163
 
156
- This ensures issue → TASK traceability. The `task_refs[]` and `task_plan_dir` fields on the issue allow the dashboard to resolve and display associated TASK details.
157
-
158
164
  ### Mode: Revise / Check
159
165
 
160
166
  Follow workflow plan.md § "Revise Mode" and § "Check Mode" respectively. These modes bypass the standard P1-P5 create pipeline.
@@ -218,6 +224,9 @@ Status verdicts:
218
224
  - [ ] Every task has `convergence.criteria[]` with grep-verifiable conditions (no subjective language)
219
225
  - [ ] UI plans: each delivery wave has ≥1 `[UI-observable]` convergence criterion (vertical slice; verified at runtime by ralph frontend-verify gate)
220
226
  - [ ] Every task `action` and `implementation` contain concrete values (no "align X with Y")
227
+ - [ ] Boundary grill executed in P3.5 (skip if no conflicts detected)
228
+ - [ ] Boundary grill results written to plan.json `boundary_grill` section (if conflicts found)
229
+ - [ ] DEC conflicts reflected in confidence `boundary_warning` factor
221
230
  - [ ] Plan confidence scored in P4 with 5-dimension factor model
222
231
  - [ ] Plan readiness gate checked before P4.5 collision detection
223
232
  - [ ] Pressure pass completed on highest-complexity task
@@ -20,7 +20,7 @@ $ARGUMENTS — intent text, flags, or keywords.
20
20
 
21
21
  **Parse:**
22
22
  ```
23
- -y flag → auto_confirm = true
23
+ -y flag → auto_confirm = true # 唯一来源:用户显式传入;ralph 不内部推断(invariant 14)
24
24
  --roadmap → wants_roadmap = true (强制多发布 roadmap 路径;roadmap 默认 opt-in)
25
25
  .md/.txt path → input_doc (supplementary context only, NEVER substitutes lifecycle stages)
26
26
  Remaining → intent
@@ -46,6 +46,9 @@ Remaining → intent
46
46
  11. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` 按 unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
47
47
  12. **Invariant violation = BLOCK** — 违反上述任一 invariant 即阻断当前操作。不得以 "效率" 或 "意图明确" 为由绕过。特别是 invariant 1(ralph 不执行 step)和 invariant 6(completion_confirmed 由 CLI 写入)不可隐性违反。
48
48
  13. **Delegate fallback 必须标记** — A_DELEGATE_EVALUATE 解析 verdict 失败时 fallback 为 "fix",但 MUST 在 decisions.ndjson 记录 `"parse_failed": true, "confidence_score": 0`,后续 step 继承 LOW CONFIDENCE 标记。
49
+ 14. **auto_confirm 单一来源** — `auto_confirm` 仅由用户 `-y` 标志设定;ralph 不得内部推断。`session.auto_mode` 仅反映用户输入。
50
+ 15. **分解契约单一所有者** — `boundary_contract` / `task_decomposition` 由 session 创建者拥有(`source=="ralph"` → `decomposition_owner="ralph"`;`source=="maestro"` → `"maestro"`)。contract 已存在时,后续 S_DECOMPOSE MUST 跳过 ask_question,仅做 shape 校验 + 缺省补齐;goal-audit 只更新 `task_decomposition[*].status/completion_confirmed/completed_at`,禁止改 `goal/done_when/boundary`。
51
+ 16. **控制权优先级(范式治理)** — FSM 独占 session 生命周期 + step 排序 + retry/fix/escalate + cross-step decision 节点;Pipeline 命令只拥有自身 artifact GATE(GATE 失败 → `maestro ralph complete <idx> --status BLOCKED|NEEDS_RETRY`,自身 GATE 全过 → DONE);Router 命令不得出现在 FSM step 内。
49
52
  </invariants>
50
53
 
51
54
  <state_machine>
@@ -135,11 +138,14 @@ S_DECISION_EVAL: (decision 节点 == `step.decision` 非空,下述 gate 名取
135
138
  DO: A_SCOPE_EVALUATE
136
139
  → S_APPLY_VERDICT WHEN: structural (post-milestone, post-debug-escalate)
137
140
  DO: A_STRUCTURAL_EVALUATE
141
+ → S_APPLY_VERDICT WHEN: reground-gate (post-reground)
142
+ DO: A_REGROUND_EVALUATE
138
143
 
139
144
  S_APPLY_VERDICT:
140
145
  → S_DISPATCH WHEN: verdict == "proceed" DO: A_APPLY_PROCEED
141
- → S_DISPATCH WHEN: post-goal-audit + unmet sub-goals DO: A_APPLY_GOAL_FIX
142
- → S_DISPATCH WHEN: post-goal-audit + all sub-goals met DO: A_APPLY_GOAL_DONE
146
+ → S_DISPATCH WHEN: post-goal-audit + has_unmet DO: A_APPLY_GOAL_FIX
147
+ → S_DISPATCH WHEN: post-goal-audit + all_met + INTENT_ALIGNED=true DO: A_APPLY_GOAL_DONE
148
+ → END WHEN: post-goal-audit + all_met + INTENT_ALIGNED=false DO: A_REGROUND_HALT(尾部漂移熔断)
143
149
  → S_DISPATCH WHEN: post-analyze-scope DO: A_APPLY_SCOPE_VERDICT
144
150
  → S_DISPATCH WHEN: verdict == "fix" DO: A_APPLY_FIX
145
151
  → S_DISPATCH WHEN: verdict == "escalate" DO: A_APPLY_ESCALATE
@@ -147,11 +153,15 @@ S_APPLY_VERDICT:
147
153
  → END WHEN: post-milestone + standard + no next milestone DO: mark completed
148
154
  → END WHEN: post-milestone + adhoc DO: mark completed (adhoc self-contained)
149
155
  → END WHEN: post-debug-escalate (always STOP) DO: A_PAUSE_ESCALATE
156
+ → END WHEN: post-reground + drifted + confidence_score >= 60 DO: A_REGROUND_HALT
157
+ → S_DISPATCH WHEN: post-reground + aligned DO: A_APPLY_PROCEED
158
+ → S_DISPATCH WHEN: post-reground + drifted + confidence_score < 60 DO: A_APPLY_PROCEED (标 LOW CONFIDENCE)
150
159
  GUARD: retry_count >= max_retries → force escalate
151
160
  GUARD: confidence_score < 60 AND proceed → override to fix
152
161
  GUARD: confidence_score > 95 AND fix AND retry > 0 → suggest proceed
153
162
  GUARD: auto_confirm → skip user prompt, apply adjusted verdict
154
163
  GUARD: not auto_confirm → ask_question with override options
164
+ GUARD: post-reground + drifted + confidence_score >= 60 → A_REGROUND_HALT(漂移熔断为安全门,auto_confirm 不跳过)
155
165
 
156
166
  S_FALLBACK:
157
167
  → S_PARSE_ROUTE WHEN: user provides input DO: ask_question
@@ -209,7 +219,7 @@ resolve_milestone(phase_number):
209
219
 
210
220
  | Pattern | Position |
211
221
  |---------|----------|
212
- | 压力测试 / 拷问 / 验证假设 / grill / stress-test | `grill`(**auto_confirm=true 时跳过,直接 `brainstorm`**) |
222
+ | 压力测试 / 拷问 / 验证假设 / grill / stress-test | `grill`(**auto_confirm=true 时透传 `-y`,grill 以 Auto mode 代码代答,不跳过**) |
213
223
  | brainstorm / 头脑风暴 / 探索 / ideate / 设计思路 | `brainstorm` |
214
224
  | blueprint / 规格 / 正式文档 / spec-generate / 7-phase | `blueprint` |
215
225
  | broad/medium intent 无数字 phase (重构/全面/重写/迁移/新功能 X) | `analyze-macro` |
@@ -271,7 +281,8 @@ wants_roadmap = (--roadmap flag)
271
281
  | passed==true, no review.json | `business-test` |
272
282
  | review.json: verdict=="BLOCK" | `review-failed` |
273
283
  | review.json: verdict!="BLOCK" | `test` |
274
- | uat.md: all passed | `milestone-audit` |
284
+ | uat.md: all passed + `session.milestone` 存在 | `milestone-audit` |
285
+ | uat.md: all passed + `session.milestone=null` (standalone) | 标记 session completed(无 milestone 可审计) |
275
286
  | uat.md: has failures | `test-failed` |
276
287
 
277
288
  ### A_DETERMINE_QUALITY_MODE
@@ -316,7 +327,9 @@ options:
316
327
 
317
328
  ### A_DECOMPOSE_TASKS
318
329
 
319
- Runs once before chain build; additive to status.json.
330
+ Runs once before chain build; additive to status.json. 设 `session.decomposition_owner = "ralph"`。
331
+
332
+ **0. Ownership guard** (invariant 15): 若 `session.boundary_contract` 或 `session.task_decomposition` 已非空(上游 maestro 已写入,`decomposition_owner == "maestro"`)→ MUST 跳过下述提问,仅做 shape 校验 + 缺省字段补齐,直接进入步骤 6。
320
333
 
321
334
  **1. Classify intent breadth:**
322
335
 
@@ -353,11 +366,11 @@ narrow → derive defaults from intent + codebase, skip questions.
353
366
 
354
367
  ### A_BUILD_STEPS
355
368
 
356
- Generate steps from `session.lifecycle_position` to `milestone-complete`.
369
+ Generate steps from `session.lifecycle_position` to `milestone-complete`(`session.milestone` 存在时)或最后一个质量门(standalone 时)。
357
370
 
358
371
  | Stage | Skill (independent) | Skill (unified) | Decision after | quality_mode |
359
372
  |-------|---------------------|-----------------|----------------|--------------|
360
- | grill | `maestro-grill "{intent}"` | *(same)* | — | all (**skip when auto_confirm**) |
373
+ | grill | `maestro-grill "{intent}"` | *(same)* | — | all (**auto_confirm 透传 `-y` 到 grill args,不删除 stage**) |
361
374
  | brainstorm | `maestro-brainstorm "{intent}" --from grill:{grill_id}` *(if grill ran)* / `maestro-brainstorm "{intent}"` *(otherwise)* | *(same)* | — | all |
362
375
  | blueprint | `maestro-blueprint "{intent}"` | *(same)* | — | all |
363
376
  | init | `maestro-init` | *(same)* | — | all |
@@ -385,11 +398,12 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
385
398
  1. **起点**:从 `session.lifecycle_position` 开始
386
399
  2. **跳过已完成**:跳过当前 milestone+phase 下已有 completed artifact 的 stage(按 `session.phase` 过滤);unified 按 milestone 过滤
387
400
  3. **quality_mode 过滤**:按 `session.quality_mode` 排除不匹配 stage
388
- 3.5. **grill auto_confirm 跳过**:`auto_confirm == true` 时删除 `grill` stage(grill 为交互式苏格拉底拷问,不支持自动模式);brainstorm args 不含 `--from grill:*`
401
+ 3.5. **grill auto_confirm 透传**:`auto_confirm == true` 时为 `grill` step args 追加 `-y`(grill 自身 Auto mode 用代码代答,见 maestro-grill `<context>` Mode selection);保留 `grill` stage 与 brainstorm `--from grill:*`(grill 仍产出 grill-report/terminology/context-package)
389
402
  3.6. **frontend-verify UI 门控**:仅当当前 phase 交付前端(检出 `dashboard/` 目录,或 phase 目标/计划含 UI 关键词 `landing|page|dashboard|frontend|UI|component|界面`)时保留 `frontend-verify` stage + `post-frontend-verify` decision;纯后端 phase 删除该 stage
390
403
  4. **决策节点**:每个 Decision after 非空的 stage 之后插入 `{ decision: "<gate>", retry_count: 0, max_retries: 2, command_scope: null, command_path: null }`
391
404
  5. **goal-audit 插入**:`task_decomposition` 存在时,在最后一个 evidence-producing stage(execute/review/test)之后、`milestone-complete` 之前插入 `decision:post-goal-audit`
392
- 6. **终点硬约束**:chain `milestone-complete` 结尾
405
+ 5.5. **re-grounding 插入**:当 `task_decomposition` 存在 **且** 链路含 ≥3 个执行 step(不含 decision 节点)时,从第 3 个执行 step 起每隔 3 个执行 step 后插入 `{ decision: "post-reground", retry_count: 0, max_retries: 0, command_scope: null, command_path: null }`。不在最后一个执行 step 之后插入(由 goal-audit 覆盖);不与已有 quality-gate decision 节点相邻(顺延到下一个 3-step 边界);fix-loop 动态插入的 step(index > 原始 chain 长度)不纳入计数
406
+ 6. **终点硬约束**:`session.milestone` 存在时 chain 以 `milestone-complete` 结尾;`session.milestone=null`(standalone)时跳过 `milestone-audit` + `milestone-complete` stage,chain 以最后一个质量门 stage 结尾
393
407
  7. **goal_ref 传播**:`task_decomposition` 存在时,每个 step 按 `step.stage ∈ g.lifecycle` 匹配 `step.goal_ref = g.id`(多匹配取字典序最小);decision 节点不打 goal_ref
394
408
  8. **占位符**:independent 保留 `{phase}` `{intent}`;unified 不带 `{phase}`
395
409
  9. **command_path 解析**(每个执行 step,decision 节点跳过):
@@ -492,14 +506,18 @@ Runs only when `task_decomposition` present.
492
506
  1. 读取 status.json.task_decomposition 中 status!=done 的子目标
493
507
  2. 打开 evidence 产物,对照 done_when 严格判定
494
508
  3. 输出 met / unmet,unmet 给出 gap + target_phase
509
+ 4. 对照 intent + definition_of_done 判定累积产出是否仍服务原始意图(意图保真检查)
495
510
  CONTEXT:
496
- status.json = {session_dir}/status.json
497
- evidence = {evidence artifacts}
511
+ status.json = {session_dir}/status.json
512
+ intent = {session.intent}
513
+ definition_of_done = {boundary_contract.definition_of_done}
514
+ evidence = {evidence artifacts}
498
515
  execution_criteria = {execution_criteria}
499
516
  boundary_contract = {boundary_contract}
500
517
  EXPECTED:
501
518
  ---VERDICT---
502
519
  STATUS=all_met|has_unmet
520
+ INTENT_ALIGNED=true|false
503
521
  UNMET=[{id:G2,gap:'...',target_phase:execute}, ...]
504
522
  CONFIDENCE_SCORE=0-100
505
523
  ---END---
@@ -512,9 +530,64 @@ Runs only when `task_decomposition` present.
512
530
  ```
513
531
  4. On callback: 对每个 met 子目标,set `task_decomposition[i].status="done"` + `completion_confirmed=true` + `completed_at=now`
514
532
  5. Append `{session_dir}/decisions.ndjson` with `"type": "goal-gate"`, `unmet_count`, `unmet_ids`
515
- 6. Verdict: `all_met` → A_APPLY_GOAL_DONE; `has_unmet` → A_APPLY_GOAL_FIX
533
+ 6. Verdict routing:
534
+ - `all_met` + `INTENT_ALIGNED=true` → A_APPLY_GOAL_DONE
535
+ - `all_met` + `INTENT_ALIGNED=false` → A_REGROUND_HALT(尾部漂移熔断,auto_confirm 不跳过)
536
+ - `has_unmet` → A_APPLY_GOAL_FIX
516
537
  GUARD: retry_count >= max_retries AND still unmet → A_APPLY_ESCALATE
517
538
 
539
+ ### A_REGROUND_EVALUATE
540
+
541
+ 仅当 `task_decomposition` 存在。周期触发(build rule 5.5)。
542
+
543
+ 1. 从 status.json 读取:`session.intent`、`session.boundary_contract`、`steps[]` 中 `status=="completed"` 的 step + `completion_evidence`、`task_decomposition` 中已 done 子目标的 `goal` + `done_when`
544
+ 2. Delegate read-only audit (run_in_background, STOP, wait):
545
+ ```
546
+ maestro delegate "PURPOSE: 意图保真检查 — 对照 intent 验证累积执行是否漂移
547
+ TASK:
548
+ 1. 读取 intent + boundary_contract.definition_of_done
549
+ 2. 读取已完成 steps 的 completion_evidence + 已 done 子目标 done_when
550
+ 3. 判定累积产出是否仍服务 intent;是否有 step 产出超出 in_scope 或触碰 out_of_scope
551
+ 4. 输出 aligned / drifted,drifted 给出 drift_description + corrective_action
552
+ CONTEXT:
553
+ intent = {session.intent}
554
+ definition_of_done = {boundary_contract.definition_of_done}
555
+ in_scope = {boundary_contract.in_scope}
556
+ out_of_scope = {boundary_contract.out_of_scope}
557
+ completed_steps = [{index, skill, stage, completion_evidence}, ...]
558
+ done_goals = [{id, goal, done_when}, ...]
559
+ EXPECTED:
560
+ ---VERDICT---
561
+ STATUS=aligned|drifted
562
+ DRIFT_DESCRIPTION=<空或具体描述>
563
+ CORRECTIVE_ACTION=<空或建议>
564
+ CONFIDENCE_SCORE=0-100
565
+ ---END---
566
+ CONSTRAINTS:
567
+ - 只评估,不修改文件
568
+ - aligned 阈值:≥80% 已完成产出直接服务 intent
569
+ - 单个 step 触碰 out_of_scope → 直接判 drifted"
570
+ --role analyze --mode analysis
571
+ ```
572
+ 3. On callback: parse verdict
573
+ 4. Append `{session_dir}/decisions.ndjson`:`{ "id": "DEC-{ts}", "type": "reground-gate", "source": "ralph", "node_id": "post-reground", "verdict": "{aligned|drifted}", "confidence_score": {N}, "drift_description": "...", "corrective_action": "..." }`
574
+ 5. Verdict routing:`aligned` → A_APPLY_PROCEED;`drifted` + `confidence_score >= 60` → A_REGROUND_HALT;`drifted` + `confidence_score < 60` → A_APPLY_PROCEED(标 LOW CONFIDENCE)
575
+
576
+ ### A_REGROUND_HALT
577
+
578
+ 漂移熔断(安全门,auto_confirm 不跳过)。
579
+
580
+ 1. Set `session.status = "paused"`,write status.json
581
+ 2. Display:
582
+ ```
583
+ ⚠️ Re-grounding 检测失败 — 执行已偏离 intent。
584
+ Intent: {session.intent}
585
+ Drift: {drift_description}
586
+ 建议回归: {corrective_action}
587
+ 选项:1) /maestro-ralph continue 忽略漂移继续 2) 手动修正后 continue 3) /maestro-ralph status 查看后决定
588
+ ```
589
+ 3. GUARD: auto_confirm 对本动作无效——漂移熔断不可自动跳过
590
+
518
591
  ### A_APPLY_PROCEED
519
592
 
520
593
  1. Mark decision completed, write status.json
@@ -589,6 +662,8 @@ Runs only when `task_decomposition` present.
589
662
  "phase": null, "phase_is_new": false,
590
663
  "milestone": "", // D-007 反查结果,禁止读 current_milestone
591
664
  "auto_mode": false,
665
+ "decomposition_owner": "ralph", // 分解契约所有者(invariant 15);缺省按 source 推断
666
+
592
667
  "quality_mode": "standard", // "full" | "standard" | "quick"
593
668
  "planning_mode": "independent", // "unified" | "independent"
594
669
  "scope_verdict": null, // "large" | "medium" | "small" | "unknown" | null
@@ -739,7 +814,7 @@ decision:post-goal-audit {retry+1}
739
814
  - [ ] D-007 反查:phase 数字 → `session.milestone`,禁止读 current_milestone;写入 step.milestone_id
740
815
  - [ ] phase_is_new=true → lifecycle_position 强制 `analyze`
741
816
  - [ ] Intent overrides 识别 grill / brainstorm / blueprint / analyze-macro
742
- - [ ] auto_confirm=true 时 grill stage 跳过(交互式拷问不支持自动模式)
817
+ - [ ] auto_confirm=true 时 grill step args 追加 `-y`(grill 以 Auto mode 执行,stage 不跳过,产出 grill-report/terminology/context-package)
743
818
  - [ ] A_RESOLVE_SCOPE_VERDICT 读 macro analyze conclusions.scope_verdict,写入 session.scope_verdict + analyze_macro_id
744
819
  - [ ] 链路起点 = analyze-macro 时:large+wants_roadmap→roadmap+analyze+plan(phase);其余(含 large 默认/medium/small)→直跳 plan --from analyze:{ANL_ID}(跳过 roadmap+analyze)
745
820
  - [ ] post-analyze-scope decision 节点在 macro analyze 之后插入;A_SCOPE_EVALUATE/A_APPLY_SCOPE_VERDICT 重塑链路
@@ -70,12 +70,8 @@ Parse $ARGUMENTS to determine mode:
70
70
  - Update frontmatter via: `maestro wiki update <id> --frontmatter '{"tool": true, "category": "<cat>", "summary": "<summary>"}'`
71
71
  - Do NOT recreate the document — modify in place
72
72
 
73
- **For all modes** — identify the usage timing: when should an agent or user invoke this tool? This becomes the first line of the entry description (see Step 5).
74
-
75
73
  ### Step 3: Determine Category
76
74
 
77
- **Core principle**: `category` = **who consumes this tool** (which agent type discovers and uses it), not what the content is about.
78
-
79
75
  | Category | Consumer Agent | Decision Question | Signal Words |
80
76
  |---|---|---|---|
81
77
  | `coding` | code-developer, workflow-executor | 开发者实现时需要这个流程吗? | build, deploy, integrate, configure, setup, migrate, api-contract |
@@ -89,8 +85,6 @@ Parse $ARGUMENTS to determine mode:
89
85
  - API verification steps (how to test) → `category: test` (RCP-*, tool: true)
90
86
  - Ask user when ambiguous: "This tool content serves both developers and testers. Split into separate documents?"
91
87
 
92
- **Ambiguous cases**: Choose the **primary consumer** — the agent that would fail without this knowledge.
93
-
94
88
  ### Step 4: Decide Inline vs Ref
95
89
 
96
90
  - Steps <10 and no code blocks → **inline mode**
@@ -44,8 +44,6 @@ Load project UI conventions before extracting design system:
44
44
  maestro spec load --category ui
45
45
  ```
46
46
 
47
- If specs not initialized, continue without — the workflow still produces valid output.
48
-
49
47
  ## 2. Execute Workflow
50
48
 
51
49
  Route to `~/.maestro/workflows/ui-codify.md` and follow completely.