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
@@ -21,7 +21,10 @@ Turn natural-language instructions into command overlays — JSON patch files th
21
21
  </required_reading>
22
22
 
23
23
  <context>
24
- **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.
24
+ **Overlay model**:
25
+ - JSON file: `name`, `targets[]` (command names), `patches[]`
26
+ - Patch: `section` (XML tag), `mode` (append/prepend/replace/new-section), `content`
27
+ - Apply: hashed HTML-comment markers (idempotent, surgical removal)
25
28
 
26
29
  **Where overlays live**
27
30
  - User overlays: `~/.maestro/overlays/*.json` — created by this skill
@@ -139,8 +142,6 @@ Run:
139
142
  maestro overlay add ~/.maestro/overlays/<slug>.json
140
143
  ```
141
144
 
142
- 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.
143
-
144
145
  ### 5. Report
145
146
 
146
147
  Show the user:
@@ -25,6 +25,7 @@ Produces plan.json + TASK files; registers PLN artifact in state.json.
25
25
  - [plan.json](~/.maestro/templates/plan.json) — read when generating plan output
26
26
  - [task.json](~/.maestro/templates/task.json) — read when generating task files
27
27
  - [state.json](~/.maestro/templates/state.json) — read when registering artifact
28
+ - [boundary-grill.md](~/.maestro/workflows/boundary-grill.md) — read when boundary conflicts detected (in P4)
28
29
  </deferred_reading>
29
30
 
30
31
  <context>
@@ -50,7 +51,7 @@ Scope routing, base flags (`--collab`, `--spec`, `-y`, `--gaps`, `--dir`), outpu
50
51
 
51
52
  **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".
52
53
 
53
- **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".
54
+ **`--from analyze:*` / `blueprint:*`**: scope=standalone skip adhoc milestone auto-creation.
54
55
 
55
56
  ### Role Knowledge
56
57
  `maestro search --category arch` → select relevant → `maestro wiki load`
@@ -84,8 +85,15 @@ Follow '~/.maestro/workflows/plan.md' completely.
84
85
  - REQUIRED: Main flow inline planning is FORBIDDEN (see P3 Agent Constraint below).
85
86
  - BLOCKED if missing: plan.json or TASK files not produced by planner agent — do not proceed to checking.
86
87
 
88
+ **GATE P3.5 → P4: Boundary Grill → Plan Check**
89
+ Run boundary grill per `~/.maestro/workflows/boundary-grill.md`.
90
+ Input: plan.json tasks + convergence criteria + upstream context. Scope guard: "only plan scope; do not re-analyze or re-scope".
91
+ IF conflicts → results to plan.json `boundary_grill` section + affected TASK files. DEC conflicts add `boundary_warning` to confidence.
92
+ NON-BLOCKING: warnings, not hard stops.
93
+
87
94
  **GATE P4 → P5: Plan Check → User Confirmation**
88
95
  - REQUIRED: Plan-checker passed (or minor issues acknowledged).
96
+ - REQUIRED: Boundary grill completed (conflicts resolved or accepted as risks).
89
97
  - REQUIRED: Confidence scored with 5-dimension factor model.
90
98
  - REQUIRED: Pressure pass completed on highest-complexity task.
91
99
  - 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).
@@ -151,8 +159,6 @@ For each created TASK-{NNN}.json that has issue_id:
151
159
  Append history entry: { action: "planned", at: <ISO>, by: "maestro-plan", summary: "Linked to TASK-{NNN}" }
152
160
  ```
153
161
 
154
- 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.
155
-
156
162
  ### Mode: Revise / Check
157
163
 
158
164
  Follow workflow plan.md § "Revise Mode" and § "Check Mode" respectively. These modes bypass the standard P1-P5 create pipeline.
@@ -216,6 +222,9 @@ Status verdicts:
216
222
  - [ ] Every task has `convergence.criteria[]` with grep-verifiable conditions (no subjective language)
217
223
  - [ ] UI plans: each delivery wave has ≥1 `[UI-observable]` convergence criterion (vertical slice; verified at runtime by ralph frontend-verify gate)
218
224
  - [ ] Every task `action` and `implementation` contain concrete values (no "align X with Y")
225
+ - [ ] Boundary grill executed in P3.5 (skip if no conflicts detected)
226
+ - [ ] Boundary grill results written to plan.json `boundary_grill` section (if conflicts found)
227
+ - [ ] DEC conflicts reflected in confidence `boundary_warning` factor
219
228
  - [ ] Plan confidence scored in P4 with 5-dimension factor model
220
229
  - [ ] Plan readiness gate checked before P4.5 collision detection
221
230
  - [ ] Pressure pass completed on highest-complexity task
@@ -22,7 +22,7 @@ $ARGUMENTS — intent text, flags, or keywords.
22
22
 
23
23
  **Parse:**
24
24
  ```
25
- -y flag → auto_confirm = true
25
+ -y flag → auto_confirm = true # 唯一来源:用户显式传入;ralph 不内部推断(invariant 14)
26
26
  --roadmap → wants_roadmap = true (强制多发布 roadmap 路径;roadmap 默认 opt-in)
27
27
  .md/.txt path → input_doc (supplementary context only, NEVER substitutes lifecycle stages)
28
28
  Remaining → intent
@@ -48,6 +48,9 @@ Remaining → intent
48
48
  11. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` 按 unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
