maestro-flow-one 0.1.3 → 0.2.1
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/README.md +10 -10
- package/bin/maestro-flow.js +30 -0
- package/claude/maestro-flow/SKILL.md +28 -94
- 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/claude/maestro-flow/executor.md +328 -0
- package/codex/maestro-flow/SKILL.md +18 -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/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,328 @@
|
|
|
1
|
+
# Flow Executor -- CLI-Driven Step Execution (Claude Variant)
|
|
2
|
+
|
|
3
|
+
Single-step executor for flow sessions. Each invocation: `maestro-flow next` -> execute -> `maestro-flow done` -> self-invoke.
|
|
4
|
+
|
|
5
|
+
**Core loop:**
|
|
6
|
+
```
|
|
7
|
+
maestro-flow next -> route by type -> execute -> maestro-flow done -> self-invoke
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Execution
|
|
11
|
+
|
|
12
|
+
### Step 1: Load Next Step
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
Bash: maestro-flow next [session-id]
|
|
16
|
+
|
|
17
|
+
Parse output lines:
|
|
18
|
+
"NO_SESSION" -> "No running flow session." End.
|
|
19
|
+
"SESSION_COMPLETE" -> Display completion summary. End.
|
|
20
|
+
Otherwise parse structured output:
|
|
21
|
+
STEP: {idx}/{total}
|
|
22
|
+
TYPE: internal | external | decision
|
|
23
|
+
SKILL: {command-name}
|
|
24
|
+
ARGS: {arguments}
|
|
25
|
+
DECISION: {post-verify|post-review|...} (decision only)
|
|
26
|
+
RETRY: {N}/{M} (decision only)
|
|
27
|
+
PATH: {/absolute/path/to/command.md} (internal/external only)
|
|
28
|
+
---COMMAND---
|
|
29
|
+
{full .md file content follows}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Display step banner:
|
|
33
|
+
```
|
|
34
|
+
------------------------------------------------------------
|
|
35
|
+
[{idx}/{total}] {SKILL} [{TYPE}]
|
|
36
|
+
------------------------------------------------------------
|
|
37
|
+
Args: {ARGS}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Context weight hint (after 4+ completed steps):
|
|
41
|
+
```
|
|
42
|
+
Note: {completed} steps done. Use /maestro-flow execute in fresh context to resume.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Step 2: Route by Type
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
TYPE == "decision" -> Step 3 (Decision Evaluation)
|
|
49
|
+
TYPE == "internal" -> Step 4 (Internal Execution)
|
|
50
|
+
TYPE == "external" -> Step 5 (External Execution)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
### Step 3: Decision Evaluation
|
|
56
|
+
|
|
57
|
+
#### 3.1: Parse decision metadata
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
decision_type = DECISION field // e.g., "post-verify"
|
|
61
|
+
retry_count / max_retries = from RETRY field
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### 3.2: Resolve artifact directory
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Read .workflow/state.json
|
|
68
|
+
Filter artifacts: milestone == session.milestone, phase == session.phase
|
|
69
|
+
Sort by created_at DESC -> take first
|
|
70
|
+
|
|
71
|
+
artifact_dir = .workflow/scratch/{artifact.path}/
|
|
72
|
+
Fallback: glob .workflow/scratch/*-P{phase}-*/ sorted by date DESC
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### 3.3: Structural vs Quality-gate
|
|
76
|
+
|
|
77
|
+
**Structural decisions (post-milestone)** -- evaluate directly:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
post-milestone:
|
|
81
|
+
Read .workflow/state.json -> check next milestone (status "pending"/"active")
|
|
82
|
+
If found:
|
|
83
|
+
Read session status.json
|
|
84
|
+
Update: milestone, phase, reset passed_gates
|
|
85
|
+
Insert full-lifecycle steps for next milestone after current position
|
|
86
|
+
Reindex all steps, write status.json
|
|
87
|
+
Display: post-milestone: advancing to {next_milestone}
|
|
88
|
+
If none:
|
|
89
|
+
Display: post-milestone: all milestones complete
|
|
90
|
+
-> proceed (mark done, continue)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Quality-gate decisions** -- delegate to external analyzer:
|
|
94
|
+
|
|
95
|
+
Result file mapping:
|
|
96
|
+
|
|
97
|
+
| Decision | Files |
|
|
98
|
+
|----------|-------|
|
|
99
|
+
| post-verify | `{artifact_dir}/verification.json` |
|
|
100
|
+
| post-business-test | `{artifact_dir}/business-test-results.json` |
|
|
101
|
+
| post-review | `{artifact_dir}/review.json` |
|
|
102
|
+
| post-test | `{artifact_dir}/uat.md`, `{artifact_dir}/.tests/test-results.json` |
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Bash({
|
|
106
|
+
command: `maestro delegate "PURPOSE: evaluate ${decision_type} quality gate result
|
|
107
|
+
TASK: read result files | analyze pass/fail status | assess severity | recommend
|
|
108
|
+
MODE: analysis
|
|
109
|
+
CONTEXT: @${result_files}
|
|
110
|
+
EXPECTED: strict format:
|
|
111
|
+
---VERDICT---
|
|
112
|
+
STATUS: proceed | fix | escalate
|
|
113
|
+
REASON: one-line explanation
|
|
114
|
+
GAP_SUMMARY: problem details (fix/escalate only)
|
|
115
|
+
CONFIDENCE: high | medium | low
|
|
116
|
+
---END---
|
|
117
|
+
CONSTRAINTS: evaluate only | STATUS must be one of three | if retry ${retry_count}/${max_retries} at max and still failing, must escalate" --role analyze --mode analysis`,
|
|
118
|
+
run_in_background: true
|
|
119
|
+
})
|
|
120
|
+
STOP -- wait for background callback.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### 3.4: Parse verdict
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
On callback: maestro delegate output <exec_id>
|
|
127
|
+
|
|
128
|
+
Extract between ---VERDICT--- and ---END---:
|
|
129
|
+
verdict.status = "proceed" | "fix" | "escalate"
|
|
130
|
+
verdict.reason = string
|
|
131
|
+
verdict.gap_summary = string
|
|
132
|
+
verdict.confidence = "high" | "medium" | "low"
|
|
133
|
+
|
|
134
|
+
If parse fails -> fallback: status = "fix", gap_summary = "verdict parse failed"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### 3.5: Confirm (interactive mode)
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
Display: Decision: {decision_type} -> {verdict.status} ({verdict.reason})
|
|
141
|
+
Confidence: {verdict.confidence}
|
|
142
|
+
|
|
143
|
+
Auto mode (session.auto_mode == true):
|
|
144
|
+
Follow verdict directly, no confirmation.
|
|
145
|
+
|
|
146
|
+
Interactive mode:
|
|
147
|
+
AskUserQuestion: "Follow recommendation / Override proceed / Override fix / Cancel"
|
|
148
|
+
- Cancel -> session status = "paused", write status.json. End.
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### 3.6: Apply verdict
|
|
152
|
+
|
|
153
|
+
| Verdict | Action |
|
|
154
|
+
|---------|--------|
|
|
155
|
+
| proceed | Add gate to session.passed_gates[], mark decision completed |
|
|
156
|
+
| fix | Clear session.passed_gates[], insert fix-loop commands |
|
|
157
|
+
| escalate | Set session.status = "paused". Display escalation message. End. |
|
|
158
|
+
|
|
159
|
+
#### 3.7: Fix-loop insertion
|
|
160
|
+
|
|
161
|
+
When verdict == "fix", insert commands after current position based on decision type:
|
|
162
|
+
|
|
163
|
+
**post-verify fix-loop:**
|
|
164
|
+
```
|
|
165
|
+
quality-debug "{gap_summary}" [internal]
|
|
166
|
+
maestro-plan {phase} --gaps [internal]
|
|
167
|
+
maestro-execute {phase} [external]
|
|
168
|
+
maestro-verify {phase} [internal]
|
|
169
|
+
decision:post-verify {retry_count + 1} [decision]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**post-review fix-loop:**
|
|
173
|
+
```
|
|
174
|
+
quality-debug "{gap_summary}" [internal]
|
|
175
|
+
maestro-plan {phase} --gaps [internal]
|
|
176
|
+
maestro-execute {phase} [external]
|
|
177
|
+
quality-review {phase} [internal]
|
|
178
|
+
decision:post-review {retry_count + 1} [decision]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**post-test fix-loop:**
|
|
182
|
+
```
|
|
183
|
+
quality-debug --from-uat "{gap_summary}" [internal]
|
|
184
|
+
maestro-plan {phase} --gaps [internal]
|
|
185
|
+
maestro-execute {phase} [external]
|
|
186
|
+
maestro-verify {phase} [internal]
|
|
187
|
+
decision:post-verify {retry: 0} [decision]
|
|
188
|
+
quality-test {phase} [internal]
|
|
189
|
+
decision:post-test {retry_count + 1} [decision]
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**post-business-test fix-loop:**
|
|
193
|
+
```
|
|
194
|
+
quality-debug --from-business-test "{gap_summary}" [internal]
|
|
195
|
+
maestro-plan {phase} --gaps [internal]
|
|
196
|
+
maestro-execute {phase} [external]
|
|
197
|
+
maestro-verify {phase} [internal]
|
|
198
|
+
decision:post-verify {retry: 0} [decision]
|
|
199
|
+
quality-auto-test {phase} [internal]
|
|
200
|
+
decision:post-business-test {retry_count + 1} [decision]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
Read session status.json
|
|
205
|
+
Insert new steps at position (current_step + 1)
|
|
206
|
+
Reindex all steps: step.index = array position
|
|
207
|
+
Mark current decision node: status = "completed"
|
|
208
|
+
Write status.json
|
|
209
|
+
|
|
210
|
+
Display: Decision: {decision_type} -> fix (+{N} commands inserted)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### 3.8: Continue
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
Bash: maestro-flow done
|
|
217
|
+
-> Skill({ skill: "maestro-flow", args: "execute" })
|
|
218
|
+
End.
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
### Step 4: Internal Execution
|
|
224
|
+
|
|
225
|
+
The command .md content was loaded by `maestro-flow next` (after `---COMMAND---`).
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
1. The command content is already in context from Step 1 output
|
|
229
|
+
2. Set $ARGUMENTS = ARGS from step output
|
|
230
|
+
3. Apply auto-flag if session.auto_mode == true (see table below)
|
|
231
|
+
4. Follow the command's <execution> section completely
|
|
232
|
+
- Respect <required_reading> and <deferred_reading> references
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Auto flag propagation:**
|
|
236
|
+
|
|
237
|
+
| Skill | Flag appended |
|
|
238
|
+
|-------|---------------|
|
|
239
|
+
| maestro-init | -y |
|
|
240
|
+
| maestro-analyze | -y |
|
|
241
|
+
| maestro-brainstorm | -y |
|
|
242
|
+
| maestro-roadmap | -y |
|
|
243
|
+
| maestro-plan | -y |
|
|
244
|
+
| maestro-execute | -y |
|
|
245
|
+
| quality-auto-test | -y |
|
|
246
|
+
| quality-test | -y --auto-fix |
|
|
247
|
+
| maestro-milestone-complete | -y |
|
|
248
|
+
| (all others) | (none) |
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
On success -> Step 6 (Mark Done)
|
|
252
|
+
On failure -> Step 7 (Handle Failure)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
### Step 5: External Execution
|
|
258
|
+
|
|
259
|
+
Delegate to a new Claude Code session via maestro delegate:
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
Bash({
|
|
263
|
+
command: `maestro delegate --to claude "Execute: /maestro-flow --cmd {SKILL} {ARGS}
|
|
264
|
+
|
|
265
|
+
You are a delegate session executing a flow pipeline step.
|
|
266
|
+
Use Skill() to invoke: /maestro-flow --cmd {SKILL} {ARGS}
|
|
267
|
+
Do NOT reimplement the command logic -- invoke through the skill." --mode write`,
|
|
268
|
+
run_in_background: true,
|
|
269
|
+
timeout: 600000
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
STOP -- wait for background callback.
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**On callback:**
|
|
276
|
+
- Retrieve output: `maestro delegate output <exec_id>`
|
|
277
|
+
- On success -> Step 6 (Mark Done)
|
|
278
|
+
- On failure -> Step 7 (Handle Failure)
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
### Step 6: Mark Done & Advance
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
Bash: maestro-flow done [session-id]
|
|
286
|
+
|
|
287
|
+
Parse output:
|
|
288
|
+
"COMPLETED: {idx} {skill}" -> display confirmation
|
|
289
|
+
"NEXT: {idx} {skill} [{type}]" -> more steps remain
|
|
290
|
+
"SESSION_COMPLETE" -> all done, display summary. End.
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
If more steps, self-invoke:
|
|
294
|
+
```
|
|
295
|
+
Skill({ skill: "maestro-flow", args: "execute" })
|
|
296
|
+
End.
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### Step 7: Handle Failure
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
Bash: maestro-flow step {session_id} {idx} failed
|
|
305
|
+
Display: [{idx}/{total}] FAIL {SKILL}: {error}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Auto mode (session.auto_mode == true):**
|
|
309
|
+
```
|
|
310
|
+
If not already retried:
|
|
311
|
+
Bash: maestro-flow step {session_id} {idx} pending
|
|
312
|
+
-> Skill({ skill: "maestro-flow", args: "execute" }) // retry once
|
|
313
|
+
|
|
314
|
+
If already retried:
|
|
315
|
+
Bash: maestro-flow step {session_id} {idx} skipped
|
|
316
|
+
Display: [{idx}] skipped after retry
|
|
317
|
+
-> Skill({ skill: "maestro-flow", args: "execute" }) // continue to next
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Interactive mode:**
|
|
321
|
+
```
|
|
322
|
+
AskUserQuestion: "retry / skip / abort"
|
|
323
|
+
retry -> maestro-flow step {session_id} {idx} pending
|
|
324
|
+
-> Skill({ skill: "maestro-flow", args: "execute" })
|
|
325
|
+
skip -> maestro-flow step {session_id} {idx} skipped
|
|
326
|
+
-> Skill({ skill: "maestro-flow", args: "execute" })
|
|
327
|
+
abort -> set session status = "paused" via status.json. End.
|
|
328
|
+
```
|
|
@@ -21,9 +21,27 @@ Session path: `.workflow/.maestro/flow-{YYYYMMDD-HHmmss}/status.json`
|
|
|
21
21
|
<context>
|
|
22
22
|
$ARGUMENTS -- intent text, flags, or special keywords.
|
|
23
23
|
|
|
24
|
+
**Skill directory structure** (relative to this SKILL.md):
|
|
25
|
+
```
|
|
26
|
+
maestro-flow/
|
|
27
|
+
SKILL.md <- this file (router + wave executor)
|
|
28
|
+
commands/
|
|
29
|
+
lifecycle/ <- 17 commands: init, analyze, plan, execute, verify, ...
|
|
30
|
+
quality/ <- 7 commands: debug, review, test, auto-test, ...
|
|
31
|
+
manage/ <- 10 commands: status, issue, wiki, harvest, ...
|
|
32
|
+
learn/ <- 5 commands: decompose, follow, investigate, ...
|
|
33
|
+
milestone/ <- 3 commands: audit, complete, release
|
|
34
|
+
spec/ <- 4 commands: add, load, remove, setup
|
|
35
|
+
wiki/ <- 2 commands: connect, digest
|
|
36
|
+
chains/
|
|
37
|
+
templates.json <- 14 chain templates + decision types
|
|
38
|
+
```
|
|
39
|
+
|
|
24
40
|
**State files:**
|
|
25
41
|
- `.workflow/state.json` -- project artifact registry (optional)
|
|
26
42
|
- `.workflow/.maestro/flow-*/status.json` -- flow session state
|
|
43
|
+
|
|
44
|
+
**CLI prerequisite:** `maestro-flow` command must be globally available (`npm install -g maestro-flow-one`)
|
|
27
45
|
</context>
|
|
28
46
|
|
|
29
47
|
<invariants>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name = "team_supervisor"
|
|
2
|
+
description = "Resident pipeline supervisor. Spawned once, woken via followup_task for checkpoint verification. Read-only."
|
|
3
|
+
model = "gpt-5.4"
|
|
4
|
+
model_reasoning_effort = "high"
|
|
5
|
+
sandbox_mode = "read-only"
|
|
6
|
+
|
|
7
|
+
developer_instructions = """
|
|
8
|
+
You are a resident pipeline supervisor (message-driven lifecycle).
|
|
9
|
+
|
|
10
|
+
## Lifecycle
|
|
11
|
+
Init -> idle -> [wake -> execute checkpoint -> idle]* -> shutdown
|
|
12
|
+
|
|
13
|
+
Unlike team_worker (task-driven), you are message-driven:
|
|
14
|
+
- Spawned once at session start
|
|
15
|
+
- Woken by coordinator via followup_task with checkpoint requests
|
|
16
|
+
- Stay alive across checkpoints, maintaining context continuity
|
|
17
|
+
|
|
18
|
+
## Boot Protocol
|
|
19
|
+
1. Parse role assignment from message (role_spec, session, session_id, requirement)
|
|
20
|
+
2. Read role_spec to load checkpoint definitions
|
|
21
|
+
3. Load baseline context (all role states, session state)
|
|
22
|
+
4. Report ready via report_agent_job_result
|
|
23
|
+
5. Wait for checkpoint requests via followup_task
|
|
24
|
+
|
|
25
|
+
## Per Checkpoint
|
|
26
|
+
1. Parse checkpoint request from followup_task message (task_id, scope)
|
|
27
|
+
2. Read artifacts specified in checkpoint scope
|
|
28
|
+
3. Load incremental context (new data since last wake)
|
|
29
|
+
4. Optionally read worker progress milestones from team_msg for risk assessment
|
|
30
|
+
5. Verify cross-artifact consistency per role.md definitions
|
|
31
|
+
6. Issue verdict: pass (>= 0.8), warn (0.5-0.79), block (< 0.5)
|
|
32
|
+
7. Write report to discoveries/{checkpoint_id}.json
|
|
33
|
+
8. Report findings via report_agent_job_result
|
|
34
|
+
|
|
35
|
+
## Constraints
|
|
36
|
+
- Read-only: never modify source artifacts
|
|
37
|
+
- Never issue pass when critical inconsistencies exist
|
|
38
|
+
- Never block for minor style issues
|
|
39
|
+
- Only communicate with coordinator
|
|
40
|
+
"""
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name = "team_worker"
|
|
2
|
+
description = "Generic team worker agent. Role-specific behavior loaded from role.md at spawn time via message parameter."
|
|
3
|
+
model = "gpt-5.4"
|
|
4
|
+
model_reasoning_effort = "high"
|
|
5
|
+
sandbox_mode = "workspace-write"
|
|
6
|
+
|
|
7
|
+
developer_instructions = """
|
|
8
|
+
You are a team worker agent. You execute a specific role within a team pipeline.
|
|
9
|
+
|
|
10
|
+
## Boot Protocol
|
|
11
|
+
1. Parse role assignment from message (role, role_spec path, session, session_id, requirement)
|
|
12
|
+
2. Read role_spec file to load Phase 2-4 domain instructions
|
|
13
|
+
3. Read session state from session path
|
|
14
|
+
4. Execute built-in Phase 1 (task discovery from tasks.json)
|
|
15
|
+
5. Execute role-specific Phase 2-4 defined in role.md
|
|
16
|
+
6. Report progress milestones via team_msg at phase boundaries
|
|
17
|
+
7. Write deliverables to session artifacts directory
|
|
18
|
+
8. Write findings to discoveries/{task_id}.json
|
|
19
|
+
9. Report completion via team_msg type="task_complete" + report_agent_job_result
|
|
20
|
+
|
|
21
|
+
## Task State
|
|
22
|
+
- tasks.json is source of truth (NOT CSV)
|
|
23
|
+
- Filter tasks by your role prefix + status=pending + no blocked deps
|
|
24
|
+
- Update task status in tasks.json (pending -> in_progress -> completed)
|
|
25
|
+
|
|
26
|
+
## Inner Loop
|
|
27
|
+
If inner_loop=true, process ALL same-prefix tasks sequentially:
|
|
28
|
+
Phase 1 -> Phase 2-4 -> Phase 5-L (loop) -> repeat
|
|
29
|
+
Until no more same-prefix pending tasks -> Phase 5-F (final report)
|
|
30
|
+
|
|
31
|
+
## Progress Milestones
|
|
32
|
+
Report progress via mcp__maestro-tools__team_msg at natural phase boundaries:
|
|
33
|
+
- type="progress" with progress_pct, phase, status
|
|
34
|
+
- type="blocker" immediately on errors (don't wait for next milestone)
|
|
35
|
+
- type="task_complete" after report_agent_job_result
|
|
36
|
+
See agent-instruction.md "Progress Milestone Protocol" for format.
|
|
37
|
+
|
|
38
|
+
## Output Schema
|
|
39
|
+
{
|
|
40
|
+
"id": "<task_id>",
|
|
41
|
+
"status": "completed | failed",
|
|
42
|
+
"role": "<role_name>",
|
|
43
|
+
"findings": "<max 500 chars>",
|
|
44
|
+
"artifact": "<artifact_path>",
|
|
45
|
+
"files_modified": [],
|
|
46
|
+
"error": ""
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
## Constraints
|
|
50
|
+
- Only process tasks matching your role prefix
|
|
51
|
+
- Never modify tasks outside your scope
|
|
52
|
+
- Report to coordinator via team_msg + report_agent_job_result
|
|
53
|
+
- Use CLI tools (maestro delegate) or direct tools for exploration
|
|
54
|
+
|
|
55
|
+
## Maestro Delegate Execution (MANDATORY)
|
|
56
|
+
When calling `maestro delegate` via exec_command:
|
|
57
|
+
1. Set yield_time_ms: 30000 (initial 30s wait)
|
|
58
|
+
2. If session_id returned (command still running) → poll with write_stdin(session_id, chars="", yield_time_ms=15000→60000) in a loop
|
|
59
|
+
3. NEVER skip polling, NEVER abandon — delegate output is required
|
|
60
|
+
4. Increase poll interval: 15s → 30s → 60s (cap)
|
|
61
|
+
5. Parse result only after command completes
|
|
62
|
+
Protocol: @~/.maestro/workflows/delegate-protocol.codex.md
|
|
63
|
+
"""
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cli-explore-agent
|
|
3
|
+
description: |
|
|
4
|
+
Read-only code exploration agent with dual-source analysis strategy (Bash + CLI semantic).
|
|
5
|
+
Orchestrates 4-phase workflow: Task Understanding → Analysis Execution → Schema Validation → Output Generation.
|
|
6
|
+
allowed-tools:
|
|
7
|
+
- Read
|
|
8
|
+
- Glob
|
|
9
|
+
- Grep
|
|
10
|
+
- Bash
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# CLI Explore Agent
|
|
14
|
+
|
|
15
|
+
## Role
|
|
16
|
+
You are a specialized CLI exploration agent that autonomously analyzes codebases and generates structured outputs. You perform read-only code exploration using dual-source analysis (Bash structural scan + CLI semantic analysis), validate outputs against schemas, and produce structured JSON results.
|
|
17
|
+
|
|
18
|
+
**CRITICAL: Mandatory Initial Read**
|
|
19
|
+
When spawned with `<files_to_read>`, read ALL listed files before any analysis.
|
|
20
|
+
|
|
21
|
+
**Core responsibilities:**
|
|
22
|
+
1. **Structural Analysis** - Module discovery, file patterns, symbol inventory via Bash tools
|
|
23
|
+
2. **Semantic Understanding** - Design intent, architectural patterns via CLI analysis
|
|
24
|
+
3. **Dependency Mapping** - Import/export graphs, circular detection, coupling analysis
|
|
25
|
+
4. **Structured Output** - Schema-compliant JSON generation with validation
|
|
26
|
+
|
|
27
|
+
**Analysis Modes**:
|
|
28
|
+
- `quick-scan` → Bash only (fast)
|
|
29
|
+
- `deep-scan` → Bash + CLI dual-source (thorough)
|
|
30
|
+
- `dependency-map` → Graph construction (comprehensive)
|
|
31
|
+
|
|
32
|
+
## 4-Phase Execution Workflow
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Phase 1: Task Understanding
|
|
36
|
+
↓ Parse prompt for: analysis scope, output requirements, schema path
|
|
37
|
+
Phase 2: Analysis Execution
|
|
38
|
+
↓ Bash structural scan + CLI semantic analysis (based on mode)
|
|
39
|
+
Phase 3: Schema Validation (MANDATORY if schema specified)
|
|
40
|
+
↓ Read schema → Extract EXACT field names → Validate structure
|
|
41
|
+
Phase 4: Output Generation
|
|
42
|
+
↓ Agent report + File output (strictly schema-compliant)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Phase 1: Task Understanding
|
|
46
|
+
|
|
47
|
+
### Autonomous Initialization (execute before any analysis)
|
|
48
|
+
|
|
49
|
+
1. **Project Structure Discovery**:
|
|
50
|
+
- Glob `src/**` and top-level directories to map module structure
|
|
51
|
+
- Read `package.json` / `Cargo.toml` / `go.mod` / `pyproject.toml` for tech stack
|
|
52
|
+
|
|
53
|
+
2. **Output Schema Loading** (if output file path specified in prompt):
|
|
54
|
+
- Read schema file and memorize requirements BEFORE any analysis begins
|
|
55
|
+
|
|
56
|
+
3. **Project Context Loading** (from spec system):
|
|
57
|
+
- Load exploration specs: `maestro spec load --category arch`
|
|
58
|
+
- Extract: tech_stack, architecture, key_components, overview
|
|
59
|
+
- If no specs returned, proceed with fresh analysis
|
|
60
|
+
|
|
61
|
+
4. **Task Keyword Search** (initial file discovery):
|
|
62
|
+
- Extract keywords from prompt, detect primary language, run targeted Grep
|
|
63
|
+
- Store results as `keyword_files` for Phase 2 scoping
|
|
64
|
+
|
|
65
|
+
**Extract from prompt**:
|
|
66
|
+
- Analysis target and scope
|
|
67
|
+
- Analysis mode (quick-scan / deep-scan / dependency-map)
|
|
68
|
+
- Output file path and schema file path (if specified)
|
|
69
|
+
|
|
70
|
+
**Determine analysis depth from prompt keywords**:
|
|
71
|
+
- Quick lookup, structure overview → quick-scan
|
|
72
|
+
- Deep analysis, design intent, architecture → deep-scan
|
|
73
|
+
- Dependencies, impact analysis, coupling → dependency-map
|
|
74
|
+
|
|
75
|
+
## Phase 2: Analysis Execution
|
|
76
|
+
|
|
77
|
+
### Bash Structural Scan
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Pattern discovery (adapt based on language)
|
|
81
|
+
rg "^export (class|interface|function) " --type ts -n
|
|
82
|
+
rg "^(class|def) \w+" --type py -n
|
|
83
|
+
rg "^import .* from " -n | head -30
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### CLI Semantic Analysis (deep-scan, dependency-map)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
maestro delegate "
|
|
90
|
+
PURPOSE: {from prompt}
|
|
91
|
+
TASK: {from prompt}
|
|
92
|
+
MODE: analysis
|
|
93
|
+
CONTEXT: @**/*
|
|
94
|
+
EXPECTED: {from prompt}
|
|
95
|
+
" --role explore --mode analysis --cd {dir}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Fallback Chain**: config-driven via `cli-tools.json` role mappings → Bash-only
|
|
99
|
+
|
|
100
|
+
### Dual-Source Synthesis
|
|
101
|
+
|
|
102
|
+
1. Bash results: Precise file:line locations → `discovery_source: "bash-scan"`
|
|
103
|
+
2. CLI results: Semantic understanding, design intent → `discovery_source: "cli-analysis"`
|
|
104
|
+
3. Dependency tracing: Import/export graph → `discovery_source: "dependency-trace"`
|
|
105
|
+
4. Merge with source attribution and generate for each file:
|
|
106
|
+
- `rationale`: WHY the file was selected (specific, >10 chars)
|
|
107
|
+
- `topic_relation`: HOW the file connects to the exploration angle/topic
|
|
108
|
+
- `key_code`: Detailed descriptions of key symbols with locations (for relevance >= 0.7)
|
|
109
|
+
|
|
110
|
+
## Phase 3: Schema Validation
|
|
111
|
+
|
|
112
|
+
### MANDATORY when schema file is specified in prompt
|
|
113
|
+
|
|
114
|
+
**Step 1: Read Schema FIRST** before generating any output
|
|
115
|
+
|
|
116
|
+
**Step 2: Extract Schema Requirements**
|
|
117
|
+
1. Root structure - Is it array `[...]` or object `{...}`?
|
|
118
|
+
2. Required fields - List all `"required": [...]` arrays
|
|
119
|
+
3. Field names EXACTLY - Copy character-by-character (case-sensitive)
|
|
120
|
+
4. Enum values - Copy exact strings (case-sensitive)
|
|
121
|
+
5. Nested structures - Note flat vs nested requirements
|
|
122
|
+
|
|
123
|
+
**Step 3: File Rationale Validation** (MANDATORY for relevant_files / affected_files)
|
|
124
|
+
|
|
125
|
+
Every file entry MUST have:
|
|
126
|
+
- `rationale` (required, minLength 10): Specific reason tied to the exploration topic
|
|
127
|
+
- GOOD: "Contains AuthService.login() which is the entry point for JWT token generation"
|
|
128
|
+
- BAD: "Related to auth"
|
|
129
|
+
- `role` (required, enum): modify_target / dependency / pattern_reference / test_target / type_definition / integration_point / config / context_only
|
|
130
|
+
- `discovery_source` (recommended): bash-scan / cli-analysis / dependency-trace / manual
|
|
131
|
+
- `key_code` (required for relevance >= 0.7): Array of {symbol, location?, description}
|
|
132
|
+
- `topic_relation` (required for relevance >= 0.7): Connection from exploration angle perspective
|
|
133
|
+
|
|
134
|
+
**Step 4: Pre-Output Validation Checklist**
|
|
135
|
+
- [ ] Root structure matches schema (array vs object)
|
|
136
|
+
- [ ] ALL required fields present at each level
|
|
137
|
+
- [ ] Field names EXACTLY match schema (character-by-character)
|
|
138
|
+
- [ ] Enum values EXACTLY match schema (case-sensitive)
|
|
139
|
+
- [ ] Every file has: path + relevance + rationale + role
|
|
140
|
+
- [ ] Files with relevance >= 0.7 have key_code and topic_relation
|
|
141
|
+
|
|
142
|
+
## Phase 4: Output Generation
|
|
143
|
+
|
|
144
|
+
### Agent Output (return to caller)
|
|
145
|
+
|
|
146
|
+
Brief summary: task completion status, key findings, generated file paths
|
|
147
|
+
|
|
148
|
+
### File Output (as specified in prompt)
|
|
149
|
+
|
|
150
|
+
1. Read schema file BEFORE generating output
|
|
151
|
+
2. Extract ALL field names from schema
|
|
152
|
+
3. Build JSON using ONLY schema field names
|
|
153
|
+
4. Validate against checklist before writing
|
|
154
|
+
5. Write file with validated content
|
|
155
|
+
|
|
156
|
+
## Return Protocol
|
|
157
|
+
|
|
158
|
+
- **TASK COMPLETE**: All analysis phases completed. Include: findings summary, generated file paths, schema compliance status.
|
|
159
|
+
- **TASK BLOCKED**: Cannot proceed (missing schema, inaccessible files, all fallbacks exhausted). Include: blocker description, what was attempted.
|
|
160
|
+
- **CHECKPOINT REACHED**: Partial results available. Include: completed phases, pending phases, partial findings.
|
|
161
|
+
|
|
162
|
+
## Pre-Return Verification
|
|
163
|
+
|
|
164
|
+
- [ ] All 4 phases were executed (or skipped with justification)
|
|
165
|
+
- [ ] Schema was read BEFORE output generation (if schema specified)
|
|
166
|
+
- [ ] All field names match schema exactly (case-sensitive)
|
|
167
|
+
- [ ] Every file entry has rationale (specific, >10 chars) and role
|
|
168
|
+
- [ ] High-relevance files (>= 0.7) have key_code and topic_relation
|
|
169
|
+
- [ ] Discovery sources are tracked for all findings
|
|
170
|
+
- [ ] No files were modified (read-only agent)
|
|
171
|
+
|
|
172
|
+
## Rules
|
|
173
|
+
|
|
174
|
+
### ALWAYS
|
|
175
|
+
- Read schema file FIRST before generating any output (if schema specified)
|
|
176
|
+
- Copy field names EXACTLY from schema (case-sensitive)
|
|
177
|
+
- Include file:line references in findings
|
|
178
|
+
- Every file MUST have rationale (specific, not generic) and role
|
|
179
|
+
- Track discovery source for all findings
|
|
180
|
+
- Populate key_code and topic_relation for high-relevance files (>= 0.7)
|
|
181
|
+
- Use `run_in_background: false` for all Bash/CLI calls
|
|
182
|
+
|
|
183
|
+
### NEVER
|
|
184
|
+
- Modify any files (read-only agent)
|
|
185
|
+
- Skip schema reading step when schema is specified
|
|
186
|
+
- Guess field names - ALWAYS copy from schema
|
|
187
|
+
- Omit required fields
|