maestro-flow 0.3.46 → 0.3.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/.claude/agents/ui-design-agent.md +1 -0
  2. package/.claude/agents/workflow-executor.md +3 -0
  3. package/.claude/commands/learn-decompose.md +91 -146
  4. package/.claude/commands/learn-follow.md +102 -137
  5. package/.claude/commands/learn-investigate.md +102 -167
  6. package/.claude/commands/learn-retro.md +100 -243
  7. package/.claude/commands/learn-second-opinion.md +95 -135
  8. package/.claude/commands/maestro-amend.md +95 -232
  9. package/.claude/commands/maestro-analyze.md +1 -6
  10. package/.claude/commands/maestro-collab.md +104 -265
  11. package/.claude/commands/maestro-composer.md +113 -293
  12. package/.claude/commands/maestro-execute.md +10 -17
  13. package/.claude/commands/maestro-impeccable.md +89 -0
  14. package/.claude/commands/maestro-plan.md +1 -6
  15. package/.claude/commands/maestro-player.md +111 -340
  16. package/.claude/commands/maestro-quick.md +9 -0
  17. package/.claude/commands/maestro-ralph-execute.md +167 -210
  18. package/.claude/commands/maestro-ralph.md +245 -426
  19. package/.claude/commands/maestro-ui-codify.md +13 -0
  20. package/.claude/commands/maestro-ui-craft.md +364 -0
  21. package/.claude/commands/maestro-ui-design.md +12 -1
  22. package/.claude/commands/maestro-verify.md +12 -13
  23. package/.claude/commands/maestro.md +142 -72
  24. package/.claude/commands/manage-knowhow-capture.md +45 -170
  25. package/.claude/commands/quality-auto-test.md +9 -0
  26. package/.claude/commands/quality-debug.md +11 -25
  27. package/.claude/commands/quality-refactor.md +9 -0
  28. package/.claude/commands/quality-review.md +5 -14
  29. package/.claude/commands/spec-add.md +1 -1
  30. package/.claude/commands/spec-load.md +3 -2
  31. package/.claude/skills/maestro-impeccable/SKILL.md +169 -0
  32. package/.codex/skills/learn-decompose/SKILL.md +1 -1
  33. package/.codex/skills/learn-investigate/SKILL.md +2 -1
  34. package/.codex/skills/maestro/SKILL.md +278 -313
  35. package/.codex/skills/maestro-analyze/SKILL.md +126 -417
  36. package/.codex/skills/maestro-brainstorm/SKILL.md +129 -451
  37. package/.codex/skills/maestro-collab/SKILL.md +134 -547
  38. package/.codex/skills/maestro-execute/SKILL.md +3 -1
  39. package/.codex/skills/maestro-impeccable/SKILL.md +112 -0
  40. package/.codex/skills/maestro-plan/SKILL.md +88 -437
  41. package/.codex/skills/maestro-player/SKILL.md +191 -333
  42. package/.codex/skills/maestro-quick/SKILL.md +2 -0
  43. package/.codex/skills/maestro-ralph/SKILL.md +307 -710
  44. package/.codex/skills/maestro-roadmap/SKILL.md +201 -518
  45. package/.codex/skills/maestro-ui-codify/SKILL.md +1 -0
  46. package/.codex/skills/maestro-ui-craft/SKILL.md +341 -0
  47. package/.codex/skills/maestro-ui-design/SKILL.md +10 -0
  48. package/.codex/skills/maestro-verify/SKILL.md +116 -409
  49. package/.codex/skills/quality-auto-test/SKILL.md +145 -443
  50. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  51. package/.codex/skills/quality-test/SKILL.md +229 -517
  52. package/.codex/skills/spec-add/SKILL.md +1 -1
  53. package/README.md +4 -1
  54. package/README.zh-CN.md +3 -1
  55. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +3 -0
  56. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  57. package/dashboard/dist-server/dashboard/src/server/routes/install.js +110 -1
  58. package/dashboard/dist-server/dashboard/src/server/routes/install.js.map +1 -1
  59. package/dashboard/dist-server/dashboard/src/server/routes/settings.js +56 -0
  60. package/dashboard/dist-server/dashboard/src/server/routes/settings.js.map +1 -1
  61. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +2 -0
  62. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  63. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +2 -2
  64. package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -1
  65. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +2 -0
  66. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  67. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +3 -1
  68. package/dashboard/dist-server/dashboard/src/shared/constants.d.ts +2 -0
  69. package/dashboard/dist-server/dashboard/src/shared/constants.js +2 -0
  70. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  71. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  72. package/dist/src/agents/cli-agent-runner.js +1 -3
  73. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  74. package/dist/src/agents/cli-history-store.d.ts +5 -0
  75. package/dist/src/agents/cli-history-store.d.ts.map +1 -1
  76. package/dist/src/agents/cli-history-store.js +65 -13
  77. package/dist/src/agents/cli-history-store.js.map +1 -1
  78. package/dist/src/cli.js +13 -0
  79. package/dist/src/cli.js.map +1 -1
  80. package/dist/src/commands/command-help.d.ts +3 -0
  81. package/dist/src/commands/command-help.d.ts.map +1 -0
  82. package/dist/src/commands/command-help.js +60 -0
  83. package/dist/src/commands/command-help.js.map +1 -0
  84. package/dist/src/commands/config.d.ts.map +1 -1
  85. package/dist/src/commands/config.js +17 -0
  86. package/dist/src/commands/config.js.map +1 -1
  87. package/dist/src/commands/delegate.d.ts.map +1 -1
  88. package/dist/src/commands/delegate.js +12 -2
  89. package/dist/src/commands/delegate.js.map +1 -1
  90. package/dist/src/commands/impeccable.d.ts +10 -0
  91. package/dist/src/commands/impeccable.d.ts.map +1 -0
  92. package/dist/src/commands/impeccable.js +181 -0
  93. package/dist/src/commands/impeccable.js.map +1 -0
  94. package/dist/src/commands/spec.js +1 -1
  95. package/dist/src/commands/spec.js.map +1 -1
  96. package/dist/src/commands/wiki.d.ts.map +1 -1
  97. package/dist/src/commands/wiki.js +5 -1
  98. package/dist/src/commands/wiki.js.map +1 -1
  99. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  100. package/dist/src/config/cli-tools-config.js +10 -7
  101. package/dist/src/config/cli-tools-config.js.map +1 -1
  102. package/dist/src/core/addon-registry.d.ts +31 -0
  103. package/dist/src/core/addon-registry.d.ts.map +1 -0
  104. package/dist/src/core/addon-registry.js +28 -0
  105. package/dist/src/core/addon-registry.js.map +1 -0
  106. package/dist/src/hooks/plugins/spec-injection-plugin.js +2 -0
  107. package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
  108. package/dist/src/hooks/spec-injector.js +2 -2
  109. package/dist/src/hooks/spec-injector.js.map +1 -1
  110. package/dist/src/index.d.ts +2 -0
  111. package/dist/src/index.d.ts.map +1 -1
  112. package/dist/src/index.js +1 -0
  113. package/dist/src/index.js.map +1 -1
  114. package/dist/src/tools/impeccable/critique-storage.d.ts +28 -0
  115. package/dist/src/tools/impeccable/critique-storage.d.ts.map +1 -0
  116. package/dist/src/tools/impeccable/critique-storage.js +120 -0
  117. package/dist/src/tools/impeccable/critique-storage.js.map +1 -0
  118. package/dist/src/tools/impeccable/design-parser.d.ts +90 -0
  119. package/dist/src/tools/impeccable/design-parser.d.ts.map +1 -0
  120. package/dist/src/tools/impeccable/design-parser.js +696 -0
  121. package/dist/src/tools/impeccable/design-parser.js.map +1 -0
  122. package/dist/src/tools/impeccable/detect-csp.d.ts +6 -0
  123. package/dist/src/tools/impeccable/detect-csp.d.ts.map +1 -0
  124. package/dist/src/tools/impeccable/detect-csp.js +130 -0
  125. package/dist/src/tools/impeccable/detect-csp.js.map +1 -0
  126. package/dist/src/tools/impeccable/is-generated.d.ts +4 -0
  127. package/dist/src/tools/impeccable/is-generated.d.ts.map +1 -0
  128. package/dist/src/tools/impeccable/is-generated.js +56 -0
  129. package/dist/src/tools/impeccable/is-generated.js.map +1 -0
  130. package/dist/src/tools/impeccable/live/accept.d.ts +50 -0
  131. package/dist/src/tools/impeccable/live/accept.d.ts.map +1 -0
  132. package/dist/src/tools/impeccable/live/accept.js +556 -0
  133. package/dist/src/tools/impeccable/live/accept.js.map +1 -0
  134. package/dist/src/tools/impeccable/live/bootstrap.d.ts +2 -0
  135. package/dist/src/tools/impeccable/live/bootstrap.d.ts.map +1 -0
  136. package/dist/src/tools/impeccable/live/bootstrap.js +244 -0
  137. package/dist/src/tools/impeccable/live/bootstrap.js.map +1 -0
  138. package/dist/src/tools/impeccable/live/complete.d.ts +7 -0
  139. package/dist/src/tools/impeccable/live/complete.d.ts.map +1 -0
  140. package/dist/src/tools/impeccable/live/complete.js +67 -0
  141. package/dist/src/tools/impeccable/live/complete.js.map +1 -0
  142. package/dist/src/tools/impeccable/live/completion.d.ts +24 -0
  143. package/dist/src/tools/impeccable/live/completion.d.ts.map +1 -0
  144. package/dist/src/tools/impeccable/live/completion.js +26 -0
  145. package/dist/src/tools/impeccable/live/completion.js.map +1 -0
  146. package/dist/src/tools/impeccable/live/inject.d.ts +41 -0
  147. package/dist/src/tools/impeccable/live/inject.d.ts.map +1 -0
  148. package/dist/src/tools/impeccable/live/inject.js +394 -0
  149. package/dist/src/tools/impeccable/live/inject.js.map +1 -0
  150. package/dist/src/tools/impeccable/live/poll.d.ts +24 -0
  151. package/dist/src/tools/impeccable/live/poll.d.ts.map +1 -0
  152. package/dist/src/tools/impeccable/live/poll.js +180 -0
  153. package/dist/src/tools/impeccable/live/poll.js.map +1 -0
  154. package/dist/src/tools/impeccable/live/resume.d.ts +5 -0
  155. package/dist/src/tools/impeccable/live/resume.d.ts.map +1 -0
  156. package/dist/src/tools/impeccable/live/resume.js +30 -0
  157. package/dist/src/tools/impeccable/live/resume.js.map +1 -0
  158. package/dist/src/tools/impeccable/live/server.d.ts +6 -0
  159. package/dist/src/tools/impeccable/live/server.d.ts.map +1 -0
  160. package/dist/src/tools/impeccable/live/server.js +867 -0
  161. package/dist/src/tools/impeccable/live/server.js.map +1 -0
  162. package/dist/src/tools/impeccable/live/session-store.d.ts +72 -0
  163. package/dist/src/tools/impeccable/live/session-store.d.ts.map +1 -0
  164. package/dist/src/tools/impeccable/live/session-store.js +281 -0
  165. package/dist/src/tools/impeccable/live/session-store.js.map +1 -0
  166. package/dist/src/tools/impeccable/live/static/live-browser-session.js +123 -0
  167. package/dist/src/tools/impeccable/live/static/live-browser.js +4860 -0
  168. package/dist/src/tools/impeccable/live/static/modern-screenshot.umd.js +14 -0
  169. package/dist/src/tools/impeccable/live/status.d.ts +2 -0
  170. package/dist/src/tools/impeccable/live/status.d.ts.map +1 -0
  171. package/dist/src/tools/impeccable/live/status.js +52 -0
  172. package/dist/src/tools/impeccable/live/status.js.map +1 -0
  173. package/dist/src/tools/impeccable/live/wrap.d.ts +33 -0
  174. package/dist/src/tools/impeccable/live/wrap.d.ts.map +1 -0
  175. package/dist/src/tools/impeccable/live/wrap.js +572 -0
  176. package/dist/src/tools/impeccable/live/wrap.js.map +1 -0
  177. package/dist/src/tools/impeccable/load-context.d.ts +13 -0
  178. package/dist/src/tools/impeccable/load-context.d.ts.map +1 -0
  179. package/dist/src/tools/impeccable/load-context.js +79 -0
  180. package/dist/src/tools/impeccable/load-context.js.map +1 -0
  181. package/dist/src/tools/impeccable/paths.d.ts +34 -0
  182. package/dist/src/tools/impeccable/paths.d.ts.map +1 -0
  183. package/dist/src/tools/impeccable/paths.js +102 -0
  184. package/dist/src/tools/impeccable/paths.js.map +1 -0
  185. package/dist/src/tools/spec-entry-parser.d.ts +1 -1
  186. package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
  187. package/dist/src/tools/spec-entry-parser.js +1 -1
  188. package/dist/src/tools/spec-entry-parser.js.map +1 -1
  189. package/dist/src/tools/spec-init.d.ts.map +1 -1
  190. package/dist/src/tools/spec-init.js +26 -1
  191. package/dist/src/tools/spec-init.js.map +1 -1
  192. package/dist/src/tools/spec-loader.d.ts +1 -1
  193. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  194. package/dist/src/tools/spec-loader.js +2 -0
  195. package/dist/src/tools/spec-loader.js.map +1 -1
  196. package/package.json +2 -2
  197. package/workflows/claude-instructions.md +17 -5
  198. package/workflows/cli-tools-usage.md +10 -3
  199. package/workflows/delegate-usage.md +3 -2
  200. package/workflows/impeccable/adapt.md +190 -0
  201. package/workflows/impeccable/animate.md +175 -0
  202. package/workflows/impeccable/audit.md +133 -0
  203. package/workflows/impeccable/bolder.md +113 -0
  204. package/workflows/impeccable/brand.md +118 -0
  205. package/workflows/impeccable/clarify.md +174 -0
  206. package/workflows/impeccable/codex.md +105 -0
  207. package/workflows/impeccable/cognitive-load.md +106 -0
  208. package/workflows/impeccable/color-and-contrast.md +105 -0
  209. package/workflows/impeccable/colorize.md +154 -0
  210. package/workflows/impeccable/craft.md +123 -0
  211. package/workflows/impeccable/critique.md +261 -0
  212. package/workflows/impeccable/delight.md +302 -0
  213. package/workflows/impeccable/distill.md +111 -0
  214. package/workflows/impeccable/document.md +439 -0
  215. package/workflows/impeccable/extract.md +69 -0
  216. package/workflows/impeccable/harden.md +347 -0
  217. package/workflows/impeccable/heuristics-scoring.md +234 -0
  218. package/workflows/impeccable/interaction-design.md +195 -0
  219. package/workflows/impeccable/layout.md +141 -0
  220. package/workflows/impeccable/live.md +622 -0
  221. package/workflows/impeccable/motion-design.md +109 -0
  222. package/workflows/impeccable/onboard.md +234 -0
  223. package/workflows/impeccable/optimize.md +258 -0
  224. package/workflows/impeccable/overdrive.md +130 -0
  225. package/workflows/impeccable/personas.md +179 -0
  226. package/workflows/impeccable/polish.md +242 -0
  227. package/workflows/impeccable/product.md +62 -0
  228. package/workflows/impeccable/quieter.md +99 -0
  229. package/workflows/impeccable/responsive-design.md +114 -0
  230. package/workflows/impeccable/shape.md +165 -0
  231. package/workflows/impeccable/spatial-design.md +100 -0
  232. package/workflows/impeccable/teach.md +168 -0
  233. package/workflows/impeccable/typeset.md +124 -0
  234. package/workflows/impeccable/typography.md +159 -0
  235. package/workflows/impeccable/ux-writing.md +107 -0
  236. package/workflows/impeccable.md +164 -0
  237. package/workflows/maestro.md +7 -3
  238. package/workflows/skill-authoring.md +265 -0
  239. package/workflows/specs-add.md +3 -2
  240. package/workflows/specs-load.md +2 -1
  241. package/workflows/specs-setup.md +21 -1