49
49
  12. **Invariant violation = BLOCK** — 违反上述任一 invariant 即阻断当前操作。不得以 "效率" 或 "意图明确" 为由绕过。特别是 invariant 1(ralph 不执行 step)和 invariant 6(completion_confirmed 由 CLI 写入)不可隐性违反。
50
50
  13. **Delegate fallback 必须标记** — A_DELEGATE_EVALUATE 解析 verdict 失败时 fallback 为 "fix",但 MUST 在 decisions.ndjson 记录 `"parse_failed": true, "confidence_score": 0`,后续 step 继承 LOW CONFIDENCE 标记。
51
+ 14. **auto_confirm 单一来源** — `auto_confirm` 仅由用户 `-y` 标志设定;ralph 不得内部推断。`session.auto_mode` 仅反映用户输入。
52
+ 15. **分解契约单一所有者** — `boundary_contract` / `task_decomposition` 由 session 创建者拥有(`source=="ralph"` → `decomposition_owner="ralph"`;`source=="maestro"` → `"maestro"`)。contract 已存在时,后续 S_DECOMPOSE MUST 跳过 AskUserQuestion,仅做 shape 校验 + 缺省补齐;goal-audit 只更新 `task_decomposition[*].status/completion_confirmed/completed_at`,禁止改 `goal/done_when/boundary`。
53
+ 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 内。
51
54
  </invariants>
52
55
 
53
56
  <state_machine>
@@ -137,11 +140,14 @@ S_DECISION_EVAL: (decision 节点 == `step.decision` 非空,下述 gate 名取
137
140
  DO: A_SCOPE_EVALUATE
138
141
  → S_APPLY_VERDICT WHEN: structural (post-milestone, post-debug-escalate)
139
142
  DO: A_STRUCTURAL_EVALUATE
143
+ → S_APPLY_VERDICT WHEN: reground-gate (post-reground)
144
+ DO: A_REGROUND_EVALUATE
140
145
 
141
146
  S_APPLY_VERDICT:
142
147
  → S_DISPATCH WHEN: verdict == "proceed" DO: A_APPLY_PROCEED
143
- → S_DISPATCH WHEN: post-goal-audit + unmet sub-goals DO: A_APPLY_GOAL_FIX
144
- → S_DISPATCH WHEN: post-goal-audit + all sub-goals met DO: A_APPLY_GOAL_DONE
148
+ → S_DISPATCH WHEN: post-goal-audit + has_unmet DO: A_APPLY_GOAL_FIX
149
+ → S_DISPATCH WHEN: post-goal-audit + all_met + INTENT_ALIGNED=true DO: A_APPLY_GOAL_DONE
150
+ → END WHEN: post-goal-audit + all_met + INTENT_ALIGNED=false DO: A_REGROUND_HALT(尾部漂移熔断)
145
151
  → S_DISPATCH WHEN: post-analyze-scope DO: A_APPLY_SCOPE_VERDICT
146
152
  → S_DISPATCH WHEN: verdict == "fix" DO: A_APPLY_FIX
147
153
  → S_DISPATCH WHEN: verdict == "escalate" DO: A_APPLY_ESCALATE
@@ -149,11 +155,15 @@ S_APPLY_VERDICT:
149
155
  → END WHEN: post-milestone + standard + no next milestone DO: mark completed
150
156
  → END WHEN: post-milestone + adhoc DO: mark completed (adhoc self-contained)
151
157
  → END WHEN: post-debug-escalate (always STOP) DO: A_PAUSE_ESCALATE
158
+ → END WHEN: post-reground + drifted + confidence_score >= 60 DO: A_REGROUND_HALT
159
+ → S_DISPATCH WHEN: post-reground + aligned DO: A_APPLY_PROCEED
160
+ → S_DISPATCH WHEN: post-reground + drifted + confidence_score < 60 DO: A_APPLY_PROCEED (标 LOW CONFIDENCE)
152
161
  GUARD: retry_count >= max_retries → force escalate
153
162
  GUARD: confidence_score < 60 AND proceed → override to fix
154
163
  GUARD: confidence_score > 95 AND fix AND retry > 0 → suggest proceed
155
164
  GUARD: auto_confirm → skip user prompt, apply adjusted verdict
156
165
  GUARD: not auto_confirm → AskUserQuestion with override options
166
+ GUARD: post-reground + drifted + confidence_score >= 60 → A_REGROUND_HALT(漂移熔断为安全门,auto_confirm 不跳过)
157
167
 
158
168
  S_FALLBACK:
159
169
  → S_PARSE_ROUTE WHEN: user provides input DO: AskUserQuestion
@@ -211,7 +221,7 @@ resolve_milestone(phase_number):
211
221
 
212
222
  | Pattern | Position |
213
223
  |---------|----------|
214
- | 压力测试 / 拷问 / 验证假设 / grill / stress-test | `grill`(**auto_confirm=true 时跳过,直接 `brainstorm`**) |
224
+ | 压力测试 / 拷问 / 验证假设 / grill / stress-test | `grill`(**auto_confirm=true 时透传 `-y`,grill 以 Auto mode 代码代答,不跳过**) |
215
225
  | brainstorm / 头脑风暴 / 探索 / ideate / 设计思路 | `brainstorm` |
216
226
  | blueprint / 规格 / 正式文档 / spec-generate / 7-phase | `blueprint` |
217
227
  | broad/medium intent 无数字 phase (重构/全面/重写/迁移/新功能 X) | `analyze-macro` |
@@ -273,7 +283,8 @@ wants_roadmap = (--roadmap flag)
273
283
  | passed==true, no review.json | `business-test` |
274
284
  | review.json: verdict=="BLOCK" | `review-failed` |
275
285
  | review.json: verdict!="BLOCK" | `test` |
276
- | uat.md: all passed | `milestone-audit` |
286
+ | uat.md: all passed + `session.milestone` 存在 | `milestone-audit` |
287
+ | uat.md: all passed + `session.milestone=null` (standalone) | 标记 session completed(无 milestone 可审计) |
277
288
  | uat.md: has failures | `test-failed` |
278
289
 
279
290
  ### A_DETERMINE_QUALITY_MODE
@@ -318,7 +329,9 @@ options:
318
329
 
319
330
  ### A_DECOMPOSE_TASKS
320
331
 
321
- Runs once before chain build; additive to status.json.
332
+ Runs once before chain build; additive to status.json. 设 `session.decomposition_owner = "ralph"`。
333
+
334
+ **0. Ownership guard** (invariant 15): 若 `session.boundary_contract` 或 `session.task_decomposition` 已非空(上游 maestro 已写入,`decomposition_owner == "maestro"`)→ MUST 跳过下述提问,仅做 shape 校验 + 缺省字段补齐,直接进入步骤 6。
322
335
 
323
336
  **1. Classify intent breadth:**
324
337
 
@@ -355,11 +368,11 @@ narrow → derive defaults from intent + codebase, skip questions.
355
368
 
356
369
  ### A_BUILD_STEPS
357
370
 
358
- Generate steps from `session.lifecycle_position` to `milestone-complete`.
371
+ Generate steps from `session.lifecycle_position` to `milestone-complete`(`session.milestone` 存在时)或最后一个质量门(standalone 时)。
359
372
 
360
373
  | Stage | Skill (independent) | Skill (unified) | Decision after | quality_mode |
361
374
  |-------|---------------------|-----------------|----------------|--------------|
362
- | grill | `maestro-grill "{intent}"` | *(same)* | — | all (**skip when auto_confirm**) |
375
+ | grill | `maestro-grill "{intent}"` | *(same)* | — | all (**auto_confirm 透传 `-y` 到 grill args,不删除 stage**) |
363
376
  | brainstorm | `maestro-brainstorm "{intent}" --from grill:{grill_id}` *(if grill ran)* / `maestro-brainstorm "{intent}"` *(otherwise)* | *(same)* | — | all |
364
377
  | blueprint | `maestro-blueprint "{intent}"` | *(same)* | — | all |
365
378
  | init | `maestro-init` | *(same)* | — | all |
@@ -387,11 +400,12 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
387
400
  1. **起点**:从 `session.lifecycle_position` 开始
388
401
  2. **跳过已完成**:跳过当前 milestone+phase 下已有 completed artifact 的 stage(按 `session.phase` 过滤);unified 按 milestone 过滤
389
402
  3. **quality_mode 过滤**:按 `session.quality_mode` 排除不匹配 stage
390
- 3.5. **grill auto_confirm 跳过**:`auto_confirm == true` 时删除 `grill` stage(grill 为交互式苏格拉底拷问,不支持自动模式);brainstorm args 不含 `--from grill:*`
403
+ 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)
391
404
  3.6. **frontend-verify UI 门控**:仅当当前 phase 交付前端(检出 `dashboard/` 目录,或 phase 目标/计划含 UI 关键词 `landing|page|dashboard|frontend|UI|component|界面`)时保留 `frontend-verify` stage + `post-frontend-verify` decision;纯后端 phase 删除该 stage
