maestro-flow 0.3.3 → 0.3.5
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/quality-business-test.md +110 -0
- package/.codex/skills/maestro-init/SKILL.md +167 -167
- package/.codex/skills/maestro-phase-add/SKILL.md +154 -154
- package/.codex/skills/maestro-phase-transition/SKILL.md +173 -173
- package/.codex/skills/maestro-verify/SKILL.md +566 -566
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +5 -5
- package/.codex/skills/manage-codebase-refresh/SKILL.md +5 -5
- package/.codex/skills/manage-issue/SKILL.md +7 -7
- package/.codex/skills/manage-issue-analyze/SKILL.md +7 -7
- package/.codex/skills/manage-issue-discover/SKILL.md +503 -503
- package/.codex/skills/manage-issue-execute/SKILL.md +9 -9
- package/.codex/skills/manage-issue-plan/SKILL.md +8 -8
- package/.codex/skills/manage-learn/SKILL.md +7 -7
- package/.codex/skills/manage-memory/SKILL.md +72 -72
- package/.codex/skills/manage-memory-capture/SKILL.md +86 -86
- package/.codex/skills/manage-status/SKILL.md +2 -2
- package/.codex/skills/quality-business-test/SKILL.md +223 -0
- package/.codex/skills/quality-debug/SKILL.md +5 -5
- package/.codex/skills/quality-integration-test/SKILL.md +544 -544
- package/.codex/skills/quality-refactor/SKILL.md +6 -6
- package/.codex/skills/quality-retrospective/SKILL.md +10 -10
- package/.codex/skills/quality-review/SKILL.md +408 -408
- package/.codex/skills/quality-sync/SKILL.md +6 -6
- package/.codex/skills/quality-test/SKILL.md +5 -5
- package/.codex/skills/quality-test-gen/SKILL.md +447 -447
- package/.codex/skills/spec-add/SKILL.md +5 -5
- package/.codex/skills/spec-load/SKILL.md +5 -5
- package/.codex/skills/spec-map/SKILL.md +5 -5
- package/.codex/skills/spec-setup/SKILL.md +2 -2
- package/chains/_intent-map.json +6 -0
- package/chains/_router.json +14 -0
- package/chains/full-lifecycle.json +15 -0
- package/chains/quality-loop.json +16 -1
- package/chains/singles/business-test.json +26 -0
- package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.d.ts +4 -0
- package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.js +47 -1
- package/dashboard/dist-server/dashboard/src/server/agents/codex-app-server-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +16 -2
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +25 -9
- package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
- package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +3 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.js +78 -61
- package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
- package/dashboard/dist-server/src/agents/cli-history-store.d.ts +14 -1
- package/dashboard/dist-server/src/agents/cli-history-store.js +24 -2
- package/dashboard/dist-server/src/agents/cli-history-store.js.map +1 -1
- package/dashboard/dist-server/src/commands/delegate.js +142 -6
- package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
- package/dist/src/agents/cli-agent-runner.d.ts +3 -0
- package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.js +72 -46
- package/dist/src/agents/cli-agent-runner.js.map +1 -1
- package/dist/src/agents/cli-history-store.d.ts +14 -1
- package/dist/src/agents/cli-history-store.d.ts.map +1 -1
- package/dist/src/agents/cli-history-store.js +24 -2
- package/dist/src/agents/cli-history-store.js.map +1 -1
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +65 -5
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/commands/install-backend.d.ts.map +1 -1
- package/dist/src/commands/install-backend.js +5 -2
- package/dist/src/commands/install-backend.js.map +1 -1
- package/dist/src/mcp/delegate-channel-relay.d.ts.map +1 -1
- package/dist/src/mcp/delegate-channel-relay.js +7 -2
- package/dist/src/mcp/delegate-channel-relay.js.map +1 -1
- package/dist/src/mcp/server.js +1 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/tools/index.d.ts +1 -6
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +1 -451
- package/dist/src/tools/index.js.map +1 -1
- package/package.json +3 -2
- package/templates/business-test-report.json +68 -0
|
@@ -1,408 +1,408 @@
|
|
|
1
|
-
---
|
|
2
|
-
name:
|
|
3
|
-
description: Tiered code review via CSV wave pipeline. Decomposes into 6 dimension agents running in parallel, with optional deep-dive aggregation wave. Replaces quality-review command.
|
|
4
|
-
argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase> [--level quick|standard|deep] [--dimensions list]\""
|
|
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 dimension selection, skip interactive validation, use defaults for level detection.
|
|
11
|
-
|
|
12
|
-
# Maestro Review (CSV Wave)
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
$
|
|
18
|
-
$
|
|
19
|
-
$
|
|
20
|
-
$
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Flags**:
|
|
24
|
-
- `-y, --yes`: Skip all confirmations (auto mode)
|
|
25
|
-
- `-c, --concurrency N`: Max concurrent agents within each wave (default: 6)
|
|
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) + `review.json` (structured review output)
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Overview
|
|
34
|
-
|
|
35
|
-
Wave-based multi-dimensional code review using `spawn_agents_on_csv`. Decomposes review into independent dimension agents (Wave 1), then aggregates findings into a unified report with verdict (Wave 2).
|
|
36
|
-
|
|
37
|
-
**Core workflow**: Collect Files → Decompose Dimensions → Parallel Review → Aggregate + Verdict
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
┌─────────────────────────────────────────────────────────────────────────┐
|
|
41
|
-
│ CODE REVIEW CSV WAVE WORKFLOW │
|
|
42
|
-
├─────────────────────────────────────────────────────────────────────────┤
|
|
43
|
-
│ │
|
|
44
|
-
│ Phase 1: Phase Resolution → CSV │
|
|
45
|
-
│ ├─ Resolve phase directory from arguments │
|
|
46
|
-
│ ├─ Collect changed files from task summaries │
|
|
47
|
-
│ ├─ Auto-detect review level (quick/standard/deep) │
|
|
48
|
-
│ ├─ Determine active dimensions │
|
|
49
|
-
│ ├─ Generate tasks.csv with one row per dimension │
|
|
50
|
-
│ └─ User validates dimension breakdown (skip if -y) │
|
|
51
|
-
│ │
|
|
52
|
-
│ Phase 2: Wave Execution Engine │
|
|
53
|
-
│ ├─ Wave 1: Dimension Review (parallel) │
|
|
54
|
-
│ │ ├─ Each dimension agent reviews all changed files │
|
|
55
|
-
│ │ ├─ Agent classifies findings by severity │
|
|
56
|
-
│ │ ├─ Discoveries shared via board (patterns, conventions) │
|
|
57
|
-
│ │ └─ Results: severity_counts + top_issues per dimension │
|
|
58
|
-
│ ├─ Wave 2: Aggregation + Deep-Dive (if needed) │
|
|
59
|
-
│ │ ├─ Aggregate all dimension findings │
|
|
60
|
-
│ │ ├─ If criticals > 0 (standard) or always (deep): deep-dive │
|
|
61
|
-
│ │ ├─ Cross-dimension impact analysis │
|
|
62
|
-
│ │ └─ Generate verdict: PASS / WARN / BLOCK │
|
|
63
|
-
│ └─ discoveries.ndjson shared across all waves (append-only) │
|
|
64
|
-
│ │
|
|
65
|
-
│ Phase 3: Results Aggregation │
|
|
66
|
-
│ ├─ Export results.csv + review.json │
|
|
67
|
-
│ ├─ Generate context.md with all findings │
|
|
68
|
-
│ ├─ Auto-create issues for qualifying findings │
|
|
69
|
-
│ ├─ Update phase index.json with review status │
|
|
70
|
-
│ └─ Display summary with verdict + next steps │
|
|
71
|
-
│ │
|
|
72
|
-
└─────────────────────────────────────────────────────────────────────────┘
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## CSV Schema
|
|
78
|
-
|
|
79
|
-
### tasks.csv (Master State)
|
|
80
|
-
|
|
81
|
-
```csv
|
|
82
|
-
id,title,description,dimension,changed_files,project_specs,review_level,deps,context_from,wave,status,findings,severity_counts,top_issues,error
|
|
83
|
-
"1","Correctness Review","Review all changed files for correctness: logic errors, missing edge cases, incorrect return values, null/undefined handling, off-by-one errors. Classify each finding as critical/high/medium/low with file:line references.","correctness","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","Existing patterns use Result type for error handling","standard","","","1","","","","",""
|
|
84
|
-
"2","Security Review","Review all changed files for security vulnerabilities: injection flaws, XSS, CSRF, auth bypass, sensitive data exposure, insecure crypto. Reference OWASP Top 10. Classify each finding.","security","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","Auth uses bcrypt + JWT","standard","","","1","","","","",""
|
|
85
|
-
"3","Performance Review","Review all changed files for performance issues: N+1 queries, unnecessary re-renders, memory leaks, blocking operations, unoptimized algorithms.","performance","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","","standard","","","1","","","","",""
|
|
86
|
-
"4","Architecture Review","Review all changed files for architecture issues: layer violations, circular dependencies, inappropriate coupling, missing abstractions, SRP violations.","architecture","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","ESM modules, strict TypeScript","standard","","","1","","","","",""
|
|
87
|
-
"5","Maintainability Review","Review all changed files for maintainability: code duplication, overly complex functions, poor naming, missing types, unclear control flow.","maintainability","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","","standard","","","1","","","","",""
|
|
88
|
-
"6","Best Practices Review","Review all changed files for best-practice violations: error handling gaps, missing validation, hardcoded values, deprecated API usage, inconsistent patterns.","best-practices","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","","standard","","","1","","","","",""
|
|
89
|
-
"7","Aggregate + Deep-Dive","Aggregate all dimension findings. Calculate severity distribution. Determine verdict (PASS/WARN/BLOCK). If critical findings exist, perform deep-dive with cross-file impact analysis.","aggregation","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","","standard","1;2;3;4;5;6","1;2;3;4;5;6","2","","","","",""
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**Columns**:
|
|
93
|
-
|
|
94
|
-
| Column | Phase | Description |
|
|
95
|
-
|--------|-------|-------------|
|
|
96
|
-
| `id` | Input | Unique task identifier (string) |
|
|
97
|
-
| `title` | Input | Short task title |
|
|
98
|
-
| `description` | Input | Detailed review instructions for this dimension |
|
|
99
|
-
| `dimension` | Input | Review dimension: correctness/security/performance/architecture/maintainability/best-practices/aggregation |
|
|
100
|
-
| `changed_files` | Input | Semicolon-separated file paths to review |
|
|
101
|
-
| `project_specs` | Input | Relevant project specs/conventions context |
|
|
102
|
-
| `review_level` | Input | quick/standard/deep — controls depth |
|
|
103
|
-
| `deps` | Input | Semicolon-separated dependency task IDs |
|
|
104
|
-
| `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
|
|
105
|
-
| `wave` | Computed | Wave number (1 = dimension review, 2 = aggregation) |
|
|
106
|
-
| `status` | Output | `pending` → `completed` / `failed` / `skipped` |
|
|
107
|
-
| `findings` | Output | Key review findings summary (max 500 chars) |
|
|
108
|
-
| `severity_counts` | Output | JSON: `{"critical":N,"high":N,"medium":N,"low":N}` |
|
|
109
|
-
| `top_issues` | Output | Top 5 issues with `[severity] description (file:line)` format |
|
|
110
|
-
| `error` | Output | Error message if failed |
|
|
111
|
-
|
|
112
|
-
### Per-Wave CSV (Temporary)
|
|
113
|
-
|
|
114
|
-
Each wave generates `wave-{N}.csv` with extra `prev_context` column.
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## Output Artifacts
|
|
119
|
-
|
|
120
|
-
| File | Purpose | Lifecycle |
|
|
121
|
-
|------|---------|-----------|
|
|
122
|
-
| `tasks.csv` | Master state — all tasks with status/findings | Updated after each wave |
|
|
123
|
-
| `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
|
|
124
|
-
| `results.csv` | Final export of all task results | Created in Phase 3 |
|
|
125
|
-
| `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
|
|
126
|
-
| `context.md` | Human-readable review report | Created in Phase 3 |
|
|
127
|
-
| `review.json` | Structured review output for downstream | Created in Phase 3 |
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Session Structure
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
.workflow/.csv-wave/review-{phase}-{date}/
|
|
135
|
-
├── tasks.csv
|
|
136
|
-
├── results.csv
|
|
137
|
-
├── discoveries.ndjson
|
|
138
|
-
├── context.md
|
|
139
|
-
├── review.json
|
|
140
|
-
└── wave-{N}.csv (temporary)
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Implementation
|
|
146
|
-
|
|
147
|
-
### Session Initialization
|
|
148
|
-
|
|
149
|
-
```javascript
|
|
150
|
-
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
|
151
|
-
|
|
152
|
-
// Parse flags
|
|
153
|
-
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
|
|
154
|
-
const continueMode = $ARGUMENTS.includes('--continue')
|
|
155
|
-
const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
|
|
156
|
-
const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 6
|
|
157
|
-
|
|
158
|
-
// Parse review-specific flags
|
|
159
|
-
const levelMatch = $ARGUMENTS.match(/--level\s+(quick|standard|deep)/)
|
|
160
|
-
const dimsMatch = $ARGUMENTS.match(/--dimensions\s+([\w,]+)/)
|
|
161
|
-
|
|
162
|
-
// Clean phase text
|
|
163
|
-
const phaseArg = $ARGUMENTS
|
|
164
|
-
.replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|--level\s+\w+|--dimensions\s+[\w,]+/g, '')
|
|
165
|
-
.trim()
|
|
166
|
-
|
|
167
|
-
const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
|
|
168
|
-
const sessionId = `review-phase${phaseArg}-${dateStr}`
|
|
169
|
-
const sessionFolder = `.workflow/.csv-wave/${sessionId}`
|
|
170
|
-
|
|
171
|
-
Bash(`mkdir -p ${sessionFolder}`)
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
### Phase 1: Phase Resolution → CSV
|
|
177
|
-
|
|
178
|
-
**Objective**: Resolve phase, collect changed files, determine review level, generate tasks.csv.
|
|
179
|
-
|
|
180
|
-
**Decomposition Rules**:
|
|
181
|
-
|
|
182
|
-
1. **Phase resolution**: Resolve `{phaseArg}` to `.workflow/phases/{NN}-{slug}/`
|
|
183
|
-
2. **File collection**: Read `.task/TASK-*.json` → collect all `files[].path` where action != "read"
|
|
184
|
-
3. **Level detection**:
|
|
185
|
-
|
|
186
|
-
| Condition | Level |
|
|
187
|
-
|-----------|-------|
|
|
188
|
-
| `--level` flag provided | Use explicit level |
|
|
189
|
-
| ≤3 changed files | quick |
|
|
190
|
-
| 4-19 changed files | standard |
|
|
191
|
-
| ≥20 files OR phase marked critical | deep |
|
|
192
|
-
|
|
193
|
-
4. **Dimension selection**:
|
|
194
|
-
|
|
195
|
-
| Level | Dimensions |
|
|
196
|
-
|-------|------------|
|
|
197
|
-
| quick | correctness, security |
|
|
198
|
-
| standard | correctness, security, performance, architecture, maintainability, best-practices |
|
|
199
|
-
| deep | all 6 + forced deep-dive in aggregation |
|
|
200
|
-
|
|
201
|
-
If `--dimensions` flag provided, override with explicit list.
|
|
202
|
-
|
|
203
|
-
5. **Specs loading**: Read `.workflow/specs/` for project conventions (unless `--skip-specs`)
|
|
204
|
-
|
|
205
|
-
6. **CSV generation**: One row per dimension + one aggregation row.
|
|
206
|
-
|
|
207
|
-
**Wave computation**: Simple 2-wave — all dimension tasks = wave 1, aggregation = wave 2.
|
|
208
|
-
|
|
209
|
-
**User validation**: Display task breakdown (skip if AUTO_YES).
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
### Phase 2: Wave Execution Engine
|
|
214
|
-
|
|
215
|
-
**Objective**: Execute dimension reviews wave-by-wave via spawn_agents_on_csv.
|
|
216
|
-
|
|
217
|
-
#### Wave 1: Dimension Reviews (Parallel)
|
|
218
|
-
|
|
219
|
-
1. Read master `tasks.csv`
|
|
220
|
-
2. Filter rows where `wave == 1` AND `status == pending`
|
|
221
|
-
3. No prev_context needed (wave 1 has no predecessors)
|
|
222
|
-
4. Write `wave-1.csv`
|
|
223
|
-
5. Execute:
|
|
224
|
-
|
|
225
|
-
```javascript
|
|
226
|
-
spawn_agents_on_csv({
|
|
227
|
-
csv_path: `${sessionFolder}/wave-1.csv`,
|
|
228
|
-
id_column: "id",
|
|
229
|
-
instruction: buildReviewInstruction(sessionFolder),
|
|
230
|
-
max_concurrency: maxConcurrency,
|
|
231
|
-
max_runtime_seconds: 600,
|
|
232
|
-
output_csv_path: `${sessionFolder}/wave-1-results.csv`,
|
|
233
|
-
output_schema: {
|
|
234
|
-
type: "object",
|
|
235
|
-
properties: {
|
|
236
|
-
id: { type: "string" },
|
|
237
|
-
status: { type: "string", enum: ["completed", "failed"] },
|
|
238
|
-
findings: { type: "string" },
|
|
239
|
-
severity_counts: { type: "string" },
|
|
240
|
-
top_issues: { type: "string" },
|
|
241
|
-
error: { type: "string" }
|
|
242
|
-
},
|
|
243
|
-
required: ["id", "status", "findings"]
|
|
244
|
-
}
|
|
245
|
-
})
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
6. Read `wave-1-results.csv`, merge into master `tasks.csv`
|
|
249
|
-
7. Delete `wave-1.csv`
|
|
250
|
-
|
|
251
|
-
#### Wave 2: Aggregation + Deep-Dive
|
|
252
|
-
|
|
253
|
-
1. Read master `tasks.csv`
|
|
254
|
-
2. Filter rows where `wave == 2` AND `status == pending`
|
|
255
|
-
3. Check deps — if all wave 1 tasks failed, skip aggregation
|
|
256
|
-
4. Build `prev_context` from wave 1 findings:
|
|
257
|
-
```
|
|
258
|
-
[Task 1: Correctness Review] Found 2 critical issues: null pointer in login handler...
|
|
259
|
-
[Task 2: Security Review] Found 1 high issue: SQL injection in query builder...
|
|
260
|
-
...
|
|
261
|
-
```
|
|
262
|
-
5. Write `wave-2.csv` with `prev_context` column
|
|
263
|
-
6. Execute `spawn_agents_on_csv` for aggregation agent
|
|
264
|
-
7. Merge results into master `tasks.csv`
|
|
265
|
-
8. Delete `wave-2.csv`
|
|
266
|
-
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
### Phase 3: Results Aggregation
|
|
270
|
-
|
|
271
|
-
**Objective**: Generate final results and human-readable report.
|
|
272
|
-
|
|
273
|
-
1. Read final master `tasks.csv`
|
|
274
|
-
2. Export as `results.csv`
|
|
275
|
-
3. Build `review.json`:
|
|
276
|
-
|
|
277
|
-
```json
|
|
278
|
-
{
|
|
279
|
-
"phase": "<phase>",
|
|
280
|
-
"level": "<level>",
|
|
281
|
-
"verdict": "PASS|WARN|BLOCK",
|
|
282
|
-
"severity_distribution": { "critical": 0, "high": 0, "medium": 0, "low": 0 },
|
|
283
|
-
"dimensions": [
|
|
284
|
-
{ "dimension": "correctness", "status": "completed", "severity_counts": {...}, "top_issues": [...] }
|
|
285
|
-
],
|
|
286
|
-
"deep_dive": { "performed": true/false, "iterations": N, "impact_analysis": "..." },
|
|
287
|
-
"issues_created": [],
|
|
288
|
-
"timestamp": "<ISO>"
|
|
289
|
-
}
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
4. Generate `context.md`:
|
|
293
|
-
|
|
294
|
-
```markdown
|
|
295
|
-
# Code Review Report — Phase {phase}
|
|
296
|
-
|
|
297
|
-
## Summary
|
|
298
|
-
- Level: {level}
|
|
299
|
-
- Files reviewed: {file_count}
|
|
300
|
-
- Dimensions: {dimension_count}
|
|
301
|
-
- Verdict: **{verdict}**
|
|
302
|
-
|
|
303
|
-
## Severity Distribution
|
|
304
|
-
| Severity | Count |
|
|
305
|
-
|----------|-------|
|
|
306
|
-
| Critical | {N} |
|
|
307
|
-
| High | {N} |
|
|
308
|
-
| Medium | {N} |
|
|
309
|
-
| Low | {N} |
|
|
310
|
-
|
|
311
|
-
## Dimension Results
|
|
312
|
-
### {dimension_name}
|
|
313
|
-
{findings}
|
|
314
|
-
|
|
315
|
-
**Top Issues:**
|
|
316
|
-
{top_issues}
|
|
317
|
-
|
|
318
|
-
## Deep-Dive Analysis
|
|
319
|
-
{if performed: impact analysis results}
|
|
320
|
-
|
|
321
|
-
## Issues Created
|
|
322
|
-
{list of created issue IDs}
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
5. **Verdict determination**:
|
|
326
|
-
|
|
327
|
-
| Condition | Verdict |
|
|
328
|
-
|-----------|---------|
|
|
329
|
-
| Any critical findings | BLOCK |
|
|
330
|
-
| High findings > 3 | BLOCK |
|
|
331
|
-
| Any high findings | WARN |
|
|
332
|
-
| Medium findings > 5 | WARN |
|
|
333
|
-
| Otherwise | PASS |
|
|
334
|
-
|
|
335
|
-
6. **Issue creation**: Based on level thresholds:
|
|
336
|
-
|
|
337
|
-
| Level | Create Issues For |
|
|
338
|
-
|-------|------------------|
|
|
339
|
-
| quick | critical only |
|
|
340
|
-
| standard | critical + high |
|
|
341
|
-
| deep | critical + high + medium |
|
|
342
|
-
|
|
343
|
-
7. **Phase index update**: Update `.workflow/phases/{phase}/index.json` with review status.
|
|
344
|
-
|
|
345
|
-
8. Display summary.
|
|
346
|
-
|
|
347
|
-
---
|
|
348
|
-
|
|
349
|
-
## Shared Discovery Board Protocol
|
|
350
|
-
|
|
351
|
-
### Standard Discovery Types
|
|
352
|
-
|
|
353
|
-
| Type | Dedup Key | Data Schema | Description |
|
|
354
|
-
|------|-----------|-------------|-------------|
|
|
355
|
-
| `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
|
|
356
|
-
| `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
|
|
357
|
-
| `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
|
|
358
|
-
| `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue found |
|
|
359
|
-
| `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
|
|
360
|
-
|
|
361
|
-
### Domain Discovery Types
|
|
362
|
-
|
|
363
|
-
| Type | Dedup Key | Data Schema | Description |
|
|
364
|
-
|------|-----------|-------------|-------------|
|
|
365
|
-
| `vulnerability` | `data.location` | `{location, type, severity, cwe}` | Security vulnerability |
|
|
366
|
-
| `code_smell` | `data.location` | `{location, type, severity, description}` | Code quality issue |
|
|
367
|
-
| `performance_hotspot` | `data.location` | `{location, type, impact}` | Performance issue |
|
|
368
|
-
| `architecture_violation` | `data.location` | `{location, rule, description}` | Architecture rule violation |
|
|
369
|
-
|
|
370
|
-
### Protocol
|
|
371
|
-
|
|
372
|
-
1. **Read** `{session_folder}/discoveries.ndjson` before own review
|
|
373
|
-
2. **Skip covered**: If discovery of same type + dedup key exists, skip
|
|
374
|
-
3. **Write immediately**: Append findings as found
|
|
375
|
-
4. **Append-only**: Never modify or delete
|
|
376
|
-
5. **Deduplicate**: Check before writing
|
|
377
|
-
|
|
378
|
-
```bash
|
|
379
|
-
echo '{"ts":"<ISO>","worker":"{id}","type":"vulnerability","data":{"location":"src/auth/login.ts:42","type":"sql_injection","severity":"critical","cwe":"CWE-89"}}' >> {session_folder}/discoveries.ndjson
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
---
|
|
383
|
-
|
|
384
|
-
## Error Handling
|
|
385
|
-
|
|
386
|
-
| Error | Resolution |
|
|
387
|
-
|-------|------------|
|
|
388
|
-
| Phase directory not found | Abort with error: "Phase {N} not found" |
|
|
389
|
-
| No task summaries found | Abort with error: "No execution results — run execute first" |
|
|
390
|
-
| No changed files | Abort with error: "No changed files detected" |
|
|
391
|
-
| Dimension agent timeout | Mark as failed, skip dependent aggregation if all failed |
|
|
392
|
-
| Aggregation agent failed | Use wave 1 results directly, verdict based on raw counts |
|
|
393
|
-
| CSV parse error | Validate format, show line number |
|
|
394
|
-
| discoveries.ndjson corrupt | Ignore malformed lines |
|
|
395
|
-
| Continue mode: no session found | List available sessions |
|
|
396
|
-
|
|
397
|
-
---
|
|
398
|
-
|
|
399
|
-
## Core Rules
|
|
400
|
-
|
|
401
|
-
1. **Start Immediately**: First action is session initialization, then Phase 1
|
|
402
|
-
2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
|
|
403
|
-
3. **CSV is Source of Truth**: Master tasks.csv holds all state
|
|
404
|
-
4. **Context Propagation**: prev_context built from master CSV, not from memory
|
|
405
|
-
5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
|
|
406
|
-
6. **Skip on Failure**: If all dimension agents failed, skip aggregation
|
|
407
|
-
7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
|
|
408
|
-
8. **DO NOT STOP**: Continuous execution until all waves complete
|
|
1
|
+
---
|
|
2
|
+
name: quality-review
|
|
3
|
+
description: Tiered code review via CSV wave pipeline. Decomposes into 6 dimension agents running in parallel, with optional deep-dive aggregation wave. Replaces quality-review command.
|
|
4
|
+
argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase> [--level quick|standard|deep] [--dimensions list]\""
|
|
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 dimension selection, skip interactive validation, use defaults for level detection.
|
|
11
|
+
|
|
12
|
+
# Maestro Review (CSV Wave)
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
$quality-review "3"
|
|
18
|
+
$quality-review -c 6 "3 --level deep"
|
|
19
|
+
$quality-review -y "3 --dimensions security,performance"
|
|
20
|
+
$quality-review --continue "review-phase3-20260318"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Flags**:
|
|
24
|
+
- `-y, --yes`: Skip all confirmations (auto mode)
|
|
25
|
+
- `-c, --concurrency N`: Max concurrent agents within each wave (default: 6)
|
|
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) + `review.json` (structured review output)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Overview
|
|
34
|
+
|
|
35
|
+
Wave-based multi-dimensional code review using `spawn_agents_on_csv`. Decomposes review into independent dimension agents (Wave 1), then aggregates findings into a unified report with verdict (Wave 2).
|
|
36
|
+
|
|
37
|
+
**Core workflow**: Collect Files → Decompose Dimensions → Parallel Review → Aggregate + Verdict
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
41
|
+
│ CODE REVIEW CSV WAVE WORKFLOW │
|
|
42
|
+
├─────────────────────────────────────────────────────────────────────────┤
|
|
43
|
+
│ │
|
|
44
|
+
│ Phase 1: Phase Resolution → CSV │
|
|
45
|
+
│ ├─ Resolve phase directory from arguments │
|
|
46
|
+
│ ├─ Collect changed files from task summaries │
|
|
47
|
+
│ ├─ Auto-detect review level (quick/standard/deep) │
|
|
48
|
+
│ ├─ Determine active dimensions │
|
|
49
|
+
│ ├─ Generate tasks.csv with one row per dimension │
|
|
50
|
+
│ └─ User validates dimension breakdown (skip if -y) │
|
|
51
|
+
│ │
|
|
52
|
+
│ Phase 2: Wave Execution Engine │
|
|
53
|
+
│ ├─ Wave 1: Dimension Review (parallel) │
|
|
54
|
+
│ │ ├─ Each dimension agent reviews all changed files │
|
|
55
|
+
│ │ ├─ Agent classifies findings by severity │
|
|
56
|
+
│ │ ├─ Discoveries shared via board (patterns, conventions) │
|
|
57
|
+
│ │ └─ Results: severity_counts + top_issues per dimension │
|
|
58
|
+
│ ├─ Wave 2: Aggregation + Deep-Dive (if needed) │
|
|
59
|
+
│ │ ├─ Aggregate all dimension findings │
|
|
60
|
+
│ │ ├─ If criticals > 0 (standard) or always (deep): deep-dive │
|
|
61
|
+
│ │ ├─ Cross-dimension impact analysis │
|
|
62
|
+
│ │ └─ Generate verdict: PASS / WARN / BLOCK │
|
|
63
|
+
│ └─ discoveries.ndjson shared across all waves (append-only) │
|
|
64
|
+
│ │
|
|
65
|
+
│ Phase 3: Results Aggregation │
|
|
66
|
+
│ ├─ Export results.csv + review.json │
|
|
67
|
+
│ ├─ Generate context.md with all findings │
|
|
68
|
+
│ ├─ Auto-create issues for qualifying findings │
|
|
69
|
+
│ ├─ Update phase index.json with review status │
|
|
70
|
+
│ └─ Display summary with verdict + next steps │
|
|
71
|
+
│ │
|
|
72
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## CSV Schema
|
|
78
|
+
|
|
79
|
+
### tasks.csv (Master State)
|
|
80
|
+
|
|
81
|
+
```csv
|
|
82
|
+
id,title,description,dimension,changed_files,project_specs,review_level,deps,context_from,wave,status,findings,severity_counts,top_issues,error
|
|
83
|
+
"1","Correctness Review","Review all changed files for correctness: logic errors, missing edge cases, incorrect return values, null/undefined handling, off-by-one errors. Classify each finding as critical/high/medium/low with file:line references.","correctness","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","Existing patterns use Result type for error handling","standard","","","1","","","","",""
|
|
84
|
+
"2","Security Review","Review all changed files for security vulnerabilities: injection flaws, XSS, CSRF, auth bypass, sensitive data exposure, insecure crypto. Reference OWASP Top 10. Classify each finding.","security","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","Auth uses bcrypt + JWT","standard","","","1","","","","",""
|
|
85
|
+
"3","Performance Review","Review all changed files for performance issues: N+1 queries, unnecessary re-renders, memory leaks, blocking operations, unoptimized algorithms.","performance","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","","standard","","","1","","","","",""
|
|
86
|
+
"4","Architecture Review","Review all changed files for architecture issues: layer violations, circular dependencies, inappropriate coupling, missing abstractions, SRP violations.","architecture","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","ESM modules, strict TypeScript","standard","","","1","","","","",""
|
|
87
|
+
"5","Maintainability Review","Review all changed files for maintainability: code duplication, overly complex functions, poor naming, missing types, unclear control flow.","maintainability","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","","standard","","","1","","","","",""
|
|
88
|
+
"6","Best Practices Review","Review all changed files for best-practice violations: error handling gaps, missing validation, hardcoded values, deprecated API usage, inconsistent patterns.","best-practices","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","","standard","","","1","","","","",""
|
|
89
|
+
"7","Aggregate + Deep-Dive","Aggregate all dimension findings. Calculate severity distribution. Determine verdict (PASS/WARN/BLOCK). If critical findings exist, perform deep-dive with cross-file impact analysis.","aggregation","src/auth/login.ts;src/auth/register.ts;src/utils/validation.ts","","standard","1;2;3;4;5;6","1;2;3;4;5;6","2","","","","",""
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Columns**:
|
|
93
|
+
|
|
94
|
+
| Column | Phase | Description |
|
|
95
|
+
|--------|-------|-------------|
|
|
96
|
+
| `id` | Input | Unique task identifier (string) |
|
|
97
|
+
| `title` | Input | Short task title |
|
|
98
|
+
| `description` | Input | Detailed review instructions for this dimension |
|
|
99
|
+
| `dimension` | Input | Review dimension: correctness/security/performance/architecture/maintainability/best-practices/aggregation |
|
|
100
|
+
| `changed_files` | Input | Semicolon-separated file paths to review |
|
|
101
|
+
| `project_specs` | Input | Relevant project specs/conventions context |
|
|
102
|
+
| `review_level` | Input | quick/standard/deep — controls depth |
|
|
103
|
+
| `deps` | Input | Semicolon-separated dependency task IDs |
|
|
104
|
+
| `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
|
|
105
|
+
| `wave` | Computed | Wave number (1 = dimension review, 2 = aggregation) |
|
|
106
|
+
| `status` | Output | `pending` → `completed` / `failed` / `skipped` |
|
|
107
|
+
| `findings` | Output | Key review findings summary (max 500 chars) |
|
|
108
|
+
| `severity_counts` | Output | JSON: `{"critical":N,"high":N,"medium":N,"low":N}` |
|
|
109
|
+
| `top_issues` | Output | Top 5 issues with `[severity] description (file:line)` format |
|
|
110
|
+
| `error` | Output | Error message if failed |
|
|
111
|
+
|
|
112
|
+
### Per-Wave CSV (Temporary)
|
|
113
|
+
|
|
114
|
+
Each wave generates `wave-{N}.csv` with extra `prev_context` column.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Output Artifacts
|
|
119
|
+
|
|
120
|
+
| File | Purpose | Lifecycle |
|
|
121
|
+
|------|---------|-----------|
|
|
122
|
+
| `tasks.csv` | Master state — all tasks with status/findings | Updated after each wave |
|
|
123
|
+
| `wave-{N}.csv` | Per-wave input (temporary) | Created before wave, deleted after |
|
|
124
|
+
| `results.csv` | Final export of all task results | Created in Phase 3 |
|
|
125
|
+
| `discoveries.ndjson` | Shared exploration board | Append-only, carries across waves |
|
|
126
|
+
| `context.md` | Human-readable review report | Created in Phase 3 |
|
|
127
|
+
| `review.json` | Structured review output for downstream | Created in Phase 3 |
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Session Structure
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
.workflow/.csv-wave/review-{phase}-{date}/
|
|
135
|
+
├── tasks.csv
|
|
136
|
+
├── results.csv
|
|
137
|
+
├── discoveries.ndjson
|
|
138
|
+
├── context.md
|
|
139
|
+
├── review.json
|
|
140
|
+
└── wave-{N}.csv (temporary)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Implementation
|
|
146
|
+
|
|
147
|
+
### Session Initialization
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
|
151
|
+
|
|
152
|
+
// Parse flags
|
|
153
|
+
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
|
|
154
|
+
const continueMode = $ARGUMENTS.includes('--continue')
|
|
155
|
+
const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
|
|
156
|
+
const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 6
|
|
157
|
+
|
|
158
|
+
// Parse review-specific flags
|
|
159
|
+
const levelMatch = $ARGUMENTS.match(/--level\s+(quick|standard|deep)/)
|
|
160
|
+
const dimsMatch = $ARGUMENTS.match(/--dimensions\s+([\w,]+)/)
|
|
161
|
+
|
|
162
|
+
// Clean phase text
|
|
163
|
+
const phaseArg = $ARGUMENTS
|
|
164
|
+
.replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|--level\s+\w+|--dimensions\s+[\w,]+/g, '')
|
|
165
|
+
.trim()
|
|
166
|
+
|
|
167
|
+
const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
|
|
168
|
+
const sessionId = `review-phase${phaseArg}-${dateStr}`
|
|
169
|
+
const sessionFolder = `.workflow/.csv-wave/${sessionId}`
|
|
170
|
+
|
|
171
|
+
Bash(`mkdir -p ${sessionFolder}`)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### Phase 1: Phase Resolution → CSV
|
|
177
|
+
|
|
178
|
+
**Objective**: Resolve phase, collect changed files, determine review level, generate tasks.csv.
|
|
179
|
+
|
|
180
|
+
**Decomposition Rules**:
|
|
181
|
+
|
|
182
|
+
1. **Phase resolution**: Resolve `{phaseArg}` to `.workflow/phases/{NN}-{slug}/`
|
|
183
|
+
2. **File collection**: Read `.task/TASK-*.json` → collect all `files[].path` where action != "read"
|
|
184
|
+
3. **Level detection**:
|
|
185
|
+
|
|
186
|
+
| Condition | Level |
|
|
187
|
+
|-----------|-------|
|
|
188
|
+
| `--level` flag provided | Use explicit level |
|
|
189
|
+
| ≤3 changed files | quick |
|
|
190
|
+
| 4-19 changed files | standard |
|
|
191
|
+
| ≥20 files OR phase marked critical | deep |
|
|
192
|
+
|
|
193
|
+
4. **Dimension selection**:
|
|
194
|
+
|
|
195
|
+
| Level | Dimensions |
|
|
196
|
+
|-------|------------|
|
|
197
|
+
| quick | correctness, security |
|
|
198
|
+
| standard | correctness, security, performance, architecture, maintainability, best-practices |
|
|
199
|
+
| deep | all 6 + forced deep-dive in aggregation |
|
|
200
|
+
|
|
201
|
+
If `--dimensions` flag provided, override with explicit list.
|
|
202
|
+
|
|
203
|
+
5. **Specs loading**: Read `.workflow/specs/` for project conventions (unless `--skip-specs`)
|
|
204
|
+
|
|
205
|
+
6. **CSV generation**: One row per dimension + one aggregation row.
|
|
206
|
+
|
|
207
|
+
**Wave computation**: Simple 2-wave — all dimension tasks = wave 1, aggregation = wave 2.
|
|
208
|
+
|
|
209
|
+
**User validation**: Display task breakdown (skip if AUTO_YES).
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### Phase 2: Wave Execution Engine
|
|
214
|
+
|
|
215
|
+
**Objective**: Execute dimension reviews wave-by-wave via spawn_agents_on_csv.
|
|
216
|
+
|
|
217
|
+
#### Wave 1: Dimension Reviews (Parallel)
|
|
218
|
+
|
|
219
|
+
1. Read master `tasks.csv`
|
|
220
|
+
2. Filter rows where `wave == 1` AND `status == pending`
|
|
221
|
+
3. No prev_context needed (wave 1 has no predecessors)
|
|
222
|
+
4. Write `wave-1.csv`
|
|
223
|
+
5. Execute:
|
|
224
|
+
|
|
225
|
+
```javascript
|
|
226
|
+
spawn_agents_on_csv({
|
|
227
|
+
csv_path: `${sessionFolder}/wave-1.csv`,
|
|
228
|
+
id_column: "id",
|
|
229
|
+
instruction: buildReviewInstruction(sessionFolder),
|
|
230
|
+
max_concurrency: maxConcurrency,
|
|
231
|
+
max_runtime_seconds: 600,
|
|
232
|
+
output_csv_path: `${sessionFolder}/wave-1-results.csv`,
|
|
233
|
+
output_schema: {
|
|
234
|
+
type: "object",
|
|
235
|
+
properties: {
|
|
236
|
+
id: { type: "string" },
|
|
237
|
+
status: { type: "string", enum: ["completed", "failed"] },
|
|
238
|
+
findings: { type: "string" },
|
|
239
|
+
severity_counts: { type: "string" },
|
|
240
|
+
top_issues: { type: "string" },
|
|
241
|
+
error: { type: "string" }
|
|
242
|
+
},
|
|
243
|
+
required: ["id", "status", "findings"]
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
6. Read `wave-1-results.csv`, merge into master `tasks.csv`
|
|
249
|
+
7. Delete `wave-1.csv`
|
|
250
|
+
|
|
251
|
+
#### Wave 2: Aggregation + Deep-Dive
|
|
252
|
+
|
|
253
|
+
1. Read master `tasks.csv`
|
|
254
|
+
2. Filter rows where `wave == 2` AND `status == pending`
|
|
255
|
+
3. Check deps — if all wave 1 tasks failed, skip aggregation
|
|
256
|
+
4. Build `prev_context` from wave 1 findings:
|
|
257
|
+
```
|
|
258
|
+
[Task 1: Correctness Review] Found 2 critical issues: null pointer in login handler...
|
|
259
|
+
[Task 2: Security Review] Found 1 high issue: SQL injection in query builder...
|
|
260
|
+
...
|
|
261
|
+
```
|
|
262
|
+
5. Write `wave-2.csv` with `prev_context` column
|
|
263
|
+
6. Execute `spawn_agents_on_csv` for aggregation agent
|
|
264
|
+
7. Merge results into master `tasks.csv`
|
|
265
|
+
8. Delete `wave-2.csv`
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
### Phase 3: Results Aggregation
|
|
270
|
+
|
|
271
|
+
**Objective**: Generate final results and human-readable report.
|
|
272
|
+
|
|
273
|
+
1. Read final master `tasks.csv`
|
|
274
|
+
2. Export as `results.csv`
|
|
275
|
+
3. Build `review.json`:
|
|
276
|
+
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"phase": "<phase>",
|
|
280
|
+
"level": "<level>",
|
|
281
|
+
"verdict": "PASS|WARN|BLOCK",
|
|
282
|
+
"severity_distribution": { "critical": 0, "high": 0, "medium": 0, "low": 0 },
|
|
283
|
+
"dimensions": [
|
|
284
|
+
{ "dimension": "correctness", "status": "completed", "severity_counts": {...}, "top_issues": [...] }
|
|
285
|
+
],
|
|
286
|
+
"deep_dive": { "performed": true/false, "iterations": N, "impact_analysis": "..." },
|
|
287
|
+
"issues_created": [],
|
|
288
|
+
"timestamp": "<ISO>"
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
4. Generate `context.md`:
|
|
293
|
+
|
|
294
|
+
```markdown
|
|
295
|
+
# Code Review Report — Phase {phase}
|
|
296
|
+
|
|
297
|
+
## Summary
|
|
298
|
+
- Level: {level}
|
|
299
|
+
- Files reviewed: {file_count}
|
|
300
|
+
- Dimensions: {dimension_count}
|
|
301
|
+
- Verdict: **{verdict}**
|
|
302
|
+
|
|
303
|
+
## Severity Distribution
|
|
304
|
+
| Severity | Count |
|
|
305
|
+
|----------|-------|
|
|
306
|
+
| Critical | {N} |
|
|
307
|
+
| High | {N} |
|
|
308
|
+
| Medium | {N} |
|
|
309
|
+
| Low | {N} |
|
|
310
|
+
|
|
311
|
+
## Dimension Results
|
|
312
|
+
### {dimension_name}
|
|
313
|
+
{findings}
|
|
314
|
+
|
|
315
|
+
**Top Issues:**
|
|
316
|
+
{top_issues}
|
|
317
|
+
|
|
318
|
+
## Deep-Dive Analysis
|
|
319
|
+
{if performed: impact analysis results}
|
|
320
|
+
|
|
321
|
+
## Issues Created
|
|
322
|
+
{list of created issue IDs}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
5. **Verdict determination**:
|
|
326
|
+
|
|
327
|
+
| Condition | Verdict |
|
|
328
|
+
|-----------|---------|
|
|
329
|
+
| Any critical findings | BLOCK |
|
|
330
|
+
| High findings > 3 | BLOCK |
|
|
331
|
+
| Any high findings | WARN |
|
|
332
|
+
| Medium findings > 5 | WARN |
|
|
333
|
+
| Otherwise | PASS |
|
|
334
|
+
|
|
335
|
+
6. **Issue creation**: Based on level thresholds:
|
|
336
|
+
|
|
337
|
+
| Level | Create Issues For |
|
|
338
|
+
|-------|------------------|
|
|
339
|
+
| quick | critical only |
|
|
340
|
+
| standard | critical + high |
|
|
341
|
+
| deep | critical + high + medium |
|
|
342
|
+
|
|
343
|
+
7. **Phase index update**: Update `.workflow/phases/{phase}/index.json` with review status.
|
|
344
|
+
|
|
345
|
+
8. Display summary.
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Shared Discovery Board Protocol
|
|
350
|
+
|
|
351
|
+
### Standard Discovery Types
|
|
352
|
+
|
|
353
|
+
| Type | Dedup Key | Data Schema | Description |
|
|
354
|
+
|------|-----------|-------------|-------------|
|
|
355
|
+
| `code_pattern` | `data.name` | `{name, file, description}` | Reusable code pattern found |
|
|
356
|
+
| `integration_point` | `data.file` | `{file, description, exports[]}` | Module connection point |
|
|
357
|
+
| `convention` | singleton | `{naming, imports, formatting}` | Project code conventions |
|
|
358
|
+
| `blocker` | `data.issue` | `{issue, severity, impact}` | Blocking issue found |
|
|
359
|
+
| `tech_stack` | singleton | `{framework, language, tools[]}` | Technology stack info |
|
|
360
|
+
|
|
361
|
+
### Domain Discovery Types
|
|
362
|
+
|
|
363
|
+
| Type | Dedup Key | Data Schema | Description |
|
|
364
|
+
|------|-----------|-------------|-------------|
|
|
365
|
+
| `vulnerability` | `data.location` | `{location, type, severity, cwe}` | Security vulnerability |
|
|
366
|
+
| `code_smell` | `data.location` | `{location, type, severity, description}` | Code quality issue |
|
|
367
|
+
| `performance_hotspot` | `data.location` | `{location, type, impact}` | Performance issue |
|
|
368
|
+
| `architecture_violation` | `data.location` | `{location, rule, description}` | Architecture rule violation |
|
|
369
|
+
|
|
370
|
+
### Protocol
|
|
371
|
+
|
|
372
|
+
1. **Read** `{session_folder}/discoveries.ndjson` before own review
|
|
373
|
+
2. **Skip covered**: If discovery of same type + dedup key exists, skip
|
|
374
|
+
3. **Write immediately**: Append findings as found
|
|
375
|
+
4. **Append-only**: Never modify or delete
|
|
376
|
+
5. **Deduplicate**: Check before writing
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
echo '{"ts":"<ISO>","worker":"{id}","type":"vulnerability","data":{"location":"src/auth/login.ts:42","type":"sql_injection","severity":"critical","cwe":"CWE-89"}}' >> {session_folder}/discoveries.ndjson
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Error Handling
|
|
385
|
+
|
|
386
|
+
| Error | Resolution |
|
|
387
|
+
|-------|------------|
|
|
388
|
+
| Phase directory not found | Abort with error: "Phase {N} not found" |
|
|
389
|
+
| No task summaries found | Abort with error: "No execution results — run execute first" |
|
|
390
|
+
| No changed files | Abort with error: "No changed files detected" |
|
|
391
|
+
| Dimension agent timeout | Mark as failed, skip dependent aggregation if all failed |
|
|
392
|
+
| Aggregation agent failed | Use wave 1 results directly, verdict based on raw counts |
|
|
393
|
+
| CSV parse error | Validate format, show line number |
|
|
394
|
+
| discoveries.ndjson corrupt | Ignore malformed lines |
|
|
395
|
+
| Continue mode: no session found | List available sessions |
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Core Rules
|
|
400
|
+
|
|
401
|
+
1. **Start Immediately**: First action is session initialization, then Phase 1
|
|
402
|
+
2. **Wave Order is Sacred**: Never execute wave 2 before wave 1 completes and results are merged
|
|
403
|
+
3. **CSV is Source of Truth**: Master tasks.csv holds all state
|
|
404
|
+
4. **Context Propagation**: prev_context built from master CSV, not from memory
|
|
405
|
+
5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
|
|
406
|
+
6. **Skip on Failure**: If all dimension agents failed, skip aggregation
|
|
407
|
+
7. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
|
|
408
|
+
8. **DO NOT STOP**: Continuous execution until all waves complete
|