maestro-flow 0.3.37 → 0.3.39

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 (186) 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 +126 -126
  16. package/.claude/commands/maestro-brainstorm.md +100 -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 +150 -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 +9 -3
  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 +1 -1
  47. package/.claude/commands/quality-debug.md +121 -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 +103 -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 +9 -8
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +442 -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 +19 -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 +681 -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 +547 -547
  96. package/.codex/skills/quality-debug/SKILL.md +339 -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 +498 -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/README.md +6 -0
  130. package/README.zh-CN.md +6 -0
  131. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
  132. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  133. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +118 -7
  134. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  135. package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
  136. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
  137. package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
  138. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  139. package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
  140. package/dashboard/dist-server/src/commands/delegate.js +18 -0
  141. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  142. package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
  143. package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
  144. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  145. package/dist/shared/agent-types.d.ts +2 -0
  146. package/dist/shared/agent-types.d.ts.map +1 -1
  147. package/dist/src/agents/cli-agent-runner.d.ts +2 -0
  148. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  149. package/dist/src/agents/cli-agent-runner.js +4 -0
  150. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  151. package/dist/src/commands/config.d.ts.map +1 -1
  152. package/dist/src/commands/config.js +29 -1
  153. package/dist/src/commands/config.js.map +1 -1
  154. package/dist/src/commands/delegate.d.ts +2 -0
  155. package/dist/src/commands/delegate.d.ts.map +1 -1
  156. package/dist/src/commands/delegate.js +18 -0
  157. package/dist/src/commands/delegate.js.map +1 -1
  158. package/dist/src/commands/launcher.d.ts.map +1 -1
  159. package/dist/src/commands/launcher.js +27 -4
  160. package/dist/src/commands/launcher.js.map +1 -1
  161. package/dist/src/config/cli-tools-config.d.ts +6 -0
  162. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  163. package/dist/src/config/cli-tools-config.js +2 -0
  164. package/dist/src/config/cli-tools-config.js.map +1 -1
  165. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  166. package/dist/src/core/overlay/applier.js +65 -5
  167. package/dist/src/core/overlay/applier.js.map +1 -1
  168. package/dist/src/core/overlay/loader.d.ts.map +1 -1
  169. package/dist/src/core/overlay/loader.js +9 -4
  170. package/dist/src/core/overlay/loader.js.map +1 -1
  171. package/dist/src/core/overlay/types.d.ts +2 -0
  172. package/dist/src/core/overlay/types.d.ts.map +1 -1
  173. package/dist/src/core/overlay/types.js +2 -0
  174. package/dist/src/core/overlay/types.js.map +1 -1
  175. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
  176. package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
  177. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
  178. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
  179. package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
  180. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
  181. package/package.json +1 -1
  182. package/shared/agent-types.ts +2 -0
  183. package/workflows/delegate-protocol.codex.md +65 -0
  184. package/workflows/issue-analyze.md +2 -3
  185. package/workflows/issue-gaps-analyze.codex.md +260 -0
  186. package/workflows/issue-gaps-analyze.md +214 -0