392
405
  4. **决策节点**:每个 Decision after 非空的 stage 之后插入 `{ decision: "<gate>", retry_count: 0, max_retries: 2, command_scope: null, command_path: null }`
393
406
  5. **goal-audit 插入**:`task_decomposition` 存在时,在最后一个 evidence-producing stage(execute/review/test)之后、`milestone-complete` 之前插入 `decision:post-goal-audit`
394
- 6. **终点硬约束**:chain `milestone-complete` 结尾
407
+ 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 长度)不纳入计数
408
+ 6. **终点硬约束**:`session.milestone` 存在时 chain 以 `milestone-complete` 结尾;`session.milestone=null`(standalone)时跳过 `milestone-audit` + `milestone-complete` stage,chain 以最后一个质量门 stage 结尾
395
409
  7. **goal_ref 传播**:`task_decomposition` 存在时,每个 step 按 `step.stage ∈ g.lifecycle` 匹配 `step.goal_ref = g.id`(多匹配取字典序最小);decision 节点不打 goal_ref
396
410
  8. **占位符**:independent 保留 `{phase}` `{intent}`;unified 不带 `{phase}`
397
411
  9. **command_path 解析**(每个执行 step,decision 节点跳过):
@@ -494,14 +508,18 @@ Runs only when `task_decomposition` present.
494
508
  1. 读取 status.json.task_decomposition 中 status!=done 的子目标
495
509
  2. 打开 evidence 产物,对照 done_when 严格判定
496
510
  3. 输出 met / unmet,unmet 给出 gap + target_phase
511
+ 4. 对照 intent + definition_of_done 判定累积产出是否仍服务原始意图(意图保真检查)
497
512
  CONTEXT:
498
- status.json = {session_dir}/status.json
499
- evidence = {evidence artifacts}
513
+ status.json = {session_dir}/status.json
514
+ intent = {session.intent}
515
+ definition_of_done = {boundary_contract.definition_of_done}
516
+ evidence = {evidence artifacts}
500
517
  execution_criteria = {execution_criteria}