@@ -1,333 +1,191 @@
1
- ---
2
- name: maestro-player
3
- description: Play workflow templates with checkpoint resume
4
- argument-hint: "<template-slug|path> [--context key=value...] [-c [session-id]] [--list] [--dry-run]"
5
- allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Wave-based template executor using `spawn_agents_on_csv`. Loads a workflow template
10
- (produced by maestro-composer), binds context variables, converts DAG nodes into
11
- CSV waves via topological sort, executes wave-by-wave with barrier/non-barrier grouping.
12
-
13
- Aligned with maestro codex coordinator pattern:
14
- - ALL skill execution via `spawn_agents_on_csv` — coordinator never executes directly
15
- - Barrier nodes (checkpoints + artifact-producing skills) execute solo
16
- - Non-barrier nodes grouped into parallel waves
17
- - Session state at `.workflow/.maestro/{session-id}/`
18
- - Resume from last completed wave via `-c`
19
-
20
- ```
21
- Load Template Bind Variables Build Wave CSV spawn → read results →
22
- (barrier: read artifacts, update context) → next wave → report
23
- ```
24
- </purpose>
25
-
26
- <invariants>
27
- 1. **ALL skills via spawn_agents_on_csv**: Every node execution goes through spawn. Coordinator NEVER directly executes any skill.
28
- 2. **Coordinator = prompt assembler only**: Load template → resolve refs → build CSV → spawn → read results → assemble next CSV.
29
- 3. **Barrier = solo wave**: Checkpoint nodes and artifact-producing skills execute alone (wave size = 1).
30
- 4. **Non-barriers can parallel**: Consecutive non-barrier nodes grouped into one wave.
31
- 5. **Wave-by-wave**: Never start wave N+1 before wave N results are read and analyzed.
32
- 6. **Coordinator owns context**: Sub-agents never read prior results — coordinator assembles full `skill_call` with resolved args.
33
- 7. **Resume from wave**: `-c` finds last completed wave, resumes from next pending step.
34
- </invariants>
35
-
36
- <context>
37
- $ARGUMENTS template slug/path, or flags.
38
-
39
- **Flags:**
40
- - `--context key=value` — Bind context variables (repeatable)
41
- - `-c` / `--continue [session-id]` Resume paused/interrupted session
42
- - `--list` List available templates
43
- - `--dry-run` Show wave plan without executing
44
-
45
- **Entry routing:**
46
-
47
- | Detection | Condition | Handler |
48
- |-----------|-----------|---------|
49
- | List | `--list` | handleList |
50
- | Resume | `-c [session-id]` | Phase 0: Resume |
51
- | Dry run | `--dry-run` | Phase 1 + 2, print plan, exit |
52
- | Normal | Template slug/path | Phase 1 |
53
- | No args | Empty | handleList + AskUserQuestion |
54
-
55
- **Session tracking (aligned with maestro codex):**
56
-
57
- | Constant | Value |
58
- |----------|-------|
59
- | Session prefix | `MCP` (Maestro Composer Player) |
60
- | Session dir | `.workflow/.maestro/MCP-<YYYYMMDD>-<HHmmss>/` |
61
- | State file | `state.json` |
62
- | Wave CSV | `wave-{N}.csv` |
63
- | Wave results | `wave-{N}-results.csv` |
64
- | Template dir | `~/.maestro/templates/workflows/` |
65
- | Template index | `~/.maestro/templates/workflows/index.json` |
66
-
67
- **Barrier nodes** (solo wave, coordinator reads artifacts after):
68
-
69
- | Node type | Artifacts to Read | Context Updates |
70
- |-----------|------------------|-----------------|
71
- | `checkpoint` | (state save only) | `last_checkpoint` |
72
- | `maestro-plan` | `plan.json`, `.task/TASK-*.json` | `plan_dir`, `task_count` |
73
- | `maestro-execute` | `results.csv` | `exec_status`, `completed_tasks` |
74
- | `maestro-analyze` | `context.md` | `analysis_dir`, `gaps`, `phase` |
75
- | `maestro-brainstorm` | `.brainstorming/` | `brainstorm_dir` |
76
- | `maestro-roadmap` | `specs/` | `spec_session_id` |
77
-
78
- All other skill nodes are **non-barrier** (groupable into parallel waves).
79
-
80
- **state.json schema:**
81
-
82
- ```json
83
- {
84
- "id": "MCP-<YYYYMMDD>-<HHmmss>",
85
- "intent": "<template_name> with context",
86
- "chain": "<template_id>",
87
- "template_path": "~/.maestro/templates/workflows/<slug>.json",
88
- "template_name": "<name>",
89
- "auto_yes": false,
90
- "status": "in_progress | paused | completed | aborted",
91
- "started_at": "<ISO>",
92
- "context": {
93
- "goal": "...", "scope": "...",
94
- "phase": null, "plan_dir": null, "analysis_dir": null,
95
- "last_checkpoint": null
96
- },
97
- "waves": [],
98
- "steps": [
99
- {
100
- "step_n": 1, "node_id": "N-001",
101
- "skill": "<executor>", "args": "<args_template>",
102
- "type": "skill | cli | checkpoint",
103
- "is_barrier": true,
104
- "status": "pending | completed | failed | skipped",
105
- "wave_n": null, "findings": null, "artifacts": null
106
- }
107
- ]
108
- }
109
- ```
110
- </context>
111
-
112
- <execution>
113
-
114
- ### handleList
115
-
116
- Scan `~/.maestro/templates/workflows/index.json`. Display:
117
- ```
118
- Available workflow templates:
119
- feature-tdd-review [feature, complex] 3 work nodes, 2 checkpoints
120
- quick-bugfix [bugfix, simple] 2 work nodes, 1 checkpoint
121
-
122
- Run: $maestro-player <slug> --context goal="..."
123
- ```
124
-
125
- If not found: "No templates. Create with $maestro-composer"
126
-
127
- ---
128
-
129
- ### Phase 0: Resume
130
-
131
- **Trigger**: `-c [session-id]`
132
-
133
- Load session state by explicit ID or most recent `MCP-*/state.json` with `status = "in_progress" | "paused"`. Error E005 if none found. Resume from next pending step after last completed wave → jump to Phase 3.
134
-
135
- ---
136
-
137
- ### Phase 1: Load & Bind
138
-
139
- 1. **Resolve template**: absolute path → as-is, slug → lookup in `~/.maestro/templates/workflows/index.json`, partial → confirm, not found → show `--list`
140
- 2. **Parse** `--context key=value` pairs into `bound_context`
141
- 3. **Load and validate** template JSON
142
- 4. **Collect missing** required variables via AskUserQuestion
143
- 5. **Bind** `{variable_name}` in all `args_template` strings. Leave `{N-xxx.field}` and `{prev_*}` unresolved (runtime Phase 3)
144
- 6. If `--dry-run`: print wave plan and exit
145
-
146
- ---
147
-
148
- ### Phase 2: Init Session & Build Wave Plan
149
-
150
- 1. Generate session ID: `MCP-<YYYYMMDD>-<HHmmss>`
151
- 2. Topological sort (Kahn's algorithm) on template nodes + edges
152
- 3. Classify barrier vs non-barrier: barriers = checkpoint nodes + `maestro-analyze`, `maestro-plan`, `maestro-brainstorm`, `maestro-roadmap`, `maestro-execute`
153
- 4. Group into waves: barrier nodes → solo wave, non-barrier nodes → accumulate into parallel wave
154
- 5. Build steps array from waves, write `state.json`
155
-
156
- **Step 2.5a — Register goal constraint**:
157
- ```
158
- functions.create_goal({
159
- objective: `Player ${template_name}: ${steps.length} steps from template ${template_id}`
160
- })
161
- ```
162
-
163
- **Step 2.6** — Display start banner:
164
- ```
165
- ============================================================
166
- MAESTRO PLAYER
167
- ============================================================
168
- Template: <template.name>
169
- Session: <session_id>
170
- Context: goal="<value>"
171
-
172
- Wave Plan:
173
- [W1] N-001 maestro-plan "{goal}" [BARRIER]
174
- [W2] N-002 maestro-execute {phase} [BARRIER]
175
- [W3] N-003 quality-test {phase}
176
- N-004 quality-review {phase}
177
- ============================================================
178
- ```
179
-
180
- **`--dry-run`**: Display above and exit.
181
-
182
- ---
183
-
184
- ### Phase 3: Wave Execution Loop
185
-
186
- Loop while any step has `status === 'pending'`:
187
-
188
- **3a. Resolve runtime references** in each step's args:
189
- - `{key}`lookup from `context[key]`
190
- - `{N-xxx.field}` lookup from completed step with matching `node_id`
191
- - `{prev_field}` → lookup from most recently completed non-checkpoint step
192
-
193
- **3b. Handle checkpoint nodes** (no CSV spawn needed):
194
- - Save checkpoint snapshot to `checkpoints/{node_id}.json` (session state + context)
195
- - Update `context.last_checkpoint`, mark completed
196
- - If `auto_continue === false`: prompt user (Continue / Pause / Abort)
197
-
198
- **3c. Build wave CSV** for skill nodes:
199
- Write `wave-{N}.csv` with columns `id,skill_call,topic`. Each row: resolved `$${step.skill} ${args}`.
200
-
201
- **3d. Spawn agents**:
202
-
203
- ```javascript
204
- spawn_agents_on_csv({
205
- csv_path: `${sessionDir}/wave-${waveNum}.csv`,
206
- id_column: "id",
207
- instruction: PLAYER_INSTRUCTION,
208
- max_workers: waveSteps.length,
209
- max_runtime_seconds: 3600,
210
- output_csv_path: `${sessionDir}/wave-${waveNum}-results.csv`,
211
- output_schema: RESULT_SCHEMA
212
- })
213
- ```
214
-
215
- **3e. Read results**: Map each result row back to its step — update status, findings, artifacts, wave_n.
216
-
217
- **3f. Barrier analysis**: If barrier wave, read artifacts and update context (see barrier node table in `<context>`).
218
-
219
- **3g. Persist + abort check**: Append wave record to `state.waves[]`, persist `state.json`. If any result failed → set `state.status = 'aborted'`, mark remaining steps as skipped.
220
-
221
- ### Sub-Agent Instruction Template
222
-
223
- ```
224
- 你是 CSV job 子 agent。
225
-
226
- 先原样执行这一段技能调用:
227
- {skill_call}
228
-
229
- 然后基于结果完成这一行任务说明:
230
- {topic}
231
-
232
- 限制:
233
- - 不要修改 .workflow/.maestro/ 下的 state 文件
234
- - skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
235
-
236
- 最后必须调用 `report_agent_job_result`,返回 JSON:
237
- {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
238
- ```
239
-
240
- ### Result Schema
241
-
242
- ```javascript
243
- const RESULT_SCHEMA = {
244
- type: "object",
245
- properties: {
246
- status: { type: "string", enum: ["completed", "failed"] },
247
- skill_call: { type: "string" },
248
- summary: { type: "string" },
249
- artifacts: { type: "string" },
250
- error: { type: "string" }
251
- },
252
- required: ["status", "skill_call", "summary", "artifacts", "error"]
253
- };
254
- ```
255
-
256
- ---
257
-
258
- ### Phase 4: Completion Report
259
-
260
- ```
261
- ============================================================
262
- MAESTRO PLAYER SESSION COMPLETE
263
- ============================================================
264
- Session: <session_id>
265
- Template: <template_name> (<template_id>)
266
- Waves: <N> executed
267
- Steps: <completed>/<total>
268
- Context: goal="<value>"
269
-
270
- WAVE RESULTS:
271
- [W1] $maestro-plan "{goal}" → ✓ plan created
272
- [W2] $maestro-execute {phase} → ✓ 12/12 tasks
273
- [W3] $quality-test {phase} → ✓ all tests pass
274
- $quality-review {phase} → ✓ no issues
275
-
276
- State: .workflow/.maestro/<session_id>/state.json
277
- Resume: $maestro-player -c
278
- ============================================================
279
- ```
280
-
281
- Update `state.status = "completed"`, write final `state.json`.
282
- Release goal constraint: `functions.update_goal({ status: "complete" })`
283
-
284
- **Note**: Abort path (Phase 3 step 3g) does NOT call `update_goal` — goal stays running for `-c` resume.
285
- </execution>
286
-
287
- <csv_schema>
288
- ### wave-{N}.csv (Per-Wave Input)
289
-
290
- ```csv
291
- id,skill_call,topic
292
- "1","$maestro-plan \"implement user auth\"","Template \"feature-plan-test\" step 1/5"
293
- ```
294
-
295
- | Column | Description |
296
- |--------|-------------|
297
- | `id` | Step number (string) |
298
- | `skill_call` | Full skill invocation with resolved context args |
299
- | `topic` | Brief description for the agent |
300
-
301
- ### wave-{N}-results.csv (Per-Wave Output)
302
-
303
- Written by `spawn_agents_on_csv`. Contains result per agent.
304
- </csv_schema>
305
-
306
- <error_codes>
307
- | Code | Severity | Condition | Recovery |
308
- |------|----------|-----------|----------|
309
- | E001 | error | Template not found | Show --list, suggest closest match |
310
- | E002 | error | Template JSON invalid | Point to file for fix |
311
- | E003 | error | Required variable missing, user declined | Cannot proceed |
312
- | E004 | error | DAG cycle in template | Suggest $maestro-composer --edit |
313
- | E005 | error | Resume session not found | List sessions |
314
- | E006 | error | Wave timeout | Mark failed, abort chain |
315
- | E007 | error | Barrier artifact not found | Retry wave once, then abort |
316
- | W001 | warning | Runtime reference resolved to empty | Log, continue |
317
- | W002 | warning | Barrier artifact partial | Continue with available context |
318
- </error_codes>
319
-
320
- <success_criteria>
321
- - [ ] Template loaded from `~/.maestro/templates/workflows/` and validated
322
- - [ ] All required context variables bound
323
- - [ ] Session dir at `.workflow/.maestro/MCP-*/` with `state.json`
324
- - [ ] DAG nodes converted to waves (barrier=solo, non-barrier=parallel)
325
- - [ ] Every skill invocation goes through `spawn_agents_on_csv` — none in coordinator
326
- - [ ] Checkpoint nodes handled inline (state save, optional user pause)
327
- - [ ] Barrier artifacts read and context updated before next wave
328
- - [ ] Runtime references ({N-xxx.field}, {prev_*}) resolved before each wave CSV
329
- - [ ] Failed step → remaining marked skipped → abort reported
330
- - [ ] `--dry-run` shows wave plan with [BARRIER] markers, no execution
331
- - [ ] `-c` resumes from last completed wave
332
- - [ ] Completion report with per-wave status
333
- </success_criteria>
1
+ ---
2
+ name: maestro-player
3
+ description: Play workflow templates with checkpoint resume
4
+ argument-hint: "<template-slug|path> [--context key=value...] [-c [session-id]] [--list] [--dry-run]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Wave-based template executor via `spawn_agents_on_csv`. Load template bind variables → topological sort → group into barrier/non-barrier waves → spawn wave-by-wave → read results → report.
10
+
11
+ Session: `.workflow/.maestro/MCP-{YYYYMMDD-HHmmss}/state.json`
12
+ </purpose>
13
+
14
+ <invariants>
15
+ 1. **ALL skills via spawn_agents_on_csv**: Coordinator NEVER directly executes any skill
16
+ 2. **Coordinator = prompt assembler**: Load → resolve refs → build CSV → spawn → read results → next CSV
17
+ 3. **Barrier = solo wave**: Checkpoint + artifact-producing skills execute alone
18
+ 4. **Non-barriers can parallel**: Grouped into one wave
19
+ 5. **Wave-by-wave**: Never start N+1 before N results read
20
+ 6. **Coordinator owns context**: Sub-agents never read prior results — coordinator assembles full skill_call
21
+ 7. **Resume from wave**: `-c` finds last completed wave, resumes next
22
+ </invariants>
23
+
24
+ <context>
25
+ $ARGUMENTS — template slug/path, or flags.
26
+
27
+ **Flags**: `--context key=value` (repeatable), `-c [session-id]` (resume), `--list`, `--dry-run`
28
+
29
+ **Entry routing**:
30
+
31
+ | Condition | Handler |
32
+ |-----------|---------|
33
+ | `--list` or no args | Scan index.json, display templates |
34
+ | `-c [session-id]` | S_RESUME |
35
+ | Template slug/path | S_LOAD |
36
+
37
+ **Barrier nodes** (solo wave, coordinator reads artifacts after):
38
+
39
+ | Node type | Artifacts to read | Context updates |
40
+ |-----------|------------------|-----------------|
41
+ | checkpoint || last_checkpoint |
42
+ | maestro-plan | plan.json, .task/ | plan_dir, task_count |
43
+ | maestro-execute | results.csv | exec_status |
44
+ | maestro-analyze | context.md | analysis_dir, gaps |
45
+ | maestro-brainstorm | .brainstorming/ | brainstorm_dir |
46
+ | maestro-roadmap | specs/ | spec_session_id |
47
+
48
+ **state.json schema**:
49
+ ```json
50
+ {
51
+ "id": "MCP-<YYYYMMDD>-<HHmmss>",
52
+ "intent": "<template_name> with context",
53
+ "chain": "<template_id>",
54
+ "template_path": "<path>",
55
+ "auto_yes": false,
56
+ "status": "in_progress|paused|completed|aborted",
57
+ "context": { "goal": "...", "phase": null, "plan_dir": null, "last_checkpoint": null },
58
+ "waves": [],
59
+ "steps": [{
60
+ "step_n": 1, "node_id": "N-001", "skill": "<executor>",
61
+ "args": "<args_template>", "type": "skill|cli|checkpoint",
62
+ "is_barrier": true, "status": "pending|completed|failed|skipped",
63
+ "wave_n": null, "findings": null, "artifacts": null
64
+ }]
65
+ }
66
+ ```
67
+
68
+ **Runtime reference resolution** (before each wave CSV):
69
+ - `{key}` context[key]
70
+ - `{N-xxx.field}` → completed step with matching node_id
71
+ - `{prev_field}` most recently completed non-checkpoint step
72
+
73
+ **CSV schemas**:
74
+
75
+ wave-{N}.csv (input): `id,skill_call,topic`
76
+ wave-{N}-results.csv (output): from spawn_agents_on_csv result schema
77
+ </context>
78
+
79
+ <state_machine>
80
+
81
+ <states>
82
+ S_ROUTE — 入口路由 PERSIST: —
83
+ S_RESUME — 恢复 session PERSIST: —
84
+ S_LOAD — 加载模板、绑定变量 PERSIST:
85
+ S_INIT — 拓扑排序、分组 waves、创建 session PERSIST: state.json
86
+ S_WAVE_LOOP — 逐 wave 执行(核心循环) PERSIST: state.json (每 wave 更新)
87
+ S_COMPLETE — 标记完成、输出报告 PERSIST: state.json (final)
88
+ </states>
89
+
90
+ <transitions>
91
+
92
+ S_ROUTE:
93
+ → handleList WHEN: --list or no args
94
+ S_RESUME WHEN: -c flag
95
+ → S_LOAD WHEN: template provided
96
+
97
+ S_RESUME:
98
+ → S_WAVE_LOOP WHEN: session found DO: load state, resume from next pending wave
99
+ → ERROR(E005) WHEN: no session found
100
+
101
+ S_LOAD:
102
+ → S_INIT DO: A_LOAD_AND_BIND
103
+
104
+ S_INIT:
105
+ → END WHEN: --dry-run DO: display wave plan with [BARRIER] markers
106
+ → S_WAVE_LOOP DO: A_INIT_SESSION
107
+
108
+ S_WAVE_LOOP:
109
+ → S_WAVE_LOOP WHEN: wave completed, more pending DO: A_EXECUTE_WAVE → advance
110
+ → S_COMPLETE WHEN: all steps completed
111
+ → END WHEN: checkpoint pause DO: set status=paused
112
+ → END WHEN: wave failed DO: mark remaining skipped, set status=aborted
113
+ GUARD: checkpoint nodes → handle inline (no spawn), save snapshot, optional user pause
114
+
115
+ S_COMPLETE:
116
+ END DO: display per-wave results, set status=completed
117
+
118
+ </transitions>
119
+
120
+ <actions>
121
+
122
+ ### A_LOAD_AND_BIND
123
+
124
+ 1. Resolve template: absolute/relative/slug → index.json lookup
125
+ 2. Parse --context key=value, validate template JSON
126
+ 3. Collect missing required vars via AskUserQuestion
127
+ 4. Bind {variable} placeholders (leave {N-xxx.field}/{prev_*} for runtime)
128
+
129
+ ### A_INIT_SESSION
130
+
131
+ 1. Generate ID: MCP-{YYYYMMDD-HHmmss}
132
+ 2. Topological sort (Kahn's) → classify barrier vs non-barrier → group into waves
133
+ 3. Build steps array, write state.json
134
+ 4. Display wave plan (template, session, context, waves with [BARRIER] markers)
135
+
136
+ ### A_EXECUTE_WAVE
137
+
138
+ 1. **Checkpoint**: handle inline — save snapshot, update context.last_checkpoint, mark completed. If auto_continue==false: AskUserQuestion (Continue/Pause/Abort).
139
+
140
+ 2. **Skill nodes**: resolve runtime references → write wave-{N}.csv → spawn:
141
+ ```
142
+ spawn_agents_on_csv({
143
+ csv_path: "wave-{N}.csv", id_column: "id",
144
+ instruction: SUB_AGENT_INSTRUCTION,
145
+ max_workers: waveSteps.length, max_runtime_seconds: 3600,
146
+ output_csv_path: "wave-{N}-results.csv", output_schema: RESULT_SCHEMA
147
+ })
148
+ ```
149
+
150
+ 3. Read results update step status/findings/artifacts
151
+ 4. **Barrier analysis**: read artifacts, update context per barrier table
152
+ 5. Append wave record to state.waves[], persist state.json
153
+
154
+ ### SUB_AGENT_INSTRUCTION
155
+
156
+ ```
157
+ 你是 CSV job 子 agent。
158
+ 先原样执行技能调用:{skill_call}
159
+ 然后基于结果完成任务说明:{topic}
160
+ 限制:不要修改 .workflow/.maestro/ 下的 state 文件
161
+ 最后调用 report_agent_job_result,返回 JSON:
162
+ {"status":"completed|failed","skill_call":"...","summary":"一句话","artifacts":"路径或空","error":"原因或空"}
163
+ ```
164
+
165
+ ### RESULT_SCHEMA
166
+
167
+ ```json
168
+ { "status": "completed|failed", "skill_call": "", "summary": "", "artifacts": "", "error": "" }
169
+ ```
170
+
171
+ </actions>
172
+
173
+ </state_machine>
174
+
175
+ <error_codes>
176
+ | Code | Condition | Recovery |
177
+ |------|-----------|----------|
178
+ | E001 | Template not found | Show --list |
179
+ | E002 | Template JSON invalid | Point to file |
180
+ | E004 | DAG cycle | Suggest maestro-composer --edit |
181
+ | E005 | Resume session not found | List sessions |
182
+ | E007 | Barrier artifact not found | Retry once, then abort |
183
+ </error_codes>
184
+
185
+ <success_criteria>
186
+ - [ ] DAG nodes grouped into barrier (solo) / non-barrier (parallel) waves
187
+ - [ ] Every skill via spawn_agents_on_csv, none in coordinator
188
+ - [ ] Barrier artifacts read and context updated before next wave
189
+ - [ ] Failed step remaining skipped → abort reported
190
+ - [ ] -c resumes from last completed wave
191
+ </success_criteria>
@@ -51,6 +51,8 @@ Extract from arguments:
51
51
 
52
52
  Read `.workflow/state.json` and `.workflow/project.md` if they exist. If `.workflow/` does not exist, create minimal scratch structure anyway (quick works without full init).
53
53
 
54
+ Load coding specs + tools if available: `maestro spec load --category coding`. If the task involves frontend/UI work (description contains component, page, style, layout, CSS, HTML, frontend), also run `maestro spec load --category ui`. Browse wiki: `maestro wiki list --category coding`, load relevant entries via `maestro wiki load <id>`. All optional — proceed without if unavailable.
55
+
54
56
  ### Step 3: Create Scratch Directory
55
57
 
56
58
  Generate slug from task description (lowercase, hyphens, max 40 chars). Create `.workflow/scratch/{slug}/`. Write `config.json` with: `task`, `flags` (discuss, full), `created_at` (ISO), `status` ("active").