maestro-flow 0.3.38 → 0.3.40

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 (187) hide show
  1. package/.claude/agents/workflow-analyzer.md +2 -0
  2. package/.claude/agents/workflow-debugger.md +2 -0
  3. package/.claude/agents/workflow-executor.md +2 -0
  4. package/.claude/agents/workflow-integration-checker.md +1 -0
  5. package/.claude/agents/workflow-nyquist-auditor.md +1 -0
  6. package/.claude/agents/workflow-planner.md +2 -0
  7. package/.claude/agents/workflow-reviewer.md +2 -0
  8. package/.claude/agents/workflow-verifier.md +2 -0
  9. package/.claude/commands/learn-decompose.md +176 -176
  10. package/.claude/commands/learn-follow.md +167 -167
  11. package/.claude/commands/learn-investigate.md +221 -221
  12. package/.claude/commands/learn-retro.md +303 -303
  13. package/.claude/commands/learn-second-opinion.md +167 -167
  14. package/.claude/commands/maestro-amend.md +300 -300
  15. package/.claude/commands/maestro-analyze.md +130 -126
  16. package/.claude/commands/maestro-brainstorm.md +104 -100
  17. package/.claude/commands/maestro-composer.md +354 -354
  18. package/.claude/commands/maestro-execute.md +120 -114
  19. package/.claude/commands/maestro-fork.md +86 -86
  20. package/.claude/commands/maestro-init.md +78 -78
  21. package/.claude/commands/maestro-learn.md +140 -140
  22. package/.claude/commands/maestro-link-coordinate.md +1 -1
  23. package/.claude/commands/maestro-merge.md +61 -61
  24. package/.claude/commands/maestro-milestone-release.md +96 -96
  25. package/.claude/commands/maestro-overlay.md +178 -178
  26. package/.claude/commands/maestro-plan.md +154 -138
  27. package/.claude/commands/maestro-player.md +404 -404
  28. package/.claude/commands/maestro-quick.md +56 -56
  29. package/.claude/commands/maestro-ralph-execute.md +7 -18
  30. package/.claude/commands/maestro-ralph.md +48 -12
  31. package/.claude/commands/maestro-roadmap.md +1 -1
  32. package/.claude/commands/maestro-ui-design.md +93 -93
  33. package/.claude/commands/maestro-update.md +176 -176
  34. package/.claude/commands/maestro-verify.md +96 -90
  35. package/.claude/commands/maestro.md +121 -121
  36. package/.claude/commands/manage-codebase-rebuild.md +75 -75
  37. package/.claude/commands/manage-codebase-refresh.md +57 -57
  38. package/.claude/commands/manage-harvest.md +94 -94
  39. package/.claude/commands/manage-issue-discover.md +77 -77
  40. package/.claude/commands/manage-issue.md +73 -73
  41. package/.claude/commands/manage-knowhow-capture.md +193 -193
  42. package/.claude/commands/manage-knowhow.md +77 -77
  43. package/.claude/commands/manage-learn.md +67 -67
  44. package/.claude/commands/manage-status.md +51 -51
  45. package/.claude/commands/manage-wiki.md +62 -62
  46. package/.claude/commands/quality-auto-test.md +5 -1
  47. package/.claude/commands/quality-debug.md +125 -115
  48. package/.claude/commands/quality-refactor.md +55 -55
  49. package/.claude/commands/quality-retrospective.md +78 -78
  50. package/.claude/commands/quality-review.md +114 -108
  51. package/.claude/commands/quality-sync.md +51 -51
  52. package/.claude/commands/quality-test.md +107 -103
  53. package/.claude/commands/spec-add.md +49 -49
  54. package/.claude/commands/spec-load.md +51 -51
  55. package/.claude/commands/spec-remove.md +51 -51
  56. package/.claude/commands/spec-setup.md +51 -51
  57. package/.claude/commands/wiki-connect.md +62 -62
  58. package/.claude/commands/wiki-digest.md +69 -69
  59. package/.codex/skills/learn-decompose/SKILL.md +113 -113
  60. package/.codex/skills/learn-follow/SKILL.md +1 -1
  61. package/.codex/skills/learn-investigate/SKILL.md +83 -83
  62. package/.codex/skills/learn-retro/SKILL.md +83 -83
  63. package/.codex/skills/learn-second-opinion/SKILL.md +86 -86
  64. package/.codex/skills/maestro/SKILL.md +304 -304
  65. package/.codex/skills/maestro-analyze/SKILL.md +11 -3
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +451 -397
  67. package/.codex/skills/maestro-composer/SKILL.md +213 -213
  68. package/.codex/skills/maestro-execute/SKILL.md +346 -318
  69. package/.codex/skills/maestro-fork/SKILL.md +56 -2
  70. package/.codex/skills/maestro-init/SKILL.md +40 -16
  71. package/.codex/skills/maestro-learn/SKILL.md +80 -80
  72. package/.codex/skills/maestro-link-coordinate/SKILL.md +257 -257
  73. package/.codex/skills/maestro-merge/SKILL.md +1 -1
  74. package/.codex/skills/maestro-milestone-audit/SKILL.md +1 -1
  75. package/.codex/skills/maestro-milestone-complete/SKILL.md +40 -9
  76. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -70
  77. package/.codex/skills/maestro-overlay/SKILL.md +1 -1
  78. package/.codex/skills/maestro-plan/SKILL.md +29 -4
  79. package/.codex/skills/maestro-player/SKILL.md +323 -323
  80. package/.codex/skills/maestro-quick/SKILL.md +1 -1
  81. package/.codex/skills/maestro-ralph/SKILL.md +693 -578
  82. package/.codex/skills/maestro-roadmap/SKILL.md +518 -468
  83. package/.codex/skills/maestro-ui-design/SKILL.md +109 -12
  84. package/.codex/skills/maestro-verify/SKILL.md +27 -9
  85. package/.codex/skills/manage-codebase-rebuild/SKILL.md +3 -2
  86. package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
  87. package/.codex/skills/manage-harvest/SKILL.md +91 -91
  88. package/.codex/skills/manage-issue/SKILL.md +19 -6
  89. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  90. package/.codex/skills/manage-knowhow/SKILL.md +95 -95
  91. package/.codex/skills/manage-knowhow-capture/SKILL.md +110 -110
  92. package/.codex/skills/manage-learn/SKILL.md +1 -1
  93. package/.codex/skills/manage-status/SKILL.md +1 -1
  94. package/.codex/skills/manage-wiki/SKILL.md +55 -55
  95. package/.codex/skills/quality-auto-test/SKILL.md +553 -547
  96. package/.codex/skills/quality-debug/SKILL.md +345 -334
  97. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  98. package/.codex/skills/quality-retrospective/SKILL.md +292 -292
  99. package/.codex/skills/quality-review/SKILL.md +365 -364
  100. package/.codex/skills/quality-sync/SKILL.md +1 -1
  101. package/.codex/skills/quality-test/SKILL.md +507 -498
  102. package/.codex/skills/spec-add/SKILL.md +101 -101
  103. package/.codex/skills/spec-load/SKILL.md +77 -77
  104. package/.codex/skills/spec-map/SKILL.md +1 -1
  105. package/.codex/skills/spec-remove/SKILL.md +69 -69
  106. package/.codex/skills/spec-setup/SKILL.md +1 -1
  107. package/.codex/skills/team-coordinate/SKILL.md +2 -1
  108. package/.codex/skills/team-executor/SKILL.md +116 -115
  109. package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -1
  110. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +14 -6
  111. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +16 -4
  112. package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +7 -1
  113. package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +16 -4
  114. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +8 -2
  115. package/.codex/skills/team-quality-assurance/SKILL.md +2 -1
  116. package/.codex/skills/team-quality-assurance/roles/scout/role.md +9 -2
  117. package/.codex/skills/team-review/SKILL.md +2 -1
  118. package/.codex/skills/team-review/roles/reviewer/role.md +10 -1
  119. package/.codex/skills/team-review/roles/scanner/role.md +10 -1
  120. package/.codex/skills/team-tech-debt/SKILL.md +144 -143
  121. package/.codex/skills/team-tech-debt/roles/executor/role.md +9 -5
  122. package/.codex/skills/team-tech-debt/roles/scanner/role.md +10 -0
  123. package/.codex/skills/team-tech-debt/roles/validator/role.md +8 -2
  124. package/.codex/skills/team-testing/SKILL.md +2 -1
  125. package/.codex/skills/team-testing/roles/executor/role.md +8 -2
  126. package/.codex/skills/team-testing/roles/generator/role.md +8 -2
  127. package/.codex/skills/wiki-connect/SKILL.md +73 -73
  128. package/.codex/skills/wiki-digest/SKILL.md +87 -87
  129. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
  130. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  131. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +6 -0
  132. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  133. package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
  134. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
  135. package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
  136. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  137. package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
  138. package/dashboard/dist-server/src/commands/delegate.js +18 -0
  139. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  140. package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
  141. package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
  142. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  143. package/dist/shared/agent-types.d.ts +2 -0
  144. package/dist/shared/agent-types.d.ts.map +1 -1
  145. package/dist/src/agents/cli-agent-runner.d.ts +2 -0
  146. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  147. package/dist/src/agents/cli-agent-runner.js +4 -0
  148. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  149. package/dist/src/commands/config.d.ts.map +1 -1
  150. package/dist/src/commands/config.js +29 -1
  151. package/dist/src/commands/config.js.map +1 -1
  152. package/dist/src/commands/delegate.d.ts +2 -0
  153. package/dist/src/commands/delegate.d.ts.map +1 -1
  154. package/dist/src/commands/delegate.js +18 -0
  155. package/dist/src/commands/delegate.js.map +1 -1
  156. package/dist/src/commands/launcher.d.ts.map +1 -1
  157. package/dist/src/commands/launcher.js +27 -4
  158. package/dist/src/commands/launcher.js.map +1 -1
  159. package/dist/src/config/cli-tools-config.d.ts +6 -0
  160. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  161. package/dist/src/config/cli-tools-config.js +2 -0
  162. package/dist/src/config/cli-tools-config.js.map +1 -1
  163. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  164. package/dist/src/core/overlay/applier.js +65 -5
  165. package/dist/src/core/overlay/applier.js.map +1 -1
  166. package/dist/src/core/overlay/loader.d.ts.map +1 -1
  167. package/dist/src/core/overlay/loader.js +9 -4
  168. package/dist/src/core/overlay/loader.js.map +1 -1
  169. package/dist/src/core/overlay/types.d.ts +2 -0
  170. package/dist/src/core/overlay/types.d.ts.map +1 -1
  171. package/dist/src/core/overlay/types.js +2 -0
  172. package/dist/src/core/overlay/types.js.map +1 -1
  173. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
  174. package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
  175. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
  176. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
  177. package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
  178. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
  179. package/package.json +1 -1
  180. package/shared/agent-types.ts +2 -0
  181. package/workflows/analyze.md +24 -2
  182. package/workflows/auto-test.md +12 -0
  183. package/workflows/brainstorm.md +11 -1
  184. package/workflows/debug.md +13 -4
  185. package/workflows/delegate-protocol.codex.md +65 -0
  186. package/workflows/plan.md +14 -4
  187. package/workflows/test.md +10 -0
