maestro-flow 0.3.9 → 0.3.11

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 (281) hide show
  1. package/.claude/agents/workflow-collab-planner.md +1 -1
  2. package/.claude/agents/workflow-executor.md +1 -1
  3. package/.claude/agents/workflow-plan-checker.md +1 -1
  4. package/.claude/agents/workflow-planner.md +1 -1
  5. package/.claude/commands/learn-decompose.md +176 -176
  6. package/.claude/commands/learn-follow.md +167 -167
  7. package/.claude/commands/learn-retro.md +1 -1
  8. package/.claude/commands/maestro-analyze.md +46 -3
  9. package/.claude/commands/maestro-coordinate.md +1 -3
  10. package/.claude/commands/maestro-execute.md +14 -0
  11. package/.claude/commands/maestro-plan.md +16 -0
  12. package/.claude/commands/manage-harvest.md +131 -131
  13. package/.claude/commands/manage-issue-discover.md +2 -2
  14. package/.claude/commands/manage-issue.md +5 -5
  15. package/.claude/commands/spec-add.md +67 -56
  16. package/.claude/commands/spec-load.md +66 -64
  17. package/.claude/commands/spec-setup.md +5 -9
  18. package/.codex/skills/learn-decompose/SKILL.md +119 -0
  19. package/.codex/skills/learn-follow/SKILL.md +83 -0
  20. package/.codex/skills/learn-investigate/SKILL.md +83 -0
  21. package/.codex/skills/learn-retro/SKILL.md +83 -0
  22. package/.codex/skills/learn-second-opinion/SKILL.md +86 -0
  23. package/.codex/skills/maestro/SKILL.md +335 -0
  24. package/.codex/skills/maestro-analyze/SKILL.md +84 -75
  25. package/.codex/skills/maestro-brainstorm/SKILL.md +452 -463
  26. package/.codex/skills/maestro-chain/SKILL.md +233 -0
  27. package/.codex/skills/maestro-coordinate/SKILL.md +167 -278
  28. package/.codex/skills/maestro-execute/SKILL.md +435 -438
  29. package/.codex/skills/maestro-fork/SKILL.md +68 -0
  30. package/.codex/skills/maestro-init/SKILL.md +171 -167
  31. package/.codex/skills/maestro-learn/SKILL.md +80 -0
  32. package/.codex/skills/maestro-link-coordinate/SKILL.md +224 -220
  33. package/.codex/skills/maestro-merge/SKILL.md +62 -0
  34. package/.codex/skills/maestro-milestone-audit/SKILL.md +108 -103
  35. package/.codex/skills/maestro-milestone-complete/SKILL.md +155 -149
  36. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -0
  37. package/.codex/skills/maestro-overlay/SKILL.md +188 -185
  38. package/.codex/skills/maestro-plan/SKILL.md +66 -69
  39. package/.codex/skills/maestro-quick/SKILL.md +26 -23
  40. package/.codex/skills/maestro-roadmap/SKILL.md +65 -73
  41. package/.codex/skills/maestro-spec-generate/SKILL.md +66 -74
  42. package/.codex/skills/maestro-ui-design/SKILL.md +34 -31
  43. package/.codex/skills/maestro-verify/SKILL.md +556 -566
  44. package/.codex/skills/manage-codebase-rebuild/SKILL.md +397 -405
  45. package/.codex/skills/manage-codebase-refresh/SKILL.md +93 -82
  46. package/.codex/skills/manage-harvest/SKILL.md +82 -0
  47. package/.codex/skills/manage-issue/SKILL.md +80 -65
  48. package/.codex/skills/manage-issue-discover/SKILL.md +491 -503
  49. package/.codex/skills/manage-learn/SKILL.md +190 -186
  50. package/.codex/skills/manage-memory/SKILL.md +95 -72
  51. package/.codex/skills/manage-memory-capture/SKILL.md +99 -86
  52. package/.codex/skills/manage-status/SKILL.md +102 -89
  53. package/.codex/skills/quality-business-test/SKILL.md +228 -223
  54. package/.codex/skills/quality-debug/SKILL.md +54 -66
  55. package/.codex/skills/quality-integration-test/SKILL.md +532 -544
  56. package/.codex/skills/quality-refactor/SKILL.md +197 -191
  57. package/.codex/skills/quality-retrospective/SKILL.md +512 -505
  58. package/.codex/skills/quality-review/SKILL.md +93 -105
  59. package/.codex/skills/quality-sync/SKILL.md +101 -89
  60. package/.codex/skills/quality-test/SKILL.md +202 -198
  61. package/.codex/skills/quality-test-gen/SKILL.md +93 -104
  62. package/.codex/skills/spec-add/SKILL.md +58 -39
  63. package/.codex/skills/spec-load/SKILL.md +45 -40
  64. package/.codex/skills/spec-map/SKILL.md +180 -182
  65. package/.codex/skills/spec-setup/SKILL.md +94 -76
  66. package/.codex/skills/team-coordinate/SKILL.md +346 -357
  67. package/.codex/skills/team-executor/SKILL.md +70 -112
  68. package/.codex/skills/team-lifecycle-v4/SKILL.md +311 -299
  69. package/.codex/skills/team-quality-assurance/SKILL.md +234 -227
  70. package/.codex/skills/team-review/SKILL.md +232 -225
  71. package/.codex/skills/team-tech-debt/SKILL.md +78 -100
  72. package/.codex/skills/team-testing/SKILL.md +242 -235
  73. package/.codex/skills/wiki-connect/SKILL.md +75 -0
  74. package/.codex/skills/wiki-digest/SKILL.md +87 -0
  75. package/README.md +14 -11
  76. package/README.zh-CN.md +14 -11
  77. package/chains/issue-lifecycle.json +13 -13
  78. package/chains/singles/issue-analyze.json +3 -3
  79. package/chains/singles/issue-execute.json +3 -3
  80. package/chains/singles/issue-plan.json +3 -3
  81. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
  82. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
  83. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
  84. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  85. package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
  86. package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
  87. package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +1 -1
  88. package/dashboard/dist-server/dashboard/src/server/routes/specs.js +75 -30
  89. package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
  90. package/dashboard/dist-server/dashboard/src/server/state/event-bus.d.ts +5 -0
  91. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js +5 -0
  92. package/dashboard/dist-server/dashboard/src/server/state/event-bus.js.map +1 -1
  93. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
  94. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
  95. package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
  96. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  97. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
  98. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  99. package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
  100. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
  101. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
  102. package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +21 -0
  103. package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
  104. package/dashboard/dist-server/dashboard/src/shared/types.d.ts +3 -2
  105. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +1 -1
  106. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
  107. package/dashboard/dist-server/src/hooks/constants.d.ts +92 -12
  108. package/dashboard/dist-server/src/hooks/constants.js +151 -16
  109. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  110. package/dashboard/dist-server/src/types/index.d.ts +5 -0
  111. package/dist/src/commands/collab.d.ts +1 -34
  112. package/dist/src/commands/collab.d.ts.map +1 -1
  113. package/dist/src/commands/collab.js +8 -76
  114. package/dist/src/commands/collab.js.map +1 -1
  115. package/dist/src/commands/hooks.d.ts +5 -1
  116. package/dist/src/commands/hooks.d.ts.map +1 -1
  117. package/dist/src/commands/hooks.js +115 -10
  118. package/dist/src/commands/hooks.js.map +1 -1
  119. package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
  120. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  121. package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
  122. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  123. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  124. package/dist/src/commands/install-ui/InstallExecution.js +5 -1
  125. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  126. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  127. package/dist/src/commands/install-ui/InstallFlow.js +7 -3
  128. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  129. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
  130. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  131. package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
  132. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  133. package/dist/src/commands/spec.d.ts.map +1 -1
  134. package/dist/src/commands/spec.js +7 -2
  135. package/dist/src/commands/spec.js.map +1 -1
  136. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
  137. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
  138. package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
  139. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
  140. package/dist/src/hooks/constants.d.ts +92 -12
  141. package/dist/src/hooks/constants.d.ts.map +1 -1
  142. package/dist/src/hooks/constants.js +151 -16
  143. package/dist/src/hooks/constants.js.map +1 -1
  144. package/dist/src/hooks/guards/index.d.ts +2 -0
  145. package/dist/src/hooks/guards/index.d.ts.map +1 -1
  146. package/dist/src/hooks/guards/index.js +2 -0
  147. package/dist/src/hooks/guards/index.js.map +1 -1
  148. package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
  149. package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
  150. package/dist/src/hooks/guards/preflight-guard.js +95 -0
  151. package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
  152. package/dist/src/hooks/guards/spec-validator.d.ts +25 -0
  153. package/dist/src/hooks/guards/spec-validator.d.ts.map +1 -0
  154. package/dist/src/hooks/guards/spec-validator.js +66 -0
  155. package/dist/src/hooks/guards/spec-validator.js.map +1 -0
  156. package/dist/src/hooks/index.d.ts +1 -0
  157. package/dist/src/hooks/index.d.ts.map +1 -1
  158. package/dist/src/hooks/index.js +1 -0
  159. package/dist/src/hooks/index.js.map +1 -1
  160. package/dist/src/hooks/keyword-spec-injector.d.ts +21 -0
  161. package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -0
  162. package/dist/src/hooks/keyword-spec-injector.js +96 -0
  163. package/dist/src/hooks/keyword-spec-injector.js.map +1 -0
  164. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts +2 -1
  165. package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
  166. package/dist/src/hooks/plugins/spec-injection-plugin.js +21 -12
  167. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  168. package/dist/src/hooks/preflight-core.d.ts +37 -0
  169. package/dist/src/hooks/preflight-core.d.ts.map +1 -0
  170. package/dist/src/hooks/preflight-core.js +86 -0
  171. package/dist/src/hooks/preflight-core.js.map +1 -0
  172. package/dist/src/hooks/spec-bridge.d.ts +40 -0
  173. package/dist/src/hooks/spec-bridge.d.ts.map +1 -0
  174. package/dist/src/hooks/spec-bridge.js +97 -0
  175. package/dist/src/hooks/spec-bridge.js.map +1 -0
  176. package/dist/src/hooks/spec-injector.d.ts.map +1 -1
  177. package/dist/src/hooks/spec-injector.js +18 -12
  178. package/dist/src/hooks/spec-injector.js.map +1 -1
  179. package/dist/src/hooks/statusline.d.ts +8 -17
  180. package/dist/src/hooks/statusline.d.ts.map +1 -1
  181. package/dist/src/hooks/statusline.js +269 -112
  182. package/dist/src/hooks/statusline.js.map +1 -1
  183. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  184. package/dist/src/i18n/locales/en.js +5 -0
  185. package/dist/src/i18n/locales/en.js.map +1 -1
  186. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  187. package/dist/src/i18n/locales/zh.js +5 -0
  188. package/dist/src/i18n/locales/zh.js.map +1 -1
  189. package/dist/src/i18n/types.d.ts +5 -0
  190. package/dist/src/i18n/types.d.ts.map +1 -1
  191. package/dist/src/team/phase-orchestrator.d.ts +52 -0
  192. package/dist/src/team/phase-orchestrator.d.ts.map +1 -0
  193. package/dist/src/team/phase-orchestrator.js +165 -0
  194. package/dist/src/team/phase-orchestrator.js.map +1 -0
  195. package/dist/src/team/phase-types.d.ts +51 -0
  196. package/dist/src/team/phase-types.d.ts.map +1 -0
  197. package/dist/src/team/phase-types.js +41 -0
  198. package/dist/src/team/phase-types.js.map +1 -0
  199. package/dist/src/tools/collab-adapter.d.ts +17 -0
  200. package/dist/src/tools/collab-adapter.d.ts.map +1 -1
  201. package/dist/src/tools/collab-adapter.js +138 -0
  202. package/dist/src/tools/collab-adapter.js.map +1 -1
  203. package/dist/src/tools/index.d.ts.map +1 -1
  204. package/dist/src/tools/index.js +6 -0
  205. package/dist/src/tools/index.js.map +1 -1
  206. package/dist/src/tools/merge-validator.d.ts +24 -0
  207. package/dist/src/tools/merge-validator.d.ts.map +1 -0
  208. package/dist/src/tools/merge-validator.js +220 -0
  209. package/dist/src/tools/merge-validator.js.map +1 -0
  210. package/dist/src/tools/spec-entry-parser.d.ts +56 -0
  211. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -0
  212. package/dist/src/tools/spec-entry-parser.js +196 -0
  213. package/dist/src/tools/spec-entry-parser.js.map +1 -0
  214. package/dist/src/tools/spec-init.d.ts.map +1 -1
  215. package/dist/src/tools/spec-init.js +66 -92
  216. package/dist/src/tools/spec-init.js.map +1 -1
  217. package/dist/src/tools/spec-keyword-index.d.ts +30 -0
  218. package/dist/src/tools/spec-keyword-index.d.ts.map +1 -0
  219. package/dist/src/tools/spec-keyword-index.js +101 -0
  220. package/dist/src/tools/spec-keyword-index.js.map +1 -0
  221. package/dist/src/tools/spec-loader.d.ts +3 -3
  222. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  223. package/dist/src/tools/spec-loader.js +49 -23
  224. package/dist/src/tools/spec-loader.js.map +1 -1
  225. package/dist/src/tools/team-agents.d.ts +27 -0
  226. package/dist/src/tools/team-agents.d.ts.map +1 -0
  227. package/dist/src/tools/team-agents.js +362 -0
  228. package/dist/src/tools/team-agents.js.map +1 -0
  229. package/dist/src/tools/team-mailbox.d.ts +40 -0
  230. package/dist/src/tools/team-mailbox.d.ts.map +1 -0
  231. package/dist/src/tools/team-mailbox.js +384 -0
  232. package/dist/src/tools/team-mailbox.js.map +1 -0
  233. package/dist/src/tools/team-msg.d.ts +17 -8
  234. package/dist/src/tools/team-msg.d.ts.map +1 -1
  235. package/dist/src/tools/team-msg.js +110 -13
  236. package/dist/src/tools/team-msg.js.map +1 -1
  237. package/dist/src/tools/team-tasks-mcp.d.ts +27 -0
  238. package/dist/src/tools/team-tasks-mcp.d.ts.map +1 -0
  239. package/dist/src/tools/team-tasks-mcp.js +408 -0
  240. package/dist/src/tools/team-tasks-mcp.js.map +1 -0
  241. package/dist/src/types/index.d.ts +5 -0
  242. package/dist/src/types/index.d.ts.map +1 -1
  243. package/package.json +2 -1
  244. package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
  245. package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
  246. package/templates/search-tools.md +1 -1
  247. package/workflows/analyze.md +816 -816
  248. package/workflows/brainstorm.md +471 -471
  249. package/workflows/cli-tools-usage.md +44 -27
  250. package/workflows/codebase-rebuild.md +332 -332
  251. package/workflows/codebase-refresh.md +240 -240
  252. package/workflows/delegate-usage.md +3 -3
  253. package/workflows/execute.md +1 -1
  254. package/workflows/harvest.md +420 -420
  255. package/workflows/integration-test.md +343 -343
  256. package/workflows/issue-analyze.md +6 -2
  257. package/workflows/issue-discover.md +414 -414
  258. package/workflows/issue-execute.md +6 -3
  259. package/workflows/issue-plan.md +5 -2
  260. package/workflows/maestro-coordinate.codex.md +281 -470
  261. package/workflows/maestro-coordinate.md +14 -14
  262. package/workflows/maestro-link-coordinate.md +2 -2
  263. package/workflows/maestro.codex.md +710 -0
  264. package/workflows/maestro.md +10 -11
  265. package/workflows/map.md +111 -111
  266. package/workflows/milestone-complete.md +176 -176
  267. package/workflows/plan.md +1 -1
  268. package/workflows/quick.md +497 -497
  269. package/workflows/refactor.md +300 -300
  270. package/workflows/retrospective.md +1 -1
  271. package/workflows/roadmap.md +335 -335
  272. package/workflows/spec-generate.md +640 -640
  273. package/workflows/specs-add.md +46 -81
  274. package/workflows/specs-load.md +15 -17
  275. package/workflows/specs-setup.md +40 -161
  276. package/.claude/commands/manage-issue-analyze.md +0 -62
  277. package/.claude/commands/manage-issue-execute.md +0 -73
  278. package/.claude/commands/manage-issue-plan.md +0 -62
  279. package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
  280. package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
  281. package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
