maestro-flow-one 0.2.0 → 0.2.2
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.
- package/.ace-tool/index.json +108 -0
- package/bin/maestro-flow.js +30 -0
- package/claude/maestro-flow/agents/cli-explore-agent.md +187 -0
- package/claude/maestro-flow/agents/conceptual-planning-agent.md +245 -0
- package/claude/maestro-flow/agents/team-supervisor.md +143 -0
- package/claude/maestro-flow/agents/team-worker.md +237 -0
- package/claude/maestro-flow/agents/ui-design-agent.md +286 -0
- package/claude/maestro-flow/agents/workflow-analyzer.md +115 -0
- package/claude/maestro-flow/agents/workflow-codebase-mapper.md +77 -0
- package/claude/maestro-flow/agents/workflow-collab-planner.md +143 -0
- package/claude/maestro-flow/agents/workflow-debugger.md +103 -0
- package/claude/maestro-flow/agents/workflow-executor.md +129 -0
- package/claude/maestro-flow/agents/workflow-external-researcher.md +86 -0
- package/claude/maestro-flow/agents/workflow-integration-checker.md +83 -0
- package/claude/maestro-flow/agents/workflow-nyquist-auditor.md +85 -0
- package/claude/maestro-flow/agents/workflow-phase-researcher.md +85 -0
- package/claude/maestro-flow/agents/workflow-plan-checker.md +90 -0
- package/claude/maestro-flow/agents/workflow-planner.md +195 -0
- package/claude/maestro-flow/agents/workflow-project-researcher.md +74 -0
- package/claude/maestro-flow/agents/workflow-research-synthesizer.md +70 -0
- package/claude/maestro-flow/agents/workflow-reviewer.md +82 -0
- package/claude/maestro-flow/agents/workflow-roadmapper.md +81 -0
- package/claude/maestro-flow/agents/workflow-verifier.md +120 -0
- package/codex/maestro-flow/agents/team-supervisor.toml +40 -0
- package/codex/maestro-flow/agents/team-worker.toml +63 -0
- package/maestro-flow/agents/cli-explore-agent.md +187 -0
- package/maestro-flow/agents/conceptual-planning-agent.md +245 -0
- package/maestro-flow/agents/team-supervisor.md +143 -0
- package/maestro-flow/agents/team-worker.md +237 -0
- package/maestro-flow/agents/ui-design-agent.md +286 -0
- package/maestro-flow/agents/workflow-analyzer.md +115 -0
- package/maestro-flow/agents/workflow-codebase-mapper.md +77 -0
- package/maestro-flow/agents/workflow-collab-planner.md +143 -0
- package/maestro-flow/agents/workflow-debugger.md +103 -0
- package/maestro-flow/agents/workflow-executor.md +129 -0
- package/maestro-flow/agents/workflow-external-researcher.md +86 -0
- package/maestro-flow/agents/workflow-integration-checker.md +83 -0
- package/maestro-flow/agents/workflow-nyquist-auditor.md +85 -0
- package/maestro-flow/agents/workflow-phase-researcher.md +85 -0
- package/maestro-flow/agents/workflow-plan-checker.md +90 -0
- package/maestro-flow/agents/workflow-planner.md +195 -0
- package/maestro-flow/agents/workflow-project-researcher.md +74 -0
- package/maestro-flow/agents/workflow-research-synthesizer.md +70 -0
- package/maestro-flow/agents/workflow-reviewer.md +82 -0
- package/maestro-flow/agents/workflow-roadmapper.md +81 -0
- package/maestro-flow/agents/workflow-verifier.md +120 -0
- package/maestro-flow/commands/learn/decompose.md +176 -0
- package/maestro-flow/commands/learn/follow.md +167 -0
- package/maestro-flow/commands/learn/investigate.md +221 -0
- package/maestro-flow/commands/learn/retro.md +303 -0
- package/maestro-flow/commands/learn/second-opinion.md +167 -0
- package/maestro-flow/commands/lifecycle/amend.md +300 -0
- package/maestro-flow/commands/lifecycle/analyze.md +130 -0
- package/maestro-flow/commands/lifecycle/brainstorm.md +104 -0
- package/maestro-flow/commands/lifecycle/collab.md +333 -0
- package/maestro-flow/commands/lifecycle/composer.md +354 -0
- package/maestro-flow/commands/lifecycle/execute.md +120 -0
- package/maestro-flow/commands/lifecycle/fork.md +86 -0
- package/maestro-flow/commands/lifecycle/init.md +78 -0
- package/maestro-flow/commands/lifecycle/learn.md +140 -0
- package/maestro-flow/commands/lifecycle/link-coordinate.md +71 -0
- package/maestro-flow/commands/lifecycle/merge.md +61 -0
- package/maestro-flow/commands/lifecycle/overlay.md +178 -0
- package/maestro-flow/commands/lifecycle/plan.md +154 -0
- package/maestro-flow/commands/lifecycle/player.md +404 -0
- package/maestro-flow/commands/lifecycle/quick.md +56 -0
- package/maestro-flow/commands/lifecycle/roadmap.md +164 -0
- package/maestro-flow/commands/lifecycle/ui-design.md +93 -0
- package/maestro-flow/commands/lifecycle/update.md +176 -0
- package/maestro-flow/commands/lifecycle/verify.md +96 -0
- package/maestro-flow/commands/manage/codebase-rebuild.md +75 -0
- package/maestro-flow/commands/manage/codebase-refresh.md +57 -0
- package/maestro-flow/commands/manage/harvest.md +94 -0
- package/maestro-flow/commands/manage/issue-discover.md +77 -0
- package/maestro-flow/commands/manage/issue.md +73 -0
- package/maestro-flow/commands/manage/knowhow-capture.md +193 -0
- package/maestro-flow/commands/manage/knowhow.md +77 -0
- package/maestro-flow/commands/manage/learn.md +67 -0
- package/maestro-flow/commands/manage/status.md +51 -0
- package/maestro-flow/commands/manage/wiki.md +62 -0
- package/maestro-flow/commands/milestone/audit.md +68 -0
- package/maestro-flow/commands/milestone/complete.md +75 -0
- package/maestro-flow/commands/milestone/release.md +96 -0
- package/maestro-flow/commands/quality/auto-test.md +128 -0
- package/maestro-flow/commands/quality/debug.md +125 -0
- package/maestro-flow/commands/quality/refactor.md +55 -0
- package/maestro-flow/commands/quality/retrospective.md +78 -0
- package/maestro-flow/commands/quality/review.md +114 -0
- package/maestro-flow/commands/quality/sync.md +51 -0
- package/maestro-flow/commands/quality/test.md +107 -0
- package/maestro-flow/commands/spec/add.md +49 -0
- package/maestro-flow/commands/spec/load.md +51 -0
- package/maestro-flow/commands/spec/remove.md +51 -0
- package/maestro-flow/commands/spec/setup.md +51 -0
- package/maestro-flow/commands/wiki/connect.md +62 -0
- package/maestro-flow/commands/wiki/digest.md +69 -0
- package/package.json +1 -1
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: maestro-collab
|
|
3
|
+
description: Multi-CLI collaborative analysis -- fan-out to multiple CLI tools, cross-verify, synthesize
|
|
4
|
+
argument-hint: "\"<requirement>\" [--tools gemini,qwen,claude] [--mode analysis|write] [--rule <template>] [-y]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Agent
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<purpose>
|
|
16
|
+
Multi-CLI collaboration: fan-out the same requirement to multiple CLI tools in parallel, cross-verify outputs for consensus/conflicts, then synthesize into a unified report with standard downstream artifacts (context.md + conclusions.json).
|
|
17
|
+
|
|
18
|
+
Each CLI tool independently analyzes the requirement. Results are compared and merged via evidence-weighted synthesis.
|
|
19
|
+
</purpose>
|
|
20
|
+
|
|
21
|
+
<context>
|
|
22
|
+
$ARGUMENTS — requirement text and optional flags.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
/maestro-collab "analyze the auth module for security vulnerabilities"
|
|
26
|
+
/maestro-collab "design a caching strategy" --tools gemini,qwen,claude
|
|
27
|
+
/maestro-collab -y "review error handling patterns"
|
|
28
|
+
/maestro-collab "refactor user service" --mode write --tools gemini,claude
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Flags**:
|
|
32
|
+
- `--tools <list>`: Comma-separated CLI tools (default: auto-select first 3 enabled)
|
|
33
|
+
- `--mode analysis|write`: Delegate mode (default: analysis)
|
|
34
|
+
- `--rule <template>`: Shared rule template for all delegates
|
|
35
|
+
- `-y` / `--yes`: Skip plan confirmation
|
|
36
|
+
|
|
37
|
+
**Output**: `.workflow/scratch/{YYYYMMDD}-collab-{slug}/`
|
|
38
|
+
- `collab-report.md` — full collaboration report
|
|
39
|
+
- `context.md` — standard Locked/Free/Deferred decisions (plan/analyze compatible)
|
|
40
|
+
- `conclusions.json` — structured conclusions (plan fast-track compatible)
|
|
41
|
+
- `per-tool/{tool}-output.md` — raw per-tool outputs
|
|
42
|
+
</context>
|
|
43
|
+
|
|
44
|
+
<execution>
|
|
45
|
+
|
|
46
|
+
### Step 1: Parse Arguments
|
|
47
|
+
|
|
48
|
+
Extract from `$ARGUMENTS`:
|
|
49
|
+
- `requirement` — remaining text after flag removal (error if empty)
|
|
50
|
+
- `--tools` → `selectedTools` (comma-split)
|
|
51
|
+
- `--mode` → `delegateMode` (default: `analysis`)
|
|
52
|
+
- `--rule` → `ruleTemplate`
|
|
53
|
+
- `-y` / `--yes` → `autoYes`
|
|
54
|
+
|
|
55
|
+
### Step 2: Discover Available CLI Tools
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
Bash("maestro tools list --json 2>/dev/null || cat ~/.maestro/cli-tools.json")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Parse tool entries. Build eligible list:
|
|
62
|
+
- `enabled == true`
|
|
63
|
+
- If `--mode write`: exclude `type == "api-endpoint"`
|
|
64
|
+
|
|
65
|
+
Auto-select (when `--tools` omitted): first 3 eligible in config order.
|
|
66
|
+
Validate: minimum 2 eligible tools (abort if fewer).
|
|
67
|
+
|
|
68
|
+
### Step 3: Present Collaboration Plan
|
|
69
|
+
|
|
70
|
+
**(Skip if `-y`)**
|
|
71
|
+
|
|
72
|
+
Display plan, then ask user:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
============================================================
|
|
76
|
+
COLLABORATION PLAN
|
|
77
|
+
============================================================
|
|
78
|
+
Requirement: {requirement}
|
|
79
|
+
Mode: {delegateMode}
|
|
80
|
+
Rule: {ruleTemplate || "none"}
|
|
81
|
+
|
|
82
|
+
Available CLI Tools (from cli-tools.json):
|
|
83
|
+
[✓] gemini — gemini-3.1-pro-preview [fullstack, frontend]
|
|
84
|
+
[✓] claude — claude-sonnet-4-6 [fullstack]
|
|
85
|
+
[✓] codex — gpt-5.5 [fullstack, backend]
|
|
86
|
+
[ ] opencode — (no model) [fullstack]
|
|
87
|
+
|
|
88
|
+
Selected: gemini, claude, codex (3 tools)
|
|
89
|
+
|
|
90
|
+
Pipeline:
|
|
91
|
+
1. Fan-out → parallel delegate to each tool
|
|
92
|
+
2. Cross-verification → consensus/conflict analysis
|
|
93
|
+
3. Synthesis → context.md + conclusions.json
|
|
94
|
+
============================================================
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use `AskUserQuestion` with options:
|
|
98
|
+
- **执行** — proceed with selected tools
|
|
99
|
+
- **修改工具选择** — let user specify different tool combination
|
|
100
|
+
- **取消** — abort
|
|
101
|
+
|
|
102
|
+
If **修改工具选择**: ask user which tools to use (show eligible list), validate ≥ 2, re-display plan.
|
|
103
|
+
|
|
104
|
+
### Step 4: Setup Session
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
slug = requirement kebab-cased, max 40 chars
|
|
108
|
+
outputDir = .workflow/scratch/{YYYYMMDD}-collab-{slug}/
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Create `outputDir` + `outputDir/per-tool/`.
|
|
112
|
+
|
|
113
|
+
### Step 5: Build Delegate Prompt
|
|
114
|
+
|
|
115
|
+
Shared prompt for all tools:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
PURPOSE: {requirement}; success = actionable findings with evidence
|
|
119
|
+
TASK: {auto-decomposed into 3-5 specific verbs}
|
|
120
|
+
MODE: {delegateMode}
|
|
121
|
+
CONTEXT: @**/*
|
|
122
|
+
EXPECTED: Structured findings with file:line references, confidence score (0-100), prioritized recommendations. Sections: ## Findings, ## Recommendations, ## Confidence
|
|
123
|
+
CONSTRAINTS: {extracted from requirement}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Step 6: Parallel Fan-Out
|
|
127
|
+
|
|
128
|
+
Launch ALL delegate calls simultaneously using multiple `Bash(run_in_background: true)` in a **single message**:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
// Launch all in ONE message — do NOT wait between calls
|
|
132
|
+
Bash({
|
|
133
|
+
command: `maestro delegate "${prompt}" --to gemini --mode ${mode} ${rule}`,
|
|
134
|
+
run_in_background: true
|
|
135
|
+
})
|
|
136
|
+
Bash({
|
|
137
|
+
command: `maestro delegate "${prompt}" --to claude --mode ${mode} ${rule}`,
|
|
138
|
+
run_in_background: true
|
|
139
|
+
})
|
|
140
|
+
Bash({
|
|
141
|
+
command: `maestro delegate "${prompt}" --to codex --mode ${mode} ${rule}`,
|
|
142
|
+
run_in_background: true
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**After launching all calls → STOP immediately. Do not output anything. Wait for background completion callbacks.**
|
|
147
|
+
|
|
148
|
+
### Step 7: Collect Results
|
|
149
|
+
|
|
150
|
+
As each background callback arrives:
|
|
151
|
+
1. Extract exec ID from output (`[MAESTRO_EXEC_ID=...]`)
|
|
152
|
+
2. Run `maestro delegate output <id>` to get full result
|
|
153
|
+
3. Write raw output to `per-tool/{tool}-output.md`
|
|
154
|
+
|
|
155
|
+
**Wait until ALL callbacks have arrived before proceeding.**
|
|
156
|
+
|
|
157
|
+
### Step 8: Cross-Verify
|
|
158
|
+
|
|
159
|
+
Read all `per-tool/{tool}-output.md` files. Compare findings across tools:
|
|
160
|
+
|
|
161
|
+
For each finding, classify:
|
|
162
|
+
- **[CONSENSUS]**: 2+ tools agree on same finding/recommendation
|
|
163
|
+
- **[CONFLICT]**: Tools disagree on approach or assessment
|
|
164
|
+
- **[UNIQUE]**: Finding from only one tool
|
|
165
|
+
|
|
166
|
+
Compute `consensus_level = (consensus_count / total_findings) * 100`.
|
|
167
|
+
|
|
168
|
+
### Step 9: Synthesize Outputs
|
|
169
|
+
|
|
170
|
+
Resolve conflicts via evidence-weighted voting:
|
|
171
|
+
- Higher confidence tool's position wins
|
|
172
|
+
- More specific evidence (file:line refs) wins over general statements
|
|
173
|
+
- If tied: mark as `[SUGGESTED]`
|
|
174
|
+
|
|
175
|
+
Generate three output files:
|
|
176
|
+
|
|
177
|
+
#### collab-report.md
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
# Multi-CLI Collaboration Report — {requirement}
|
|
181
|
+
|
|
182
|
+
## Summary
|
|
183
|
+
- Tools: {tool_list}
|
|
184
|
+
- Consensus level: {N}%
|
|
185
|
+
- Key finding: {top finding}
|
|
186
|
+
|
|
187
|
+
## Consensus Findings
|
|
188
|
+
{findings agreed by 2+ tools}
|
|
189
|
+
|
|
190
|
+
## Resolved Conflicts
|
|
191
|
+
{conflicts resolved with rationale and winning tool}
|
|
192
|
+
|
|
193
|
+
## Unresolved Items
|
|
194
|
+
{items requiring human judgment}
|
|
195
|
+
|
|
196
|
+
## Unique Insights
|
|
197
|
+
{valuable unique findings with source tool attribution}
|
|
198
|
+
|
|
199
|
+
## Recommendations
|
|
200
|
+
{prioritized, merged recommendations}
|
|
201
|
+
|
|
202
|
+
## Per-Tool Confidence
|
|
203
|
+
| Tool | Confidence | Key Strength |
|
|
204
|
+
|------|-----------|--------------|
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### context.md (standard downstream format)
|
|
208
|
+
|
|
209
|
+
```markdown
|
|
210
|
+
# Context: {requirement}
|
|
211
|
+
|
|
212
|
+
**Date**: {date}
|
|
213
|
+
**Mode**: collab ({tool_list})
|
|
214
|
+
**Consensus Level**: {N}%
|
|
215
|
+
|
|
216
|
+
## Decisions
|
|
217
|
+
|
|
218
|
+
### Decision N: {TITLE}
|
|
219
|
+
- **Context**: {what and why}
|
|
220
|
+
- **Options**: 1. {opt1} 2. {opt2}
|
|
221
|
+
- **Chosen**: {selected}
|
|
222
|
+
- **Reason**: {rationale — which tools agreed/disagreed}
|
|
223
|
+
|
|
224
|
+
## Constraints
|
|
225
|
+
|
|
226
|
+
### Locked
|
|
227
|
+
{[CONSENSUS] items — treat as confirmed decisions}
|
|
228
|
+
|
|
229
|
+
### Free
|
|
230
|
+
{[UNIQUE] items with strong evidence — implementer discretion}
|
|
231
|
+
|
|
232
|
+
### Deferred
|
|
233
|
+
{[UNRESOLVED] conflicts — require human judgment}
|
|
234
|
+
|
|
235
|
+
## Code Context
|
|
236
|
+
{file:line references from per-tool findings}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### conclusions.json
|
|
240
|
+
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"session_id": "{sessionId}",
|
|
244
|
+
"subject": "{requirement}",
|
|
245
|
+
"mode": "collab",
|
|
246
|
+
"tools": ["gemini", "claude", "codex"],
|
|
247
|
+
"consensus_level": 85,
|
|
248
|
+
"recommendation": "Go|No-Go|Conditional",
|
|
249
|
+
"confidence": "high|medium|low",
|
|
250
|
+
"dimensions": [
|
|
251
|
+
{ "name": "gemini", "score": 80, "findings": "...", "recommendations": "..." }
|
|
252
|
+
],
|
|
253
|
+
"decisions": [
|
|
254
|
+
{ "title": "...", "classification": "locked|free|deferred", "source_tools": [], "rationale": "..." }
|
|
255
|
+
],
|
|
256
|
+
"timestamp": "<ISO>"
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Step 10: Register Artifact
|
|
261
|
+
|
|
262
|
+
Append to `.workflow/state.json`:
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"id": "CLB-{next_id}",
|
|
267
|
+
"type": "collab",
|
|
268
|
+
"milestone": "{current_milestone}",
|
|
269
|
+
"phase": null,
|
|
270
|
+
"scope": "adhoc",
|
|
271
|
+
"path": "scratch/{YYYYMMDD}-collab-{slug}",
|
|
272
|
+
"status": "completed",
|
|
273
|
+
"depends_on": null,
|
|
274
|
+
"harvested": false,
|
|
275
|
+
"created_at": "<ISO>",
|
|
276
|
+
"completed_at": "<ISO>"
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Step 11: Display Summary
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
============================================================
|
|
284
|
+
MULTI-CLI COLLABORATION COMPLETE
|
|
285
|
+
============================================================
|
|
286
|
+
Requirement: {requirement}
|
|
287
|
+
Tools: {tool_list}
|
|
288
|
+
Consensus Level: {N}%
|
|
289
|
+
|
|
290
|
+
Per-Tool:
|
|
291
|
+
gemini: completed (confidence: {N}%)
|
|
292
|
+
claude: completed (confidence: {N}%)
|
|
293
|
+
codex: completed (confidence: {N}%)
|
|
294
|
+
|
|
295
|
+
Artifact: CLB-{id}
|
|
296
|
+
Output: {outputDir}/
|
|
297
|
+
|
|
298
|
+
Next steps:
|
|
299
|
+
/maestro-analyze "{topic}" — Deep feasibility analysis
|
|
300
|
+
/maestro-plan "{phase} --dir {dir}" — Plan from collab conclusions
|
|
301
|
+
/maestro-brainstorm "{topic}" — Expand with multi-role brainstorm
|
|
302
|
+
============================================================
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
</execution>
|
|
306
|
+
|
|
307
|
+
<error_codes>
|
|
308
|
+
|
|
309
|
+
| Code | Severity | Condition | Recovery |
|
|
310
|
+
|------|----------|-----------|----------|
|
|
311
|
+
| E001 | error | Requirement argument missing | Prompt for requirement |
|
|
312
|
+
| E002 | error | Fewer than 2 CLI tools eligible | Check cli-tools.json, enable more tools |
|
|
313
|
+
| E003 | error | Specified tool not found/enabled | Show available tools |
|
|
314
|
+
| E004 | error | All delegates failed | Abort with per-tool error details |
|
|
315
|
+
| W001 | warning | One tool failed | Continue with remaining tools |
|
|
316
|
+
| W002 | warning | >50% conflicts in cross-verify | Highlight in report, recommend manual review |
|
|
317
|
+
| W003 | warning | Low consensus level (<40%) | Flag in summary |
|
|
318
|
+
|
|
319
|
+
</error_codes>
|
|
320
|
+
|
|
321
|
+
<success_criteria>
|
|
322
|
+
- [ ] Available tools discovered from cli-tools.json with eligibility filtering
|
|
323
|
+
- [ ] Plan presented via AskUserQuestion with tool modification option (unless -y)
|
|
324
|
+
- [ ] All delegates launched in parallel via Bash(run_in_background: true)
|
|
325
|
+
- [ ] Execution stopped after launch — waited for all callbacks
|
|
326
|
+
- [ ] Per-tool outputs written to per-tool/{tool}-output.md
|
|
327
|
+
- [ ] Cross-verification: consensus/conflict/unique classification complete
|
|
328
|
+
- [ ] collab-report.md produced with merged findings
|
|
329
|
+
- [ ] context.md produced in Locked/Free/Deferred format (downstream compatible)
|
|
330
|
+
- [ ] conclusions.json produced (plan fast-track compatible)
|
|
331
|
+
- [ ] CLB artifact registered in state.json
|
|
332
|
+
- [ ] Partial degradation: continued if 1+ tools succeeded
|
|
333
|
+
</success_criteria>
|
|
@@ -0,0 +1,354 @@
|
|
|
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>
|