maestro-flow 0.4.2 → 0.4.3
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/.claude/commands/maestro-analyze.md +1 -1
- package/.claude/commands/maestro-brainstorm.md +1 -1
- package/.claude/commands/maestro-collab.md +1 -1
- package/.claude/commands/maestro-execute.md +10 -1
- package/.claude/commands/maestro-guard.md +101 -0
- package/.claude/commands/maestro-impeccable.md +1 -1
- package/.claude/commands/maestro-plan.md +15 -2
- package/.claude/commands/maestro-ralph-execute.md +9 -2
- package/.claude/commands/maestro-ralph.md +8 -1
- package/.claude/commands/maestro-verify.md +15 -1
- package/.claude/commands/quality-auto-test.md +1 -1
- package/.claude/commands/quality-debug.md +1 -1
- package/.claude/commands/quality-refactor.md +1 -1
- package/.claude/commands/quality-retrospective.md +1 -1
- package/.claude/commands/quality-review.md +15 -1
- package/.claude/commands/quality-test.md +1 -1
- package/.claude/commands/security-audit.md +154 -0
- package/.claude/skills/maestro-help/index/catalog.json +2 -0
- package/.codex/skills/maestro-analyze/SKILL.md +18 -1
- package/.codex/skills/maestro-brainstorm/SKILL.md +17 -4
- package/.codex/skills/maestro-collab/SKILL.md +7 -1
- package/.codex/skills/maestro-execute/SKILL.md +365 -348
- package/.codex/skills/maestro-guard/SKILL.md +97 -0
- package/.codex/skills/maestro-impeccable/SKILL.md +1 -1
- package/.codex/skills/maestro-plan/SKILL.md +66 -7
- package/.codex/skills/maestro-ralph/SKILL.md +1 -1
- package/.codex/skills/maestro-verify/SKILL.md +18 -1
- package/.codex/skills/quality-auto-test/SKILL.md +13 -3
- package/.codex/skills/quality-debug/SKILL.md +362 -346
- package/.codex/skills/quality-refactor/SKILL.md +1 -1
- package/.codex/skills/quality-retrospective/SKILL.md +292 -292
- package/.codex/skills/quality-review/SKILL.md +374 -365
- package/.codex/skills/quality-test/SKILL.md +1 -1
- package/.codex/skills/security-audit/SKILL.md +154 -0
- package/bin/maestro-hook-runner.js +21 -1
- package/dashboard/dist-server/src/coordinator/output-parser.js +27 -0
- package/dashboard/dist-server/src/coordinator/output-parser.js.map +1 -1
- package/dist/src/commands/coordinate.d.ts.map +1 -1
- package/dist/src/commands/coordinate.js +2 -0
- package/dist/src/commands/coordinate.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +39 -3
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/coordinator/output-parser.d.ts.map +1 -1
- package/dist/src/coordinator/output-parser.js +27 -0
- package/dist/src/coordinator/output-parser.js.map +1 -1
- package/dist/src/hooks/delegate-monitor.d.ts +1 -0
- package/dist/src/hooks/delegate-monitor.d.ts.map +1 -1
- package/dist/src/hooks/delegate-monitor.js +1 -1
- package/dist/src/hooks/delegate-monitor.js.map +1 -1
- package/dist/src/hooks/guards/workflow-guard.d.ts +15 -0
- package/dist/src/hooks/guards/workflow-guard.d.ts.map +1 -1
- package/dist/src/hooks/guards/workflow-guard.js +61 -1
- package/dist/src/hooks/guards/workflow-guard.js.map +1 -1
- package/dist/src/hooks/plugins/decision-log-plugin.d.ts +19 -0
- package/dist/src/hooks/plugins/decision-log-plugin.d.ts.map +1 -0
- package/dist/src/hooks/plugins/decision-log-plugin.js +28 -0
- package/dist/src/hooks/plugins/decision-log-plugin.js.map +1 -0
- package/dist/src/hooks/plugins/index.d.ts +2 -0
- package/dist/src/hooks/plugins/index.d.ts.map +1 -1
- package/dist/src/hooks/plugins/index.js +1 -0
- package/dist/src/hooks/plugins/index.js.map +1 -1
- package/dist/src/hooks/session-context.d.ts +1 -0
- package/dist/src/hooks/session-context.d.ts.map +1 -1
- package/dist/src/hooks/session-context.js +1 -1
- package/dist/src/hooks/session-context.js.map +1 -1
- package/dist/src/hooks/skill-context.d.ts +1 -0
- package/dist/src/hooks/skill-context.d.ts.map +1 -1
- package/dist/src/hooks/skill-context.js +1 -1
- package/dist/src/hooks/skill-context.js.map +1 -1
- package/dist/src/hooks/spec-injector.d.ts.map +1 -1
- package/dist/src/hooks/spec-injector.js +2 -0
- package/dist/src/hooks/spec-injector.js.map +1 -1
- package/package.json +1 -1
- package/workflows/debug.md +73 -0
- package/workflows/execute.md +27 -0
- package/workflows/plan.md +11 -0
- package/workflows/review.md +33 -1
- package/workflows/tdd.md +257 -0
- package/workflows/verify.md +57 -0
|
@@ -1,348 +1,365 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: maestro-execute
|
|
3
|
-
description:
|
|
4
|
-
argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase> [--auto-commit] [--method agent|cli] [--dir <path>]\""
|
|
5
|
-
allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
<purpose>
|
|
9
|
-
Wave-based parallel task execution using `spawn_agents_on_csv`. Reads plan.json to build a CSV where waves are pre-computed from the plan. Each wave runs tasks in parallel, with cross-wave context propagation via `prev_context`. This is the core execution engine of the maestro pipeline.
|
|
10
|
-
|
|
11
|
-
**Core workflow**: Load Plan -> Build CSV from Tasks -> Wave-by-Wave Parallel Execution -> Aggregate Results
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
| |
|
|
29
|
-
| Phase
|
|
30
|
-
| +--
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
| | +--
|
|
41
|
-
| | +--
|
|
42
|
-
| +--
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
| +--
|
|
46
|
-
| +--
|
|
47
|
-
| +--
|
|
48
|
-
| +--
|
|
49
|
-
| +--
|
|
50
|
-
| +--
|
|
51
|
-
| +--
|
|
52
|
-
| |
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
id
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
|
108
|
-
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
**
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
1
|
+
---
|
|
2
|
+
name: maestro-execute
|
|
3
|
+
description: Use when a confirmed plan is ready for implementation
|
|
4
|
+
argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase> [--auto-commit] [--method agent|cli] [--dir <path>]\""
|
|
5
|
+
allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, request_user_input
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<purpose>
|
|
9
|
+
Wave-based parallel task execution using `spawn_agents_on_csv`. Reads plan.json to build a CSV where waves are pre-computed from the plan. Each wave runs tasks in parallel, with cross-wave context propagation via `prev_context`. This is the core execution engine of the maestro pipeline.
|
|
10
|
+
|
|
11
|
+
**Core workflow**: Load Plan -> Build CSV from Tasks -> Wave-by-Wave Parallel Execution -> Aggregate Results
|
|
12
|
+
|
|
13
|
+
## Iron Law
|
|
14
|
+
|
|
15
|
+
**VERIFY EACH TASK OUTPUT BEFORE MARKING COMPLETE.** Every task needs convergence criteria checks — no task may be marked "completed" based on agent self-report alone.
|
|
16
|
+
|
|
17
|
+
## Red Flags — These Thoughts Mean STOP
|
|
18
|
+
- "The agent said it's done, so it must be done" / "I'll batch-verify all tasks at the end"
|
|
19
|
+
- "This task is too simple to need verification" / "Let me mark it complete and fix later"
|
|
20
|
+
All mean: **run convergence criteria check NOW**.
|
|
21
|
+
|
|
22
|
+
**Topology**: Custom (waves inherited from plan.json -- no Kahn's algorithm needed)
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
+---------------------------------------------------------------------------+
|
|
26
|
+
| TASK EXECUTION CSV WAVE WORKFLOW |
|
|
27
|
+
+---------------------------------------------------------------------------+
|
|
28
|
+
| |
|
|
29
|
+
| Phase 1: Plan Resolution -> CSV |
|
|
30
|
+
| +-- Resolve phase directory (or --dir path) |
|
|
31
|
+
| +-- Read plan.json + .task/TASK-*.json definitions |
|
|
32
|
+
| +-- Detect completed tasks (breakpoint resume) |
|
|
33
|
+
| +-- Build tasks.csv with one row per pending task |
|
|
34
|
+
| +-- Waves inherited from plan.json (pre-computed) |
|
|
35
|
+
| +-- Load project specs for executor context |
|
|
36
|
+
| +-- User validates task breakdown (skip if -y) |
|
|
37
|
+
| |
|
|
38
|
+
| Phase 2: Wave Execution Engine |
|
|
39
|
+
| +-- For each wave (sequential): |
|
|
40
|
+
| | +-- Wave N: Task Execution (parallel within wave) |
|
|
41
|
+
| | | +-- Each agent implements one task |
|
|
42
|
+
| | | +-- Agent reads task definition + convergence criteria |
|
|
43
|
+
| | | +-- Agent creates/modifies files per task.files |
|
|
44
|
+
| | | +-- Agent verifies convergence.criteria (max 3 fix attempts) |
|
|
45
|
+
| | | +-- Agent writes .summaries/TASK-{NNN}-summary.md |
|
|
46
|
+
| | | +-- Atomic commit if --auto-commit |
|
|
47
|
+
| | | +-- Discoveries shared via board (patterns, blockers) |
|
|
48
|
+
| | +-- Merge wave results into master tasks.csv |
|
|
49
|
+
| | +-- Build prev_context for next wave from completed findings |
|
|
50
|
+
| | +-- If blocked tasks: prompt user (skip if -y: auto-continue) |
|
|
51
|
+
| +-- discoveries.ndjson shared across all waves (append-only) |
|
|
52
|
+
| |
|
|
53
|
+
| Phase 3: Results Aggregation |
|
|
54
|
+
| +-- Export results.csv |
|
|
55
|
+
| +-- Update .task/TASK-*.json statuses |
|
|
56
|
+
| +-- Update index.json execution progress |
|
|
57
|
+
| +-- Update state.json project progress |
|
|
58
|
+
| +-- Generate context.md with execution report |
|
|
59
|
+
| +-- Auto-sync codebase docs (if configured) |
|
|
60
|
+
| +-- Display summary with next steps |
|
|
61
|
+
| |
|
|
62
|
+
+---------------------------------------------------------------------------+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
</purpose>
|
|
66
|
+
|
|
67
|
+
<context>
|
|
68
|
+
```bash
|
|
69
|
+
$maestro-execute "3"
|
|
70
|
+
$maestro-execute -c 4 "3 --auto-commit"
|
|
71
|
+
$maestro-execute -y "3 --method cli"
|
|
72
|
+
$maestro-execute "3 --dir .workflow/scratch/quick-fix"
|
|
73
|
+
$maestro-execute --continue "20260318-execute-P3-phase3"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Flags**:
|
|
77
|
+
- `-y, --yes`: Skip all confirmations (auto mode)
|
|
78
|
+
- `-c, --concurrency N`: Max concurrent agents within each wave (default: 5)
|
|
79
|
+
- `--continue`: Resume existing session
|
|
80
|
+
|
|
81
|
+
**Inner flags** (passed inside quotes):
|
|
82
|
+
- `--auto-commit`: Atomic git commit after each task completion
|
|
83
|
+
- `--method agent|cli`: Override execution method (default: from config.json)
|
|
84
|
+
- `--dir <path>`: Use arbitrary directory instead of phase resolution (scratch mode)
|
|
85
|
+
|
|
86
|
+
When `--yes` or `-y`: Auto-confirm task breakdown, skip blocked-task prompts, auto-continue through all waves.
|
|
87
|
+
|
|
88
|
+
**Output Directory**: `.workflow/.csv-wave/{session-id}/`
|
|
89
|
+
**Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
|
|
90
|
+
</context>
|
|
91
|
+
|
|
92
|
+
<csv_schema>
|
|
93
|
+
|
|
94
|
+
### tasks.csv (Master State)
|
|
95
|
+
|
|
96
|
+
```csv
|
|
97
|
+
id,title,description,scope,convergence_criteria,hints,execution_directives,deps,context_from,wave,status,findings,files_modified,tests_passed,error
|
|
98
|
+
"TASK-001","Setup auth module","Create authentication module with JWT token generation and verification. Export verifyToken and generateToken functions.","src/auth/","auth.ts contains export function verifyToken(; auth.ts contains export function generateToken(","Reference existing middleware pattern in src/middleware/auth.ts","npm test -- --grep auth","","","1","","","","",""
|
|
99
|
+
"TASK-002","Create user model","Define User interface and database schema with email, passwordHash, role fields. Use existing Result type pattern.","src/models/","user.ts contains export interface User; user.ts contains email: string","See src/models/session.ts for existing model pattern","npm test -- --grep user","","","1","","","","",""
|
|
100
|
+
"TASK-003","Auth middleware","Create Express middleware that validates JWT from Authorization header. Use verifyToken from auth module. Return 401 on invalid token.","src/middleware/","auth-middleware.ts contains export function authMiddleware(; auth-middleware.ts contains verifyToken","Follows existing middleware pattern in src/middleware/logging.ts","npm test -- --grep middleware","TASK-001","TASK-001","2","","","","",""
|
|
101
|
+
"TASK-004","Login endpoint","Implement POST /api/login endpoint. Validate credentials against user model, return JWT on success. Use generateToken from auth module.","src/routes/","login.ts contains router.post('/api/login'; login.ts contains generateToken(","Wire into existing Express app in src/app.ts","curl -X POST localhost:3000/api/login","TASK-001;TASK-002","TASK-001;TASK-002","2","","","","",""
|
|
102
|
+
"TASK-005","Integration tests","Write integration tests for full auth flow: register, login, access protected route, token refresh.","tests/","tests/auth.test.ts exists; npm test exits with code 0","Use existing test setup in tests/setup.ts","npm test","TASK-003;TASK-004","TASK-003;TASK-004","3","","","","",""
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Columns**:
|
|
106
|
+
|
|
107
|
+
| Column | Phase | Description |
|
|
108
|
+
|--------|-------|-------------|
|
|
109
|
+
| `id` | Input | Task ID (TASK-NNN format, from plan.json) |
|
|
110
|
+
| `title` | Input | Short task title from task definition |
|
|
111
|
+
| `description` | Input | Full task description from TASK-*.json |
|
|
112
|
+
| `scope` | Input | Target file/directory glob from task.files |
|
|
113
|
+
| `convergence_criteria` | Input | Grep-verifiable completion criteria (semicolon-separated) |
|
|
114
|
+
| `hints` | Input | Implementation hints + reference files from task definition |
|
|
115
|
+
| `execution_directives` | Input | Verification commands to run after implementation |
|
|
116
|
+
| `deps` | Input | Semicolon-separated dependency task IDs |
|
|
117
|
+
| `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
|
|
118
|
+
| `wave` | Computed | Wave number from plan.json wave assignment |
|
|
119
|
+
| `status` | Output | `pending` -> `completed` / `failed` / `blocked` / `skipped` |
|
|
120
|
+
| `findings` | Output | Implementation notes and observations (max 500 chars) |
|
|
121
|
+
| `files_modified` | Output | Semicolon-separated list of created/modified files |
|
|
122
|
+
| `tests_passed` | Output | Test pass/fail status from execution_directives |
|
|
123
|
+
| `error` | Output | Error message if failed or blocked |
|
|
124
|
+
|
|
125
|
+
### Per-Wave CSV (Temporary)
|
|
126
|
+
|
|
127
|
+
Each wave generates `wave-{N}.csv` with extra `prev_context` column populated from predecessor task findings.
|
|
128
|
+
|
|
129
|
+
### Output Artifacts
|
|
130
|
+
|
|
131
|
+
| File | Purpose | Lifecycle |
|
|
132
|
+
|------|---------|-----------|
|
|
133
|
+
| `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
|
|
134
|
+
| `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
|
|
135
|
+
| `wave-{N}-results.csv` | Per-wave output | Created by spawn_agents_on_csv |
|
|
136
|
+
| `results.csv` | Final export of all task results | Created in Phase 3 |
|
|
137
|
+
| `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
|
|
138
|
+
| `context.md` | Human-readable execution report | Created in Phase 3 |
|
|
139
|
+
|
|
140
|
+
### Session Structure
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
.workflow/.csv-wave/{YYYYMMDD}-execute-P{N}-{slug}/
|
|
144
|
+
+-- tasks.csv
|
|
145
|
+
+-- results.csv
|
|
146
|
+
+-- discoveries.ndjson
|
|
147
|
+
+-- context.md
|
|
148
|
+
+-- config.json
|
|
149
|
+
+-- wave-{N}.csv (temporary)
|
|
150
|
+
+-- wave-{N}-results.csv (temporary)
|
|
151
|
+
```
|
|
152
|
+
</csv_schema>
|
|
153
|
+
|
|
154
|
+
<invariants>
|
|
155
|
+
1. **Start Immediately**: First action is session initialization, then Phase 1
|
|
156
|
+
2. **Wave Order is Sacred**: Never execute wave N+1 before wave N completes and results are merged
|
|
157
|
+
3. **CSV is Source of Truth**: Master tasks.csv holds all execution state
|
|
158
|
+
4. **Context Propagation**: prev_context built from master CSV findings, not from memory
|
|
159
|
+
5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
|
|
160
|
+
6. **Cascading Skip on Failure**: If a task fails/blocks, all dependent tasks are skipped
|
|
161
|
+
7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
|
|
162
|
+
8. **Max 3 Fix Attempts**: Per task, auto-fix convergence failures up to 3 times, then mark blocked
|
|
163
|
+
9. **Breakpoint Resume**: Always detect completed tasks and skip them on re-run
|
|
164
|
+
10. **DO NOT STOP**: Continuous execution until all waves complete or user explicitly stops
|
|
165
|
+
</invariants>
|
|
166
|
+
|
|
167
|
+
<execution>
|
|
168
|
+
|
|
169
|
+
### Session Initialization
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
Parse from $ARGUMENTS:
|
|
173
|
+
AUTO_YES ← --yes | -y
|
|
174
|
+
continueMode ← --continue
|
|
175
|
+
maxConcurrency ← --concurrency | -c N (default: 5)
|
|
176
|
+
autoCommit ← --auto-commit
|
|
177
|
+
executionMethod ← --method agent|cli (default: from config.json)
|
|
178
|
+
scratchDir ← --dir <path> (default: null)
|
|
179
|
+
phaseArg ← remaining text after flag removal
|
|
180
|
+
|
|
181
|
+
Derive:
|
|
182
|
+
dateStr ← UTC+8 YYYYMMDD
|
|
183
|
+
sessionId ← scratchDir ? "{dateStr}-execute-scratch" : "{dateStr}-execute-P{phaseArg}-{phaseSlug}"
|
|
184
|
+
sessionFolder ← ".workflow/.csv-wave/{sessionId}"
|
|
185
|
+
|
|
186
|
+
mkdir -p {sessionFolder}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Pre-flight: Team Conflict Check
|
|
190
|
+
|
|
191
|
+
Before any task execution, run:
|
|
192
|
+
```
|
|
193
|
+
Bash("maestro collab preflight --phase <phase-number>")
|
|
194
|
+
```
|
|
195
|
+
If exit code is 1, present warnings and ask whether to proceed.
|
|
196
|
+
|
|
197
|
+
### Phase 1: Plan Resolution -> CSV
|
|
198
|
+
|
|
199
|
+
**Objective**: Resolve phase, load plan + task definitions, detect resume point, generate tasks.csv.
|
|
200
|
+
|
|
201
|
+
**Decomposition Rules**:
|
|
202
|
+
|
|
203
|
+
1. **Plan resolution** (per scratch-milestone-architecture):
|
|
204
|
+
|
|
205
|
+
| Input | Resolution |
|
|
206
|
+
|-------|------------|
|
|
207
|
+
| `--dir <path>` | Use path directly (scratch plan dir) |
|
|
208
|
+
| No args | Find all pending plans for current milestone from state.json.artifacts[] |
|
|
209
|
+
| Number (e.g., `3`) | Find pending plans for phase N from state.json.artifacts[] |
|
|
210
|
+
|
|
211
|
+
For multi-plan: execute sequentially. Each plan is a full CSV session.
|
|
212
|
+
|
|
213
|
+
2. **Load plan**: Read `{PLAN_DIR}/plan.json` for wave structure and task assignments
|
|
214
|
+
|
|
215
|
+
3. **Detect completed tasks (breakpoint resume)**: Read `.task/TASK-{NNN}.json` for each task; exclude completed ones from CSV. Log resume count.
|
|
216
|
+
|
|
217
|
+
4. **Build tasks.csv**: For each pending task per wave, read `.task/TASK-{NNN}.json` and extract: title, description, scope (from files), convergence.criteria, hints, execution_directives. Set `deps` from task dependency, `context_from` = deps, `wave` from plan.json.
|
|
218
|
+
|
|
219
|
+
5. **Load project specs + tools**: Run `maestro spec load --category coding` to load coding conventions, architecture constraints, AND discoverable knowhow tools (passed to all agents)
|
|
220
|
+
|
|
221
|
+
6. **Load UI specs (conditional)**: If any task involves frontend/UI work (task scope/description contains component, page, style, layout, CSS, HTML, frontend; or focus_paths in `src/components/`, `src/pages/`, `src/styles/`, `src/ui/`), also run `maestro spec load --category ui` and include in agent context.
|
|
222
|
+
|
|
223
|
+
7. **Load codebase + wiki context** (optional, passed to all agents):
|
|
224
|
+
- If `.workflow/codebase/ARCHITECTURE.md` exists: read and include as `codebase_context` in agent instructions
|
|
225
|
+
- Run `maestro wiki search "<phase keywords>" --json 2>/dev/null`; if results: include top 5 entries as `wiki_context`
|
|
226
|
+
- Both are optional — proceed without if unavailable
|
|
227
|
+
|
|
228
|
+
7. **User validation**: Display task/wave breakdown. Skip if AUTO_YES.
|
|
229
|
+
|
|
230
|
+
8. **TDD plan detection**: If `plan.json.tdd_mode == true`, enable TDD execution enforcement:
|
|
231
|
+
- RED tasks (meta.tdd_phase=red): after completion, verify test exists AND fails. If test passes → mark BLOCKED "Test passes before implementation — wrong test".
|
|
232
|
+
- GREEN tasks (meta.tdd_phase=green): after completion, verify ALL tests pass. If RED test still fails → mark BLOCKED.
|
|
233
|
+
- REFACTOR tasks (meta.tdd_phase=refactor): after completion, verify ALL tests still pass. If any fails → undo, mark BLOCKED.
|
|
234
|
+
|
|
235
|
+
### Phase 2: Wave Execution Engine
|
|
236
|
+
|
|
237
|
+
**Objective**: Execute tasks wave-by-wave via spawn_agents_on_csv with cross-wave context propagation.
|
|
238
|
+
|
|
239
|
+
#### Per-Wave Execution Loop
|
|
240
|
+
|
|
241
|
+
For each wave N in ascending order:
|
|
242
|
+
|
|
243
|
+
1. Extract wave N pending rows from master `tasks.csv` (skip wave if none)
|
|
244
|
+
2. Build `prev_context` per task from completed predecessor findings
|
|
245
|
+
3. Write `wave-{N}.csv` with `prev_context` column, then execute:
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
spawn_agents_on_csv({
|
|
249
|
+
csv_path: `${sessionFolder}/wave-${N}.csv`,
|
|
250
|
+
id_column: "id",
|
|
251
|
+
instruction: buildExecutorInstruction(sessionFolder, phaseDir, autoCommit, specsContent), // agent: ~/.codex/agents/workflow-executor.toml
|
|
252
|
+
max_concurrency: maxConcurrency, max_runtime_seconds: 3600,
|
|
253
|
+
output_csv_path: `${sessionFolder}/wave-${N}-results.csv`,
|
|
254
|
+
output_schema: { id, status: [completed|failed|blocked], findings, files_modified, tests_passed, error }
|
|
255
|
+
})
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
4. Merge results into master `tasks.csv`, delete `wave-{N}.csv`
|
|
259
|
+
|
|
260
|
+
#### Blocked Task Handling
|
|
261
|
+
|
|
262
|
+
After each wave: if blocked tasks exist, prompt user to continue or stop (AUTO_YES: auto-continue). Skip tasks whose deps are blocked/failed.
|
|
263
|
+
|
|
264
|
+
#### Cascading Skip
|
|
265
|
+
|
|
266
|
+
Blocked/failed tasks cascade: mark all downstream dependents as `skipped` with error "Dependency {dep_id} blocked/failed".
|
|
267
|
+
|
|
268
|
+
### Phase 3: Results Aggregation
|
|
269
|
+
|
|
270
|
+
**Objective**: Update all state files and generate execution report.
|
|
271
|
+
|
|
272
|
+
1. Export final `tasks.csv` as `results.csv`
|
|
273
|
+
|
|
274
|
+
2. **Update task files**: Write each task's status from CSV back to `.task/{id}.json`
|
|
275
|
+
|
|
276
|
+
3. **Issue status sync**: For tasks with `issue_id`, update `.workflow/issues/issues.jsonl`:
|
|
277
|
+
- All task_refs completed -> `issue.status = "resolved"`; any failed -> `"in_progress"`
|
|
278
|
+
- Append history entry: `{ action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }`
|
|
279
|
+
|
|
280
|
+
4. **Register EXC artifact in state.json**: Find matching plan artifact, create `{ id: "EXC-{next_id}", type: "execute", milestone, phase, scope, path, status: "completed", depends_on: plan_artifact.id, harvested: false, created_at, completed_at }`
|
|
281
|
+
|
|
282
|
+
5. **Extract incremental specs**: Read `.summaries/`, use `maestro spec add` CLI:
|
|
283
|
+
- Learnings/pitfalls → `maestro spec add learning "<title>" "<content>" --keywords ... --source execute:{PLAN_DIR}`
|
|
284
|
+
- Design rationale → `maestro spec add coding "<title>" "<content>" --keywords ...`
|
|
285
|
+
- Root cause/workaround → `maestro spec add debug "<title>" "<content>" --keywords ...`
|
|
286
|
+
Mark artifact `harvested: true`
|
|
287
|
+
|
|
288
|
+
6. **Post-task Knowledge Inquiry**: After each task completes, evaluate inquiry triggers:
|
|
289
|
+
|
|
290
|
+
- **Execution deviation**: If task summary mentions approach change, dependency swap, or plan deviation:
|
|
291
|
+
→ Prompt: "TASK-{NNN} deviated from the plan. Record as architecture constraint?"
|
|
292
|
+
→ On confirm: `maestro spec add arch "<decision>" "<rationale>" --keywords ... --source execute:{PLAN_DIR}`
|
|
293
|
+
|
|
294
|
+
- **Retry success**: If task required >=2 retries before completion:
|
|
295
|
+
→ Prompt: "TASK-{NNN} succeeded after {N} retries. Document this fix pattern?"
|
|
296
|
+
→ On confirm: `maestro spec add debug "<pattern>" "<content>" --keywords ... --source execute:{PLAN_DIR}`
|
|
297
|
+
|
|
298
|
+
- **Implicit knowledge**: If task summary contains design rationale ("chose X because", "rejected Y due to"):
|
|
299
|
+
→ Prompt: "Design decision detected. Record as a learning?"
|
|
300
|
+
→ On confirm: `maestro spec add learning "<decision>" "<rationale>" --keywords ... --source execute:{PLAN_DIR}`
|
|
301
|
+
|
|
302
|
+
Use `request_user_input` for prompts:
|
|
303
|
+
```json
|
|
304
|
+
{ "questions": [{ "id": "knowledge-capture", "header": "Knowledge Capture", "question": "...", "options": [{ "label": "Yes", "description": "Record to specs" }, { "label": "Skip", "description": "Continue without recording" }] }] }
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
7. **Generate context.md**: Execution report with summary (tasks/blocked/waves/auto-commit), per-wave result table (task, status, files, tests), blocked tasks, discovery board summary, next steps.
|
|
308
|
+
|
|
309
|
+
8. **Auto-sync** (if config.json.codebase.auto_sync_after_execute == true): detect changed files, trigger codebase doc update.
|
|
310
|
+
|
|
311
|
+
9. **Display completion report**: Phase, completed/blocked counts, wave progress, paths to `.summaries/` and `.task/`, next step suggestions (`maestro-verify`, `manage-status`).
|
|
312
|
+
|
|
313
|
+
### Shared Discovery Board Protocol
|
|
314
|
+
|
|
315
|
+
#### Standard Discovery Types
|
|
316
|
+
|
|
317
|
+
| Type | Dedup Key | Data Schema | Description |
|
|
318
|
+
|------|-----------|-------------|-------------|
|
|
319
|
+
| `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found during implementation |
|
|
320
|
+
| `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point discovered |
|
|
321
|
+
| `convention` | singleton | `{naming, imports, formatting}` | Project coding conventions observed |
|
|
322
|
+
| `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue encountered |
|
|
323
|
+
| `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack detail confirmed |
|
|
324
|
+
| `test_command` | `data.command` | `{command, scope, result}` | Working test command discovered |
|
|
325
|
+
|
|
326
|
+
#### Protocol
|
|
327
|
+
|
|
328
|
+
Read `discoveries.ndjson` before implementation. Append-only: dedup by type+key before writing, never modify/delete.
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
echo '{"ts":"<ISO>","worker":"TASK-001","type":"code_pattern","data":{"name":"Result type","file":"src/types/result.ts","description":"All functions return Result<T,E> for error handling"}}' >> {session_folder}/discoveries.ndjson
|
|
332
|
+
```
|
|
333
|
+
</execution>
|
|
334
|
+
|
|
335
|
+
<error_codes>
|
|
336
|
+
|
|
337
|
+
| Error | Resolution |
|
|
338
|
+
|-------|------------|
|
|
339
|
+
| Phase directory not found | Abort with error: "Phase {N} not found" |
|
|
340
|
+
| plan.json not found | Abort with error: "No plan found -- run plan first" |
|
|
341
|
+
| No pending tasks (all completed) | Abort with info: "All tasks already completed" |
|
|
342
|
+
| Task file (.task/TASK-*.json) missing | Skip task, log error, mark as failed |
|
|
343
|
+
| Agent spawn fails | Retry once, then mark task as blocked with checkpoint |
|
|
344
|
+
| Convergence criteria not met after 3 attempts | Mark task as blocked, write checkpoint |
|
|
345
|
+
| Git commit fails (--auto-commit) | Log warning, continue (task still marked completed) |
|
|
346
|
+
| All tasks in wave blocked | Stop execution, report blocked wave |
|
|
347
|
+
| CSV parse error | Validate format, show line number |
|
|
348
|
+
| discoveries.ndjson corrupt | Ignore malformed lines, continue |
|
|
349
|
+
| Continue mode: no session found | List available sessions |
|
|
350
|
+
</error_codes>
|
|
351
|
+
|
|
352
|
+
<success_criteria>
|
|
353
|
+
- [ ] Session folder created with valid tasks.csv
|
|
354
|
+
- [ ] All waves executed in order with cross-wave context propagation
|
|
355
|
+
- [ ] Completed tasks have .summaries/TASK-{NNN}-summary.md
|
|
356
|
+
- [ ] .task/TASK-*.json statuses updated to match execution results
|
|
357
|
+
- [ ] state.json updated with EXC artifact
|
|
358
|
+
- [ ] Issue status synced for tasks with issue_id (all completed → resolved, any failed → in_progress)
|
|
359
|
+
- [ ] Incremental specs extracted from summaries (learnings, design rationale, root causes)
|
|
360
|
+
- [ ] Post-task knowledge inquiry triggered when applicable (deviation, retry>=2, design rationale)
|
|
361
|
+
- [ ] context.md produced with execution report
|
|
362
|
+
- [ ] Blocked tasks have checkpoint info for resume
|
|
363
|
+
- [ ] Cascading skip applied for dependent tasks
|
|
364
|
+
- [ ] discoveries.ndjson append-only throughout
|
|
365
|
+
</success_criteria>
|