@@ -1,324 +1,213 @@
1
1
  ---
2
2
  name: maestro-coordinate
3
- description: Team-agent pipeline coordinator — classifies intent, maps to skill chain, spawns one agent per step whose prompt contains the skill invocation ($skill-name "intent"). Step results propagate as context to each successor. Session state at .workflow/.maestro-coordinate/{session-id}/state.json.
4
- argument-hint: "\"intent text\" [-y] [-c|--continue] [--dry-run] [--chain <name>]"
5
- allowed-tools: spawn_agent, wait_agent, send_message, close_agent, Read, Write, Bash, Glob, Grep
3
+ description: CLI-based coordinator — analyze intent select command chain execute sequentially via maestro delegate with auto-confirm. Async state machine with template-driven prompts and gemini analysis between steps.
4
+ argument-hint: "\"intent text\" [-y] [-c] [--dry-run] [--chain <name>]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
8
- ## Auto Mode
9
-
10
- When `-y` or `--yes`: Skip clarification and confirmation prompts. Pass `-y` through to each step's skill invocation.
11
-
12
- # Maestro Coordinate
13
-
14
- ## Usage
15
-
16
- ```bash
17
- $maestro-coordinate "implement user authentication with JWT"
18
- $maestro-coordinate -y "refactor the payment module"
19
- $maestro-coordinate --continue
20
- $maestro-coordinate --dry-run "add rate limiting to API endpoints"
21
- $maestro-coordinate --chain feature "add dark mode toggle"
22
- ```
23
-
24
- **Flags**:
25
- - `-y, --yes` — Auto mode: skip all prompts; propagate `-y` to each skill
26
- - `--continue` — Resume latest paused session from last incomplete step
27
- - `--dry-run` — Display planned chain without spawning any agents
28
- - `--chain <name>` — Force a specific chain (skips intent classification)
29
-
30
- **Session state**: `.workflow/.maestro-coordinate/{session-id}/state.json`
31
-
32
- ---
33
-
34
- ## Overview
35
-
36
- Sequential pipeline coordinator (Pattern 2.5). Each chain step is one `spawn_agent` whose message contains a `$skill-name "intent"` invocation together with context accumulated from prior steps. The agent executes the skill and returns structured findings; those findings are injected into the next step's spawn message as `## Context from Previous Steps`.
8
+ <purpose>
9
+ Sequential CLI-delegate coordinator. Each chain step executes via `maestro delegate "prompt" --to <tool> --mode write`
10
+ with a template-driven prompt. After each step, gemini analysis evaluates output quality and generates
11
+ optimization hints for subsequent steps. All execution is background-async with hook callbacks.
37
12
 