501
518
  boundary_contract = {boundary_contract}
502
519
  EXPECTED:
503
520
  ---VERDICT---
504
521
  STATUS=all_met|has_unmet
522
+ INTENT_ALIGNED=true|false
505
523
  UNMET=[{id:G2,gap:'...',target_phase:execute}, ...]
506
524
  CONFIDENCE_SCORE=0-100
507
525
  ---END---
@@ -514,9 +532,64 @@ Runs only when `task_decomposition` present.
514
532
  ```
515
533
  4. On callback: 对每个 met 子目标,set `task_decomposition[i].status="done"` + `completion_confirmed=true` + `completed_at=now`
516
534
  5. Append `{session_dir}/decisions.ndjson` with `"type": "goal-gate"`, `unmet_count`, `unmet_ids`
517
- 6. Verdict: `all_met` → A_APPLY_GOAL_DONE; `has_unmet` → A_APPLY_GOAL_FIX
535
+ 6. Verdict routing:
536
+ - `all_met` + `INTENT_ALIGNED=true` → A_APPLY_GOAL_DONE
537
+ - `all_met` + `INTENT_ALIGNED=false` → A_REGROUND_HALT(尾部漂移熔断,auto_confirm 不跳过)
538
+ - `has_unmet` → A_APPLY_GOAL_FIX
518
539
  GUARD: retry_count >= max_retries AND still unmet → A_APPLY_ESCALATE
519
540
 
541
+ ### A_REGROUND_EVALUATE
542
+
543
+ 仅当 `task_decomposition` 存在。周期触发(build rule 5.5)。
544
+
545
+ 1. 从 status.json 读取:`session.intent`、`session.boundary_contract`、`steps[]` 中 `status=="completed"` 的 step + `completion_evidence`、`task_decomposition` 中已 done 子目标的 `goal` + `done_when`
546
+ 2. Delegate read-only audit (run_in_background, STOP, wait):
547
+ ```
548
+ maestro delegate "PURPOSE: 意图保真检查 — 对照 intent 验证累积执行是否漂移
549
+ TASK:
550
+ 1. 读取 intent + boundary_contract.definition_of_done
551
+ 2. 读取已完成 steps 的 completion_evidence + 已 done 子目标 done_when
552
+ 3. 判定累积产出是否仍服务 intent;是否有 step 产出超出 in_scope 或触碰 out_of_scope
553
+ 4. 输出 aligned / drifted,drifted 给出 drift_description + corrective_action
554
+ CONTEXT:
555
+ intent = {session.intent}
556
+ definition_of_done = {boundary_contract.definition_of_done}
557
+ in_scope = {boundary_contract.in_scope}
558
+ out_of_scope = {boundary_contract.out_of_scope}
559
+ completed_steps = [{index, skill, stage, completion_evidence}, ...]
560
+ done_goals = [{id, goal, done_when}, ...]
561
+ EXPECTED:
562
+ ---VERDICT---
563
+ STATUS=aligned|drifted
564
+ DRIFT_DESCRIPTION=<空或具体描述>
565
+ CORRECTIVE_ACTION=<空或建议>
566
+ CONFIDENCE_SCORE=0-100
567
+ ---END---
568
+ CONSTRAINTS:
569
+ - 只评估,不修改文件
570
+ - aligned 阈值:≥80% 已完成产出直接服务 intent
571
+ - 单个 step 触碰 out_of_scope → 直接判 drifted"
572
+ --role analyze --mode analysis
573
+ ```
574
+ 3. On callback: parse verdict
575
+ 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": "..." }`
576
+ 5. Verdict routing:`aligned` → A_APPLY_PROCEED;`drifted` + `confidence_score >= 60` → A_REGROUND_HALT;`drifted` + `confidence_score < 60` → A_APPLY_PROCEED(标 LOW CONFIDENCE)
577
+
578
+ ### A_REGROUND_HALT
579
+
580
+ 漂移熔断(安全门,auto_confirm 不跳过)。
581
+
582
+ 1. Set `session.status = "paused"`,write status.json
583
+ 2. Display:
584
+ ```
585
+ ⚠️ Re-grounding 检测失败 — 执行已偏离 intent。
586
+ Intent: {session.intent}
587
+ Drift: {drift_description}
588
+ 建议回归: {corrective_action}
589
+ 选项:1) /maestro-ralph continue 忽略漂移继续 2) 手动修正后 continue 3) /maestro-ralph status 查看后决定
590
+ ```
591
+ 3. GUARD: auto_confirm 对本动作无效——漂移熔断不可自动跳过
592
+
520
593
  ### A_APPLY_PROCEED
521
594
 
522
595
  1. Mark decision completed, write status.json
@@ -591,6 +664,8 @@ Runs only when `task_decomposition` present.
591
664
  "phase": null, "phase_is_new": false,
592
665
  "milestone": "", // D-007 反查结果,禁止读 current_milestone
593
666
  "auto_mode": false,
667
+ "decomposition_owner": "ralph", // 分解契约所有者(invariant 15);缺省按 source 推断
668
+
594
669
  "quality_mode": "standard", // "full" | "standard" | "quick"
595
670
  "planning_mode": "independent", // "unified" | "independent"
596
671
  "scope_verdict": null, // "large" | "medium" | "small" | "unknown" | null
