maestro-flow 0.3.14 → 0.3.15

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.
@@ -0,0 +1,448 @@
1
+ ---
2
+ name: maestro-player
3
+ description: Workflow template player — load JSON template, bind variables, execute DAG nodes wave-by-wave via spawn_agents_on_csv, persist state at checkpoints, support resume. Coordinator assembles skill_call from template nodes — never executes skills directly.
4
+ argument-hint: "<template-slug|path> [--context key=value...] [-c [session-id]] [--list] [--dry-run]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Wave-based template executor using `spawn_agents_on_csv`. Loads a workflow template
10
+ (produced by maestro-composer), binds context variables, converts DAG nodes into
11
+ CSV waves via topological sort, executes wave-by-wave with barrier/non-barrier grouping.
12
+
13
+ Aligned with maestro codex coordinator pattern:
14
+ - ALL skill execution via `spawn_agents_on_csv` — coordinator never executes directly
15
+ - Barrier nodes (checkpoints + artifact-producing skills) execute solo
16
+ - Non-barrier nodes grouped into parallel waves
17
+ - Session state at `.workflow/.maestro-coordinate/{session-id}/`
18
+ - Resume from last completed wave via `-c`
19
+
20
+ ```
21
+ Load Template → Bind Variables → Build Wave CSV → spawn → read results →
22
+ (barrier: read artifacts, update context) → next wave → report
23
+ ```
24
+ </purpose>
25
+
26
+ <invariants>
27
+ 1. **ALL skills via spawn_agents_on_csv**: Every node execution goes through spawn. Coordinator NEVER directly executes any skill.
28
+ 2. **Coordinator = prompt assembler only**: Load template → resolve refs → build CSV → spawn → read results → assemble next CSV.
29
+ 3. **Barrier = solo wave**: Checkpoint nodes and artifact-producing skills execute alone (wave size = 1).
30
+ 4. **Non-barriers can parallel**: Consecutive non-barrier nodes grouped into one wave.
31
+ 5. **Wave-by-wave**: Never start wave N+1 before wave N results are read and analyzed.
32
+ 6. **Coordinator owns context**: Sub-agents never read prior results — coordinator assembles full `skill_call` with resolved args.
33
+ 7. **Resume from wave**: `-c` finds last completed wave, resumes from next pending step.
34
+ </invariants>
35
+
36
+ <context>
37
+ $ARGUMENTS — template slug/path, or flags.
38
+
39
+ **Flags:**
40
+ - `--context key=value` — Bind context variables (repeatable)
41
+ - `-c` / `--continue [session-id]` — Resume paused/interrupted session
42
+ - `--list` — List available templates
43
+ - `--dry-run` — Show wave plan without executing
44
+
45
+ **Entry routing:**
46
+
47
+ | Detection | Condition | Handler |
48
+ |-----------|-----------|---------|
49
+ | List | `--list` | handleList |
50
+ | Resume | `-c [session-id]` | Phase 0: Resume |
51
+ | Dry run | `--dry-run` | Phase 1 + 2, print plan, exit |
52
+ | Normal | Template slug/path | Phase 1 |
53
+ | No args | Empty | handleList + AskUserQuestion |
54
+
55
+ **Session tracking (aligned with maestro codex):**
56
+
57
+ | Constant | Value |
58
+ |----------|-------|
59
+ | Session prefix | `MCP` (Maestro Composer Player) |
60
+ | Session dir | `.workflow/.maestro-coordinate/MCP-<YYYYMMDD>-<HHmmss>/` |
61
+ | State file | `state.json` |
62
+ | Wave CSV | `wave-{N}.csv` |
63
+ | Wave results | `wave-{N}-results.csv` |
64
+ | Template dir | `~/.maestro/templates/workflows/` |
65
+ | Template index | `~/.maestro/templates/workflows/index.json` |
66
+
67
+ **Barrier nodes** (solo wave, coordinator reads artifacts after):
68
+
69
+ | Node type | Artifacts to Read | Context Updates |
70
+ |-----------|------------------|-----------------|
71
+ | `checkpoint` | — (state save only) | `last_checkpoint` |
72
+ | `maestro-plan` | `plan.json`, `.task/TASK-*.json` | `plan_dir`, `task_count` |
73
+ | `maestro-execute` | `results.csv` | `exec_status`, `completed_tasks` |
74
+ | `maestro-analyze` | `context.md` | `analysis_dir`, `gaps`, `phase` |
75
+ | `maestro-brainstorm` | `.brainstorming/` | `brainstorm_dir` |
76
+ | `maestro-spec-generate` | `specs/` | `spec_session_id` |
77
+
78
+ All other skill nodes are **non-barrier** (groupable into parallel waves).
79
+
80
+ **state.json schema:**
81
+
82
+ ```json
83
+ {
84
+ "id": "MCP-<YYYYMMDD>-<HHmmss>",
85
+ "intent": "<template_name> with context",
86
+ "chain": "<template_id>",
87
+ "template_path": "~/.maestro/templates/workflows/<slug>.json",
88
+ "template_name": "<name>",
89
+ "auto_yes": false,
90
+ "status": "in_progress | paused | completed | aborted",
91
+ "started_at": "<ISO>",
92
+ "context": {
93
+ "goal": "...", "scope": "...",
94
+ "phase": null, "plan_dir": null, "analysis_dir": null,
95
+ "last_checkpoint": null
96
+ },
97
+ "waves": [],
98
+ "steps": [
99
+ {
100
+ "step_n": 1, "node_id": "N-001",
101
+ "skill": "<executor>", "args": "<args_template>",
102
+ "type": "skill | cli | checkpoint",
103
+ "is_barrier": true,
104
+ "status": "pending | completed | failed | skipped",
105
+ "wave_n": null, "findings": null, "artifacts": null
106
+ }
107
+ ]
108
+ }
109
+ ```
110
+ </context>
111
+
112
+ <execution>
113
+
114
+ ### handleList
115
+
116
+ Scan `~/.maestro/templates/workflows/index.json`. Display:
117
+ ```
118
+ Available workflow templates:
119
+ feature-tdd-review [feature, complex] 3 work nodes, 2 checkpoints
120
+ quick-bugfix [bugfix, simple] 2 work nodes, 1 checkpoint
121
+
122
+ Run: $maestro-player <slug> --context goal="..."
123
+ ```
124
+
125
+ If not found: "No templates. Create with $maestro-composer"
126
+
127
+ ---
128
+
129
+ ### Phase 0: Resume
130
+
131
+ **Trigger**: `-c [session-id]`
132
+
133
+ 1. If session-id given: load `.workflow/.maestro-coordinate/<session-id>/state.json`
134
+ 2. If no session-id: Glob `.workflow/.maestro-coordinate/MCP-*/state.json` sorted desc, find `status = "in_progress" | "paused"`
135
+ 3. None found → error E005
136
+ 4. Identify last completed wave, resume from next pending step
137
+ 5. Jump to Phase 3 (Wave Execution)
138
+
139
+ ---
140
+
141
+ ### Phase 1: Load & Bind
142
+
143
+ **Step 1.1** — Resolve template path:
144
+ 1. Absolute path → use as-is
145
+ 2. Slug → look up in `~/.maestro/templates/workflows/index.json`
146
+ 3. Partial match → confirm with user
147
+ 4. Not found → show `--list`, AskUserQuestion
148
+
149
+ **Step 1.2** — Parse `--context key=value` pairs into `bound_context`.
150
+
151
+ **Step 1.3** — Load and validate template JSON.
152
+
153
+ **Step 1.4** — Collect missing required variables via AskUserQuestion.
154
+
155
+ **Step 1.5** — Bind `{variable_name}` in all `args_template` strings. Leave `{N-xxx.field}` and `{prev_*}` unresolved (runtime Phase 3).
156
+
157
+ **Step 1.6** — If `--dry-run`: print wave plan and exit (see Phase 2 output).
158
+
159
+ ---
160
+
161
+ ### Phase 2: Init Session & Build Wave Plan
162
+
163
+ **Step 2.1** — Generate session ID: `MCP-<YYYYMMDD>-<HHmmss>`.
164
+
165
+ **Step 2.2** — Topological sort (Kahn's algorithm) on template nodes + edges.
166
+
167
+ **Step 2.3** — Classify barrier vs non-barrier per node:
168
+
169
+ ```javascript
170
+ const BARRIER_SKILLS = new Set([
171
+ 'maestro-analyze', 'maestro-plan', 'maestro-brainstorm',
172
+ 'maestro-spec-generate', 'maestro-execute'
173
+ ]);
174
+
175
+ function isBarrier(node) {
176
+ if (node.type === 'checkpoint') return true;
177
+ return BARRIER_SKILLS.has(node.executor);
178
+ }
179
+ ```
180
+
181
+ **Step 2.4** — Group into waves:
182
+
183
+ ```javascript
184
+ function buildWaves(sortedNodes) {
185
+ const waves = [];
186
+ let currentWave = [];
187
+ for (const node of sortedNodes) {
188
+ if (isBarrier(node)) {
189
+ if (currentWave.length > 0) waves.push(currentWave);
190
+ waves.push([node]); // barrier = solo wave
191
+ currentWave = [];
192
+ } else {
193
+ currentWave.push(node);
194
+ }
195
+ }
196
+ if (currentWave.length > 0) waves.push(currentWave);
197
+ return waves;
198
+ }
199
+ ```
200
+
201
+ **Step 2.5** — Build steps array from waves. Write `state.json` to `.workflow/.maestro-coordinate/<session-id>/`.
202
+
203
+ **Step 2.6** — Display start banner:
204
+ ```
205
+ ============================================================
206
+ MAESTRO PLAYER
207
+ ============================================================
208
+ Template: <template.name>
209
+ Session: <session_id>
210
+ Context: goal="<value>"
211
+
212
+ Wave Plan:
213
+ [W1] N-001 maestro-plan "{goal}" [BARRIER]
214
+ [W2] N-002 maestro-execute {phase} [BARRIER]
215
+ [W3] N-003 quality-test {phase}
216
+ N-004 quality-review {phase}
217
+ ============================================================
218
+ ```
219
+
220
+ **`--dry-run`**: Display above and exit.
221
+
222
+ ---
223
+
224
+ ### Phase 3: Wave Execution Loop
225
+
226
+ ```javascript
227
+ let waveNum = 0;
228
+ while (state.steps.some(s => s.status === 'pending')) {
229
+ waveNum++;
230
+ const waveSteps = getNextWave(state.steps);
231
+ ```
232
+
233
+ **3a. Resolve runtime references** in each step's args:
234
+
235
+ ```javascript
236
+ function resolveArgs(args, steps, context) {
237
+ return args
238
+ .replace(/{(\w+)}/g, (_, key) => context[key] ?? '')
239
+ .replace(/{N-(\d+)\.(\w+)}/g, (_, id, field) => {
240
+ const step = steps.find(s => s.node_id === `N-${id}`);
241
+ return step?.[field] ?? '';
242
+ })
243
+ .replace(/{prev_(\w+)}/g, (_, field) => {
244
+ const prev = [...steps].reverse().find(s =>
245
+ s.status === 'completed' && s.type !== 'checkpoint');
246
+ return prev?.[field] ?? '';
247
+ });
248
+ }
249
+ ```
250
+
251
+ **3b. Handle checkpoint nodes** (no CSV spawn needed):
252
+
253
+ ```javascript
254
+ if (waveSteps[0].type === 'checkpoint') {
255
+ const cp = waveSteps[0];
256
+ // Save checkpoint snapshot
257
+ Write(`${sessionDir}/checkpoints/${cp.node_id}.json`, JSON.stringify({
258
+ session_id: state.id, checkpoint_id: cp.node_id,
259
+ saved_at: new Date().toISOString(),
260
+ steps_snapshot: state.steps, context: state.context
261
+ }, null, 2));
262
+
263
+ state.context.last_checkpoint = cp.node_id;
264
+ cp.status = 'completed'; cp.wave_n = waveNum;
265
+
266
+ // If auto_continue == false: pause for user
267
+ if (!cp.auto_continue) {
268
+ AskUserQuestion: Continue / Pause / Abort
269
+ on Pause: state.status = 'paused', save, exit
270
+ on Abort: state.status = 'aborted', skip remaining, exit
271
+ }
272
+
273
+ Write(stateFile, JSON.stringify(state, null, 2));
274
+ continue;
275
+ }
276
+ ```
277
+
278
+ **3c. Build wave CSV** for skill nodes:
279
+
280
+ ```javascript
281
+ const csvContent = 'id,skill_call,topic\n' + waveSteps.map(step => {
282
+ const resolvedArgs = resolveArgs(step.args, state.steps, state.context);
283
+ const skillCall = `$${step.skill} ${resolvedArgs}`.trim();
284
+ return `"${step.step_n}","${skillCall.replace(/"/g, '""')}","Template \"${state.template_name}\" step ${step.step_n}/${state.steps.length}"`;
285
+ }).join('\n');
286
+
287
+ Write(`${sessionDir}/wave-${waveNum}.csv`, csvContent);
288
+ ```
289
+
290
+ **3d. Spawn agents**:
291
+
292
+ ```javascript
293
+ spawn_agents_on_csv({
294
+ csv_path: `${sessionDir}/wave-${waveNum}.csv`,
295
+ id_column: "id",
296
+ instruction: PLAYER_INSTRUCTION,
297
+ max_workers: waveSteps.length,
298
+ max_runtime_seconds: 1800,
299
+ output_csv_path: `${sessionDir}/wave-${waveNum}-results.csv`,
300
+ output_schema: RESULT_SCHEMA
301
+ });
302
+ ```
303
+
304
+ **3e. Read results, update state**:
305
+
306
+ ```javascript
307
+ const results = readCSV(`${sessionDir}/wave-${waveNum}-results.csv`);
308
+ for (const row of results) {
309
+ const step = state.steps.find(s => s.step_n === parseInt(row.id));
310
+ step.status = row.status;
311
+ step.findings = row.summary;
312
+ step.artifacts = row.artifacts;
313
+ step.wave_n = waveNum;
314
+ }
315
+ ```
316
+
317
+ **3f. Barrier analysis** (if barrier wave):
318
+
319
+ ```javascript
320
+ if (isBarrier(waveSteps[0])) {
321
+ analyzeBarrierArtifacts(waveSteps[0], results[0], state.context);
322
+ }
323
+ ```
324
+
325
+ **3g. Persist + abort check**:
326
+
327
+ ```javascript
328
+ state.waves.push({ wave_n: waveNum, steps: waveSteps.map(s => s.step_n) });
329
+ Write(stateFile, JSON.stringify(state, null, 2));
330
+
331
+ if (results.some(r => r.status === 'failed')) {
332
+ state.status = 'aborted';
333
+ state.steps.filter(s => s.status === 'pending').forEach(s => s.status = 'skipped');
334
+ Write(stateFile, JSON.stringify(state, null, 2));
335
+ break;
336
+ }
337
+ ```
338
+
339
+ ### Sub-Agent Instruction Template
340
+
341
+ ```
342
+ 你是 CSV job 子 agent。
343
+
344
+ 先原样执行这一段技能调用:
345
+ {skill_call}
346
+
347
+ 然后基于结果完成这一行任务说明:
348
+ {topic}
349
+
350
+ 限制:
351
+ - 不要修改 .workflow/.maestro-coordinate/ 下的 state 文件
352
+ - skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
353
+
354
+ 最后必须调用 `report_agent_job_result`,返回 JSON:
355
+ {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
356
+ ```
357
+
358
+ ### Result Schema
359
+
360
+ ```javascript
361
+ const RESULT_SCHEMA = {
362
+ type: "object",
363
+ properties: {
364
+ status: { type: "string", enum: ["completed", "failed"] },
365
+ skill_call: { type: "string" },
366
+ summary: { type: "string" },
367
+ artifacts: { type: "string" },
368
+ error: { type: "string" }
369
+ },
370
+ required: ["status", "skill_call", "summary", "artifacts", "error"]
371
+ };
372
+ ```
373
+
374
+ ---
375
+
376
+ ### Phase 4: Completion Report
377
+
378
+ ```
379
+ ============================================================
380
+ MAESTRO PLAYER SESSION COMPLETE
381
+ ============================================================
382
+ Session: <session_id>
383
+ Template: <template_name> (<template_id>)
384
+ Waves: <N> executed
385
+ Steps: <completed>/<total>
386
+ Context: goal="<value>"
387
+
388
+ WAVE RESULTS:
389
+ [W1] $maestro-plan "{goal}" → ✓ plan created
390
+ [W2] $maestro-execute {phase} → ✓ 12/12 tasks
391
+ [W3] $quality-test {phase} → ✓ all tests pass
392
+ $quality-review {phase} → ✓ no issues
393
+
394
+ State: .workflow/.maestro-coordinate/<session_id>/state.json
395
+ Resume: $maestro-player -c
396
+ ============================================================
397
+ ```
398
+
399
+ Update `state.status = "completed"`, write final `state.json`.
400
+ </execution>
401
+
402
+ <csv_schema>
403
+ ### wave-{N}.csv (Per-Wave Input)
404
+
405
+ ```csv
406
+ id,skill_call,topic
407
+ "1","$maestro-plan \"implement user auth\"","Template \"feature-plan-test\" step 1/5"
408
+ ```
409
+
410
+ | Column | Description |
411
+ |--------|-------------|
412
+ | `id` | Step number (string) |
413
+ | `skill_call` | Full skill invocation with resolved context args |
414
+ | `topic` | Brief description for the agent |
415
+
416
+ ### wave-{N}-results.csv (Per-Wave Output)
417
+
418
+ Written by `spawn_agents_on_csv`. Contains result per agent.
419
+ </csv_schema>
420
+
421
+ <error_codes>
422
+ | Code | Severity | Condition | Recovery |
423
+ |------|----------|-----------|----------|
424
+ | E001 | error | Template not found | Show --list, suggest closest match |
425
+ | E002 | error | Template JSON invalid | Point to file for fix |
426
+ | E003 | error | Required variable missing, user declined | Cannot proceed |
427
+ | E004 | error | DAG cycle in template | Suggest $maestro-composer --edit |
428
+ | E005 | error | Resume session not found | List sessions |
429
+ | E006 | error | Wave timeout | Mark failed, abort chain |
430
+ | E007 | error | Barrier artifact not found | Retry wave once, then abort |
431
+ | W001 | warning | Runtime reference resolved to empty | Log, continue |
432
+ | W002 | warning | Barrier artifact partial | Continue with available context |
433
+ </error_codes>
434
+
435
+ <success_criteria>
436
+ - [ ] Template loaded from `~/.maestro/templates/workflows/` and validated
437
+ - [ ] All required context variables bound
438
+ - [ ] Session dir at `.workflow/.maestro-coordinate/MCP-*/` with `state.json`
439
+ - [ ] DAG nodes converted to waves (barrier=solo, non-barrier=parallel)
440
+ - [ ] Every skill invocation goes through `spawn_agents_on_csv` — none in coordinator
441
+ - [ ] Checkpoint nodes handled inline (state save, optional user pause)
442
+ - [ ] Barrier artifacts read and context updated before next wave
443
+ - [ ] Runtime references ({N-xxx.field}, {prev_*}) resolved before each wave CSV
444
+ - [ ] Failed step → remaining marked skipped → abort reported
445
+ - [ ] `--dry-run` shows wave plan with [BARRIER] markers, no execution
446
+ - [ ] `-c` resumes from last completed wave
447
+ - [ ] Completion report with per-wave status
448
+ </success_criteria>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "Workflow orchestration CLI with MCP endpoint support and extensible architecture",
5
5
  "type": "module",