38
13
  ```
39
- Intent → Resolve Chain → Step 1 → Step 2 → Step N → Report
40
- (chainMap) spawn spawn spawn
41
- wait wait wait
42
- close close close
43
- │ │ │
44
- findings → prev_context → prev_context
14
+ Intent → Resolve Chain → Step 1 → Analysis → Step 2 → Analysis → Report
15
+ (chainMap) delegate gemini delegate gemini
16
+ callback callback callback callback
45
17
  ```
18
+ </purpose>
46
19
 
47
- ---
20
+ <required_reading>
21
+ @~/.maestro/workflows/maestro-coordinate.codex.md — authoritative `detectTaskType`, `detectNextAction`, `chainMap` (35+ intent patterns, 40+ chain types). Read before executing any step.
22
+ </required_reading>
48
23
 
49
- ## Chain Map
24
+ <deferred_reading>
25
+ - [coordinate template](~/.maestro/templates/cli/prompts/coordinate-step.txt) — read when filling step prompts
26
+ </deferred_reading>
50
27
 
51
- | Intent keywords | Chain | Steps (skills, in order) |
52
- |----------------|-------|--------------------------|
53
- | fix, bug, error, broken, crash | `quality-fix` | $manage-issue-analyze → $manage-issue-execute → $maestro-verify |
54
- | test, spec, coverage | `quality-test` | $quality-test |
55
- | refactor, cleanup, debt | `quality-refactor` | $quality-refactor |
56
- | feature, implement, add, build | `feature` | $maestro-plan → $maestro-execute → $maestro-verify |
57
- | review, check, audit | `quality-review` | $quality-review |
58
- | deploy, release, ship | `deploy` | $maestro-verify → $maestro-execute |
28
+ <context>
29
+ $ARGUMENTS — user intent text, or special flags.
59
30
 