@@ -741,7 +816,7 @@ decision:post-goal-audit {retry+1}
741
816
  - [ ] D-007 反查:phase 数字 → `session.milestone`,禁止读 current_milestone;写入 step.milestone_id
742
817
  - [ ] phase_is_new=true → lifecycle_position 强制 `analyze`
743
818
  - [ ] Intent overrides 识别 grill / brainstorm / blueprint / analyze-macro
744
- - [ ] auto_confirm=true 时 grill stage 跳过(交互式拷问不支持自动模式)
819
+ - [ ] auto_confirm=true 时 grill step args 追加 `-y`(grill 以 Auto mode 执行,stage 不跳过,产出 grill-report/terminology/context-package)
745
820
  - [ ] A_RESOLVE_SCOPE_VERDICT 读 macro analyze conclusions.scope_verdict,写入 session.scope_verdict + analyze_macro_id
746
821
  - [ ] 链路起点 = analyze-macro 时:large+wants_roadmap→roadmap+analyze+plan(phase);其余(含 large 默认/medium/small)→直跳 plan --from analyze:{ANL_ID}(跳过 roadmap+analyze)
747
822
  - [ ] post-analyze-scope decision 节点在 macro analyze 之后插入;A_SCOPE_EVALUATE/A_APPLY_SCOPE_VERDICT 重塑链路
@@ -68,12 +68,8 @@ Parse $ARGUMENTS to determine mode:
68
68
  - Update frontmatter via: `maestro wiki update <id> --frontmatter '{"tool": true, "category": "<cat>", "summary": "<summary>"}'`
69
69
  - Do NOT recreate the document — modify in place
70
70
 
71
- **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).
72
-
73
71
  ### Step 3: Determine Category
74
72
 
75
- **Core principle**: `category` = **who consumes this tool** (which agent type discovers and uses it), not what the content is about.
76
-
77
73
  | Category | Consumer Agent | Decision Question | Signal Words |
78
74
  |---|---|---|---|
79
75
  | `coding` | code-developer, workflow-executor | 开发者实现时需要这个流程吗? | build, deploy, integrate, configure, setup, migrate, api-contract |
@@ -87,8 +83,6 @@ Parse $ARGUMENTS to determine mode:
87
83
  - API verification steps (how to test) → `category: test` (RCP-*, tool: true)
88
84
  - Ask user when ambiguous: "This tool content serves both developers and testers. Split into separate documents?"
89
85
 
90
- **Ambiguous cases**: Choose the **primary consumer** — the agent that would fail without this knowledge.
91
-
92
86
  ### Step 4: Decide Inline vs Ref
93
87
 
94
88
  - Steps <10 and no code blocks → **inline mode**
@@ -43,8 +43,6 @@ Load project UI conventions before extracting design system:
43
43
  maestro spec load --category ui