6
6
  "imports": {
@@ -0,0 +1,170 @@
1
+ # Node Catalog — Available Executors for maestro-composer
2
+
3
+ All executors available for node resolution in Phase 2 (Resolve).
4
+ Only commands that exist in `~/.claude/commands/` are listed.
5
+
6
+ ## Skill Nodes (maestro commands)
7
+
8
+ | Executor | Input Ports | Output Ports | Typical Args Template |
9
+ |----------|-------------|--------------|----------------------|
10
+ | `maestro-plan` | requirement | plan | `"{goal}"` |
11
+ | `maestro-execute` | plan | code | `{phase}` |
12
+ | `maestro-verify` | code | verification | `{phase}` |
13
+ | `maestro-analyze` | requirement | analysis | `"{goal}"` |
14
+ | `maestro-brainstorm` | topic | brainstorm-analysis | `"{goal}"` |
15
+ | `maestro-spec-generate` | requirement | specification | `"{goal}"` |
16
+ | `maestro-roadmap` | requirement | roadmap | `"{goal}"` |
17
+ | `maestro-quick` | requirement | code | `"{goal}"` |
18
+ | `maestro-ui-design` | requirement | ui-design | `{phase}` |
19
+
20
+ ## Quality Commands (as skill nodes)
21
+
22
+ | Executor | Input Ports | Output Ports | Typical Args |
23
+ |----------|-------------|--------------|--------------|
24
+ | `quality-review` | code | review-findings | `{phase}` |
25
+ | `quality-test` | code | test-passed | `{phase}` |
26
+ | `quality-test-gen` | code | test-generated | `{phase}` |
27
+ | `quality-debug` | bug-report | diagnosis | `"{goal}"` |
28
+ | `quality-refactor` | codebase | refactored-code | `"{goal}"` |
29
+ | `quality-integration-test` | requirement | test-passed | `{phase}` |
30
+ | `quality-sync` | code | synced-docs | `{phase}` |
31
+ | `quality-retrospective` | phase | retrospective | `{phase}` |
32
+ | `quality-business-test` | requirement | test-passed | `{phase}` |
33
+
34
+ ## Management Commands (as skill nodes)
35
+
36
+ | Executor | Input Ports | Output Ports | Typical Args |
37
+ |----------|-------------|--------------|--------------|
38
+ | `manage-status` | — | dashboard | (no args) |
39
+ | `manage-issue` | — | issue-status | `"{goal}"` |
40
+ | `manage-issue-discover` | codebase | pending-issues | `"{goal}"` |
41
+ | `manage-codebase-rebuild` | — | docs | (no args) |
42
+ | `manage-codebase-refresh` | — | docs | (no args) |
43
+ | `manage-harvest` | artifacts | knowledge | (no args) |
44
+ | `manage-learn` | — | learning | `"{goal}"` |
45
+
46
+ ## Milestone Commands (as skill nodes)
47
+
48
+ | Executor | Input Ports | Output Ports | Typical Args |
49
+ |----------|-------------|--------------|--------------|
50
+ | `maestro-milestone-audit` | — | audit-report | (no args) |
51
+ | `maestro-milestone-complete` | — | archived | (no args) |
52
+ | `maestro-milestone-release` | — | release | (no args) |
53
+
54
+ ## Spec Commands (as skill nodes)
55
+
56
+ | Executor | Input Ports | Output Ports | Typical Args |
57
+ |----------|-------------|--------------|--------------|
58
+ | `spec-add` | knowledge | spec-entry | `"{goal}"` |
59
+ | `spec-load` | — | specs | `"{goal}"` |
60
+ | `spec-setup` | — | specs | (no args) |
61
+
62
+ ## CLI Nodes (via `maestro delegate`)
63
+
64
+ CLI nodes use `maestro delegate` with `--to <tool> --mode <mode> --rule <rule>`.
65
+
66
+ | Use Case | cli_tool | cli_mode | cli_rule |
67
+ |----------|----------|----------|----------|
68
+ | Architecture analysis | gemini | analysis | analysis-review-architecture |
69
+ | Code quality review | gemini | analysis | analysis-review-code-quality |
70
+ | Bug root cause | gemini | analysis | analysis-diagnose-bug-root-cause |
71
+ | Security assessment | gemini | analysis | analysis-assess-security-risks |
72
+ | Performance analysis | gemini | analysis | analysis-analyze-performance |
73
+ | Code patterns | gemini | analysis | analysis-analyze-code-patterns |
74
+ | Task breakdown | gemini | analysis | planning-breakdown-task-steps |
75
+ | Architecture design | gemini | analysis | planning-plan-architecture-design |
76
+ | Feature implementation | gemini | write | development-implement-feature |
77
+ | Refactoring | gemini | write | development-refactor-codebase |
78
+ | Test generation | gemini | write | development-generate-tests |
79
+
80
+ **CLI node args_template format**:
81
+ ```
82
+ PURPOSE: {goal}
83
+ TASK: [derived from step description]
84
+ MODE: analysis
85
+ CONTEXT: @**/* | Memory: {memory_context}
86
+ EXPECTED: [derived from step output_ports]
87
+ CONSTRAINTS: {scope}
88
+ ```
89
+
90
+ ## Agent Nodes
91
+
92
+ | subagent_type | Use Case | run_in_background |
93
+ |---------------|----------|-------------------|
94
+ | `general-purpose` | Freeform analysis or implementation | false |
95
+ | `code-developer` | Code implementation | false |
96
+
97
+ **Agent node args_template format**:
98
+ ```
99
+ Task: {goal}
100
+
101
+ Context from previous step:
102
+ {prev_output}
103
+
104
+ Deliver: [specify expected output format]
105
+ ```
106
+
107
+ ## Team Skill Nodes
108
+
109
+ | Executor | Input Ports | Output Ports | Typical Args |
110
+ |----------|-------------|--------------|--------------|
111
+ | `team-lifecycle-v4` | requirement | code | `"{goal}"` |
112
+ | `team-coordinate` | requirement | coordinated-output | `"{goal}"` |
113
+ | `team-review` | code | review-findings | `"{goal}"` |
114
+ | `team-testing` | code | test-passed | `"{goal}"` |
115
+ | `team-quality-assurance` | code | qa-report | `"{goal}"` |
116
+ | `team-tech-debt` | codebase | refactored-code | `"{goal}"` |
117
+
118
+ ## Resolution Algorithm
119
+
120
+ 1. Match step `type_hint` to executor candidates in catalog
121
+ 2. If multiple candidates, select by semantic fit to step description
122
+ 3. If no catalog match, emit `cli` node with inferred `--rule` and `--mode`
123
+
124
+ | type_hint | Default executor type | Default executor |
125
+ |-----------|----------------------|------------------|
126
+ | `planning` | skill | `maestro-plan` |
127
+ | `execution` | skill | `maestro-execute` |
128
+ | `testing` | skill | `quality-test` |
129
+ | `review` | skill | `quality-review` |
130
+ | `brainstorm` | skill | `maestro-brainstorm` |
131
+ | `analysis` | cli | `maestro delegate --to gemini --mode analysis` |
132
+ | `spec` | skill | `maestro-spec-generate` |
133
+ | `refactor` | skill | `quality-refactor` |
134
+ | `integration-test` | skill | `quality-integration-test` |
135
+ | `debug` | skill | `quality-debug` |
136
+ | `verify` | skill | `maestro-verify` |
137
+ | `agent` | agent | (infer subagent_type from description) |
138
+ | `checkpoint` | checkpoint | — |
139
+
140
+ ## Context Injection Rules
141
+
142
+ - Planning nodes after analysis: inject `--context {prev_output_path}`
143
+ - Execution nodes after planning: inherit phase from prior plan output
144
+ - Testing/review nodes after execution: inherit phase from prior execution
145
+
146
+ ## Runtime Reference Syntax (resolved by maestro-player)
147
+
148
+ | Reference | Resolves To |
149
+ |-----------|-------------|
150
+ | `{variable}` | Value from context binding |
151
+ | `{N-001.session_id}` | `steps[0].session_id` |
152
+ | `{N-001.output_path}` | `steps[0].output_path` |
153
+ | `{prev_session_id}` | session_id of preceding work node |
154
+ | `{prev_output_path}` | output_path of preceding work node |
155
+
156
+ Fallback: if referenced field is null, substitution results in empty string.
157
+
158
+ ## Checkpoint Nodes
159
+
160
+ Checkpoints are auto-generated, not selected from catalog.
161
+
162
+ | auto_continue | When to Use |
163
+ |---------------|-------------|
164
+ | `true` | Background save, execution continues automatically |
165
+ | `false` | Pause for user review before proceeding |
166
+
167
+ Set `auto_continue: false` when:
168
+ - The next node is user-facing (plan display, spec review)
169
+ - The user requested an explicit pause
170
+ - The next node spawns a background agent