60
- ---
31
+ **Flags:**
32
+ - `-y, --yes` — Auto mode: skip all prompts, inject auto-confirm into delegates
33
+ - `-c, --continue` — Resume previous session from last incomplete step
34
+ - `--dry-run` — Show planned chain without executing
35
+ - `--chain <name>` — Force specific chain (skips intent classification)
61
36
 
62
- ## Implementation
37
+ **Session state**: `.workflow/.maestro-coordinate/{session-id}/state.json`
38
+ </context>
39
+
40
+ <invariants>
41
+ 1. **STOP after each delegate call**: Background execution via `run_in_background: true`, wait for hook callback.
42
+ 2. **State machine**: Advance via `current_step`, no sync loops for async operations.
43
+ 3. **Template-driven**: All steps use `coordinate-step.txt`, no per-command prompt assembly.
44
+ 4. **Context propagation**: Parse PHASE / spec session ID / scratch_dir / issue_id from each step output, feed to next step.
45
+ 5. **Gemini analysis after each step**: Evaluate output quality, generate hints for next step, chain via `--resume`.
46
+ 6. **Auto-confirm injection**: `{{AUTO_DIRECTIVE}}` in template prevents blocking during background execution.
47
+ 7. **Resumable**: `-c` reads `state.json`, jumps to first pending step.
48
+ 8. **Delegate tool**: `maestro delegate --to codex` for all execution steps; `--to gemini` only for post-step analysis.</invariants>
63
49
 