44
44
  ```
45
45
 
46
- If specs not initialized, continue without — the workflow still produces valid output.
47
-
48
46
  ## 2. Execute Workflow
49
47
 
50
48
  Route to `~/.maestro/workflows/ui-codify.md` and follow completely.
@@ -39,17 +39,18 @@ $ARGUMENTS — user intent text, or special keywords.
39
39
  1. **All chains dispatch via maestro-ralph-execute** — maestro never executes steps directly
40
40
  2. **Session before execution** — status.json created before any step runs
41
41
  3. **Auto flag pass-through** — 仅当用户传入 `-y` 时透传 `-y` 到 skill args
42
- 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`
42
+ 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`
43
43
  5. **status.json 唯一真源** — 不生成 `goal-checklist.md` 或外部清单
44
44
  6. **执行步骤统一通过 `maestro ralph next` 加载** — `command_scope`/`command_path` 由 `maestro ralph skills --platform claude --json --quiet` 预校验(project 覆盖 global,限定 `.claude/`);decision 节点不走 CLI,走 `Skill("maestro-ralph")` handoff
45
45
  7. **Topology awareness** — chain catalog 含 grill / brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / ...;scope_verdict 由 ralph 在 `post-analyze-scope` 决定
46
- 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
46
+ 8. **Grill `-y` 透传** — `-y` auto mode 透传 `-y` grill args(grill 自身 Auto mode 用代码代答),不删除 grill stage;grill 仍产出 grill-report/terminology/context-package 供下游 brainstorm
47
47
  9. **D-007 milestone 反查** — 数字 phase 的 `milestone_id` 由 `state.json.milestones[].phase_slugs` 反查
48
48
  10. **每个 step 必须 `completion_confirmed: true`** — 由 `maestro ralph complete N --status DONE|DONE_WITH_CONCERNS` 写入
49
49
  11. **schema** — `ralph_protocol_version: "1"` 标记 CLI-driven session;新增字段全部可选
50
50
  12. **Invariant violation = BLOCK** — 违反上述任一 invariant 即阻断当前操作,不可绕过。特别是 invariant 1(dispatch via ralph-execute)和 invariant 2(session before execution)和 invariant 10(completion_confirmed 由 CLI 写入)为硬约束。
51
51
  14. **禁止以上下文消耗为由中断执行** — harness 自动处理 context compression,以"上下文不足"或"避免 context overflow"为由中断属于 invariant violation
52
52
  13. **Classification evidence** — S_CLASSIFY 的 chain 选择决策 MUST 记录到 status.json 的 `classification_rationale` 字段:匹配了哪个 pattern、排除了哪些备选、confidence level。无记录的分类不可进入 S_CREATE。
53
+ 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 内。
53
54
  </invariants>
54
55
 
55
56
  <state_machine>
@@ -128,7 +129,7 @@ S_FALLBACK:
128
129
  1. Read `~/.maestro/workflows/maestro.md` from deferred_reading
129
130
  2. Match intent to task_type via chain catalog (semantic)
130
131
  3. Select chain from chainMap,遵循拓扑约束:
131
- - 压力测试/拷问/验证假设/grill/stress-test → `grill`(**-y 模式跳过 grill,直接走 brainstorm**)
132
+ - 压力测试/拷问/验证假设/grill/stress-test → `grill`(**-y 模式透传 `-y` 到 grill,grill 以 Auto mode 执行,不跳过**)
132
133
  - 头脑风暴/探索 → `brainstorm`
133
134
  - 学习/阅读代码/跟读/follow → `Skill("learn-follow")`;调查/为什么/investigate → `Skill("learn-investigate")`;分解/模式/decompose → `Skill("learn-decompose")`;评审/挑战/second-opinion → `Skill("learn-second-opinion")`;回顾/retro → `Skill("quality-retrospective")`
134
135
  - 正式规格/spec-generate/7-phase → `blueprint`
@@ -146,7 +147,7 @@ S_FALLBACK:
146
147
 
147
148
  ### A_DECOMPOSE_TASKS
148
149
 
149
- maestro-ralph `A_DECOMPOSE_TASKS` 共享分解契约。Condensed:
150
+ `session.decomposition_owner = "maestro"`。下游 ralph 只消费不二次提问(invariant 4)。Condensed:
150
151
 
151
152
  1. 分类意图广度。narrow / 单步 / `{status,init,quick}` 链跳过
152
153
  2. broad/medium → `AskUserQuestion` ≤3 轮:Scope / Constraints / Definition of Done
@@ -175,7 +176,7 @@ S_FALLBACK:
175
176
  "ralph_protocol_version": "1", "active_step_index": null,
176
177
  "phase", "phase_is_new": false, "milestone": "",
177
178
  "scope_verdict": null, "analyze_macro_id": null, "blueprint_id": null,
178
- "auto_mode": false, "cli_tool": "claude",
179
+ "auto_mode": false, "decomposition_owner": "maestro", "cli_tool": "claude",
179
180
  "context": { "scratch_dir": null, "plan_dir": null, "analysis_dir": null,
180
181
  "brainstorm_dir": null, "blueprint_dir": null, "issue_id": null },
181
182
  "steps": [{
@@ -220,7 +221,7 @@ S_FALLBACK:
220
221
 
221
222
  - [ ] Intent classified with task_type, complexity, clarity_score
222
223
  - [ ] Chain catalog 覆盖 grill / brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / quality pipeline
223
- - [ ] `-y` 模式不触发 grill(交互式压力测试不支持自动模式,跳过直接走 brainstorm)
224
+ - [ ] `-y` 模式透传 `-y` 到 grill(grill 以 Auto mode 代码代答执行,stage 不跳过)
224
225
  - [ ] D-007: 数字 phase 步骤的 `milestone_id` 通过 `state.json.milestones[].phase_slugs` 反查
225
226
  - [ ] macro analyze 后跟 `decision:post-analyze-scope`(由 ralph 评估 scope_verdict 决定下游链路)
226
227
  - [ ] plan 支持 `{phase}` / `--from analyze:{ANL_ID}` / `--from blueprint:{BLP_ID}` 三路径;`source_artifact_ref` 写入 step
@@ -15,8 +15,6 @@ allowed-tools:
15
15
 
16
16
  <purpose>
17
17
  Analyze current repository's code patterns to auto-generate `.workflow/kg/extractors.yaml` — a declarative config that teaches MaestroGraph's codegraph extractor to recognize project-specific symbols beyond standard function/class/method declarations.
18
-
19
- Detects: builder/factory API registrations, domain constant patterns, custom decorator conventions, framework-specific patterns, module-level constants.
20
18
  </purpose>
21
19
 
22
20
  <context>
@@ -31,8 +31,6 @@ Flags, artifact context resolution, and output directory format defined in workf
31
31
 
32
32
  ### Frontend Verify Mode (`--frontend-verify`)
33
33
 
34
- 补 ralph 链路缺失的运行时可用性门:确定性验证每个用户可观测能力真正经 UI 可触发,避免"后端绿灯=完成"。
35
-
36
34
  1. **Resolve targets**: 读 phase 的 `plan.json` / `.task/TASK-*.json`,提取所有 `[UI-observable]` convergence.criteria(plan 阶段产出);缺失则枚举后端写端点(POST/PUT/PATCH/DELETE)作为待验证清单。
37
35
  2. **Start app**: `next start`(或从 dashboard/package.json 解析的既有启动脚本);启动失败 → E003。
38
36
  3. **Drive browser**: 用 chrome-devtools MCP(`mcp__claude_dms3-chrome-devtools__*`:navigate / click / fill / take_snapshot / list_network_requests)逐条执行每个 `[UI-observable]` 流程,断言:UI 入口存在且可触发 → 对应写请求返回 2xx → DOM 出现预期结果。
@@ -75,4 +75,3 @@ Follow '~/.maestro/workflows/specs-load.md' completely.
75
75
  - [ ] Legacy entries filtered by text grep fallback
76
76
  - [ ] Results displayed with file:category references
77
77
  </success_criteria>
78
- </output>
@@ -46,4 +46,3 @@ Follow '~/.maestro/workflows/specs-setup.md' completely.
46
46
  - [ ] Workflow recipe knowhow created in `.workflow/knowhow/` for each detected operational workflow (test / debug / build / dev / lint). Each recipe matches the `recipe` schema in `~/.maestro/workflows/knowhow.md` Part B and contains at least one runnable command.
47
47
  - [ ] Report displayed grouped by destination (specs / recipes / skipped / deferred), with `.proposed.md` files surfaced when an existing recipe slug was preserved.
48
48
  </success_criteria>
49
- </output>
@@ -50,15 +50,21 @@ Research and codebase exploration for context gathering.
50
50
  | package.json / Cargo.toml / pyproject.toml / go.mod exists | Explore |
51
51
  | No project files | Skip (codebase_context = null) |
52
52
 
53
- When project detected:
54
- ```
55
- Bash({ command: `maestro delegate "PURPOSE: Explore codebase for context
56
- TASK: • Identify tech stack Map architecture patterns • Document conventions • List integration points
57
- MODE: analysis
58
- CONTEXT: @**/*
59
- EXPECTED: JSON with: tech_stack[], architecture_patterns[], conventions[], integration_points[]" --tool gemini --mode analysis`, run_in_background: false })
53
+ When project detected — prefer `maestro explore` multi-prompt:
54
+ ```bash
55
+ maestro explore \
56
+ "FIND: tech stack and framework detection
57
+ SCOPE: package.json, Cargo.toml, pyproject.toml, go.mod, src/
58
+ EXPECTED: tech_stack list with versions" \
59
+ "FIND: architecture patterns and conventions
60
+ SCOPE: src/
61
+ EXCLUDE: tests, node_modules
62
+ EXPECTED: patterns list with file:line evidence" \
63
+ --max-turns 3 --json
60
64
  ```