@@ -1,354 +1,354 @@
1
- ---
2
- name: maestro-composer
3
- description: Semantic workflow composer parse natural language into DAG of skill/CLI/agent nodes, auto-inject checkpoints, persist as reusable JSON template
4
- argument-hint: "\"workflow description\" [--resume] [--edit <template-path>]"
5
- allowed-tools:
6
- - Read
7
- - Write
8
- - Edit
9
- - Bash
10
- - Glob
11
- - Grep
12
- - Agent
13
- - AskUserQuestion
14
- ---
15
- <purpose>
16
- Interactive workflow template composer. Parses natural language into a reusable DAG template
17
- via 5 phases with user confirmation at each boundary. Templates saved globally at
18
- `~/.maestro/templates/workflows/`. Progressive disclosure — specs loaded only when phase needs them.
19
-
20
- Three entry modes:
21
- 1. **New design**: Parse → [confirm] → Resolve → [confirm] → Enrich → Confirm pipeline → Persist
22
- 2. **Resume design**: Load in-progress draft from `.workflow/templates/design-drafts/`
23
- 3. **Edit template**: Load existing template, modify, re-save
24
- </purpose>
25
-
26
- <deferred_reading>
27
- - [node-catalog](~/.maestro/templates/workflows/specs/node-catalog.md) — read at Phase 2 (Resolve) when mapping steps to executors
28
- - [template-schema](~/.maestro/templates/workflows/specs/template-schema.md) — read at Phase 5 (Persist) when assembling final JSON
29
- </deferred_reading>
30
-
31
- <context>
32
- $ARGUMENTS — natural language workflow description, or flags.
33
-
34
- **Flags:**
35
- - `--resume` — Resume in-progress design session
36
- - `--edit <template-path>` — Edit an existing template
37
-
38
- **Shared constants:**
39
-
40
- | Constant | Value |
41
- |----------|-------|
42
- | Session prefix | `WFD` |
43
- | Template dir (global) | `~/.maestro/templates/workflows/` |
44
- | Template index (global) | `~/.maestro/templates/workflows/index.json` |
45
- | Design drafts dir (local) | `.workflow/templates/design-drafts/` |
46
- | Template ID format | `wft-<slug>-<YYYYMMDD>` |
47
- | Node ID format | `N-<seq>` (e.g. N-001), `CP-<seq>` for checkpoints |
48
- | Max nodes | 20 |
49
-
50
- **Entry routing:**
51
-
52
- | Detection | Condition | Handler |
53
- |-----------|-----------|---------|
54
- | Resume design | `--resume` flag or existing WFD session | Phase 0: Resume |
55
- | Edit template | `--edit <template-path>` | Phase 0: Load + Edit |
56
- | New design | Default | Phase 1: Parse |
57
- </context>
58
-
59
- <execution>
60
-
61
- ### Phase 0: Resume / Edit (conditional)
62
-
63
- **Resume design session** (if `--resume`):
64
- 1. Scan `.workflow/templates/design-drafts/WFD-*/` for in-progress designs
65
- 2. Multiple found → AskUserQuestion for selection
66
- 3. Load draft → skip to last incomplete phase
67
-
68
- **Edit existing template** (if `--edit <path>`):
69
- 1. Load template from `--edit` path
70
- 2. Show current pipeline visualization (Phase 4 format)
71
- 3. AskUserQuestion: which nodes to modify/add/remove
72
- 4. Re-enter at Phase 3 with edits applied
73
-
74
- ---
75
-
76
- ### Phase 1: Parse — Semantic Intent Extraction
77
-
78
- **Step 1.1** — Parse `$ARGUMENTS` as description. If empty, AskUserQuestion:
79
- ```
80
- "Describe the workflow you want to automate.
81
- Include: what steps to run, in what order, and what varies each time (inputs).
82
- Example: 'analyze the code, then plan, implement, and test the feature'"
83
- ```
84
-
85
- **Step 1.2** — Extract sequential actions as candidate nodes using semantic understanding:
86
-
87
- | Signal | Candidate Type |
88
- |--------|---------------|
89
- | "analyze", "review", "explore" | analysis (cli) |
90
- | "plan", "design", "spec" | planning (skill) |
91
- | "implement", "build", "code", "fix" | execution (skill) |
92
- | "test", "validate", "verify" | testing (skill) |
93
- | "brainstorm", "ideate" | brainstorm (skill) |
94
- | "review code" | review (skill) |
95
- | "then", "next", "after" | sequential edge |
96
- | "parallel", "simultaneously" | parallel edge |
97
-
98
- **Step 1.3** — Extract variables (inputs that vary per run). Detect from: direct mentions, `{var}` patterns, implicit from task type.
99
-
100
- **Step 1.4** — Classify task type: `bugfix | feature | tdd | review | brainstorm | spec-driven | roadmap | refactor | auto-test | quick-task | custom`
101
-
102
- **Step 1.5** — Assess complexity: `simple` (1-3 nodes), `medium` (4-7), `complex` (8+)
103
-
104
- **Step 1.6** — Write `intent.json` to `.workflow/templates/design-drafts/WFD-<slug>-<date>/`.
105
-
106
- **Step 1.7 — Interactive confirmation**:
107
-
108
- Display parsed intent summary:
109
- ```
110
- ============================================================
111
- COMPOSER — Intent Parsed
112
- ============================================================
113
- Description: "<original input>"
114
- Task type: <type>
115
- Complexity: <level>
116
-
117
- Detected steps:
118
- 1. <description> → <type_hint>
119
- 2. <description> → <type_hint>
120
- 3. <description> → <type_hint>
121
-
122
- Variables:
123
- - goal (required): <inferred description>
124
-
125
- Draft: .workflow/templates/design-drafts/WFD-<slug>-<date>/
126
- ============================================================
127
- ```
128
-
129
- AskUserQuestion:
130
- ```
131
- options:
132
- - "Looks good, continue to resolution" → Phase 2
133
- - "Edit steps" → re-describe, re-parse
134
- - "Add a step" → append, re-parse
135
- - "Cancel" → save draft, exit
136
- ```
137
-
138
- ---
139
-
140
- ### Phase 2: Resolve — Map Steps to Executor Nodes
141
-
142
- **Read deferred**: `~/.maestro/templates/workflows/specs/node-catalog.md` — load node catalog for executor mapping.
143
-
144
- If the spec file does not exist, use the built-in fallback mapping:
145
-
146
- | type_hint | Default executor type | Default executor |
147
- |-----------|----------------------|------------------|
148
- | `planning` | skill | `maestro-plan` |
149
- | `execution` | skill | `maestro-execute` |
150
- | `testing` | skill | `quality-test` |
151
- | `review` | skill | `quality-review` |
152
- | `brainstorm` | skill | `maestro-brainstorm` |
153
- | `analysis` | cli | `maestro delegate --role analyze --mode analysis` |
154
- | `verify` | skill | `maestro-verify` |
155
- | `refactor` | skill | `quality-refactor` |
156
- | `debug` | skill | `quality-debug` |
157
- | `spec` | skill | `maestro-roadmap --mode full` |
158
- | `checkpoint` | checkpoint | — |
159
-
160
- **Step 2.1** — Load `intent.json`.
161
-
162
- **Step 2.2** — Map each step to executor. Resolution: match `type_hint` → catalog → semantic fit → fallback `cli`.
163
-
164
- **Step 2.3** — Build `args_template` with variable placeholders. Context injection:
165
- - Planning after analysis → `--context {prev_output_path}`
166
- - Execution after planning → `--resume-session {prev_session_id}`
167
- - Testing after execution → `--session {prev_session_id}`
168
-
169
- **Step 2.4** — Assign `parallel_group` for steps with `parallel_with` set.
170
-
171
- **Step 2.5** — Write `nodes.json`.
172
-
173
- **Step 2.6 — Interactive confirmation**:
174
-
175
- Display resolved nodes:
176
- ```
177
- ============================================================
178
- COMPOSER — Nodes Resolved
179
- ============================================================
180
- N-001 [skill] maestro-plan "{goal}"
181
- N-002 [skill] maestro-execute {phase}
182
- N-003 [skill] quality-test {phase}
183
-
184
- Parallel groups: none
185
- ============================================================
186
- ```
187
-
188
- AskUserQuestion:
189
- ```
190
- options:
191
- - "Continue to checkpoint injection" → Phase 3
192
- - "Change executor for a node" → select node, pick new executor
193
- - "Change node type" → skill/cli/agent/command
194
- - "Back to intent" → Phase 1
195
- - "Cancel" → save draft, exit
196
- ```
197
-
198
- ---
199
-
200
- ### Phase 3: Enrich — Inject Checkpoints + Build DAG
201
-
202
- **Step 3.1** — Load `nodes.json`.
203
-
204
- **Step 3.2** — Build sequential edges (N-001 → N-002 → ...). For parallel groups: fan-out/fan-in.
205
-
206
- **Step 3.3** — Auto-inject checkpoint nodes. Inject if ANY rule triggers:
207
-
208
- | Rule | Condition |
209
- |------|-----------|
210
- | Artifact boundary | Source output_ports: plan, spec, analysis, review-findings |
211
- | Execution gate | Target executor contains `execute` |
212
- | Agent spawn | Target type is `agent` |
213
- | Long-running | Target is maestro-plan, maestro-roadmap --mode full |
214
- | User-defined | Step had `type_hint: checkpoint` |
215
- | Post-testing | Source executor contains `test` or `auto-test` |
216
-
217
- Set `auto_continue: false` for checkpoints before user-facing deliverables.
218
-
219
- **Step 3.4** — Insert checkpoint edges (A → B becomes A → CP-X → B).
220
-
221
- **Step 3.5** — Finalize `context_schema` from all `{variable}` references.
222
-
223
- **Step 3.6** — Validate: no cycles, no orphans, all nodes reachable.
224
-
225
- **Step 3.7** — Write `dag.json`.
226
-
227
- → Proceed directly to Phase 4 (confirm is the pipeline visualization).
228
-
229
- ---
230
-
231
- ### Phase 4: Confirm — Visualize + User Approval
232
-
233
- **Step 4.1** — Render ASCII pipeline from `dag.json`:
234
- ```
235
- ============================================================
236
- COMPOSER — Pipeline Review
237
- ============================================================
238
- Pipeline: <template-name>
239
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
240
- N-001 [skill] maestro-plan "{goal}"
241
- |
242
- CP-01 [checkpoint] After Plan auto-continue
243
- |
244
- N-002 [skill] maestro-execute {phase}
245
- |
246
- CP-02 [checkpoint] Before Tests pause-for-user
247
- |
248
- N-003 [skill] quality-test {phase}
249
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
250
- Variables (required): goal
251
- Checkpoints: 2 (1 auto, 1 pause)
252
- Nodes: 3 work + 2 checkpoints
253
- ============================================================
254
- ```
255
-
256
- For parallel groups show fan-out/fan-in:
257
- ```
258
- N-003a [skill] quality-review ─┐
259
- ├─ N-004 [skill] quality-test
260
- N-003b [cli] cli analysis ─┘
261
- ```
262
-
263
- **Step 4.2** — AskUserQuestion:
264
- ```
265
- options:
266
- - "Confirm & Save" → Phase 5
267
- - "Edit a node" → select node ID, modify executor/args, re-render
268
- - "Add a node" → insert position + description, re-resolve + re-enrich, re-render
269
- - "Remove a node" → select node, re-wire edges, re-render
270
- - "Rename template" → new name
271
- - "Re-run checkpoint injection" → back to Phase 3.3
272
- - "Cancel" → save draft, output resume command
273
- ```
274
-
275
- **Step 4.3** — On edit: apply change, re-render, re-ask. Loop until Confirm or Cancel.
276
-
277
- **Step 4.4** — On Confirm: freeze dag.json, proceed to Phase 5. On Cancel: save draft, output `/maestro-composer --resume`.
278
-
279
- ---
280
-
281
- ### Phase 5: Persist — Assemble + Save Template
282
-
283
- **Read deferred**: `~/.maestro/templates/workflows/specs/template-schema.md` — load full JSON schema for template assembly.
284
-
285
- If the spec file does not exist, use the built-in template structure:
286
- ```json
287
- {
288
- "template_id": "wft-<slug>-<YYYYMMDD>",
289
- "name": "<name>", "description": "<desc>", "version": "1.0",
290
- "created_at": "<ISO>", "source_session": "WFD-<slug>-<date>",
291
- "tags": [], "context_schema": {},
292
- "nodes": [], "edges": [], "checkpoints": [],
293
- "execution_mode": "serial",
294
- "metadata": { "node_count": 0, "checkpoint_count": 0 }
295
- }
296
- ```
297
-
298
- **Step 5.1** — Load `intent.json` + `dag.json`.
299
-
300
- **Step 5.2** — Determine template name (from Phase 4 or derive from task_type + description). Slug = kebab-case. If file exists with different content, append `-v2`, `-v3`.
301
-
302
- **Step 5.3** — Assemble template JSON.
303
-
304
- **Step 5.4** — Ensure `~/.maestro/templates/workflows/` exists. Write `<slug>.json`.
305
-
306
- **Step 5.5** — Update `~/.maestro/templates/workflows/index.json`.
307
-
308
- **Step 5.6** — Output summary:
309
- ```
310
- ============================================================
311
- COMPOSER — Template Saved
312
- ============================================================
313
- Path: ~/.maestro/templates/workflows/<slug>.json
314
- ID: wft-<slug>-<date>
315
- Nodes: <n> work + <n> checkpoints
316
- Variables: <required vars>
317
-
318
- To execute:
319
- /maestro-player <slug> --context goal="<your goal>"
320
-
321
- To edit later:
322
- /maestro-composer --edit ~/.maestro/templates/workflows/<slug>.json
323
-
324
- To list all templates:
325
- /maestro-player --list
326
- ============================================================
327
- ```
328
-
329
- **Step 5.7** — Clean up design draft directory.
330
- </execution>
331
-
332
- <error_codes>
333
- | Code | Severity | Description | Recovery |
334
- |------|----------|-------------|----------|
335
- | E001 | error | Empty description and no flags | AskUserQuestion for workflow description |
336
- | E002 | error | Step extraction found 0 steps | Ask user to rephrase with action verbs |
337
- | E003 | error | Node count exceeds max (20) | Suggest splitting into sub-workflows |
338
- | E004 | error | DAG cycle detected | Show cycle, ask user to resolve |
339
- | E005 | error | Resume session not found | Show available design drafts |
340
- | E006 | error | Edit template not found | Show available templates |
341
- | W001 | warning | Ambiguous step-to-executor mapping | Show candidates, let user choose |
342
- | W002 | warning | No checkpoint injection rules triggered | Warn user, offer to add manually |
343
- | W003 | warning | Deferred spec file not found | Use built-in fallback, continue |
344
- </error_codes>
345
-
346
- <success_criteria>
347
- - [ ] Intent parsed and confirmed by user (Phase 1 interactive gate)
348
- - [ ] Nodes resolved and confirmed by user (Phase 2 interactive gate)
349
- - [ ] DAG built with auto-injected checkpoints
350
- - [ ] Pipeline visualized and confirmed by user (Phase 4 interactive gate)
351
- - [ ] Template JSON written to `~/.maestro/templates/workflows/<slug>.json`
352
- - [ ] Template index updated at `~/.maestro/templates/workflows/index.json`
353
- - [ ] Deferred specs loaded only when phase needs them (not upfront)
354
- </success_criteria>
1
+ ---
2
+ name: maestro-composer
3
+ description: Compose reusable workflow templates from natural language
4
+ argument-hint: "\"workflow description\" [--resume] [--edit <template-path>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Interactive workflow template composer. Parses natural language into a reusable DAG template
17
+ via 5 phases with user confirmation at each boundary. Templates saved globally at
18
+ `~/.maestro/templates/workflows/`. Progressive disclosure — specs loaded only when phase needs them.
19
+
20
+ Three entry modes:
21
+ 1. **New design**: Parse → [confirm] → Resolve → [confirm] → Enrich → Confirm pipeline → Persist
22
+ 2. **Resume design**: Load in-progress draft from `.workflow/templates/design-drafts/`
23
+ 3. **Edit template**: Load existing template, modify, re-save
24
+ </purpose>
25
+
26
+ <deferred_reading>
27
+ - [node-catalog](~/.maestro/templates/workflows/specs/node-catalog.md) — read at Phase 2 (Resolve) when mapping steps to executors
28
+ - [template-schema](~/.maestro/templates/workflows/specs/template-schema.md) — read at Phase 5 (Persist) when assembling final JSON
29
+ </deferred_reading>
30
+
31
+ <context>
32
+ $ARGUMENTS — natural language workflow description, or flags.
33
+
34
+ **Flags:**
35
+ - `--resume` — Resume in-progress design session
36
+ - `--edit <template-path>` — Edit an existing template
37
+
38
+ **Shared constants:**
39
+
40
+ | Constant | Value |
41
+ |----------|-------|
42
+ | Session prefix | `WFD` |
43
+ | Template dir (global) | `~/.maestro/templates/workflows/` |
44
+ | Template index (global) | `~/.maestro/templates/workflows/index.json` |
45
+ | Design drafts dir (local) | `.workflow/templates/design-drafts/` |
46
+ | Template ID format | `wft-<slug>-<YYYYMMDD>` |
47
+ | Node ID format | `N-<seq>` (e.g. N-001), `CP-<seq>` for checkpoints |
48
+ | Max nodes | 20 |
49
+
50
+ **Entry routing:**
51
+
52
+ | Detection | Condition | Handler |
53
+ |-----------|-----------|---------|
54
+ | Resume design | `--resume` flag or existing WFD session | Phase 0: Resume |
55
+ | Edit template | `--edit <template-path>` | Phase 0: Load + Edit |
56
+ | New design | Default | Phase 1: Parse |
57
+ </context>
58
+
59
+ <execution>
60
+
61
+ ### Phase 0: Resume / Edit (conditional)
62
+
63
+ **Resume design session** (if `--resume`):
64
+ 1. Scan `.workflow/templates/design-drafts/WFD-*/` for in-progress designs
65
+ 2. Multiple found → AskUserQuestion for selection
66
+ 3. Load draft → skip to last incomplete phase
67
+
68
+ **Edit existing template** (if `--edit <path>`):
69
+ 1. Load template from `--edit` path
70
+ 2. Show current pipeline visualization (Phase 4 format)
71
+ 3. AskUserQuestion: which nodes to modify/add/remove
72
+ 4. Re-enter at Phase 3 with edits applied
73
+
74
+ ---
75
+
76
+ ### Phase 1: Parse — Semantic Intent Extraction
77
+
78
+ **Step 1.1** — Parse `$ARGUMENTS` as description. If empty, AskUserQuestion:
79
+ ```
80
+ "Describe the workflow you want to automate.
81
+ Include: what steps to run, in what order, and what varies each time (inputs).
82
+ Example: 'analyze the code, then plan, implement, and test the feature'"
83
+ ```
84
+
85
+ **Step 1.2** — Extract sequential actions as candidate nodes using semantic understanding:
86
+
87
+ | Signal | Candidate Type |
88
+ |--------|---------------|
89
+ | "analyze", "review", "explore" | analysis (cli) |
90
+ | "plan", "design", "spec" | planning (skill) |
91
+ | "implement", "build", "code", "fix" | execution (skill) |
92
+ | "test", "validate", "verify" | testing (skill) |
93
+ | "brainstorm", "ideate" | brainstorm (skill) |
94
+ | "review code" | review (skill) |
95
+ | "then", "next", "after" | sequential edge |
96
+ | "parallel", "simultaneously" | parallel edge |
97
+
98
+ **Step 1.3** — Extract variables (inputs that vary per run). Detect from: direct mentions, `{var}` patterns, implicit from task type.
99
+
100
+ **Step 1.4** — Classify task type: `bugfix | feature | tdd | review | brainstorm | spec-driven | roadmap | refactor | auto-test | quick-task | custom`
101
+
102
+ **Step 1.5** — Assess complexity: `simple` (1-3 nodes), `medium` (4-7), `complex` (8+)
103
+
104
+ **Step 1.6** — Write `intent.json` to `.workflow/templates/design-drafts/WFD-<slug>-<date>/`.
105
+
106
+ **Step 1.7 — Interactive confirmation**:
107
+
108
+ Display parsed intent summary:
109
+ ```
110
+ ============================================================
111
+ COMPOSER — Intent Parsed
112
+ ============================================================
113
+ Description: "<original input>"
114
+ Task type: <type>
115
+ Complexity: <level>
116
+
117
+ Detected steps:
118
+ 1. <description> → <type_hint>
119
+ 2. <description> → <type_hint>
120
+ 3. <description> → <type_hint>
121
+
122
+ Variables:
123
+ - goal (required): <inferred description>
124
+
125
+ Draft: .workflow/templates/design-drafts/WFD-<slug>-<date>/
126
+ ============================================================
127
+ ```
128
+
129
+ AskUserQuestion:
130
+ ```
131
+ options:
132
+ - "Looks good, continue to resolution" → Phase 2
133
+ - "Edit steps" → re-describe, re-parse
134
+ - "Add a step" → append, re-parse
135
+ - "Cancel" → save draft, exit
136
+ ```
137
+
138
+ ---
139
+
140
+ ### Phase 2: Resolve — Map Steps to Executor Nodes
141
+
142
+ **Read deferred**: `~/.maestro/templates/workflows/specs/node-catalog.md` — load node catalog for executor mapping.
143
+
144
+ If the spec file does not exist, use the built-in fallback mapping:
145
+
146
+ | type_hint | Default executor type | Default executor |
147
+ |-----------|----------------------|------------------|
148
+ | `planning` | skill | `maestro-plan` |
149
+ | `execution` | skill | `maestro-execute` |
150
+ | `testing` | skill | `quality-test` |
151
+ | `review` | skill | `quality-review` |
152
+ | `brainstorm` | skill | `maestro-brainstorm` |
153
+ | `analysis` | cli | `maestro delegate --role analyze --mode analysis` |
154
+ | `verify` | skill | `maestro-verify` |
155
+ | `refactor` | skill | `quality-refactor` |
156
+ | `debug` | skill | `quality-debug` |
157
+ | `spec` | skill | `maestro-roadmap --mode full` |
158
+ | `checkpoint` | checkpoint | — |
159
+
160
+ **Step 2.1** — Load `intent.json`.
161
+
162
+ **Step 2.2** — Map each step to executor. Resolution: match `type_hint` → catalog → semantic fit → fallback `cli`.
163
+
164
+ **Step 2.3** — Build `args_template` with variable placeholders. Context injection:
165
+ - Planning after analysis → `--context {prev_output_path}`
166
+ - Execution after planning → `--resume-session {prev_session_id}`
167
+ - Testing after execution → `--session {prev_session_id}`
168
+
169
+ **Step 2.4** — Assign `parallel_group` for steps with `parallel_with` set.
170
+
171
+ **Step 2.5** — Write `nodes.json`.
172
+
173
+ **Step 2.6 — Interactive confirmation**:
174
+
175
+ Display resolved nodes:
176
+ ```
177
+ ============================================================
178
+ COMPOSER — Nodes Resolved
179
+ ============================================================
180
+ N-001 [skill] maestro-plan "{goal}"
181
+ N-002 [skill] maestro-execute {phase}
182
+ N-003 [skill] quality-test {phase}
183
+
184
+ Parallel groups: none
185
+ ============================================================
186
+ ```
187
+
188
+ AskUserQuestion:
189
+ ```
190
+ options:
191
+ - "Continue to checkpoint injection" → Phase 3
192
+ - "Change executor for a node" → select node, pick new executor
193
+ - "Change node type" → skill/cli/agent/command
194
+ - "Back to intent" → Phase 1
195
+ - "Cancel" → save draft, exit
196
+ ```
197
+
198
+ ---
199
+
200
+ ### Phase 3: Enrich — Inject Checkpoints + Build DAG
201
+
202
+ **Step 3.1** — Load `nodes.json`.
203
+
204
+ **Step 3.2** — Build sequential edges (N-001 → N-002 → ...). For parallel groups: fan-out/fan-in.
205
+
206
+ **Step 3.3** — Auto-inject checkpoint nodes. Inject if ANY rule triggers:
207
+
208
+ | Rule | Condition |
209
+ |------|-----------|
210
+ | Artifact boundary | Source output_ports: plan, spec, analysis, review-findings |
211
+ | Execution gate | Target executor contains `execute` |
212
+ | Agent spawn | Target type is `agent` |
213
+ | Long-running | Target is maestro-plan, maestro-roadmap --mode full |
214
+ | User-defined | Step had `type_hint: checkpoint` |
215
+ | Post-testing | Source executor contains `test` or `auto-test` |
216
+
217
+ Set `auto_continue: false` for checkpoints before user-facing deliverables.
218
+
219
+ **Step 3.4** — Insert checkpoint edges (A → B becomes A → CP-X → B).
220
+
221
+ **Step 3.5** — Finalize `context_schema` from all `{variable}` references.
222
+
223
+ **Step 3.6** — Validate: no cycles, no orphans, all nodes reachable.
224
+
225
+ **Step 3.7** — Write `dag.json`.
226
+
227
+ → Proceed directly to Phase 4 (confirm is the pipeline visualization).
228
+
229
+ ---
230
+
231
+ ### Phase 4: Confirm — Visualize + User Approval
232
+
233
+ **Step 4.1** — Render ASCII pipeline from `dag.json`:
234
+ ```
235
+ ============================================================
236
+ COMPOSER — Pipeline Review
237
+ ============================================================
238
+ Pipeline: <template-name>
239
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
240
+ N-001 [skill] maestro-plan "{goal}"
241
+ |
242
+ CP-01 [checkpoint] After Plan auto-continue
243
+ |
244
+ N-002 [skill] maestro-execute {phase}
245
+ |
246
+ CP-02 [checkpoint] Before Tests pause-for-user
247
+ |
248
+ N-003 [skill] quality-test {phase}
249
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
250
+ Variables (required): goal
251
+ Checkpoints: 2 (1 auto, 1 pause)
252
+ Nodes: 3 work + 2 checkpoints
253
+ ============================================================
254
+ ```
255
+
256
+ For parallel groups show fan-out/fan-in:
257
+ ```
258
+ N-003a [skill] quality-review ─┐
259
+ ├─ N-004 [skill] quality-test
260
+ N-003b [cli] cli analysis ─┘
261
+ ```
262
+
263
+ **Step 4.2** — AskUserQuestion:
264
+ ```
265
+ options:
266
+ - "Confirm & Save" → Phase 5
267
+ - "Edit a node" → select node ID, modify executor/args, re-render
268
+ - "Add a node" → insert position + description, re-resolve + re-enrich, re-render
269
+ - "Remove a node" → select node, re-wire edges, re-render
270
+ - "Rename template" → new name
271
+ - "Re-run checkpoint injection" → back to Phase 3.3
272
+ - "Cancel" → save draft, output resume command
273
+ ```
274
+
275
+ **Step 4.3** — On edit: apply change, re-render, re-ask. Loop until Confirm or Cancel.
276
+
277
+ **Step 4.4** — On Confirm: freeze dag.json, proceed to Phase 5. On Cancel: save draft, output `/maestro-composer --resume`.
278
+
279
+ ---
280
+
281
+ ### Phase 5: Persist — Assemble + Save Template
282
+
283
+ **Read deferred**: `~/.maestro/templates/workflows/specs/template-schema.md` — load full JSON schema for template assembly.
284
+
285
+ If the spec file does not exist, use the built-in template structure:
286
+ ```json
287
+ {
288
+ "template_id": "wft-<slug>-<YYYYMMDD>",
289
+ "name": "<name>", "description": "<desc>", "version": "1.0",
290
+ "created_at": "<ISO>", "source_session": "WFD-<slug>-<date>",
291
+ "tags": [], "context_schema": {},
292
+ "nodes": [], "edges": [], "checkpoints": [],
293
+ "execution_mode": "serial",
294
+ "metadata": { "node_count": 0, "checkpoint_count": 0 }
295
+ }
296
+ ```
297
+
298
+ **Step 5.1** — Load `intent.json` + `dag.json`.
299
+
300
+ **Step 5.2** — Determine template name (from Phase 4 or derive from task_type + description). Slug = kebab-case. If file exists with different content, append `-v2`, `-v3`.
301
+
302
+ **Step 5.3** — Assemble template JSON.
303
+
304
+ **Step 5.4** — Ensure `~/.maestro/templates/workflows/` exists. Write `<slug>.json`.
305
+
306
+ **Step 5.5** — Update `~/.maestro/templates/workflows/index.json`.
307
+
308
+ **Step 5.6** — Output summary:
309
+ ```
310
+ ============================================================
311
+ COMPOSER — Template Saved
312
+ ============================================================
313
+ Path: ~/.maestro/templates/workflows/<slug>.json
314
+ ID: wft-<slug>-<date>
315
+ Nodes: <n> work + <n> checkpoints
316
+ Variables: <required vars>
317
+
318
+ To execute:
319
+ /maestro-player <slug> --context goal="<your goal>"
320
+
321
+ To edit later:
322
+ /maestro-composer --edit ~/.maestro/templates/workflows/<slug>.json
323
+
324
+ To list all templates:
325
+ /maestro-player --list
326
+ ============================================================
327
+ ```
328
+
329
+ **Step 5.7** — Clean up design draft directory.
330
+ </execution>
331
+
332
+ <error_codes>
333
+ | Code | Severity | Description | Recovery |
334
+ |------|----------|-------------|----------|
335
+ | E001 | error | Empty description and no flags | AskUserQuestion for workflow description |
336
+ | E002 | error | Step extraction found 0 steps | Ask user to rephrase with action verbs |
337
+ | E003 | error | Node count exceeds max (20) | Suggest splitting into sub-workflows |
338
+ | E004 | error | DAG cycle detected | Show cycle, ask user to resolve |
339
+ | E005 | error | Resume session not found | Show available design drafts |
340
+ | E006 | error | Edit template not found | Show available templates |
341
+ | W001 | warning | Ambiguous step-to-executor mapping | Show candidates, let user choose |
342
+ | W002 | warning | No checkpoint injection rules triggered | Warn user, offer to add manually |
343
+ | W003 | warning | Deferred spec file not found | Use built-in fallback, continue |
344
+ </error_codes>
345
+
346
+ <success_criteria>
347
+ - [ ] Intent parsed and confirmed by user (Phase 1 interactive gate)
348
+ - [ ] Nodes resolved and confirmed by user (Phase 2 interactive gate)
349
+ - [ ] DAG built with auto-injected checkpoints
350
+ - [ ] Pipeline visualized and confirmed by user (Phase 4 interactive gate)
351
+ - [ ] Template JSON written to `~/.maestro/templates/workflows/<slug>.json`
352
+ - [ ] Template index updated at `~/.maestro/templates/workflows/index.json`
353
+ - [ ] Deferred specs loaded only when phase needs them (not upfront)
354
+ </success_criteria>