64
- > **Full implementation reference**: The complete `detectTaskType`, `detectNextAction`, and `chainMap` definitions (35+ intent patterns, 40+ chain types) are in `~/.maestro/workflows/maestro-coordinate.codex.md`. Read that file for authoritative logic before executing any step.
50
+ <execution>
65
51
 
66
- ### Session Initialization
52
+ ### Step 1: Parse Arguments
67
53
 
68
54
  ```javascript
69
- const dateStr = new Date().toISOString().substring(0, 10).replace(/-/g, '')
70
- const timeStr = new Date().toISOString().substring(11, 19).replace(/:/g, '')
71
- const sessionId = `MCC-${dateStr}-${timeStr}`
72
- const sessionDir = `.workflow/.maestro-coordinate/${sessionId}`
73
-
74
- Bash(`mkdir -p ${sessionDir}`)
75
-
76
- functions.update_plan({
77
- explanation: "Starting coordinate session",
78
- plan: [
79
- { step: "Phase 1: Resolve intent and chain", status: "in_progress" },
80
- { step: "Phase 2: Execute steps (pipeline)", status: "pending" },
81
- { step: "Phase 3: Completion report", status: "pending" }
82
- ]
83
- })
55
+ const args = $ARGUMENTS.trim();
56
+ const AUTO_YES = /\b(-y|--yes)\b/.test(args);
57
+ const RESUME = /\b(-c|--continue)\b/.test(args);
58
+ const DRY_RUN = /\b--dry-run\b/.test(args);
59
+ const forcedChain = args.match(/--chain\s+(\S+)/)?.[1] || null;
60
+ const intent = args
61
+ .replace(/\b(-y|--yes|-c|--continue|--dry-run)\b/g, '')
62
+ .replace(/--chain\s+\S+/g, '')
63
+ .trim();
84
64
  ```
85
65
 
86
- ### Phase 1: Resolve Intent and Chain
66
+ **If RESUME**: Find latest `state.json` in `.workflow/.maestro-coordinate/`, load → jump to Step 6.
87
67
 
88
- **`--continue` mode**: Glob `.workflow/.maestro-coordinate/MCC-*/state.json` sorted by name desc; load the most recent; skip to Phase 2 at the first step where `status === "pending"`.
68
+ ### Step 2–4: Classify Intent Confirm
89
69
 
90
- **Fresh mode**:
70
+ 1. Read `.workflow/state.json` + `.workflow/roadmap.md` + current phase
71
+ 2. If `--chain` given → use directly; else classify via `detectTaskType` + `chainMap`
72
+ 3. If clarity < 2 and not AUTO_YES → clarify via AskUserQuestion (max 2 rounds)
73
+ 4. **`--dry-run`**: Display chain and exit
74
+ 5. **User confirmation** (skip if AUTO_YES): Execute / Execute from step N / Cancel
91
75
 
92
- 1. Read `.workflow/state.json` for project context (`current_phase`, `workflow_name`)
93
- 2. If `--chain` is given, use it directly
94
- 3. Otherwise, classify intent with keyword heuristics (see Chain Map above)
95
- 4. If no keyword matches and not `AUTO_YES`: ask one clarifying question via `functions.request_user_input`
96
- 5. Resolve the chain's skill list from Chain Map
97
- 6. Write `state.json`:
76
+ ### Step 5: Setup Session
98
77
 
