maestro-flow 0.1.1 → 0.1.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/.codex/skills/manage-codebase-rebuild/SKILL.md +405 -405
- package/.codex/skills/manage-codebase-refresh/SKILL.md +82 -82
- package/.codex/skills/manage-issue/SKILL.md +65 -65
- package/.codex/skills/manage-status/SKILL.md +89 -89
- package/.codex/skills/quality-debug/SKILL.md +413 -413
- package/.codex/skills/quality-refactor/SKILL.md +191 -191
- package/.codex/skills/quality-sync/SKILL.md +89 -89
- package/.codex/skills/quality-test/SKILL.md +198 -198
- package/.codex/skills/spec-add/SKILL.md +79 -79
- package/.codex/skills/spec-load/SKILL.md +75 -75
- package/.codex/skills/spec-map/SKILL.md +182 -182
- package/.codex/skills/spec-setup/SKILL.md +76 -76
- package/.codex/skills/team-coordinate/SKILL.md +7 -7
- package/.codex/skills/team-coordinate/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -2
- package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +2 -2
- package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +2 -2
- package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +1 -1
- package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +2 -2
- package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +1 -1
- package/.codex/skills/team-lifecycle-v4/schemas/tasks-schema.md +1 -1
- package/.codex/skills/team-quality-assurance/SKILL.md +2 -2
- package/.codex/skills/team-quality-assurance/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-quality-assurance/roles/executor/role.md +1 -1
- package/.codex/skills/team-quality-assurance/roles/scout/role.md +2 -2
- package/.codex/skills/team-review/SKILL.md +2 -2
- package/.codex/skills/team-review/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-review/roles/reviewer/role.md +2 -2
- package/.codex/skills/team-review/roles/scanner/role.md +1 -1
- package/.codex/skills/team-tech-debt/SKILL.md +2 -2
- package/.codex/skills/team-tech-debt/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-tech-debt/roles/executor/role.md +1 -1
- package/.codex/skills/team-tech-debt/roles/scanner/role.md +2 -2
- package/.codex/skills/team-tech-debt/roles/validator/role.md +1 -1
- package/.codex/skills/team-testing/SKILL.md +2 -2
- package/.codex/skills/team-testing/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-testing/roles/executor/role.md +2 -2
- package/.codex/skills/team-testing/roles/generator/role.md +2 -2
- package/README.md +43 -4
- package/dist/agents/dashboard-bridge.d.ts +5 -0
- package/dist/agents/dashboard-bridge.d.ts.map +1 -1
- package/dist/agents/dashboard-bridge.js +13 -0
- package/dist/agents/dashboard-bridge.js.map +1 -1
- package/dist/agents/parallel-cli-runner.d.ts +42 -0
- package/dist/agents/parallel-cli-runner.d.ts.map +1 -0
- package/dist/agents/parallel-cli-runner.js +200 -0
- package/dist/agents/parallel-cli-runner.js.map +1 -0
- package/dist/agents/terminal-adapter.d.ts +94 -0
- package/dist/agents/terminal-adapter.d.ts.map +1 -0
- package/dist/agents/terminal-adapter.js +132 -0
- package/dist/agents/terminal-adapter.js.map +1 -0
- package/dist/agents/terminal-backend.d.ts +53 -0
- package/dist/agents/terminal-backend.d.ts.map +1 -0
- package/dist/agents/terminal-backend.js +286 -0
- package/dist/agents/terminal-backend.js.map +1 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/coordinate.d.ts.map +1 -1
- package/dist/commands/coordinate.js +14 -5
- package/dist/commands/coordinate.js.map +1 -1
- package/dist/commands/delegate.d.ts +3 -0
- package/dist/commands/delegate.d.ts.map +1 -0
- package/dist/commands/delegate.js +142 -0
- package/dist/commands/delegate.js.map +1 -0
- package/dist/commands/msg.d.ts +3 -0
- package/dist/commands/msg.d.ts.map +1 -0
- package/dist/commands/msg.js +110 -0
- package/dist/commands/msg.js.map +1 -0
- package/dist/coordinator/graph-types.d.ts +17 -0
- package/dist/coordinator/graph-types.d.ts.map +1 -1
- package/dist/coordinator/graph-walker.d.ts +3 -1
- package/dist/coordinator/graph-walker.d.ts.map +1 -1
- package/dist/coordinator/graph-walker.js +147 -8
- package/dist/coordinator/graph-walker.js.map +1 -1
- package/dist/coordinator/index.d.ts +2 -0
- package/dist/coordinator/index.d.ts.map +1 -1
- package/dist/coordinator/index.js +1 -0
- package/dist/coordinator/index.js.map +1 -1
- package/dist/coordinator/parallel-executor.d.ts +24 -0
- package/dist/coordinator/parallel-executor.d.ts.map +1 -0
- package/dist/coordinator/parallel-executor.js +43 -0
- package/dist/coordinator/parallel-executor.js.map +1 -0
- package/package.json +4 -2
- package/templates/cli/prompts/rules-tech-rules-agent-prompt.txt +89 -89
- package/templates/cli/prompts/workflow-codex-feasibility-validation.txt +176 -176
- package/templates/cli/prompts/workflow-gemini-solution-design.txt +131 -131
- package/templates/cli/prompts/workflow-skill-index.txt +224 -224
- package/templates/cli/protocols/analysis-protocol.md +2 -2
- package/templates/cli/protocols/write-protocol.md +2 -2
- package/workflows/memory.md +2 -2
- package/.codex/skills/team-lifecycle-v4/MIGRATION-PLAN.md +0 -512
|
@@ -1,413 +1,413 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: maestro-debug
|
|
3
|
-
description: Hypothesis-driven debugging via CSV wave pipeline. Wave 1 generates parallel hypotheses, Wave 2 attempts parallel fixes on confirmed hypotheses. Replaces quality-debug command.
|
|
4
|
-
argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"[bug description] [--from-uat <phase>] [--parallel]\""
|
|
5
|
-
allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Auto Mode
|
|
9
|
-
|
|
10
|
-
When `--yes` or `-y`: Auto-confirm hypothesis selection, skip interactive symptom gathering (require bug description in args), use defaults for mode detection.
|
|
11
|
-
|
|
12
|
-
# Maestro Debug (CSV Wave)
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
$maestro-debug "Login button throws 500 error on click"
|
|
18
|
-
$maestro-debug -y "JWT token not refreshed --from-uat 3"
|
|
19
|
-
$maestro-debug -c 4 "Navigation crash --from-uat 3 --parallel"
|
|
20
|
-
$maestro-debug --continue "debug-jwt-expiry-20260318"
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Flags**:
|
|
24
|
-
- `-y, --yes`: Skip all confirmations (auto mode)
|
|
25
|
-
- `-c, --concurrency N`: Max concurrent agents within each wave (default: 5)
|
|
26
|
-
- `--continue`: Resume existing session
|
|
27
|
-
|
|
28
|
-
**Output Directory**: `.workflow/.csv-wave/{session-id}/`
|
|
29
|
-
**Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Overview
|
|
34
|
-
|
|
35
|
-
Wave-based hypothesis-driven debugging using `spawn_agents_on_csv`. Wave 1 explores hypotheses in parallel, Wave 2 attempts fixes on confirmed hypotheses in parallel.
|
|
36
|
-
|
|
37
|
-
**Core workflow**: Gather Symptoms -> Generate Hypotheses -> Parallel Investigation -> Parallel Fix Attempts -> Unify Results
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
+---------------------------------------------------------------------------+
|
|
41
|
-
| DEBUG CSV WAVE WORKFLOW |
|
|
42
|
-
+---------------------------------------------------------------------------+
|
|
43
|
-
| |
|
|
44
|
-
| Phase 1: Input Resolution -> CSV |
|
|
45
|
-
| +-- Parse mode: standalone / --from-uat / --parallel |
|
|
46
|
-
| +-- Gather symptoms (interactive) or load UAT gaps (pre-filled) |
|
|
47
|
-
| +-- Cluster gaps by component (if from-uat) |
|
|
48
|
-
| +-- Generate 3-5 hypotheses per cluster/issue |
|
|
49
|
-
| +-- Generate tasks.csv with one row per hypothesis |
|
|
50
|
-
| +-- User validates hypothesis breakdown (skip if -y) |
|
|
51
|
-
| |
|
|
52
|
-
| Phase 2: Wave Execution Engine |
|
|
53
|
-
| +-- Wave 1: Hypothesis Investigation (parallel) |
|
|
54
|
-
| | +-- Each agent investigates one hypothesis |
|
|
55
|
-
| | +-- Agent searches code, logs evidence, confirms/refutes |
|
|
56
|
-
| | +-- Discoveries shared via board (code patterns, root causes) |
|
|
57
|
-
| | +-- Results: evidence_for + evidence_against per hypothesis |
|
|
58
|
-
| +-- Wave 2: Fix Attempts (parallel, confirmed hypotheses only) |
|
|
59
|
-
| | +-- Filter: only hypotheses with status=confirmed from wave 1 |
|
|
60
|
-
| | +-- Each agent attempts fix for its confirmed root cause |
|
|
61
|
-
| | +-- Agent applies fix, runs verification, logs result |
|
|
62
|
-
| | +-- Results: fix_applied + verified per fix task |
|
|
63
|
-
| +-- discoveries.ndjson shared across all waves (append-only) |
|
|
64
|
-
| |
|
|
65
|
-
| Phase 3: Results Aggregation |
|
|
66
|
-
| +-- Export results.csv with all investigation + fix outcomes |
|
|
67
|
-
| +-- Generate context.md with diagnosis summary |
|
|
68
|
-
| +-- Update UAT gaps with diagnosis (if --from-uat) |
|
|
69
|
-
| +-- Update issues.jsonl with diagnosis results |
|
|
70
|
-
| +-- Display summary with next steps |
|
|
71
|
-
| |
|
|
72
|
-
+---------------------------------------------------------------------------+
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## CSV Schema
|
|
78
|
-
|
|
79
|
-
### tasks.csv (Master State)
|
|
80
|
-
|
|
81
|
-
```csv
|
|
82
|
-
id,title,description,hypothesis,evidence_for,evidence_against,deps,context_from,wave,status,findings,fix_applied,verified,error
|
|
83
|
-
"H1","Null pointer in login handler","Investigate whether login handler crashes due to null user object after failed DB lookup","User object is null when DB returns empty result; login.ts:42 dereferences without null check","","","","","1","","","","",""
|
|
84
|
-
"H2","Missing error boundary","Investigate whether unhandled promise rejection in auth middleware propagates to 500","Auth middleware catches DB errors but not validation errors; middleware.ts:78 has no catch block","","","","","1","","","","",""
|
|
85
|
-
"H3","Stale session token","Investigate whether expired session tokens bypass refresh logic","Session refresh only triggers on 403 but server returns 401 for expired tokens; session.ts:15","","","","","1","","","","",""
|
|
86
|
-
"FIX-H1","Fix null pointer in login","Apply null check before user object dereference in login handler","","","","H1","H1","2","","","","",""
|
|
87
|
-
"FIX-H3","Fix session token refresh","Update refresh trigger to also handle 401 status codes","","","","H3","H3","2","","","","",""
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
**Columns**:
|
|
91
|
-
|
|
92
|
-
| Column | Phase | Description |
|
|
93
|
-
|--------|-------|-------------|
|
|
94
|
-
| `id` | Input | Unique task identifier: `H{N}` for hypotheses (wave 1), `FIX-H{N}` for fixes (wave 2) |
|
|
95
|
-
| `title` | Input | Short hypothesis or fix title |
|
|
96
|
-
| `description` | Input | Detailed investigation/fix instructions |
|
|
97
|
-
| `hypothesis` | Input | The hypothesis being tested (wave 1) or empty (wave 2) |
|
|
98
|
-
| `evidence_for` | Output | Evidence supporting the hypothesis |
|
|
99
|
-
| `evidence_against` | Output | Evidence refuting the hypothesis |
|
|
100
|
-
| `deps` | Input | Semicolon-separated dependency task IDs (wave 2 depends on wave 1) |
|
|
101
|
-
| `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
|
|
102
|
-
| `wave` | Computed | Wave number (1 = investigation, 2 = fix attempt) |
|
|
103
|
-
| `status` | Output | `pending` -> `confirmed` / `refuted` / `inconclusive` / `fixed` / `fix_failed` / `skipped` |
|
|
104
|
-
| `findings` | Output | Key findings summary (max 500 chars) |
|
|
105
|
-
| `fix_applied` | Output | Description of fix applied (wave 2 only) |
|
|
106
|
-
| `verified` | Output | `true` / `false` — whether fix was verified to work (wave 2 only) |
|
|
107
|
-
| `error` | Output | Error message if failed |
|
|
108
|
-
|
|
109
|
-
### Per-Wave CSV (Temporary)
|
|
110
|
-
|
|
111
|
-
Each wave generates `wave-{N}.csv` with extra `prev_context` column.
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## Output Artifacts
|
|
116
|
-
|
|
117
|
-
| File | Purpose | Lifecycle |
|
|
118
|
-
|------|---------|-----------|
|
|
119
|
-
| `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
|
|
120
|
-
| `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
|
|
121
|
-
| `results.csv` | Final export of all task results | Created in Phase 3 |
|
|
122
|
-
| `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
|
|
123
|
-
| `context.md` | Human-readable diagnosis report | Created in Phase 3 |
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Session Structure
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
.workflow/.csv-wave/debug-{slug}-{date}/
|
|
131
|
-
+-- tasks.csv
|
|
132
|
-
+-- results.csv
|
|
133
|
-
+-- discoveries.ndjson
|
|
134
|
-
+-- context.md
|
|
135
|
-
+-- wave-{N}.csv (temporary)
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## Implementation
|
|
141
|
-
|
|
142
|
-
### Session Initialization
|
|
143
|
-
|
|
144
|
-
```javascript
|
|
145
|
-
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
|
146
|
-
|
|
147
|
-
// Parse flags
|
|
148
|
-
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
|
|
149
|
-
const continueMode = $ARGUMENTS.includes('--continue')
|
|
150
|
-
const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
|
|
151
|
-
const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 5
|
|
152
|
-
|
|
153
|
-
// Parse debug-specific flags
|
|
154
|
-
const fromUatMatch = $ARGUMENTS.match(/--from-uat\s+(\S+)/)
|
|
155
|
-
const parallelMode = $ARGUMENTS.includes('--parallel')
|
|
156
|
-
|
|
157
|
-
// Clean bug description
|
|
158
|
-
const bugDescription = $ARGUMENTS
|
|
159
|
-
.replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|--from-uat\s+\S+|--parallel/g, '')
|
|
160
|
-
.trim()
|
|
161
|
-
|
|
162
|
-
const slug = bugDescription.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
|
|
163
|
-
const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
|
|
164
|
-
const sessionId = `debug-${slug}-${dateStr}`
|
|
165
|
-
const sessionFolder = `.workflow/.csv-wave/${sessionId}`
|
|
166
|
-
|
|
167
|
-
Bash(`mkdir -p ${sessionFolder}`)
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
### Phase 1: Input Resolution -> CSV
|
|
173
|
-
|
|
174
|
-
**Objective**: Parse mode, gather symptoms or load UAT gaps, generate hypotheses, build tasks.csv.
|
|
175
|
-
|
|
176
|
-
**Decomposition Rules**:
|
|
177
|
-
|
|
178
|
-
1. **Mode detection**:
|
|
179
|
-
|
|
180
|
-
| Condition | Mode |
|
|
181
|
-
|-----------|------|
|
|
182
|
-
| `--from-uat` flag present | from-uat (load gaps from uat.md) |
|
|
183
|
-
| `--parallel` flag present | parallel (implies from-uat, one agent per gap cluster) |
|
|
184
|
-
| Neither flag | standalone (gather symptoms interactively) |
|
|
185
|
-
|
|
186
|
-
2. **Symptom collection**:
|
|
187
|
-
|
|
188
|
-
| Mode | Source | Action |
|
|
189
|
-
|------|--------|--------|
|
|
190
|
-
| standalone | User input | Ask 5 questions: expected, actual, errors, timeline, reproduction |
|
|
191
|
-
| from-uat | `{phase_dir}/uat.md` | Parse Gaps section, cluster by component |
|
|
192
|
-
| parallel | `{phase_dir}/uat.md` | Same as from-uat, one investigation per cluster |
|
|
193
|
-
|
|
194
|
-
3. **Hypothesis generation**: For each symptom cluster or bug description:
|
|
195
|
-
- Analyze code patterns around affected area
|
|
196
|
-
- Generate 3-5 ranked hypotheses
|
|
197
|
-
- Each hypothesis becomes a wave 1 CSV row
|
|
198
|
-
|
|
199
|
-
4. **Fix task generation**: For each hypothesis, pre-generate a wave 2 fix row:
|
|
200
|
-
- `deps` points to the hypothesis ID
|
|
201
|
-
- `context_from` points to the hypothesis ID
|
|
202
|
-
- Wave 2 tasks only execute if their hypothesis is confirmed
|
|
203
|
-
|
|
204
|
-
5. **CSV generation**: Hypothesis rows (wave 1) + fix rows (wave 2).
|
|
205
|
-
|
|
206
|
-
**Wave computation**: Simple 2-wave -- all hypothesis tasks = wave 1, all fix tasks = wave 2.
|
|
207
|
-
|
|
208
|
-
**User validation**: Display hypothesis breakdown (skip if AUTO_YES).
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
### Phase 2: Wave Execution Engine
|
|
213
|
-
|
|
214
|
-
**Objective**: Investigate hypotheses wave-by-wave via spawn_agents_on_csv.
|
|
215
|
-
|
|
216
|
-
#### Wave 1: Hypothesis Investigation (Parallel)
|
|
217
|
-
|
|
218
|
-
1. Read master `tasks.csv`
|
|
219
|
-
2. Filter rows where `wave == 1` AND `status == pending`
|
|
220
|
-
3. No prev_context needed (wave 1 has no predecessors)
|
|
221
|
-
4. Write `wave-1.csv`
|
|
222
|
-
5. Execute:
|
|
223
|
-
|
|
224
|
-
```javascript
|
|
225
|
-
spawn_agents_on_csv({
|
|
226
|
-
csv_path: `${sessionFolder}/wave-1.csv`,
|
|
227
|
-
id_column: "id",
|
|
228
|
-
instruction: buildInvestigationInstruction(sessionFolder),
|
|
229
|
-
max_concurrency: maxConcurrency,
|
|
230
|
-
max_runtime_seconds: 600,
|
|
231
|
-
output_csv_path: `${sessionFolder}/wave-1-results.csv`,
|
|
232
|
-
output_schema: {
|
|
233
|
-
type: "object",
|
|
234
|
-
properties: {
|
|
235
|
-
id: { type: "string" },
|
|
236
|
-
status: { type: "string", enum: ["confirmed", "refuted", "inconclusive", "failed"] },
|
|
237
|
-
findings: { type: "string" },
|
|
238
|
-
evidence_for: { type: "string" },
|
|
239
|
-
evidence_against: { type: "string" },
|
|
240
|
-
error: { type: "string" }
|
|
241
|
-
},
|
|
242
|
-
required: ["id", "status", "findings"]
|
|
243
|
-
}
|
|
244
|
-
})
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
6. Read `wave-1-results.csv`, merge into master `tasks.csv`
|
|
248
|
-
7. Delete `wave-1.csv`
|
|
249
|
-
8. **Filter for wave 2**: Mark wave 2 fix tasks as `skipped` if their hypothesis was `refuted` or `inconclusive`
|
|
250
|
-
|
|
251
|
-
#### Wave 2: Fix Attempts (Parallel, Confirmed Only)
|
|
252
|
-
|
|
253
|
-
1. Read master `tasks.csv`
|
|
254
|
-
2. Filter rows where `wave == 2` AND `status == pending` (not skipped)
|
|
255
|
-
3. If no confirmed hypotheses, skip wave 2 entirely
|
|
256
|
-
4. Build `prev_context` from wave 1 findings:
|
|
257
|
-
```
|
|
258
|
-
[H1: Null pointer in login handler] CONFIRMED: User object null when DB returns empty...
|
|
259
|
-
[H3: Stale session token] CONFIRMED: Refresh logic only handles 403, not 401...
|
|
260
|
-
```
|
|
261
|
-
5. Write `wave-2.csv` with `prev_context` column
|
|
262
|
-
6. Execute:
|
|
263
|
-
|
|
264
|
-
```javascript
|
|
265
|
-
spawn_agents_on_csv({
|
|
266
|
-
csv_path: `${sessionFolder}/wave-2.csv`,
|
|
267
|
-
id_column: "id",
|
|
268
|
-
instruction: buildFixInstruction(sessionFolder),
|
|
269
|
-
max_concurrency: maxConcurrency,
|
|
270
|
-
max_runtime_seconds: 900,
|
|
271
|
-
output_csv_path: `${sessionFolder}/wave-2-results.csv`,
|
|
272
|
-
output_schema: {
|
|
273
|
-
type: "object",
|
|
274
|
-
properties: {
|
|
275
|
-
id: { type: "string" },
|
|
276
|
-
status: { type: "string", enum: ["fixed", "fix_failed", "failed"] },
|
|
277
|
-
findings: { type: "string" },
|
|
278
|
-
fix_applied: { type: "string" },
|
|
279
|
-
verified: { type: "string" },
|
|
280
|
-
error: { type: "string" }
|
|
281
|
-
},
|
|
282
|
-
required: ["id", "status", "findings"]
|
|
283
|
-
}
|
|
284
|
-
})
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
7. Merge results into master `tasks.csv`
|
|
288
|
-
8. Delete `wave-2.csv`
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
### Phase 3: Results Aggregation
|
|
293
|
-
|
|
294
|
-
**Objective**: Generate final results and human-readable report.
|
|
295
|
-
|
|
296
|
-
1. Read final master `tasks.csv`
|
|
297
|
-
2. Export as `results.csv`
|
|
298
|
-
3. Generate `context.md`:
|
|
299
|
-
|
|
300
|
-
```markdown
|
|
301
|
-
# Debug Report -- {bug_description}
|
|
302
|
-
|
|
303
|
-
## Summary
|
|
304
|
-
- Mode: {standalone | from-uat | parallel}
|
|
305
|
-
- Hypotheses: {total} investigated
|
|
306
|
-
- Confirmed: {confirmed_count}
|
|
307
|
-
- Fixes applied: {fixed_count}
|
|
308
|
-
- Fixes verified: {verified_count}
|
|
309
|
-
|
|
310
|
-
## Hypothesis Results
|
|
311
|
-
|
|
312
|
-
### H{N}: {title} [{status}]
|
|
313
|
-
**Hypothesis**: {hypothesis}
|
|
314
|
-
**Evidence For**: {evidence_for}
|
|
315
|
-
**Evidence Against**: {evidence_against}
|
|
316
|
-
**Findings**: {findings}
|
|
317
|
-
|
|
318
|
-
## Fix Results
|
|
319
|
-
|
|
320
|
-
### FIX-H{N}: {title} [{status}]
|
|
321
|
-
**Fix Applied**: {fix_applied}
|
|
322
|
-
**Verified**: {verified}
|
|
323
|
-
**Findings**: {findings}
|
|
324
|
-
|
|
325
|
-
## Root Causes
|
|
326
|
-
{aggregated confirmed hypotheses with evidence}
|
|
327
|
-
|
|
328
|
-
## Next Steps
|
|
329
|
-
{suggested actions based on results}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
4. **UAT update** (if --from-uat): For each confirmed hypothesis with fix:
|
|
333
|
-
- Update `{phase_dir}/uat.md` gaps with `root_cause`, `fix_direction`, `affected_files`
|
|
334
|
-
|
|
335
|
-
5. **Issue update**: If `.workflow/issues/issues.jsonl` exists:
|
|
336
|
-
- Update matching issues with status `diagnosed`, add `context.suggested_fix` and `context.notes`
|
|
337
|
-
|
|
338
|
-
6. **Next step routing**:
|
|
339
|
-
|
|
340
|
-
| Result | Suggestion |
|
|
341
|
-
|--------|------------|
|
|
342
|
-
| All fixes verified | Run tests: `Skill({ skill: "quality-test", args: "{phase}" })` |
|
|
343
|
-
| Fixes applied, not verified | Re-verify: `Skill({ skill: "maestro-verify", args: "{phase}" })` |
|
|
344
|
-
| Confirmed but no fix | Plan fixes: `Skill({ skill: "maestro-plan", args: "{phase} --gaps" })` |
|
|
345
|
-
| All inconclusive | Resume with more context or manual investigation |
|
|
346
|
-
| From UAT, all diagnosed | `Skill({ skill: "quality-test", args: "{phase} --auto-fix" })` |
|
|
347
|
-
|
|
348
|
-
7. Display summary.
|
|
349
|
-
|
|
350
|
-
---
|
|
351
|
-
|
|
352
|
-
## Shared Discovery Board Protocol
|
|
353
|
-
|
|
354
|
-
### Standard Discovery Types
|
|
355
|
-
|
|
356
|
-
| Type | Dedup Key | Data Schema | Description |
|
|
357
|
-
|------|-----------|-------------|-------------|
|
|
358
|
-
| `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
|
|
359
|
-
| `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
|
|
360
|
-
| `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
|
|
361
|
-
| `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue found |
|
|
362
|
-
| `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
|
|
363
|
-
|
|
364
|
-
### Domain Discovery Types
|
|
365
|
-
|
|
366
|
-
| Type | Dedup Key | Data Schema | Description |
|
|
367
|
-
|------|-----------|-------------|-------------|
|
|
368
|
-
| `root_cause` | `data.location` | `{location, cause, severity, confidence}` | Confirmed root cause |
|
|
369
|
-
| `hypothesis_evidence` | `data.hypothesis+data.location` | `{hypothesis, location, type, conclusion}` | Evidence for/against hypothesis |
|
|
370
|
-
| `affected_component` | `data.component` | `{component, files[], impact}` | Component affected by bug |
|
|
371
|
-
| `reproduction_path` | `data.trigger` | `{trigger, steps[], frequency}` | Bug reproduction path |
|
|
372
|
-
|
|
373
|
-
### Protocol
|
|
374
|
-
|
|
375
|
-
1. **Read** `{session_folder}/discoveries.ndjson` before own investigation
|
|
376
|
-
2. **Skip covered**: If discovery of same type + dedup key exists, skip
|
|
377
|
-
3. **Write immediately**: Append findings as found
|
|
378
|
-
4. **Append-only**: Never modify or delete
|
|
379
|
-
5. **Deduplicate**: Check before writing
|
|
380
|
-
|
|
381
|
-
```bash
|
|
382
|
-
echo '{"ts":"<ISO>","worker":"{id}","type":"root_cause","data":{"location":"src/auth/login.ts:42","cause":"null_dereference","severity":"high","confidence":"confirmed"}}' >> {session_folder}/discoveries.ndjson
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
---
|
|
386
|
-
|
|
387
|
-
## Error Handling
|
|
388
|
-
|
|
389
|
-
| Error | Resolution |
|
|
390
|
-
|-------|------------|
|
|
391
|
-
| No bug description and no --from-uat | Abort with error: "Issue description required" |
|
|
392
|
-
| UAT file not found for --from-uat phase | Abort with error: "uat.md not found for phase {N}" |
|
|
393
|
-
| No gaps in UAT file | Abort with error: "No failed gaps found in uat.md" |
|
|
394
|
-
| Hypothesis agent timeout | Mark as inconclusive, continue with remaining |
|
|
395
|
-
| All hypotheses refuted | Skip wave 2, suggest manual investigation |
|
|
396
|
-
| Fix agent timeout | Mark as fix_failed, report partial results |
|
|
397
|
-
| CSV parse error | Validate format, show line number |
|
|
398
|
-
| discoveries.ndjson corrupt | Ignore malformed lines |
|
|
399
|
-
| Continue mode: no session found | List available sessions |
|
|
400
|
-
| Existing debug session found | Offer resume (skip if AUTO_YES) |
|
|
401
|
-
|
|
402
|
-
---
|
|
403
|
-
|
|
404
|
-
## Core Rules
|
|
405
|
-
|
|
406
|
-
1. **Start Immediately**: First action is session initialization, then Phase 1
|
|
407
|
-
2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
|
|
408
|
-
3. **CSV is Source of Truth**: Master tasks.csv holds all state
|
|
409
|
-
4. **Context Propagation**: prev_context built from master CSV, not from memory
|
|
410
|
-
5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
|
|
411
|
-
6. **Skip on Refuted**: Wave 2 fix tasks skip if their hypothesis was refuted or inconclusive
|
|
412
|
-
7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
|
|
413
|
-
8. **DO NOT STOP**: Continuous execution until all waves complete
|
|
1
|
+
---
|
|
2
|
+
name: maestro-debug
|
|
3
|
+
description: Hypothesis-driven debugging via CSV wave pipeline. Wave 1 generates parallel hypotheses, Wave 2 attempts parallel fixes on confirmed hypotheses. Replaces quality-debug command.
|
|
4
|
+
argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"[bug description] [--from-uat <phase>] [--parallel]\""
|
|
5
|
+
allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Auto Mode
|
|
9
|
+
|
|
10
|
+
When `--yes` or `-y`: Auto-confirm hypothesis selection, skip interactive symptom gathering (require bug description in args), use defaults for mode detection.
|
|
11
|
+
|
|
12
|
+
# Maestro Debug (CSV Wave)
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
$maestro-debug "Login button throws 500 error on click"
|
|
18
|
+
$maestro-debug -y "JWT token not refreshed --from-uat 3"
|
|
19
|
+
$maestro-debug -c 4 "Navigation crash --from-uat 3 --parallel"
|
|
20
|
+
$maestro-debug --continue "debug-jwt-expiry-20260318"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Flags**:
|
|
24
|
+
- `-y, --yes`: Skip all confirmations (auto mode)
|
|
25
|
+
- `-c, --concurrency N`: Max concurrent agents within each wave (default: 5)
|
|
26
|
+
- `--continue`: Resume existing session
|
|
27
|
+
|
|
28
|
+
**Output Directory**: `.workflow/.csv-wave/{session-id}/`
|
|
29
|
+
**Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (human-readable report)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Overview
|
|
34
|
+
|
|
35
|
+
Wave-based hypothesis-driven debugging using `spawn_agents_on_csv`. Wave 1 explores hypotheses in parallel, Wave 2 attempts fixes on confirmed hypotheses in parallel.
|
|
36
|
+
|
|
37
|
+
**Core workflow**: Gather Symptoms -> Generate Hypotheses -> Parallel Investigation -> Parallel Fix Attempts -> Unify Results
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
+---------------------------------------------------------------------------+
|
|
41
|
+
| DEBUG CSV WAVE WORKFLOW |
|
|
42
|
+
+---------------------------------------------------------------------------+
|
|
43
|
+
| |
|
|
44
|
+
| Phase 1: Input Resolution -> CSV |
|
|
45
|
+
| +-- Parse mode: standalone / --from-uat / --parallel |
|
|
46
|
+
| +-- Gather symptoms (interactive) or load UAT gaps (pre-filled) |
|
|
47
|
+
| +-- Cluster gaps by component (if from-uat) |
|
|
48
|
+
| +-- Generate 3-5 hypotheses per cluster/issue |
|
|
49
|
+
| +-- Generate tasks.csv with one row per hypothesis |
|
|
50
|
+
| +-- User validates hypothesis breakdown (skip if -y) |
|
|
51
|
+
| |
|
|
52
|
+
| Phase 2: Wave Execution Engine |
|
|
53
|
+
| +-- Wave 1: Hypothesis Investigation (parallel) |
|
|
54
|
+
| | +-- Each agent investigates one hypothesis |
|
|
55
|
+
| | +-- Agent searches code, logs evidence, confirms/refutes |
|
|
56
|
+
| | +-- Discoveries shared via board (code patterns, root causes) |
|
|
57
|
+
| | +-- Results: evidence_for + evidence_against per hypothesis |
|
|
58
|
+
| +-- Wave 2: Fix Attempts (parallel, confirmed hypotheses only) |
|
|
59
|
+
| | +-- Filter: only hypotheses with status=confirmed from wave 1 |
|
|
60
|
+
| | +-- Each agent attempts fix for its confirmed root cause |
|
|
61
|
+
| | +-- Agent applies fix, runs verification, logs result |
|
|
62
|
+
| | +-- Results: fix_applied + verified per fix task |
|
|
63
|
+
| +-- discoveries.ndjson shared across all waves (append-only) |
|
|
64
|
+
| |
|
|
65
|
+
| Phase 3: Results Aggregation |
|
|
66
|
+
| +-- Export results.csv with all investigation + fix outcomes |
|
|
67
|
+
| +-- Generate context.md with diagnosis summary |
|
|
68
|
+
| +-- Update UAT gaps with diagnosis (if --from-uat) |
|
|
69
|
+
| +-- Update issues.jsonl with diagnosis results |
|
|
70
|
+
| +-- Display summary with next steps |
|
|
71
|
+
| |
|
|
72
|
+
+---------------------------------------------------------------------------+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## CSV Schema
|
|
78
|
+
|
|
79
|
+
### tasks.csv (Master State)
|
|
80
|
+
|
|
81
|
+
```csv
|
|
82
|
+
id,title,description,hypothesis,evidence_for,evidence_against,deps,context_from,wave,status,findings,fix_applied,verified,error
|
|
83
|
+
"H1","Null pointer in login handler","Investigate whether login handler crashes due to null user object after failed DB lookup","User object is null when DB returns empty result; login.ts:42 dereferences without null check","","","","","1","","","","",""
|
|
84
|
+
"H2","Missing error boundary","Investigate whether unhandled promise rejection in auth middleware propagates to 500","Auth middleware catches DB errors but not validation errors; middleware.ts:78 has no catch block","","","","","1","","","","",""
|
|
85
|
+
"H3","Stale session token","Investigate whether expired session tokens bypass refresh logic","Session refresh only triggers on 403 but server returns 401 for expired tokens; session.ts:15","","","","","1","","","","",""
|
|
86
|
+
"FIX-H1","Fix null pointer in login","Apply null check before user object dereference in login handler","","","","H1","H1","2","","","","",""
|
|
87
|
+
"FIX-H3","Fix session token refresh","Update refresh trigger to also handle 401 status codes","","","","H3","H3","2","","","","",""
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Columns**:
|
|
91
|
+
|
|
92
|
+
| Column | Phase | Description |
|
|
93
|
+
|--------|-------|-------------|
|
|
94
|
+
| `id` | Input | Unique task identifier: `H{N}` for hypotheses (wave 1), `FIX-H{N}` for fixes (wave 2) |
|
|
95
|
+
| `title` | Input | Short hypothesis or fix title |
|
|
96
|
+
| `description` | Input | Detailed investigation/fix instructions |
|
|
97
|
+
| `hypothesis` | Input | The hypothesis being tested (wave 1) or empty (wave 2) |
|
|
98
|
+
| `evidence_for` | Output | Evidence supporting the hypothesis |
|
|
99
|
+
| `evidence_against` | Output | Evidence refuting the hypothesis |
|
|
100
|
+
| `deps` | Input | Semicolon-separated dependency task IDs (wave 2 depends on wave 1) |
|
|
101
|
+
| `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
|
|
102
|
+
| `wave` | Computed | Wave number (1 = investigation, 2 = fix attempt) |
|
|
103
|
+
| `status` | Output | `pending` -> `confirmed` / `refuted` / `inconclusive` / `fixed` / `fix_failed` / `skipped` |
|
|
104
|
+
| `findings` | Output | Key findings summary (max 500 chars) |
|
|
105
|
+
| `fix_applied` | Output | Description of fix applied (wave 2 only) |
|
|
106
|
+
| `verified` | Output | `true` / `false` — whether fix was verified to work (wave 2 only) |
|
|
107
|
+
| `error` | Output | Error message if failed |
|
|
108
|
+
|
|
109
|
+
### Per-Wave CSV (Temporary)
|
|
110
|
+
|
|
111
|
+
Each wave generates `wave-{N}.csv` with extra `prev_context` column.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Output Artifacts
|
|
116
|
+
|
|
117
|
+
| File | Purpose | Lifecycle |
|
|
118
|
+
|------|---------|-----------|
|
|
119
|
+
| `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
|
|
120
|
+
| `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
|
|
121
|
+
| `results.csv` | Final export of all task results | Created in Phase 3 |
|
|
122
|
+
| `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
|
|
123
|
+
| `context.md` | Human-readable diagnosis report | Created in Phase 3 |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Session Structure
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
.workflow/.csv-wave/debug-{slug}-{date}/
|
|
131
|
+
+-- tasks.csv
|
|
132
|
+
+-- results.csv
|
|
133
|
+
+-- discoveries.ndjson
|
|
134
|
+
+-- context.md
|
|
135
|
+
+-- wave-{N}.csv (temporary)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Implementation
|
|
141
|
+
|
|
142
|
+
### Session Initialization
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
|
146
|
+
|
|
147
|
+
// Parse flags
|
|
148
|
+
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
|
|
149
|
+
const continueMode = $ARGUMENTS.includes('--continue')
|
|
150
|
+
const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
|
|
151
|
+
const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 5
|
|
152
|
+
|
|
153
|
+
// Parse debug-specific flags
|
|
154
|
+
const fromUatMatch = $ARGUMENTS.match(/--from-uat\s+(\S+)/)
|
|
155
|
+
const parallelMode = $ARGUMENTS.includes('--parallel')
|
|
156
|
+
|
|
157
|
+
// Clean bug description
|
|
158
|
+
const bugDescription = $ARGUMENTS
|
|
159
|
+
.replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|--from-uat\s+\S+|--parallel/g, '')
|
|
160
|
+
.trim()
|
|
161
|
+
|
|
162
|
+
const slug = bugDescription.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
|
|
163
|
+
const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
|
|
164
|
+
const sessionId = `debug-${slug}-${dateStr}`
|
|
165
|
+
const sessionFolder = `.workflow/.csv-wave/${sessionId}`
|
|
166
|
+
|
|
167
|
+
Bash(`mkdir -p ${sessionFolder}`)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### Phase 1: Input Resolution -> CSV
|
|
173
|
+
|
|
174
|
+
**Objective**: Parse mode, gather symptoms or load UAT gaps, generate hypotheses, build tasks.csv.
|
|
175
|
+
|
|
176
|
+
**Decomposition Rules**:
|
|
177
|
+
|
|
178
|
+
1. **Mode detection**:
|
|
179
|
+
|
|
180
|
+
| Condition | Mode |
|
|
181
|
+
|-----------|------|
|
|
182
|
+
| `--from-uat` flag present | from-uat (load gaps from uat.md) |
|
|
183
|
+
| `--parallel` flag present | parallel (implies from-uat, one agent per gap cluster) |
|
|
184
|
+
| Neither flag | standalone (gather symptoms interactively) |
|
|
185
|
+
|
|
186
|
+
2. **Symptom collection**:
|
|
187
|
+
|
|
188
|
+
| Mode | Source | Action |
|
|
189
|
+
|------|--------|--------|
|
|
190
|
+
| standalone | User input | Ask 5 questions: expected, actual, errors, timeline, reproduction |
|
|
191
|
+
| from-uat | `{phase_dir}/uat.md` | Parse Gaps section, cluster by component |
|
|
192
|
+
| parallel | `{phase_dir}/uat.md` | Same as from-uat, one investigation per cluster |
|
|
193
|
+
|
|
194
|
+
3. **Hypothesis generation**: For each symptom cluster or bug description:
|
|
195
|
+
- Analyze code patterns around affected area
|
|
196
|
+
- Generate 3-5 ranked hypotheses
|
|
197
|
+
- Each hypothesis becomes a wave 1 CSV row
|
|
198
|
+
|
|
199
|
+
4. **Fix task generation**: For each hypothesis, pre-generate a wave 2 fix row:
|
|
200
|
+
- `deps` points to the hypothesis ID
|
|
201
|
+
- `context_from` points to the hypothesis ID
|
|
202
|
+
- Wave 2 tasks only execute if their hypothesis is confirmed
|
|
203
|
+
|
|
204
|
+
5. **CSV generation**: Hypothesis rows (wave 1) + fix rows (wave 2).
|
|
205
|
+
|
|
206
|
+
**Wave computation**: Simple 2-wave -- all hypothesis tasks = wave 1, all fix tasks = wave 2.
|
|
207
|
+
|
|
208
|
+
**User validation**: Display hypothesis breakdown (skip if AUTO_YES).
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### Phase 2: Wave Execution Engine
|
|
213
|
+
|
|
214
|
+
**Objective**: Investigate hypotheses wave-by-wave via spawn_agents_on_csv.
|
|
215
|
+
|
|
216
|
+
#### Wave 1: Hypothesis Investigation (Parallel)
|
|
217
|
+
|
|
218
|
+
1. Read master `tasks.csv`
|
|
219
|
+
2. Filter rows where `wave == 1` AND `status == pending`
|
|
220
|
+
3. No prev_context needed (wave 1 has no predecessors)
|
|
221
|
+
4. Write `wave-1.csv`
|
|
222
|
+
5. Execute:
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
spawn_agents_on_csv({
|
|
226
|
+
csv_path: `${sessionFolder}/wave-1.csv`,
|
|
227
|
+
id_column: "id",
|
|
228
|
+
instruction: buildInvestigationInstruction(sessionFolder),
|
|
229
|
+
max_concurrency: maxConcurrency,
|
|
230
|
+
max_runtime_seconds: 600,
|
|
231
|
+
output_csv_path: `${sessionFolder}/wave-1-results.csv`,
|
|
232
|
+
output_schema: {
|
|
233
|
+
type: "object",
|
|
234
|
+
properties: {
|
|
235
|
+
id: { type: "string" },
|
|
236
|
+
status: { type: "string", enum: ["confirmed", "refuted", "inconclusive", "failed"] },
|
|
237
|
+
findings: { type: "string" },
|
|
238
|
+
evidence_for: { type: "string" },
|
|
239
|
+
evidence_against: { type: "string" },
|
|
240
|
+
error: { type: "string" }
|
|
241
|
+
},
|
|
242
|
+
required: ["id", "status", "findings"]
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
6. Read `wave-1-results.csv`, merge into master `tasks.csv`
|
|
248
|
+
7. Delete `wave-1.csv`
|
|
249
|
+
8. **Filter for wave 2**: Mark wave 2 fix tasks as `skipped` if their hypothesis was `refuted` or `inconclusive`
|
|
250
|
+
|
|
251
|
+
#### Wave 2: Fix Attempts (Parallel, Confirmed Only)
|
|
252
|
+
|
|
253
|
+
1. Read master `tasks.csv`
|
|
254
|
+
2. Filter rows where `wave == 2` AND `status == pending` (not skipped)
|
|
255
|
+
3. If no confirmed hypotheses, skip wave 2 entirely
|
|
256
|
+
4. Build `prev_context` from wave 1 findings:
|
|
257
|
+
```
|
|
258
|
+
[H1: Null pointer in login handler] CONFIRMED: User object null when DB returns empty...
|
|
259
|
+
[H3: Stale session token] CONFIRMED: Refresh logic only handles 403, not 401...
|
|
260
|
+
```
|
|
261
|
+
5. Write `wave-2.csv` with `prev_context` column
|
|
262
|
+
6. Execute:
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
spawn_agents_on_csv({
|
|
266
|
+
csv_path: `${sessionFolder}/wave-2.csv`,
|
|
267
|
+
id_column: "id",
|
|
268
|
+
instruction: buildFixInstruction(sessionFolder),
|
|
269
|
+
max_concurrency: maxConcurrency,
|
|
270
|
+
max_runtime_seconds: 900,
|
|
271
|
+
output_csv_path: `${sessionFolder}/wave-2-results.csv`,
|
|
272
|
+
output_schema: {
|
|
273
|
+
type: "object",
|
|
274
|
+
properties: {
|
|
275
|
+
id: { type: "string" },
|
|
276
|
+
status: { type: "string", enum: ["fixed", "fix_failed", "failed"] },
|
|
277
|
+
findings: { type: "string" },
|
|
278
|
+
fix_applied: { type: "string" },
|
|
279
|
+
verified: { type: "string" },
|
|
280
|
+
error: { type: "string" }
|
|
281
|
+
},
|
|
282
|
+
required: ["id", "status", "findings"]
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
7. Merge results into master `tasks.csv`
|
|
288
|
+
8. Delete `wave-2.csv`
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
### Phase 3: Results Aggregation
|
|
293
|
+
|
|
294
|
+
**Objective**: Generate final results and human-readable report.
|
|
295
|
+
|
|
296
|
+
1. Read final master `tasks.csv`
|
|
297
|
+
2. Export as `results.csv`
|
|
298
|
+
3. Generate `context.md`:
|
|
299
|
+
|
|
300
|
+
```markdown
|
|
301
|
+
# Debug Report -- {bug_description}
|
|
302
|
+
|
|
303
|
+
## Summary
|
|
304
|
+
- Mode: {standalone | from-uat | parallel}
|
|
305
|
+
- Hypotheses: {total} investigated
|
|
306
|
+
- Confirmed: {confirmed_count}
|
|
307
|
+
- Fixes applied: {fixed_count}
|
|
308
|
+
- Fixes verified: {verified_count}
|
|
309
|
+
|
|
310
|
+
## Hypothesis Results
|
|
311
|
+
|
|
312
|
+
### H{N}: {title} [{status}]
|
|
313
|
+
**Hypothesis**: {hypothesis}
|
|
314
|
+
**Evidence For**: {evidence_for}
|
|
315
|
+
**Evidence Against**: {evidence_against}
|
|
316
|
+
**Findings**: {findings}
|
|
317
|
+
|
|
318
|
+
## Fix Results
|
|
319
|
+
|
|
320
|
+
### FIX-H{N}: {title} [{status}]
|
|
321
|
+
**Fix Applied**: {fix_applied}
|
|
322
|
+
**Verified**: {verified}
|
|
323
|
+
**Findings**: {findings}
|
|
324
|
+
|
|
325
|
+
## Root Causes
|
|
326
|
+
{aggregated confirmed hypotheses with evidence}
|
|
327
|
+
|
|
328
|
+
## Next Steps
|
|
329
|
+
{suggested actions based on results}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
4. **UAT update** (if --from-uat): For each confirmed hypothesis with fix:
|
|
333
|
+
- Update `{phase_dir}/uat.md` gaps with `root_cause`, `fix_direction`, `affected_files`
|
|
334
|
+
|
|
335
|
+
5. **Issue update**: If `.workflow/issues/issues.jsonl` exists:
|
|
336
|
+
- Update matching issues with status `diagnosed`, add `context.suggested_fix` and `context.notes`
|
|
337
|
+
|
|
338
|
+
6. **Next step routing**:
|
|
339
|
+
|
|
340
|
+
| Result | Suggestion |
|
|
341
|
+
|--------|------------|
|
|
342
|
+
| All fixes verified | Run tests: `Skill({ skill: "quality-test", args: "{phase}" })` |
|
|
343
|
+
| Fixes applied, not verified | Re-verify: `Skill({ skill: "maestro-verify", args: "{phase}" })` |
|
|
344
|
+
| Confirmed but no fix | Plan fixes: `Skill({ skill: "maestro-plan", args: "{phase} --gaps" })` |
|
|
345
|
+
| All inconclusive | Resume with more context or manual investigation |
|
|
346
|
+
| From UAT, all diagnosed | `Skill({ skill: "quality-test", args: "{phase} --auto-fix" })` |
|
|
347
|
+
|
|
348
|
+
7. Display summary.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Shared Discovery Board Protocol
|
|
353
|
+
|
|
354
|
+
### Standard Discovery Types
|
|
355
|
+
|
|
356
|
+
| Type | Dedup Key | Data Schema | Description |
|
|
357
|
+
|------|-----------|-------------|-------------|
|
|
358
|
+
| `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
|
|
359
|
+
| `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
|
|
360
|
+
| `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
|
|
361
|
+
| `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue found |
|
|
362
|
+
| `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
|
|
363
|
+
|
|
364
|
+
### Domain Discovery Types
|
|
365
|
+
|
|
366
|
+
| Type | Dedup Key | Data Schema | Description |
|
|
367
|
+
|------|-----------|-------------|-------------|
|
|
368
|
+
| `root_cause` | `data.location` | `{location, cause, severity, confidence}` | Confirmed root cause |
|
|
369
|
+
| `hypothesis_evidence` | `data.hypothesis+data.location` | `{hypothesis, location, type, conclusion}` | Evidence for/against hypothesis |
|
|
370
|
+
| `affected_component` | `data.component` | `{component, files[], impact}` | Component affected by bug |
|
|
371
|
+
| `reproduction_path` | `data.trigger` | `{trigger, steps[], frequency}` | Bug reproduction path |
|
|
372
|
+
|
|
373
|
+
### Protocol
|
|
374
|
+
|
|
375
|
+
1. **Read** `{session_folder}/discoveries.ndjson` before own investigation
|
|
376
|
+
2. **Skip covered**: If discovery of same type + dedup key exists, skip
|
|
377
|
+
3. **Write immediately**: Append findings as found
|
|
378
|
+
4. **Append-only**: Never modify or delete
|
|
379
|
+
5. **Deduplicate**: Check before writing
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
echo '{"ts":"<ISO>","worker":"{id}","type":"root_cause","data":{"location":"src/auth/login.ts:42","cause":"null_dereference","severity":"high","confidence":"confirmed"}}' >> {session_folder}/discoveries.ndjson
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Error Handling
|
|
388
|
+
|
|
389
|
+
| Error | Resolution |
|
|
390
|
+
|-------|------------|
|
|
391
|
+
| No bug description and no --from-uat | Abort with error: "Issue description required" |
|
|
392
|
+
| UAT file not found for --from-uat phase | Abort with error: "uat.md not found for phase {N}" |
|
|
393
|
+
| No gaps in UAT file | Abort with error: "No failed gaps found in uat.md" |
|
|
394
|
+
| Hypothesis agent timeout | Mark as inconclusive, continue with remaining |
|
|
395
|
+
| All hypotheses refuted | Skip wave 2, suggest manual investigation |
|
|
396
|
+
| Fix agent timeout | Mark as fix_failed, report partial results |
|
|
397
|
+
| CSV parse error | Validate format, show line number |
|
|
398
|
+
| discoveries.ndjson corrupt | Ignore malformed lines |
|
|
399
|
+
| Continue mode: no session found | List available sessions |
|
|
400
|
+
| Existing debug session found | Offer resume (skip if AUTO_YES) |
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Core Rules
|
|
405
|
+
|
|
406
|
+
1. **Start Immediately**: First action is session initialization, then Phase 1
|
|
407
|
+
2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
|
|
408
|
+
3. **CSV is Source of Truth**: Master tasks.csv holds all state
|
|
409
|
+
4. **Context Propagation**: prev_context built from master CSV, not from memory
|
|
410
|
+
5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
|
|
411
|
+
6. **Skip on Refuted**: Wave 2 fix tasks skip if their hypothesis was refuted or inconclusive
|
|
412
|
+
7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
|
|
413
|
+
8. **DO NOT STOP**: Continuous execution until all waves complete
|