@@ -1,213 +1,213 @@
1
- ---
2
- name: maestro-composer
3
- description: Interactive workflow template composer — parse natural language into DAG of skill nodes, auto-inject checkpoints, confirm pipeline interactively, persist as reusable JSON template to ~/.maestro/templates/workflows/
4
- argument-hint: "\"workflow description\" [--resume] [--edit <template-path>]"
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- <purpose>
9
- Interactive workflow template composer. Parses natural language into a reusable DAG template
10
- via 5 phases with user confirmation at each boundary. Templates saved globally at
11
- `~/.maestro/templates/workflows/`. Progressive disclosure — specs loaded only when phase needs them.
12
-
13
- Sequential interactive flow (no spawn_agents_on_csv — this is design, not execution):
14
- ```
15
- Parse NL → [confirm] → Resolve to nodes → [confirm] → Inject checkpoints → Confirm pipeline → Persist
16
- ```
17
-
18
- Three entry modes:
19
- 1. **New design**: Phase 1-5
20
- 2. **Resume design**: Load draft from `.workflow/templates/design-drafts/`
21
- 3. **Edit template**: Load existing, modify, re-save
22
- </purpose>
23
-
24
- <context>
25
- $ARGUMENTS — natural language workflow description, or flags.
26
-
27
- **Flags:**
28
- - `--resume` — Resume in-progress design session
29
- - `--edit <template-path>` — Edit an existing template
30
-
31
- **Shared constants:**
32
-
33
- | Constant | Value |
34
- |----------|-------|
35
- | Session prefix | `WFD` |
36
- | Template dir (global) | `~/.maestro/templates/workflows/` |
37
- | Template index (global) | `~/.maestro/templates/workflows/index.json` |
38
- | Design drafts dir (local) | `.workflow/templates/design-drafts/` |
39
- | Template ID format | `wft-<slug>-<YYYYMMDD>` |
40
- | Node ID format | `N-<seq>` (e.g. N-001), `CP-<seq>` for checkpoints |
41
- | Max nodes | 20 |
42
-
43
- **Entry routing:**
44
-
45
- | Detection | Condition | Handler |
46
- |-----------|-----------|---------|
47
- | Resume | `--resume` or existing WFD session | Phase 0: Resume |
48
- | Edit | `--edit <path>` | Phase 0: Load + Edit |
49
- | New | Default | Phase 1: Parse |
50
-
51
- **Node catalog**: Read `~/.maestro/templates/workflows/specs/node-catalog.md` at Phase 2 (deferred).
52
- **Template schema**: Read `~/.maestro/templates/workflows/specs/template-schema.md` at Phase 5 (deferred).
53
- </context>
54
-
55
- <execution>
56
-
57
- ### Phase 0: Resume / Edit (conditional)
58
-
59
- **Resume** (`--resume`):
60
- 1. Scan `.workflow/templates/design-drafts/WFD-*/` for in-progress designs
61
- 2. Multiple → AskUserQuestion for selection
62
- 3. Load draft → skip to last incomplete phase
63
-
64
- **Edit** (`--edit <path>`):
65
- 1. Load template JSON
66
- 2. Show pipeline visualization (Phase 4 format)
67
- 3. AskUserQuestion: which nodes to modify/add/remove
68
- 4. Re-enter at Phase 3
69
-
70
- ---
71
-
72
- ### Phase 1: Parse — Semantic Intent Extraction
73
-
74
- **Step 1.1** — Parse `$ARGUMENTS`. If empty, AskUserQuestion:
75
- ```
76
- "Describe the workflow you want to automate.
77
- Include: what steps to run, in what order, and what varies each time.
78
- Example: 'analyze the code, then plan, implement, and test the feature'"
79
- ```
80
-
81
- **Step 1.2** — Extract sequential actions as candidate nodes:
82
-
83
- | Signal | Candidate Type |
84
- |--------|---------------|
85
- | "analyze", "review", "explore" | analysis (cli) |
86
- | "plan", "design", "spec" | planning (skill) |
87
- | "implement", "build", "code", "fix" | execution (skill) |
88
- | "test", "validate", "verify" | testing (skill) |
89
- | "brainstorm", "ideate" | brainstorm (skill) |
90
- | "review code" | review (skill) |
91
- | "then", "next", "after" | sequential edge |
92
- | "parallel", "simultaneously" | parallel edge |
93
-
94
- **Step 1.3** — Extract variables (inputs that vary per run).
95
-
96
- **Step 1.4** — Classify task type: `bugfix | feature | tdd | review | brainstorm | spec-driven | roadmap | refactor | integration-test | quick-task | custom`
97
-
98
- **Step 1.5** — Assess complexity: `simple` (1-3 nodes), `medium` (4-7), `complex` (8+)
99
-
100
- **Step 1.6** — Write `intent.json` to `.workflow/templates/design-drafts/WFD-<slug>-<date>/`.
101
-
102
- **Step 1.7 — Interactive confirmation**: Display description, task type, complexity, detected steps (numbered with type_hint), and variables. AskUserQuestion: `Continue to resolution` / `Edit steps` / `Add a step` / `Cancel`
103
-
104
- ---
105
-
106
- ### Phase 2: Resolve — Map Steps to Executor Nodes
107
-
108
- **Read deferred**: `~/.maestro/templates/workflows/specs/node-catalog.md`
109
-
110
- If spec not found, use built-in fallback:
111
-
112
- | type_hint | executor type | executor |
113
- |-----------|--------------|----------|
114
- | `planning` | skill | `maestro-plan` |
115
- | `execution` | skill | `maestro-execute` |
116
- | `testing` | skill | `quality-test` |
117
- | `review` | skill | `quality-review` |
118
- | `brainstorm` | skill | `maestro-brainstorm` |
119
- | `analysis` | cli | `maestro delegate --role analyze --mode analysis` |
120
- | `verify` | skill | `maestro-verify` |
121
- | `refactor` | skill | `quality-refactor` |
122
- | `debug` | skill | `quality-debug` |
123
- | `spec` | skill | `maestro-roadmap --mode full` |
124
- | `checkpoint` | checkpoint | — |
125
-
126
- **Step 2.1** — Load `intent.json`, map each step to executor.
127
-
128
- **Step 2.2** — Build `args_template` with variable placeholders and context injection:
129
- - Planning after analysis → `--context {prev_output_path}`
130
- - Execution after planning → inherit phase
131
- - Testing after execution → inherit phase
132
-
133
- **Step 2.3** — Assign `parallel_group` for parallel steps.
134
-
135
- **Step 2.4** — Write `nodes.json`.
136
-
137
- **Step 2.5 — Interactive confirmation**: Display resolved nodes table (ID, type, executor, args) and parallel groups. AskUserQuestion: `Continue to checkpoint injection` / `Change executor` / `Change node type` / `Back to intent` / `Cancel`
138
-
139
- ---
140
-
141
- ### Phase 3: Enrich — Inject Checkpoints + Build DAG
142
-
143
- **Step 3.1** — Load `nodes.json`. Build sequential edges. For parallel groups: fan-out/fan-in.
144
-
145
- **Step 3.2** — Auto-inject checkpoint nodes:
146
-
147
- | Rule | Condition |
148
- |------|-----------|
149
- | Artifact boundary | Source output_ports: plan, spec, analysis, review-findings |
150
- | Execution gate | Target executor contains `execute` |
151
- | Agent spawn | Target type is `agent` |
152
- | Long-running | Target is maestro-plan, maestro-roadmap |
153
- | User-defined | Step had `type_hint: checkpoint` |
154
- | Post-testing | Source executor contains `test` or `integration-test` |
155
-
156
- Set `auto_continue: false` for checkpoints before user-facing deliverables.
157
-
158
- **Step 3.3** — Finalize `context_schema`, validate DAG (no cycles, no orphans).
159
-
160
- **Step 3.4** — Write `dag.json`. → Proceed to Phase 4.
161
-
162
- ---
163
-
164
- ### Phase 4: Confirm — Visualize + User Approval
165
-
166
- **Step 4.1** — Render ASCII pipeline: vertical node chain with `|` connectors showing each node (ID, type, executor, args) and checkpoint nodes (auto-continue vs pause-for-user). Footer: required variables, checkpoint counts, node counts.
167
-
168
- **Step 4.2** — AskUserQuestion: `Confirm & Save` / `Edit a node` / `Add a node` / `Remove a node` / `Rename template` / `Re-run checkpoint injection` / `Cancel`
169
-
170
- **Step 4.3** — Loop edits until Confirm or Cancel.
171
-
172
- ---
173
-
174
- ### Phase 5: Persist — Assemble + Save Template
175
-
176
- **Read deferred**: `~/.maestro/templates/workflows/specs/template-schema.md`
177
-
178
- **Step 5.1** — Load `intent.json` + `dag.json`. Assemble template JSON.
179
-
180
- **Step 5.2** — Determine slug (kebab-case). If exists, append `-v2`.
181
-
182
- **Step 5.3** — Write `~/.maestro/templates/workflows/<slug>.json`.
183
-
184
- **Step 5.4** — Update `~/.maestro/templates/workflows/index.json`.
185
-
186
- **Step 5.5** — Output summary: path, template ID, node/checkpoint counts, required variables. Include usage commands: `$maestro-player <slug> --context goal="..."`, `$maestro-composer --edit <path>`, `$maestro-player --list`.
187
-
188
- **Step 5.6** — Clean up design draft directory.
189
- </execution>
190
-
191
- <error_codes>
192
- | Code | Severity | Condition | Recovery |
193
- |------|----------|-----------|----------|
194
- | E001 | error | Empty description and no flags | AskUserQuestion for description |
195
- | E002 | error | 0 steps extracted | Ask to rephrase with action verbs |
196
- | E003 | error | Node count exceeds 20 | Suggest splitting into sub-workflows |
197
- | E004 | error | DAG cycle detected | Show cycle, ask to resolve |
198
- | E005 | error | Resume session not found | Show available drafts |
199
- | E006 | error | Edit template not found | Show available templates |
200
- | W001 | warning | Ambiguous executor mapping | Show candidates, let user choose |
201
- | W002 | warning | No checkpoint rules triggered | Warn, offer manual add |
202
- | W003 | warning | Deferred spec not found | Use built-in fallback |
203
- </error_codes>
204
-
205
- <success_criteria>
206
- - [ ] Intent parsed and confirmed by user (Phase 1 gate)
207
- - [ ] Nodes resolved and confirmed by user (Phase 2 gate)
208
- - [ ] DAG built with auto-injected checkpoints
209
- - [ ] Pipeline visualized and confirmed by user (Phase 4 gate)
210
- - [ ] Template JSON written to `~/.maestro/templates/workflows/<slug>.json`
211
- - [ ] Template index updated
212
- - [ ] Deferred specs loaded only when phase needs them
213
- </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: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Interactive workflow template composer. Parses natural language into a reusable DAG template
10
+ via 5 phases with user confirmation at each boundary. Templates saved globally at
11
+ `~/.maestro/templates/workflows/`. Progressive disclosure — specs loaded only when phase needs them.
12
+
13
+ Sequential interactive flow (no spawn_agents_on_csv — this is design, not execution):
14
+ ```
15
+ Parse NL → [confirm] → Resolve to nodes → [confirm] → Inject checkpoints → Confirm pipeline → Persist
16
+ ```
17
+
18
+ Three entry modes:
19
+ 1. **New design**: Phase 1-5
20
+ 2. **Resume design**: Load draft from `.workflow/templates/design-drafts/`
21
+ 3. **Edit template**: Load existing, modify, re-save
22
+ </purpose>
23
+
24
+ <context>
25
+ $ARGUMENTS — natural language workflow description, or flags.
26
+
27
+ **Flags:**
28
+ - `--resume` — Resume in-progress design session
29
+ - `--edit <template-path>` — Edit an existing template
30
+
31
+ **Shared constants:**
32
+
33
+ | Constant | Value |
34
+ |----------|-------|
35
+ | Session prefix | `WFD` |
36
+ | Template dir (global) | `~/.maestro/templates/workflows/` |
37
+ | Template index (global) | `~/.maestro/templates/workflows/index.json` |
38
+ | Design drafts dir (local) | `.workflow/templates/design-drafts/` |
39
+ | Template ID format | `wft-<slug>-<YYYYMMDD>` |
40
+ | Node ID format | `N-<seq>` (e.g. N-001), `CP-<seq>` for checkpoints |
41
+ | Max nodes | 20 |
42
+
43
+ **Entry routing:**
44
+
45
+ | Detection | Condition | Handler |
46
+ |-----------|-----------|---------|
47
+ | Resume | `--resume` or existing WFD session | Phase 0: Resume |
48
+ | Edit | `--edit <path>` | Phase 0: Load + Edit |
49
+ | New | Default | Phase 1: Parse |
50
+
51
+ **Node catalog**: Read `~/.maestro/templates/workflows/specs/node-catalog.md` at Phase 2 (deferred).
52
+ **Template schema**: Read `~/.maestro/templates/workflows/specs/template-schema.md` at Phase 5 (deferred).
53
+ </context>
54
+
55
+ <execution>
56
+
57
+ ### Phase 0: Resume / Edit (conditional)
58
+
59
+ **Resume** (`--resume`):
60
+ 1. Scan `.workflow/templates/design-drafts/WFD-*/` for in-progress designs
61
+ 2. Multiple → AskUserQuestion for selection
62
+ 3. Load draft → skip to last incomplete phase
63
+
64
+ **Edit** (`--edit <path>`):
65
+ 1. Load template JSON
66
+ 2. Show pipeline visualization (Phase 4 format)
67
+ 3. AskUserQuestion: which nodes to modify/add/remove
68
+ 4. Re-enter at Phase 3
69
+
70
+ ---
71
+
72
+ ### Phase 1: Parse — Semantic Intent Extraction
73
+
74
+ **Step 1.1** — Parse `$ARGUMENTS`. If empty, AskUserQuestion:
75
+ ```
76
+ "Describe the workflow you want to automate.
77
+ Include: what steps to run, in what order, and what varies each time.
78
+ Example: 'analyze the code, then plan, implement, and test the feature'"
79
+ ```
80
+
81
+ **Step 1.2** — Extract sequential actions as candidate nodes:
82
+
83
+ | Signal | Candidate Type |
84
+ |--------|---------------|
85
+ | "analyze", "review", "explore" | analysis (cli) |
86
+ | "plan", "design", "spec" | planning (skill) |
87
+ | "implement", "build", "code", "fix" | execution (skill) |
88
+ | "test", "validate", "verify" | testing (skill) |
89
+ | "brainstorm", "ideate" | brainstorm (skill) |
90
+ | "review code" | review (skill) |
91
+ | "then", "next", "after" | sequential edge |
92
+ | "parallel", "simultaneously" | parallel edge |
93
+
94
+ **Step 1.3** — Extract variables (inputs that vary per run).
95
+
96
+ **Step 1.4** — Classify task type: `bugfix | feature | tdd | review | brainstorm | spec-driven | roadmap | refactor | integration-test | quick-task | custom`
97
+
98
+ **Step 1.5** — Assess complexity: `simple` (1-3 nodes), `medium` (4-7), `complex` (8+)
99
+
100
+ **Step 1.6** — Write `intent.json` to `.workflow/templates/design-drafts/WFD-<slug>-<date>/`.
101
+
102
+ **Step 1.7 — Interactive confirmation**: Display description, task type, complexity, detected steps (numbered with type_hint), and variables. AskUserQuestion: `Continue to resolution` / `Edit steps` / `Add a step` / `Cancel`
103
+
104
+ ---
105
+
106
+ ### Phase 2: Resolve — Map Steps to Executor Nodes
107
+
108
+ **Read deferred**: `~/.maestro/templates/workflows/specs/node-catalog.md`
109
+
110
+ If spec not found, use built-in fallback:
111
+
112
+ | type_hint | executor type | executor |
113
+ |-----------|--------------|----------|
114
+ | `planning` | skill | `maestro-plan` |
115
+ | `execution` | skill | `maestro-execute` |
116
+ | `testing` | skill | `quality-test` |
117
+ | `review` | skill | `quality-review` |
118
+ | `brainstorm` | skill | `maestro-brainstorm` |
119
+ | `analysis` | cli | `maestro delegate --role analyze --mode analysis` |
120
+ | `verify` | skill | `maestro-verify` |
121
+ | `refactor` | skill | `quality-refactor` |
122
+ | `debug` | skill | `quality-debug` |
123
+ | `spec` | skill | `maestro-roadmap --mode full` |
124
+ | `checkpoint` | checkpoint | — |
125
+
126
+ **Step 2.1** — Load `intent.json`, map each step to executor.
127
+
128
+ **Step 2.2** — Build `args_template` with variable placeholders and context injection:
129
+ - Planning after analysis → `--context {prev_output_path}`
130
+ - Execution after planning → inherit phase
131
+ - Testing after execution → inherit phase
132
+
133
+ **Step 2.3** — Assign `parallel_group` for parallel steps.
134
+
135
+ **Step 2.4** — Write `nodes.json`.
136
+
137
+ **Step 2.5 — Interactive confirmation**: Display resolved nodes table (ID, type, executor, args) and parallel groups. AskUserQuestion: `Continue to checkpoint injection` / `Change executor` / `Change node type` / `Back to intent` / `Cancel`
138
+
139
+ ---
140
+
141
+ ### Phase 3: Enrich — Inject Checkpoints + Build DAG
142
+
143
+ **Step 3.1** — Load `nodes.json`. Build sequential edges. For parallel groups: fan-out/fan-in.
144
+
145
+ **Step 3.2** — Auto-inject checkpoint nodes:
146
+
147
+ | Rule | Condition |
148
+ |------|-----------|
149
+ | Artifact boundary | Source output_ports: plan, spec, analysis, review-findings |
150
+ | Execution gate | Target executor contains `execute` |
151
+ | Agent spawn | Target type is `agent` |
152
+ | Long-running | Target is maestro-plan, maestro-roadmap |
153
+ | User-defined | Step had `type_hint: checkpoint` |
154
+ | Post-testing | Source executor contains `test` or `integration-test` |
155
+
156
+ Set `auto_continue: false` for checkpoints before user-facing deliverables.
157
+
158
+ **Step 3.3** — Finalize `context_schema`, validate DAG (no cycles, no orphans).
159
+
160
+ **Step 3.4** — Write `dag.json`. → Proceed to Phase 4.
161
+
162
+ ---
163
+
164
+ ### Phase 4: Confirm — Visualize + User Approval
165
+
166
+ **Step 4.1** — Render ASCII pipeline: vertical node chain with `|` connectors showing each node (ID, type, executor, args) and checkpoint nodes (auto-continue vs pause-for-user). Footer: required variables, checkpoint counts, node counts.
167
+
168
+ **Step 4.2** — AskUserQuestion: `Confirm & Save` / `Edit a node` / `Add a node` / `Remove a node` / `Rename template` / `Re-run checkpoint injection` / `Cancel`
169
+
170
+ **Step 4.3** — Loop edits until Confirm or Cancel.
171
+
172
+ ---
173
+
174
+ ### Phase 5: Persist — Assemble + Save Template
175
+
176
+ **Read deferred**: `~/.maestro/templates/workflows/specs/template-schema.md`
177
+
178
+ **Step 5.1** — Load `intent.json` + `dag.json`. Assemble template JSON.
179
+
180
+ **Step 5.2** — Determine slug (kebab-case). If exists, append `-v2`.
181
+
182
+ **Step 5.3** — Write `~/.maestro/templates/workflows/<slug>.json`.
183
+
184
+ **Step 5.4** — Update `~/.maestro/templates/workflows/index.json`.
185
+
186
+ **Step 5.5** — Output summary: path, template ID, node/checkpoint counts, required variables. Include usage commands: `$maestro-player <slug> --context goal="..."`, `$maestro-composer --edit <path>`, `$maestro-player --list`.
187
+
188
+ **Step 5.6** — Clean up design draft directory.
189
+ </execution>
190
+
191
+ <error_codes>
192
+ | Code | Severity | Condition | Recovery |
193
+ |------|----------|-----------|----------|
194
+ | E001 | error | Empty description and no flags | AskUserQuestion for description |
195
+ | E002 | error | 0 steps extracted | Ask to rephrase with action verbs |
196
+ | E003 | error | Node count exceeds 20 | Suggest splitting into sub-workflows |
197
+ | E004 | error | DAG cycle detected | Show cycle, ask to resolve |
198
+ | E005 | error | Resume session not found | Show available drafts |
199
+ | E006 | error | Edit template not found | Show available templates |
200
+ | W001 | warning | Ambiguous executor mapping | Show candidates, let user choose |
201
+ | W002 | warning | No checkpoint rules triggered | Warn, offer manual add |
202
+ | W003 | warning | Deferred spec not found | Use built-in fallback |
203
+ </error_codes>
204
+
205
+ <success_criteria>
206
+ - [ ] Intent parsed and confirmed by user (Phase 1 gate)
207
+ - [ ] Nodes resolved and confirmed by user (Phase 2 gate)
208
+ - [ ] DAG built with auto-injected checkpoints
209
+ - [ ] Pipeline visualized and confirmed by user (Phase 4 gate)
210
+ - [ ] Template JSON written to `~/.maestro/templates/workflows/<slug>.json`
211
+ - [ ] Template index updated
212
+ - [ ] Deferred specs loaded only when phase needs them
213
+ </success_criteria>