99
78
  ```javascript
100
- Write(`${sessionDir}/state.json`, JSON.stringify({
101
- id: sessionId,
102
- intent,
103
- chain: resolvedChain,
104
- auto_yes: AUTO_YES,
105
- status: "in_progress",
106
- started_at: new Date().toISOString(),
107
- steps: CHAIN_MAP[resolvedChain].map((skill, i) => ({
108
- step_n: i + 1,
109
- skill,
110
- status: "pending",
111
- findings: null,
112
- quality_score: null,
113
- hints_for_next: null
79
+ const sessionId = `coord-${new Date().toISOString().replace(/[-:T]/g, '').slice(0, 15)}`;
80
+ const sessionDir = `.workflow/.maestro-coordinate/${sessionId}`;
81
+
82
+ const state = {
83
+ session_id: sessionId, status: 'running',
84
+ created_at: new Date().toISOString(),
85
+ intent, task_type: taskType, chain_name: chainName,
86
+ auto_mode: AUTO_YES, phase: resolvedPhase,
87
+ current_step: 0, gemini_session_id: null, step_analyses: [],
88
+ steps: chain.map((s, i) => ({
89
+ index: i, cmd: s.cmd, args: s.args || '',
90
+ status: 'pending', exec_id: null, analysis: null
114
91
  }))
115
- }, null, 2))
116
- ```
117
-
118
- **`--dry-run`**: Display the chain plan and stop — no agents spawned.
119
-
120
- ```
121
- Chain: <resolvedChain>
122
- Steps:
123
- 1. <skill-1>
124
- 2. <skill-2>
125
- 3. <skill-3>
126
- ```
127
-
128
- **User confirmation** (skip if `AUTO_YES`): Display the plan above and prompt `Proceed? (yes/no)`.
129
-
130
- ```javascript
131
- functions.update_plan({
132
- explanation: "Chain resolved, starting pipeline",
133
- plan: [
134
- { step: "Phase 1: Resolve intent and chain", status: "completed" },
135
- { step: "Phase 2: Execute steps (pipeline)", status: "in_progress" },
136
- { step: "Phase 3: Completion report", status: "pending" }
137
- ]
138
- })
92
+ };
93
+ Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
139
94
  ```
140
95
 
141
- ---
96
+ ### Step 6: Execute Step via maestro delegate
142
97
 
143
- ### Phase 2: Execute Steps (Pipeline)
144
-
145
- Sequential loop — each step spawns one agent, waits for it, extracts findings, then closes it before spawning the next.
98
+ #### 6a: Assemble args
146
99
 
147
100
  ```javascript
148
- let prevContext = '' // accumulates across steps
149
-
150
- for (const step of state.steps.filter(s => s.status === 'pending')) {
151
- const skillFlag = AUTO_YES ? `-y` : ''
152
-
153
- // Assemble the agent prompt with the skill invocation embedded
154
- const stepPrompt = buildStepPrompt({
155
- step,
156
- totalSteps: state.steps.length,
157
- chain: state.chain,
158
- intent: state.intent,
159
- prevContext,
160
- skillFlag,
161
- sessionDir
162
- })
163
-
164
- // Spawn step agent
165
- const agent = spawn_agent({ message: stepPrompt })
166
-
167
- // Wait — initial spawn: 30 min
168
- let result = wait_agent({ timeout_ms: 1800000 })
169
- if (result.timed_out) {
170
- // Step 1: Status probe (non-interrupting, 3 min)
171
- followup_task({ target: agent, message: "STATUS_CHECK: Report current progress, findings so far, and estimated remaining work." })
172
- const status = wait_agent({ timeout_ms: 180000 })
173
- if (status.timed_out) {
174
- // Step 2: Force finalize (interrupt, 3 min)
175
- followup_task({ target: agent, message: "FINALIZE: Output all current findings immediately. Time limit reached.", interrupt: true })
176
- const forced = wait_agent({ timeout_ms: 180000 })
177
- if (forced.timed_out) {
178
- // Step 3: Abort
179
- close_agent({ target: agent })
180
- } else {
181
- result = forced
182
- }
183
- } else {
184
- result = status
185
- }
186
- }
187
-
188
- // Parse structured output from agent
189
- const output = parseLastJSON(result.status[agent].completed) ?? {
190
- quality_score: null,
191
- findings: result.status[agent].completed?.slice(-500) ?? "(no output)",
192
- hints_for_next: ""
193
- }
194
-
195
- close_agent({ target: agent })
196
-
197
- // Persist step result
198
- step.status = result.timed_out ? "failed" : "completed"
199
- step.findings = output.findings
200
- step.quality_score = output.quality_score
201
- step.hints_for_next = output.hints_for_next
202
- step.completed_at = new Date().toISOString()
203
- Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2))
204
-
205
- // Build prev_context for next step
206
- prevContext += `\n\n## Step ${step.step_n}: ${step.skill}\nFindings: ${step.findings}\nHints: ${step.hints_for_next ?? ''}`
207
-
208
- // Abort on failure — mark remaining steps as skipped
209
- if (step.status === "failed") {
210
- state.steps
211
- .filter(s => s.status === 'pending')
212
- .forEach(s => { s.status = 'skipped'; s.findings = `Blocked: step ${step.step_n} (${step.skill}) failed` })
213
- state.status = "aborted"
214
- Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2))
215
- break
101
+ const AUTO_FLAG_MAP = {
102
+ 'maestro-analyze': '-y', 'maestro-brainstorm': '-y', 'maestro-ui-design': '-y',
103
+ 'maestro-plan': '--auto', 'maestro-spec-generate': '-y', 'quality-test': '--auto-fix',
104
+ 'quality-retrospective': '--auto-yes',
105
+ };
106
+
107
+ function assembleArgs(step) {
108
+ let a = (step.args || '')
109
+ .replace(/\{phase\}/g, context.current_phase || '')
110
+ .replace(/\{description\}/g, context.user_intent || '')
111
+ .replace(/\{issue_id\}/g, context.issue_id || '')
112
+ .replace(/\{spec_session_id\}/g, context.spec_session_id || '')
113
+ .replace(/\{scratch_dir\}/g, context.scratch_dir || '');
114
+ if (state.auto_mode) {
115
+ const flag = AUTO_FLAG_MAP[step.cmd];
116
+ if (flag && !a.includes(flag)) a = a ? `${a} ${flag}` : flag;
216
117
  }
118
+ return a.trim();
217
119
  }