61
65
 
66
+ **Fallback**: `maestro delegate "PURPOSE: Explore codebase for context ..." --tool gemini --mode analysis`
67
+
62
68
  ### Tech Profile Scan
63
69
 
64
70
  After codebase exploration, scan results for context-aware trigger signals (based on detected codebase characteristics):
@@ -39,18 +39,22 @@ Scan codebase from multiple perspectives (bug, security, test-coverage, code-qua
39
39
 
40
40
  **Low complexity**: Use `` for quick pattern-based scan.
41
41
 
42
- **Medium/High complexity**: CLI fan-out -- one `maestro delegate --mode analysis` per perspective:
43
-
44
- For each active perspective, build prompt:
45
- ```
46
- PURPOSE: Scan code from <perspective> perspective to discover potential issues
47
- TASK: Analyze code patterns for <perspective> problems, identify anti-patterns, check for common issues
48
- MODE: analysis
49
- CONTEXT: @<scan-scope>
50
- EXPECTED: List of findings with severity (critical/high/medium/low), file:line references, description
51
- CONSTRAINTS: Focus on actionable findings only
42
+ **Medium/High complexity**: Multi-prompt `maestro explore` (preferred for read-only scan):
43
+
44
+ Build one prompt per active perspective:
45
+ ```bash
46
+ maestro explore \
47
+ "FIND: <perspective1> issues and anti-patterns
48
+ SCOPE: <scan-scope>
49
+ ATTENTION: common <perspective1> problems
50
+ EXPECTED: severity + file:line + description" \
51
+ "FIND: <perspective2> issues and anti-patterns
52
+ SCOPE: <scan-scope>
53
+ EXPECTED: severity + file:line + description" \
54
+ --max-turns 3 --json
52
55
  ```
53
- Execute via: `maestro delegate "<prompt>" --role analyze --mode analysis`
56
+
57
+ **Fallback** (when deeper analysis needed per perspective): `maestro delegate "<prompt>" --role analyze --mode analysis`
54
58
 
55
59
  After all perspectives complete:
56
60
  - Parse CLI outputs into structured findings
@@ -56,7 +56,7 @@ Multi-dimension tech debt scanner. Scan codebase across 5 dimensions (code, arch
56
56
  - Classify findings into dimensions
57
57
 
58
58
  **Medium/High Complexity** (Fan-out):
59
- - Fan-out A: CLI exploration (structure, patterns, dependencies angles) via `maestro delegate --role explore --mode analysis`
59
+ - Fan-out A: `maestro explore` multi-prompt parallel (structure, patterns, dependencies angles) preferred over delegate for exploration
60
60
  - Fan-out B: CLI dimension analysis (parallel per dimension -- code, architecture, testing, dependency, documentation) via `--role analyze`
61
61
  - Fan-out C (High only): Multi-perspective analysis (security, performance, code-quality, architecture) via `--role analyze`
62
62
  - Fan-in: Merge results, cross-deduplicate by file:line, boost severity for multi-source findings
@@ -41,24 +41,31 @@ Explore codebase structure through cli-explore-agent, collecting structured cont
41
41
 
42
42
  ## Phase 3: Codebase Exploration
43
43
 
44
- Use CLI tool for codebase exploration:
45
-
46
- ```javascript
47
- Bash({
48
- command: `maestro delegate "PURPOSE: Explore codebase for <topic> from <perspective> perspective; success = structured findings with relevant files and patterns
49
- TASK: • Run module depth analysis • Search for topic-related patterns • Identify key files and their relationships • Extract architectural insights
50
- MODE: analysis
51
- CONTEXT: @**/* | Memory: Session <session-folder>, perspective <perspective>
52
- EXPECTED: JSON output with: relevant_files (path, relevance, summary), patterns, key_findings, module_map, questions_for_analysis, _metadata (perspective, search_queries, timestamp)
53
- CONSTRAINTS: Focus on <perspective> angle - <strategy.focus> | Write to <session>/explorations/exploration-<num>.json
54
- " --tool gemini --mode analysis --rule analysis-analyze-code-patterns`,
55
- run_in_background: false
56
- })
44
+ **Primary: `maestro explore`** (structured multi-prompt):
45
+
46
+ ```bash
47
+ maestro explore \
48
+ "FIND: <topic> patterns and implementations
49
+ SCOPE: src/
50
+ ATTENTION: <perspective>-specific concerns
51
+ EXPECTED: file:line evidence with relevance" \
52
+ "FIND: module boundaries and relationships for <topic>
53
+ SCOPE: src/
54
+ EXCLUDE: tests, generated code
55
+ EXPECTED: dependency pairs and architectural insights" \
56
+ --max-turns 3 --json
57
57
  ```
58
58
 
59
- **ACE fallback** (when CLI produces no output):
60
- ```javascript
61
- ({ project_root_path: ".", query: "<topic> <perspective>" })
59
+ Parse JSON results extract relevant_files, patterns, key_findings.
60
+
61
+ **Fallback: `maestro delegate`** (when explore results insufficient):
62
+
63
+ ```bash
64
+ maestro delegate "PURPOSE: Explore codebase for <topic> from <perspective> perspective
65
+ TASK: Search for topic-related patterns | Identify key files and relationships | Extract architectural insights
66
+ EXPECTED: JSON with relevant_files, patterns, key_findings
67
+ CONSTRAINTS: Focus on <perspective> angle
68
+ " --tool gemini --mode analysis --rule analysis-analyze-code-patterns
62
69
  ```
63
70
 
64
71
  ## Phase 4: Result Validation
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: domain-add
3
+ description: Register a domain term into project glossary
4
+ argument-hint: "<canonical> <definition>"
5
+ allowed-tools: Read, Write, Bash, Glob, Grep
6
+ ---
7
+
8
+ <purpose>
9
+ 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).
10
+
11
+ ```bash
12
+ $domain-add "auth-token" "Short-lived credential for API authentication"
13
+ $domain-add "event-bus" "Central pub-sub message broker for cross-module communication"
14
+ ```
15
+
16
+ **CLI alternative**: `maestro domain add "<canonical>" "<definition>" --tier core|extended|peripheral`. Used by finish-work for programmatic domain term extraction from session outputs.
17
+ </purpose>
18
+
19
+ <context>
20
+ $ARGUMENTS — `<canonical> <definition>` where canonical is a kebab-case term name.
21
+
22
+ **Prerequisites**: `.workflow/domain/` must exist (run `maestro domain init` if missing).
23
+
24
+ **Domain term lifecycle**: discover/manual → register → active → (optional) deprecated → removed
25
+ </context>
26
+
27
+ <execution>
28
+
29
+ ### Step 1: Parse Input
30
+
31
+ Extract canonical (first token, kebab-case) and definition (remainder) from arguments.
32
+ - Validate canonical is non-empty, kebab-case (lowercase, hyphens only)
33
+ - Validate definition is non-empty, ≤200 chars (E001 if missing)
34
+
35
+ ### Step 2: Validate Domain Directory
36
+
37
+ Verify `.workflow/domain/glossary.yaml` exists (E002). If not, run `maestro domain init`.
38
+
39
+ ### Step 3: Check Duplicates
40
+
41
+ Read existing glossary and check for:
42
+ - Exact duplicate (same canonical name) → report existing entry, exit
43
+ - Near match (Levenshtein ≤ 2 or alias overlap) → warn, ask to confirm or merge
44
+
45
+ ### Step 4: Extract Metadata
46
+
47
+ Auto-derive from the definition and codebase context:
48
+ - **aliases** (1-3): common abbreviations, Chinese translations, alternate forms
49
+ - **keywords** (3-5): search terms for discovery
50
+ - **tier**: `core` | `extended` | `peripheral`
51
+ - **relationships**: scan existing glossary for related terms
52
+
53
+ ### Step 5: Register Term
54
+
55
+ ```bash
56
+ maestro domain add "<canonical>" "<definition>" --tier <tier>
57
+ maestro domain update "<canonical>" --aliases "alias1,alias2" --keywords "kw1,kw2" --relationships "rel1,rel2"
58
+ ```
59
+
60
+ ### Step 6: Confirm
61
+
62
+ Display: canonical name, definition, aliases, tier, relationships, and verify command `maestro domain list`.
63
+ </execution>
64
+
65
+ <error_codes>
66
+ | Code | Severity | Description |
67
+ |------|----------|-------------|
68
+ | E001 | fatal | Canonical name and definition are both required |
69
+ | E002 | fatal | `.workflow/domain/` not initialized — run `maestro domain init` first |
70
+ | E003 | fatal | Term already registered with same canonical name |
71
+ </error_codes>
72
+
73
+ <success_criteria>
74
+ - [ ] Canonical name and definition parsed and validated
75
+ - [ ] No duplicate term in glossary
76
+ - [ ] Aliases and keywords auto-extracted
77
+ - [ ] Term written to glossary.yaml with tier and relationships
78
+ - [ ] Confirmation displayed with verify command
79
+ </success_criteria>