218
120
  ```
219
121
 
220
- ---
221
-
222
- #### Step Agent Prompt Template (`buildStepPrompt`)
122
+ #### 6b: Build prompt from template + launch
223
123
 
224
- The assembled prompt embeds the skill call so the agent knows exactly what to invoke:
124
+ Read `~/.maestro/templates/cli/prompts/coordinate-step.txt`, fill placeholders.
125
+ If previous step has analysis hints, inject as `{{ANALYSIS_HINTS}}`.
225
126
 
127
+ ```javascript
128
+ const prompt = template
129
+ .replace('{{COMMAND}}', `/${step.cmd}`)
130
+ .replace('{{ARGS}}', assembledArgs)
131
+ .replace('{{STEP_N}}', `${state.current_step + 1}/${state.steps.length}`)
132
+ .replace('{{AUTO_DIRECTIVE}}', state.auto_mode ? 'Auto-confirm all prompts. No interactive questions.' : '')
133
+ .replace('{{CHAIN_NAME}}', state.chain_name)
134
+ .replace('{{ANALYSIS_HINTS}}', analysisHints);
135
+
136
+ Bash({
137
+ command: `maestro delegate ${escapeForShell(prompt)} --to codex --mode write`,
138
+ run_in_background: true, timeout: 600000
139
+ });
140
+ // ■ STOP — wait for hook callback
226
141
  ```
227
- ## TASK ASSIGNMENT
228
-
229
- ### MANDATORY FIRST STEPS
230
- 1. Read: ~/.maestro/workflows/maestro-coordinate.codex.md
231
- 2. Read: ~/.codex/skills/{skill}/SKILL.md
232
-
233
- ---
234
-
235
- **Coordinate Chain: {chain} | Step {step_n} of {totalSteps}**
236
-
237
- ## Skill Invocation
238
- Execute this skill call to complete your task:
239
-
240
- ${skill} "{intent}" {skillFlag}
241
-
242
- Follow the Implementation section of the skill file you read in step 2.
243
- The intent above is your driving goal.
244
-
245
- {#if prevContext}
246
- ## Context from Previous Steps
247
- {prevContext}
248
-
249
- Use hints from the previous step to guide execution priorities.
250
- {/if}
251
142
 
252
- ## Output (required last JSON block in your response)
253
- After execution complete, output exactly:
254
- ```json
255
- {
256
- "quality_score": <0-10>,
257
- "findings": "<what was accomplished — max 500 chars>",
258
- "hints_for_next": "<specific guidance for the next chain step>"
259
- }
260
- ```
143
+ ### Step 7: Post-Step Callback
261
144
 
262
- Session artifacts: {sessionDir}/
145
+ ```javascript
146
+ // Context propagation from output
147
+ const phaseMatch = output.match(/PHASE:\s*(\d+)/m);
148
+ if (phaseMatch) context.current_phase = phaseMatch[1];
149
+ const specMatch = output.match(/SPEC-[\w-]+/);
150
+ if (specMatch) context.spec_session_id = specMatch[0];
151
+ const scratchMatch = output.match(/scratch_dir:\s*(.+)/m);
152
+ if (scratchMatch) context.scratch_dir = scratchMatch[1].trim();
153
+
154
+ // Success/failure
155
+ const failed = /^STATUS:\s*FAILURE/m.test(output);
156
+ if (!failed) { step.status = 'completed'; }
157
+ else if (state.auto_mode && !step.retried) { step.retried = true; /* re-execute Step 6 */ return; }
158
+ else { step.status = 'skipped'; /* or AskUserQuestion: Retry / Skip / Abort */ }
159
+
160
+ Write(`${sessionDir}/step-${stepIdx + 1}-output.txt`, output);
161
+ // → Step 7b (gemini analysis) if completed + multi-step chain
162
+ // → else advance current_step, loop to Step 6 or Step 8
263
163
  ```
264
164
 
265
- ---
266
-
267
- ### Phase 3: Completion Report
165
+ ### Step 7b: Analyze Step Output (via gemini)
268
166
 
269
167
  ```javascript
270
- state.status = state.steps.every(s => s.status === 'completed') ? "completed" : state.status
271
- Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2))
272
-
273
- functions.update_plan({
274
- explanation: "Coordinate complete",
275
- plan: [
276
- { step: "Phase 1: Resolve intent and chain", status: "completed" },
277
- { step: "Phase 2: Execute steps (pipeline)", status: "completed" },
278
- { step: "Phase 3: Completion report", status: "completed" }
279
- ]
280
- })
281
- ```
282
-
283
- Display:
168
+ let delegateCmd = `maestro delegate ${escapeForShell(analysisPrompt)} --to gemini --mode analysis --rule analysis-review-code-quality`;
169
+ if (state.gemini_session_id) delegateCmd += ` --resume ${state.gemini_session_id}`;
170
+ Bash({ command: delegateCmd, run_in_background: true, timeout: 300000 });
171
+ // ■ STOP — wait for hook callback
284
172
  ```
285
- === COORDINATE COMPLETE ===
286
- Session: <sessionId>
287
- Chain: <chain>
288
- Steps: <N completed>/<total>
289
-
290
- STEP RESULTS:
291
- [1] <skill> — score: <N>/10 ✓ <findings summary>
292
- [2] <skill> — score: <N>/10 ✓ <findings summary>
293
- [3] <skill> — score: <N>/10 ✓ <findings summary>
294
-
295
- State: .workflow/.maestro-coordinate/<sessionId>/state.json
296
- Resume: $maestro-coordinate --continue
297
- ```
298
-
299
- ---
300
173
 
301
- ## Error Handling
174
+ Post-analyze: store quality_score + issues + next_step_hints in `state.step_analyses[]`, chain gemini sessions via `--resume`.
302
175
 
303
- | Code | Severity | Condition | Recovery |
304
- |------|----------|-----------|----------|
305
- | E001 | error | Intent unclassifiable after clarification | Default to `feature` chain; note in state.json |
306
- | E002 | error | `--chain` value not in chain map | List valid chains, abort |
307
- | E003 | error | Step agent timeout (4-step cascade exhausted) | Mark step `failed`; skip remaining steps; suggest `--continue` |
308
- | E004 | error | Step agent failed (non-JSON output) | Mark step `failed`; preserve raw output in `findings`; skip remaining |
309
- | E005 | error | `--continue`: no session found | Glob `.workflow/.maestro-coordinate/MCC-*/`, list sessions, prompt |
310
- | W001 | warning | Step output JSON missing `hints_for_next` | Continue with empty hints; next step still gets `findings` |
176
+ ### Step 8: Completion Report
311
177
 
312
- ---
313
-
314
- ## Core Rules
315
-
316
- 1. **Start Immediately**: Init session dir and write `state.json` before any spawn
317
- 2. **Sequential**: Never spawn step N+1 until step N agent is closed and results written
318
- 3. **Skill in Prompt**: Every step agent's message MUST contain `$skill-name "intent"` — this is how the agent knows which skill to execute
319
- 4. **State.json is source of truth**: Write after every step; `--continue` reads it to resume
320
- 5. **Skip on Failure**: Step failure immediately marks all remaining steps `skipped` and aborts the loop
321
- 6. **Close before spawn**: Always `close_agent` the current step agent before spawning the next
322
- 7. **Dry-run is read-only**: Stop after displaying the chain plan — never spawn agents
323
- 8. **Timeout handling**: 4-step cascade — status probe → force finalize → abort; if all timed out → mark `failed`
324
- 9. **No CLI fallback**: All execution is agent-native — no `exec_command("maestro delegate ...")`
178
+ ```
179
+ ============================================================
180
+ MAESTRO-COORDINATE COMPLETE
181
+ ============================================================
182
+ Session: {session_id}
183
+ Chain: {chain_name} ({done}/{total})
184
+
185
+ Steps:
186
+ [✓] 1. maestro-plan completed (quality: 85/100)
187
+ [✓] 2. maestro-execute completed (quality: 78/100)
188
+
189
+ Avg Quality: {avg_score}/100
190
+ Next: $maestro-coordinate --continue
191
+ ============================================================
192
+ ```
193
+ </execution>
194
+
195
+ <error_codes>
196
+ | Code | Severity | Description | Recovery |
197
+ |------|----------|-------------|----------|
198
+ | E001 | error | No intent and project not initialized | Suggest $maestro-init |
199
+ | E002 | error | Clarity too low after 2 rounds | Ask to rephrase |
200
+ | E003 | error | Step failed + abort | Suggest resume with -c |
201
+ | E004 | error | Resume session not found | Show available sessions |
202
+ </error_codes>
203
+
204
+ <success_criteria>
205
+ - [ ] Intent classified and chain selected via detectTaskType + chainMap
206
+ - [ ] Each step executed via `maestro delegate` with coordinate-step template
207
+ - [ ] Auto-confirm injected, structured return parsed
208
+ - [ ] Each completed step analyzed via `maestro delegate --to gemini --mode analysis`
209
+ - [ ] Analysis hints injected into next step prompt via `{{ANALYSIS_HINTS}}`
210
+ - [ ] Gemini sessions chained via `--resume` for accumulated context
211
+ - [ ] Session state at .workflow/.maestro-coordinate/{session_id}/
212
+ - [ ] Completion report with per-step status and quality scores
213
+ </success_criteria>