claude-code-workflow 7.2.14 → 7.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.claude/commands/workflow/analyze-with-file.md +7 -0
  2. package/.codex/skills/analyze-with-file/SKILL.md +1181 -1182
  3. package/.codex/skills/brainstorm/SKILL.md +723 -725
  4. package/.codex/skills/brainstorm-with-file/SKILL.md +10 -5
  5. package/.codex/skills/clean/SKILL.md +33 -26
  6. package/.codex/skills/collaborative-plan-with-file/SKILL.md +830 -831
  7. package/.codex/skills/csv-wave-pipeline/SKILL.md +906 -906
  8. package/.codex/skills/issue-discover/SKILL.md +57 -50
  9. package/.codex/skills/issue-discover/phases/01-issue-new.md +18 -11
  10. package/.codex/skills/issue-discover/phases/02-discover.md +31 -26
  11. package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +13 -11
  12. package/.codex/skills/issue-discover/phases/04-quick-execute.md +32 -27
  13. package/.codex/skills/parallel-dev-cycle/SKILL.md +402 -402
  14. package/.codex/skills/project-documentation-workflow/SKILL.md +13 -3
  15. package/.codex/skills/roadmap-with-file/SKILL.md +901 -897
  16. package/.codex/skills/session-sync/SKILL.md +222 -212
  17. package/.codex/skills/spec-add/SKILL.md +620 -613
  18. package/.codex/skills/spec-generator/SKILL.md +2 -2
  19. package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +10 -10
  20. package/.codex/skills/spec-generator/phases/01-discovery.md +11 -18
  21. package/.codex/skills/spec-generator/phases/02-product-brief.md +5 -5
  22. package/.codex/skills/spec-generator/phases/03-requirements.md +7 -7
  23. package/.codex/skills/spec-generator/phases/04-architecture.md +4 -4
  24. package/.codex/skills/spec-generator/phases/05-epics-stories.md +5 -6
  25. package/.codex/skills/spec-generator/phases/06-readiness-check.md +10 -17
  26. package/.codex/skills/spec-generator/phases/07-issue-export.md +326 -329
  27. package/.codex/skills/spec-setup/SKILL.md +669 -657
  28. package/.codex/skills/team-arch-opt/SKILL.md +50 -50
  29. package/.codex/skills/team-arch-opt/agents/completion-handler.md +3 -3
  30. package/.codex/skills/team-brainstorm/SKILL.md +724 -725
  31. package/.codex/skills/team-coordinate/SKILL.md +51 -51
  32. package/.codex/skills/team-coordinate/agents/completion-handler.md +3 -3
  33. package/.codex/skills/team-coordinate/agents/plan-reviewer.md +4 -4
  34. package/.codex/skills/team-designer/SKILL.md +691 -691
  35. package/.codex/skills/team-designer/agents/requirement-clarifier.md +11 -12
  36. package/.codex/skills/team-executor/SKILL.md +45 -45
  37. package/.codex/skills/team-frontend/SKILL.md +45 -45
  38. package/.codex/skills/team-frontend/agents/completion-handler.md +3 -3
  39. package/.codex/skills/team-frontend/agents/qa-gate-reviewer.md +4 -4
  40. package/.codex/skills/team-frontend-debug/SKILL.md +50 -50
  41. package/.codex/skills/team-frontend-debug/agents/completion-handler.md +3 -3
  42. package/.codex/skills/team-frontend-debug/agents/conditional-skip-gate.md +4 -4
  43. package/.codex/skills/team-issue/SKILL.md +751 -740
  44. package/.codex/skills/team-iterdev/SKILL.md +825 -826
  45. package/.codex/skills/team-lifecycle-v4/SKILL.md +775 -775
  46. package/.codex/skills/team-lifecycle-v4/agents/quality-gate.md +165 -165
  47. package/.codex/skills/team-lifecycle-v4/agents/requirement-clarifier.md +163 -163
  48. package/.codex/skills/team-perf-opt/SKILL.md +50 -50
  49. package/.codex/skills/team-perf-opt/agents/completion-handler.md +3 -3
  50. package/.codex/skills/team-planex-v2/SKILL.md +652 -637
  51. package/.codex/skills/team-quality-assurance/SKILL.md +51 -52
  52. package/.codex/skills/team-review/SKILL.md +40 -40
  53. package/.codex/skills/team-roadmap-dev/SKILL.md +51 -51
  54. package/.codex/skills/team-roadmap-dev/agents/roadmap-discusser.md +8 -8
  55. package/.codex/skills/team-tech-debt/SKILL.md +50 -50
  56. package/.codex/skills/team-tech-debt/agents/plan-approver.md +5 -5
  57. package/.codex/skills/team-testing/SKILL.md +51 -52
  58. package/.codex/skills/team-uidesign/SKILL.md +40 -40
  59. package/.codex/skills/team-uidesign/agents/completion-handler.md +177 -177
  60. package/.codex/skills/team-ultra-analyze/SKILL.md +786 -787
  61. package/.codex/skills/team-ultra-analyze/agents/discussion-feedback.md +8 -8
  62. package/.codex/skills/team-ux-improve/SKILL.md +51 -52
  63. package/.codex/skills/team-ux-improve/agents/ux-designer.md +2 -2
  64. package/.codex/skills/team-ux-improve/agents/ux-explorer.md +1 -1
  65. package/.codex/skills/unified-execute-with-file/SKILL.md +797 -796
  66. package/.codex/skills/workflow-execute/SKILL.md +1117 -1118
  67. package/.codex/skills/workflow-lite-planex/SKILL.md +1144 -1141
  68. package/.codex/skills/workflow-plan/SKILL.md +631 -636
  69. package/.codex/skills/workflow-tdd-plan/SKILL.md +753 -759
  70. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +402 -392
  71. package/README.md +25 -0
  72. package/ccw/dist/commands/install.d.ts.map +1 -1
  73. package/ccw/dist/commands/install.js +12 -0
  74. package/ccw/dist/commands/install.js.map +1 -1
  75. package/package.json +1 -1
@@ -1,826 +1,825 @@
1
- ---
2
- name: team-iterdev
3
- description: Iterative development team with Generator-Critic loop, dynamic pipeline selection (patch/sprint/multi-sprint), task ledger for progress tracking, and shared wisdom for cross-sprint learning.
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"task description\""
5
- allowed-tools: spawn_agents_on_csv, spawn_agent, wait, send_input, close_agent, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
- ---
7
-
8
- ## Auto Mode
9
-
10
- When `--yes` or `-y`: Auto-confirm task decomposition, skip interactive validation, use defaults.
11
-
12
- # Team IterDev
13
-
14
- ## Usage
15
-
16
- ```bash
17
- $team-iterdev "Implement user authentication with JWT"
18
- $team-iterdev -c 4 "Refactor payment module to support multiple gateways"
19
- $team-iterdev -y "Fix login button not responding on mobile"
20
- $team-iterdev --continue "ids-auth-jwt-20260308"
21
- ```
22
-
23
- **Flags**:
24
- - `-y, --yes`: Skip all confirmations (auto mode)
25
- - `-c, --concurrency N`: Max concurrent agents within each wave (default: 3)
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
- Iterative development team skill with Generator-Critic (GC) loops between developer and reviewer roles (max 3 rounds). Automatically selects pipeline complexity (patch/sprint/multi-sprint) based on task signals. Tracks progress via task ledger. Accumulates cross-sprint wisdom in shared discovery board.
36
-
37
- **Execution Model**: Hybrid -- CSV wave pipeline (primary) + individual agent spawn (secondary for GC loop control and requirement analysis)
38
-
39
- ```
40
- +-------------------------------------------------------------------------+
41
- | TEAM ITERDEV WORKFLOW |
42
- +-------------------------------------------------------------------------+
43
- | |
44
- | Phase 0: Pre-Wave Interactive |
45
- | +-- Analyze task complexity and select pipeline mode |
46
- | +-- Explore codebase for patterns and dependencies |
47
- | +-- Output: pipeline mode, task analysis, session artifacts |
48
- | |
49
- | Phase 1: Requirement -> CSV + Classification |
50
- | +-- Parse task into pipeline-specific task chain |
51
- | +-- Assign roles: architect, developer, tester, reviewer |
52
- | +-- Classify tasks: csv-wave | interactive (exec_mode) |
53
- | +-- Compute dependency waves (topological sort -> depth grouping) |
54
- | +-- Generate tasks.csv with wave + exec_mode columns |
55
- | +-- User validates task breakdown (skip if -y) |
56
- | |
57
- | Phase 2: Wave Execution Engine (Extended) |
58
- | +-- For each wave (1..N): |
59
- | | +-- Execute pre-wave interactive tasks (if any) |
60
- | | +-- Build wave CSV (filter csv-wave tasks for this wave) |
61
- | | +-- Inject previous findings into prev_context column |
62
- | | +-- spawn_agents_on_csv(wave CSV) |
63
- | | +-- Execute post-wave interactive tasks (if any) |
64
- | | +-- Merge all results into master tasks.csv |
65
- | | +-- Check: any failed? -> skip dependents |
66
- | +-- discoveries.ndjson shared across all modes (append-only) |
67
- | |
68
- | Phase 3: Post-Wave Interactive |
69
- | +-- Generator-Critic (GC) loop control |
70
- | +-- If review has critical issues: trigger DEV-fix -> re-REVIEW |
71
- | +-- Max 3 GC rounds, then force convergence |
72
- | |
73
- | Phase 4: Results Aggregation |
74
- | +-- Export final results.csv |
75
- | +-- Generate context.md with all findings |
76
- | +-- Display summary: completed/failed/skipped per wave |
77
- | +-- Offer: view results | retry failed | done |
78
- | |
79
- +-------------------------------------------------------------------------+
80
- ```
81
-
82
- ---
83
-
84
- ## Task Classification Rules
85
-
86
- Each task is classified by `exec_mode`:
87
-
88
- | exec_mode | Mechanism | Criteria |
89
- |-----------|-----------|----------|
90
- | `csv-wave` | `spawn_agents_on_csv` | One-shot, structured I/O, no multi-round interaction |
91
- | `interactive` | `spawn_agent`/`wait`/`send_input`/`close_agent` | Multi-round, clarification, inline utility |
92
-
93
- **Classification Decision**:
94
-
95
- | Task Property | Classification |
96
- |---------------|---------------|
97
- | Architecture design (DESIGN-*) | `csv-wave` |
98
- | Code implementation (DEV-*) | `csv-wave` |
99
- | Test execution and fix cycle (VERIFY-*) | `csv-wave` |
100
- | Code review (REVIEW-*) | `csv-wave` |
101
- | Fix task from review feedback (DEV-fix-*) | `csv-wave` |
102
- | GC loop control (decide revision vs convergence) | `interactive` |
103
- | Task analysis and pipeline selection (Phase 0) | `interactive` |
104
-
105
- ---
106
-
107
- ## Pipeline Selection Logic
108
-
109
- | Signal | Score |
110
- |--------|-------|
111
- | Changed files > 10 | +3 |
112
- | Changed files 3-10 | +2 |
113
- | Structural change (refactor, architect, restructure) | +3 |
114
- | Cross-cutting concern (multiple, across, cross) | +2 |
115
- | Simple fix (fix, bug, typo, patch) | -2 |
116
-
117
- | Score | Pipeline |
118
- |-------|----------|
119
- | >= 5 | multi-sprint |
120
- | 2-4 | sprint |
121
- | 0-1 | patch |
122
-
123
- ### Pipeline Definitions
124
-
125
- **Patch** (2 tasks, serial):
126
- ```
127
- DEV-001 -> VERIFY-001
128
- ```
129
-
130
- **Sprint** (4 tasks, with parallel window):
131
- ```
132
- DESIGN-001 -> DEV-001 -> [VERIFY-001 + REVIEW-001] (parallel)
133
- ```
134
-
135
- **Multi-Sprint** (5+ tasks, iterative with GC loop):
136
- ```
137
- Sprint 1: DESIGN-001 -> DEV-001 -> [VERIFY-001 + REVIEW-001] -> DEV-fix (if needed) -> REVIEW-002
138
- Sprint 2+ created dynamically
139
- ```
140
-
141
- ---
142
-
143
- ## CSV Schema
144
-
145
- ### tasks.csv (Master State)
146
-
147
- ```csv
148
- id,title,description,role,pipeline,sprint_num,gc_round,deps,context_from,exec_mode,wave,status,findings,review_score,gc_signal,error
149
- "DESIGN-001","Technical design and task breakdown","Explore codebase, create component design, break into implementable tasks with acceptance criteria","architect","sprint","1","0","","","csv-wave","1","pending","","","",""
150
- "DEV-001","Implement design","Load design and task breakdown, implement tasks in execution order, validate syntax","developer","sprint","1","0","DESIGN-001","DESIGN-001","csv-wave","2","pending","","","",""
151
- "VERIFY-001","Verify implementation","Detect test framework, run targeted tests, run regression suite","tester","sprint","1","0","DEV-001","DEV-001","csv-wave","3","pending","","","",""
152
- ```
153
-
154
- **Columns**:
155
-
156
- | Column | Phase | Description |
157
- |--------|-------|-------------|
158
- | `id` | Input | Unique task identifier (string) |
159
- | `title` | Input | Short task title |
160
- | `description` | Input | Detailed task description |
161
- | `role` | Input | Worker role: architect, developer, tester, reviewer |
162
- | `pipeline` | Input | Pipeline mode: patch, sprint, multi-sprint |
163
- | `sprint_num` | Input | Sprint number (1-based, for multi-sprint) |
164
- | `gc_round` | Input | Generator-Critic round number (0 = initial, 1+ = fix round) |
165
- | `deps` | Input | Semicolon-separated dependency task IDs |
166
- | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
167
- | `exec_mode` | Input | `csv-wave` or `interactive` |
168
- | `wave` | Computed | Wave number (computed by topological sort, 1-based) |
169
- | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
170
- | `findings` | Output | Key discoveries or implementation notes (max 500 chars) |
171
- | `review_score` | Output | Quality score 1-10 (reviewer only) |
172
- | `gc_signal` | Output | `REVISION_NEEDED` or `CONVERGED` (reviewer only) |
173
- | `error` | Output | Error message if failed (empty if success) |
174
-
175
- ### Per-Wave CSV (Temporary)
176
-
177
- Each wave generates a temporary `wave-{N}.csv` with extra `prev_context` column (csv-wave tasks only).
178
-
179
- ---
180
-
181
- ## Agent Registry (Interactive Agents)
182
-
183
- | Agent | Role File | Pattern | Responsibility | Position |
184
- |-------|-----------|---------|----------------|----------|
185
- | task-analyzer | agents/task-analyzer.md | 2.3 (wait-respond) | Analyze task complexity, select pipeline mode, detect capabilities | standalone (Phase 0) |
186
- | gc-controller | agents/gc-controller.md | 2.3 (wait-respond) | Evaluate review severity, decide DEV-fix vs convergence | post-wave (after REVIEW wave) |
187
-
188
- > **COMPACT PROTECTION**: Agent files are execution documents. When context compression occurs, **you MUST immediately `Read` the corresponding agent.md** to reload.
189
-
190
- ---
191
-
192
- ## Output Artifacts
193
-
194
- | File | Purpose | Lifecycle |
195
- |------|---------|-----------|
196
- | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
197
- | `wave-{N}.csv` | Per-wave input (temporary, csv-wave tasks only) | Created before wave, deleted after |
198
- | `results.csv` | Final export of all task results | Created in Phase 4 |
199
- | `discoveries.ndjson` | Shared exploration board (all agents, both modes) | Append-only, carries across waves |
200
- | `context.md` | Human-readable execution report | Created in Phase 4 |
201
- | `interactive/{id}-result.json` | Results from interactive tasks | Created per interactive task |
202
- | `wisdom/` | Cross-sprint knowledge accumulation | Updated by agents via discoveries |
203
-
204
- ---
205
-
206
- ## Session Structure
207
-
208
- ```
209
- .workflow/.csv-wave/{session-id}/
210
- +-- tasks.csv # Master state (all tasks, both modes)
211
- +-- results.csv # Final results export
212
- +-- discoveries.ndjson # Shared discovery board (all agents)
213
- +-- context.md # Human-readable report
214
- +-- wave-{N}.csv # Temporary per-wave input (csv-wave only)
215
- +-- interactive/ # Interactive task artifacts
216
- | +-- {id}-result.json # Per-task results
217
- +-- wisdom/ # Cross-sprint knowledge
218
- | +-- learnings.md
219
- | +-- decisions.md
220
- | +-- conventions.md
221
- | +-- issues.md
222
- +-- design/ # Architect output
223
- | +-- design-001.md
224
- | +-- task-breakdown.json
225
- +-- code/ # Developer tracking
226
- | +-- dev-log.md
227
- +-- verify/ # Tester output
228
- | +-- verify-001.json
229
- +-- review/ # Reviewer output
230
- +-- review-001.md
231
- ```
232
-
233
- ---
234
-
235
- ## Implementation
236
-
237
- ### Session Initialization
238
-
239
- ```javascript
240
- const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
241
-
242
- // Parse flags
243
- const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
244
- const continueMode = $ARGUMENTS.includes('--continue')
245
- const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
246
- const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 3
247
-
248
- // Clean requirement text (remove flags)
249
- const requirement = $ARGUMENTS
250
- .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+/g, '')
251
- .trim()
252
-
253
- const slug = requirement.toLowerCase()
254
- .replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
255
- .substring(0, 40)
256
- const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
257
- let sessionId = `ids-${slug}-${dateStr}`
258
- let sessionFolder = `.workflow/.csv-wave/${sessionId}`
259
-
260
- // Continue mode: find existing session
261
- if (continueMode) {
262
- const existing = Bash(`ls -t .workflow/.csv-wave/ids-* 2>/dev/null | head -1`).trim()
263
- if (existing) {
264
- sessionId = existing.split('/').pop()
265
- sessionFolder = existing
266
- // Read existing tasks.csv, find incomplete waves, resume from Phase 2
267
- }
268
- }
269
-
270
- Bash(`mkdir -p ${sessionFolder}/{interactive,wisdom,design,code,verify,review}`)
271
-
272
- // Initialize wisdom files
273
- Write(`${sessionFolder}/wisdom/learnings.md`, `# Learnings\n\n`)
274
- Write(`${sessionFolder}/wisdom/decisions.md`, `# Decisions\n\n`)
275
- Write(`${sessionFolder}/wisdom/conventions.md`, `# Conventions\n\n`)
276
- Write(`${sessionFolder}/wisdom/issues.md`, `# Issues\n\n`)
277
- ```
278
-
279
- ---
280
-
281
- ### Phase 0: Pre-Wave Interactive
282
-
283
- **Objective**: Analyze task complexity, explore codebase, and select pipeline mode.
284
-
285
- **Execution**:
286
-
287
- ```javascript
288
- const analyzer = spawn_agent({
289
- message: `
290
- ## TASK ASSIGNMENT
291
-
292
- ### MANDATORY FIRST STEPS (Agent Execute)
293
- 1. **Read role definition**: ~ or <project>/.codex/skills/team-iterdev/agents/task-analyzer.md (MUST read first)
294
- 2. Read: .workflow/project-tech.json (if exists)
295
-
296
- ---
297
-
298
- Goal: Analyze iterative development task and select pipeline mode
299
- Requirement: ${requirement}
300
-
301
- ### Task
302
- 1. Detect capabilities from keywords:
303
- - design/architect/restructure -> architect role needed
304
- - implement/build/code/fix -> developer role needed
305
- - test/verify/validate -> tester role needed
306
- - review/audit/quality -> reviewer role needed
307
- 2. Score complexity for pipeline selection:
308
- - Changed files > 10: +3, 3-10: +2
309
- - Structural change: +3
310
- - Cross-cutting: +2
311
- - Simple fix: -2
312
- 3. Score >= 5 -> multi-sprint, 2-4 -> sprint, 0-1 -> patch
313
- 4. Return structured analysis result
314
- `
315
- })
316
-
317
- const analyzerResult = wait({ ids: [analyzer], timeout_ms: 120000 })
318
-
319
- if (analyzerResult.timed_out) {
320
- send_input({ id: analyzer, message: "Please finalize and output current findings." })
321
- const retry = wait({ ids: [analyzer], timeout_ms: 60000 })
322
- }
323
-
324
- close_agent({ id: analyzer })
325
-
326
- // Store analysis result
327
- Write(`${sessionFolder}/interactive/task-analyzer-result.json`, JSON.stringify({
328
- task_id: "task-analysis",
329
- status: "completed",
330
- pipeline_mode: parsedMode, // "patch" | "sprint" | "multi-sprint"
331
- capabilities: parsedCapabilities,
332
- complexity_score: parsedScore,
333
- roles_needed: parsedRoles,
334
- timestamp: getUtc8ISOString()
335
- }))
336
- ```
337
-
338
- If not AUTO_YES, present pipeline mode selection for confirmation:
339
-
340
- ```javascript
341
- if (!AUTO_YES) {
342
- const answer = AskUserQuestion({
343
- questions: [{
344
- question: `Task: "${requirement}"\nRecommended pipeline: ${pipeline_mode} (complexity: ${complexity_score})\nRoles: ${roles_needed.join(', ')}\n\nApprove?`,
345
- header: "Pipeline Selection",
346
- multiSelect: false,
347
- options: [
348
- { label: "Approve", description: `Use ${pipeline_mode} pipeline` },
349
- { label: "Patch", description: "Simple fix: DEV -> VERIFY (2 tasks)" },
350
- { label: "Sprint", description: "Standard: DESIGN -> DEV -> VERIFY + REVIEW (4 tasks)" },
351
- { label: "Multi-Sprint", description: "Complex: Multiple sprint cycles with incremental delivery" }
352
- ]
353
- }]
354
- })
355
- }
356
- ```
357
-
358
- **Success Criteria**:
359
- - Pipeline mode selected and confirmed
360
- - Task analysis stored in session
361
- - Interactive agents closed, results stored
362
-
363
- ---
364
-
365
- ### Phase 1: Requirement -> CSV + Classification
366
-
367
- **Objective**: Build tasks.csv from selected pipeline mode with proper wave assignments.
368
-
369
- **Decomposition Rules**:
370
-
371
- | Pipeline | Tasks | Wave Structure |
372
- |----------|-------|---------------|
373
- | patch | DEV-001 -> VERIFY-001 | 2 waves, serial |
374
- | sprint | DESIGN-001 -> DEV-001 -> VERIFY-001 + REVIEW-001 | 3 waves (VERIFY and REVIEW parallel in wave 3) |
375
- | multi-sprint | DESIGN-001 -> DEV-001 -> VERIFY-001 + REVIEW-001 -> DEV-fix + REVIEW-002 | 4+ waves, with GC loop |
376
-
377
- **Pipeline Task Definitions**:
378
-
379
- #### Patch Pipeline (2 csv-wave tasks)
380
-
381
- | Task ID | Role | Wave | Deps | Description |
382
- |---------|------|------|------|-------------|
383
- | DEV-001 | developer | 1 | (none) | Implement fix: load target files, apply changes, validate syntax |
384
- | VERIFY-001 | tester | 2 | DEV-001 | Verify fix: detect test framework, run targeted tests, check for regressions |
385
-
386
- #### Sprint Pipeline (4 csv-wave tasks)
387
-
388
- | Task ID | Role | Wave | Deps | Description |
389
- |---------|------|------|------|-------------|
390
- | DESIGN-001 | architect | 1 | (none) | Technical design: explore codebase, create component design, task breakdown |
391
- | DEV-001 | developer | 2 | DESIGN-001 | Implement design: load design and task breakdown, implement in order, validate syntax |
392
- | VERIFY-001 | tester | 3 | DEV-001 | Verify implementation: detect framework, run targeted tests, run regression suite |
393
- | REVIEW-001 | reviewer | 3 | DEV-001 | Code review: load changes and design, review across correctness/completeness/maintainability/security, score quality |
394
-
395
- #### Multi-Sprint Pipeline (5+ csv-wave tasks + GC control)
396
-
397
- | Task ID | Role | Wave | Deps | Description |
398
- |---------|------|------|------|-------------|
399
- | DESIGN-001 | architect | 1 | (none) | Technical design and task breakdown for sprint 1 |
400
- | DEV-001 | developer | 2 | DESIGN-001 | First implementation batch |
401
- | VERIFY-001 | tester | 3 | DEV-001 | Test execution and fix cycle |
402
- | REVIEW-001 | reviewer | 3 | DEV-001 | Code review with GC signal |
403
- | GC-CHECK-001 | gc-controller | 4 | REVIEW-001 | GC decision: revision or convergence |
404
-
405
- Additional DEV-fix and REVIEW tasks created dynamically when GC controller decides REVISION.
406
-
407
- **Classification Rules**:
408
-
409
- All work tasks (design, development, testing, review) are `csv-wave`. GC loop control between reviewer and next dev-fix is `interactive` (post-wave, spawned by orchestrator to decide the GC outcome).
410
-
411
- **Wave Computation**: Kahn's BFS topological sort with depth tracking (csv-wave tasks only).
412
-
413
- **User Validation**: Display task breakdown with wave + exec_mode assignment (skip if AUTO_YES).
414
-
415
- **Success Criteria**:
416
- - tasks.csv created with valid schema, wave, and exec_mode assignments
417
- - No circular dependencies
418
- - User approved (or AUTO_YES)
419
-
420
- ---
421
-
422
- ### Phase 2: Wave Execution Engine (Extended)
423
-
424
- **Objective**: Execute tasks wave-by-wave with hybrid mechanism support and cross-wave context propagation.
425
-
426
- ```javascript
427
- const failedIds = new Set()
428
- const skippedIds = new Set()
429
- const MAX_GC_ROUNDS = 3
430
- let gcRound = 0
431
-
432
- for (let wave = 1; wave <= maxWave; wave++) {
433
- console.log(`\n## Wave ${wave}/${maxWave}\n`)
434
-
435
- // 1. Read current master CSV
436
- const masterCsv = parseCsv(Read(`${sessionFolder}/tasks.csv`))
437
-
438
- // 2. Separate csv-wave and interactive tasks for this wave
439
- const waveTasks = masterCsv.filter(row => parseInt(row.wave) === wave)
440
- const csvTasks = waveTasks.filter(t => t.exec_mode === 'csv-wave')
441
- const interactiveTasks = waveTasks.filter(t => t.exec_mode === 'interactive')
442
-
443
- // 3. Skip tasks whose deps failed
444
- const executableCsvTasks = []
445
- for (const task of csvTasks) {
446
- const deps = task.deps.split(';').filter(Boolean)
447
- if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
448
- skippedIds.add(task.id)
449
- updateMasterCsvRow(sessionFolder, task.id, {
450
- status: 'skipped',
451
- error: 'Dependency failed or skipped'
452
- })
453
- continue
454
- }
455
- executableCsvTasks.push(task)
456
- }
457
-
458
- // 4. Build prev_context for each csv-wave task
459
- for (const task of executableCsvTasks) {
460
- const contextIds = task.context_from.split(';').filter(Boolean)
461
- const prevFindings = contextIds
462
- .map(id => {
463
- const prevRow = masterCsv.find(r => r.id === id)
464
- if (prevRow && prevRow.status === 'completed' && prevRow.findings) {
465
- return `[Task ${id}: ${prevRow.title}] ${prevRow.findings}`
466
- }
467
- return null
468
- })
469
- .filter(Boolean)
470
- .join('\n')
471
- task.prev_context = prevFindings || 'No previous context available'
472
- }
473
-
474
- // 5. Write wave CSV and execute csv-wave tasks
475
- if (executableCsvTasks.length > 0) {
476
- const waveHeader = 'id,title,description,role,pipeline,sprint_num,gc_round,deps,context_from,exec_mode,wave,prev_context'
477
- const waveRows = executableCsvTasks.map(t =>
478
- [t.id, t.title, t.description, t.role, t.pipeline, t.sprint_num, t.gc_round, t.deps, t.context_from, t.exec_mode, t.wave, t.prev_context]
479
- .map(cell => `"${String(cell).replace(/"/g, '""')}"`)
480
- .join(',')
481
- )
482
- Write(`${sessionFolder}/wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n'))
483
-
484
- const waveResult = spawn_agents_on_csv({
485
- csv_path: `${sessionFolder}/wave-${wave}.csv`,
486
- id_column: "id",
487
- instruction: Read(`~ or <project>/.codex/skills/team-iterdev/instructions/agent-instruction.md`),
488
- max_concurrency: maxConcurrency,
489
- max_runtime_seconds: 900,
490
- output_csv_path: `${sessionFolder}/wave-${wave}-results.csv`,
491
- output_schema: {
492
- type: "object",
493
- properties: {
494
- id: { type: "string" },
495
- status: { type: "string", enum: ["completed", "failed"] },
496
- findings: { type: "string" },
497
- review_score: { type: "string" },
498
- gc_signal: { type: "string" },
499
- error: { type: "string" }
500
- },
501
- required: ["id", "status", "findings"]
502
- }
503
- })
504
-
505
- // Merge results into master CSV
506
- const waveResults = parseCsv(Read(`${sessionFolder}/wave-${wave}-results.csv`))
507
- for (const result of waveResults) {
508
- updateMasterCsvRow(sessionFolder, result.id, {
509
- status: result.status,
510
- findings: result.findings || '',
511
- review_score: result.review_score || '',
512
- gc_signal: result.gc_signal || '',
513
- error: result.error || ''
514
- })
515
- if (result.status === 'failed') failedIds.add(result.id)
516
- }
517
-
518
- Bash(`rm -f "${sessionFolder}/wave-${wave}.csv"`)
519
- }
520
-
521
- // 6. Execute post-wave interactive tasks (GC controller)
522
- for (const task of interactiveTasks) {
523
- if (task.status !== 'pending') continue
524
- const deps = task.deps.split(';').filter(Boolean)
525
- if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
526
- skippedIds.add(task.id)
527
- continue
528
- }
529
-
530
- // Spawn GC controller agent
531
- const gcAgent = spawn_agent({
532
- message: `
533
- ## TASK ASSIGNMENT
534
-
535
- ### MANDATORY FIRST STEPS (Agent Execute)
536
- 1. **Read role definition**: ~ or <project>/.codex/skills/team-iterdev/agents/gc-controller.md (MUST read first)
537
- 2. Read: ${sessionFolder}/discoveries.ndjson (shared discoveries)
538
-
539
- ---
540
-
541
- Goal: Evaluate review severity and decide DEV-fix vs convergence
542
- Session: ${sessionFolder}
543
- GC Round: ${gcRound}
544
- Max GC Rounds: ${MAX_GC_ROUNDS}
545
-
546
- ### Context
547
- Read the latest review file in ${sessionFolder}/review/ and check:
548
- - review.critical_count > 0 OR review.score < 7 -> REVISION
549
- - review.critical_count == 0 AND review.score >= 7 -> CONVERGE
550
- If gcRound >= maxRounds -> CONVERGE (force convergence)
551
- `
552
- })
553
-
554
- const gcResult = wait({ ids: [gcAgent], timeout_ms: 120000 })
555
- if (gcResult.timed_out) {
556
- send_input({ id: gcAgent, message: "Please finalize your decision now." })
557
- wait({ ids: [gcAgent], timeout_ms: 60000 })
558
- }
559
- close_agent({ id: gcAgent })
560
-
561
- Write(`${sessionFolder}/interactive/${task.id}-result.json`, JSON.stringify({
562
- task_id: task.id, status: "completed",
563
- gc_decision: gcDecision, gc_round: gcRound,
564
- timestamp: getUtc8ISOString()
565
- }))
566
-
567
- if (gcDecision === "CONVERGE") {
568
- // Skip remaining GC tasks, mark fix tasks as skipped
569
- } else {
570
- gcRound++
571
- // Dynamically add DEV-fix and REVIEW tasks to master CSV for next waves
572
- const fixWave = wave + 1
573
- const reviewWave = wave + 2
574
- appendMasterCsvRow(sessionFolder, {
575
- id: `DEV-fix-${gcRound}`, title: `Fix review issues (round ${gcRound})`,
576
- description: `Fix critical/high issues from REVIEW. Focus on review feedback only.`,
577
- role: 'developer', pipeline: pipeline_mode, sprint_num: '1',
578
- gc_round: String(gcRound), deps: task.id, context_from: `REVIEW-001`,
579
- exec_mode: 'csv-wave', wave: String(fixWave),
580
- status: 'pending', findings: '', review_score: '', gc_signal: '', error: ''
581
- })
582
- appendMasterCsvRow(sessionFolder, {
583
- id: `REVIEW-${gcRound + 1}`, title: `Re-review (round ${gcRound})`,
584
- description: `Review fixes from DEV-fix-${gcRound}. Re-evaluate quality.`,
585
- role: 'reviewer', pipeline: pipeline_mode, sprint_num: '1',
586
- gc_round: String(gcRound), deps: `DEV-fix-${gcRound}`, context_from: `DEV-fix-${gcRound}`,
587
- exec_mode: 'csv-wave', wave: String(reviewWave),
588
- status: 'pending', findings: '', review_score: '', gc_signal: '', error: ''
589
- })
590
- maxWave = Math.max(maxWave, reviewWave)
591
- }
592
-
593
- updateMasterCsvRow(sessionFolder, task.id, { status: 'completed', findings: `GC decision: ${gcDecision}` })
594
- }
595
- }
596
- ```
597
-
598
- **Success Criteria**:
599
- - All waves executed in order
600
- - Both csv-wave and interactive tasks handled per wave
601
- - Each wave's results merged into master CSV before next wave starts
602
- - Dependent tasks skipped when predecessor failed
603
- - discoveries.ndjson accumulated across all waves and mechanisms
604
- - GC loop controlled with max 3 rounds
605
-
606
- ---
607
-
608
- ### Phase 3: Post-Wave Interactive
609
-
610
- **Objective**: Handle any final GC loop convergence and multi-sprint transitions.
611
-
612
- If the pipeline is multi-sprint and the current sprint completed successfully:
613
- 1. Evaluate sprint metrics (velocity, review scores)
614
- 2. If more sprints needed, dynamically create next sprint tasks in master CSV
615
- 3. If sprint metrics are strong (review avg >= 8), consider downgrading next sprint to simpler pipeline
616
-
617
- If max GC rounds reached and issues remain, log to wisdom/issues.md and proceed.
618
-
619
- **Success Criteria**:
620
- - Post-wave interactive processing complete
621
- - Interactive agents closed, results stored
622
-
623
- ---
624
-
625
- ### Phase 4: Results Aggregation
626
-
627
- **Objective**: Generate final results and human-readable report.
628
-
629
- ```javascript
630
- const masterCsv = Read(`${sessionFolder}/tasks.csv`)
631
- Write(`${sessionFolder}/results.csv`, masterCsv)
632
-
633
- const tasks = parseCsv(masterCsv)
634
- const completed = tasks.filter(t => t.status === 'completed')
635
- const failed = tasks.filter(t => t.status === 'failed')
636
- const skipped = tasks.filter(t => t.status === 'skipped')
637
-
638
- const contextContent = `# Team IterDev Report
639
-
640
- **Session**: ${sessionId}
641
- **Requirement**: ${requirement}
642
- **Pipeline**: ${pipeline_mode}
643
- **Completed**: ${getUtc8ISOString()}
644
-
645
- ---
646
-
647
- ## Summary
648
-
649
- | Metric | Count |
650
- |--------|-------|
651
- | Total Tasks | ${tasks.length} |
652
- | Completed | ${completed.length} |
653
- | Failed | ${failed.length} |
654
- | Skipped | ${skipped.length} |
655
- | GC Rounds | ${gcRound} |
656
-
657
- ---
658
-
659
- ## Pipeline Execution
660
-
661
- ${waveDetails}
662
-
663
- ---
664
-
665
- ## Task Details
666
-
667
- ${taskDetails}
668
-
669
- ---
670
-
671
- ## Deliverables
672
-
673
- | Artifact | Path |
674
- |----------|------|
675
- | Design Document | ${sessionFolder}/design/design-001.md |
676
- | Task Breakdown | ${sessionFolder}/design/task-breakdown.json |
677
- | Dev Log | ${sessionFolder}/code/dev-log.md |
678
- | Verification | ${sessionFolder}/verify/verify-001.json |
679
- | Review Report | ${sessionFolder}/review/review-001.md |
680
- | Wisdom | ${sessionFolder}/wisdom/ |
681
- `
682
-
683
- Write(`${sessionFolder}/context.md`, contextContent)
684
- ```
685
-
686
- If not AUTO_YES, offer completion actions:
687
-
688
- ```javascript
689
- if (!AUTO_YES) {
690
- AskUserQuestion({
691
- questions: [{
692
- question: "IterDev pipeline complete. What would you like to do?",
693
- header: "Completion",
694
- multiSelect: false,
695
- options: [
696
- { label: "Archive & Clean (Recommended)", description: "Archive session, generate final report" },
697
- { label: "Keep Active", description: "Keep session for follow-up or inspection" },
698
- { label: "Retry Failed", description: "Re-run failed tasks" }
699
- ]
700
- }]
701
- })
702
- }
703
- ```
704
-
705
- **Success Criteria**:
706
- - results.csv exported (all tasks, both modes)
707
- - context.md generated
708
- - All interactive agents closed
709
- - Summary displayed to user
710
-
711
- ---
712
-
713
- ## Shared Discovery Board Protocol
714
-
715
- All agents across all waves share `discoveries.ndjson`. This enables cross-role knowledge sharing.
716
-
717
- **Discovery Types**:
718
-
719
- | Type | Dedup Key | Data Schema | Description |
720
- |------|-----------|-------------|-------------|
721
- | `design_decision` | `data.component` | `{component, approach, rationale, alternatives}` | Architecture decision |
722
- | `implementation` | `data.file` | `{file, changes, pattern_used, notes}` | Code implementation detail |
723
- | `test_result` | `data.test_suite` | `{test_suite, pass_rate, failures[], regressions}` | Test execution result |
724
- | `review_finding` | `data.file_line` | `{file_line, severity, dimension, description, suggestion}` | Review finding |
725
- | `convention` | `data.name` | `{name, description, example}` | Discovered project convention |
726
- | `gc_decision` | `data.round` | `{round, signal, critical_count, score}` | GC loop decision |
727
-
728
- **Format**: NDJSON, each line is self-contained JSON:
729
-
730
- ```jsonl
731
- {"ts":"2026-03-08T10:00:00+08:00","worker":"DESIGN-001","type":"design_decision","data":{"component":"AuthModule","approach":"JWT with refresh tokens","rationale":"Stateless auth for microservices","alternatives":"Session-based, OAuth2"}}
732
- {"ts":"2026-03-08T10:05:00+08:00","worker":"DEV-001","type":"implementation","data":{"file":"src/auth/jwt.ts","changes":"Added JWT middleware","pattern_used":"Express middleware pattern","notes":"Uses existing bcrypt dependency"}}
733
- {"ts":"2026-03-08T10:10:00+08:00","worker":"REVIEW-001","type":"review_finding","data":{"file_line":"src/auth/jwt.ts:42","severity":"HIGH","dimension":"security","description":"Token expiry not validated","suggestion":"Add exp claim check"}}
734
- ```
735
-
736
- **Protocol Rules**:
737
- 1. Read board before own work -- leverage existing context
738
- 2. Write discoveries immediately via `echo >>` -- don't batch
739
- 3. Deduplicate -- check existing entries by type + dedup key
740
- 4. Append-only -- never modify or delete existing lines
741
-
742
- ---
743
-
744
- ## Consensus Severity Routing
745
-
746
- When the reviewer returns review results with severity-graded verdicts:
747
-
748
- | Severity | Action |
749
- |----------|--------|
750
- | HIGH | Trigger DEV-fix round (GC loop), max 3 rounds total |
751
- | MEDIUM | Log warning, continue pipeline |
752
- | LOW | Treat as review passed |
753
-
754
- **Constraints**: Max 3 GC rounds (fix cycles). If still HIGH after 3 rounds, force convergence and record in wisdom/issues.md.
755
-
756
- ---
757
-
758
- ## Error Handling
759
-
760
- | Error | Resolution |
761
- |-------|------------|
762
- | Circular dependency | Detect in wave computation, abort with error message |
763
- | CSV agent timeout | Mark as failed in results, continue with wave |
764
- | CSV agent failed | Mark as failed, skip dependent tasks in later waves |
765
- | Interactive agent timeout | Urge convergence via send_input, then close if still timed out |
766
- | Interactive agent failed | Mark as failed, skip dependents |
767
- | All agents in wave failed | Log error, offer retry or abort |
768
- | CSV parse error | Validate CSV format before execution, show line number |
769
- | discoveries.ndjson corrupt | Ignore malformed lines, continue with valid entries |
770
- | GC loop exceeds 3 rounds | Force convergence, record in wisdom/issues.md |
771
- | Sprint velocity drops below 50% | Report to user, suggest scope reduction |
772
- | Task ledger corrupted | Rebuild from tasks.csv state |
773
- | Continue mode: no session found | List available sessions, prompt user to select |
774
-
775
- ---
776
-
777
- ## Core Rules
778
-
779
- 1. **Start Immediately**: First action is session initialization, then Phase 0/1
780
- 2. **Wave Order is Sacred**: Never execute wave N before wave N-1 completes and results are merged
781
- 3. **CSV is Source of Truth**: Master tasks.csv holds all state (both csv-wave and interactive)
782
- 4. **CSV First**: Default to csv-wave for tasks; only use interactive when interaction pattern requires it
783
- 5. **Context Propagation**: prev_context built from master CSV, not from memory
784
- 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson -- both mechanisms share it
785
- 7. **Skip on Failure**: If a dependency failed, skip the dependent task (regardless of mechanism)
786
- 8. **Lifecycle Balance**: Every spawn_agent MUST have a matching close_agent
787
- 9. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
788
- 10. **DO NOT STOP**: Continuous execution until all waves complete or all remaining tasks are skipped
789
-
790
-
791
- ---
792
-
793
- ## Coordinator Role Constraints (Main Agent)
794
-
795
- **CRITICAL**: The coordinator (main agent executing this skill) is responsible for **orchestration only**, NOT implementation.
796
-
797
- 15. **Coordinator Does NOT Execute Code**: The main agent MUST NOT write, modify, or implement any code directly. All implementation work is delegated to spawned team agents. The coordinator only:
798
- - Spawns agents with task assignments
799
- - Waits for agent callbacks
800
- - Merges results and coordinates workflow
801
- - Manages workflow transitions between phases
802
-
803
- 16. **Patient Waiting is Mandatory**: Agent execution takes significant time (typically 10-30 minutes per phase, sometimes longer). The coordinator MUST:
804
- - Wait patiently for `wait()` calls to complete
805
- - NOT skip workflow steps due to perceived delays
806
- - NOT assume agents have failed just because they're taking time
807
- - Trust the timeout mechanisms defined in the skill
808
-
809
- 17. **Use send_input for Clarification**: When agents need guidance or appear stuck, the coordinator MUST:
810
- - Use `send_input()` to ask questions or provide clarification
811
- - NOT skip the agent or move to next phase prematurely
812
- - Give agents opportunity to respond before escalating
813
- - Example: `send_input({ id: agent_id, message: "Please provide status update or clarify blockers" })`
814
-
815
- 18. **No Workflow Shortcuts**: The coordinator MUST NOT:
816
- - Skip phases or stages defined in the workflow
817
- - Bypass required approval or review steps
818
- - Execute dependent tasks before prerequisites complete
819
- - Assume task completion without explicit agent callback
820
- - Make up or fabricate agent results
821
-
822
- 19. **Respect Long-Running Processes**: This is a complex multi-agent workflow that requires patience:
823
- - Total execution time may range from 30-90 minutes or longer
824
- - Each phase may take 10-30 minutes depending on complexity
825
- - The coordinator must remain active and attentive throughout the entire process
826
- - Do not terminate or skip steps due to time concerns
1
+ ---
2
+ name: team-iterdev
3
+ description: Iterative development team with Generator-Critic loop, dynamic pipeline selection (patch/sprint/multi-sprint), task ledger for progress tracking, and shared wisdom for cross-sprint learning.
4
+ argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"task description\""
5
+ allowed-tools: spawn_agents_on_csv, spawn_agent, wait, send_input, close_agent, Read, Write, Edit, Bash, Glob, Grep, request_user_input
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-confirm task decomposition, skip interactive validation, use defaults.
11
+
12
+ # Team IterDev
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ $team-iterdev "Implement user authentication with JWT"
18
+ $team-iterdev -c 4 "Refactor payment module to support multiple gateways"
19
+ $team-iterdev -y "Fix login button not responding on mobile"
20
+ $team-iterdev --continue "ids-auth-jwt-20260308"
21
+ ```
22
+
23
+ **Flags**:
24
+ - `-y, --yes`: Skip all confirmations (auto mode)
25
+ - `-c, --concurrency N`: Max concurrent agents within each wave (default: 3)
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
+ Iterative development team skill with Generator-Critic (GC) loops between developer and reviewer roles (max 3 rounds). Automatically selects pipeline complexity (patch/sprint/multi-sprint) based on task signals. Tracks progress via task ledger. Accumulates cross-sprint wisdom in shared discovery board.
36
+
37
+ **Execution Model**: Hybrid -- CSV wave pipeline (primary) + individual agent spawn (secondary for GC loop control and requirement analysis)
38
+
39
+ ```
40
+ +-------------------------------------------------------------------------+
41
+ | TEAM ITERDEV WORKFLOW |
42
+ +-------------------------------------------------------------------------+
43
+ | |
44
+ | Phase 0: Pre-Wave Interactive |
45
+ | +-- Analyze task complexity and select pipeline mode |
46
+ | +-- Explore codebase for patterns and dependencies |
47
+ | +-- Output: pipeline mode, task analysis, session artifacts |
48
+ | |
49
+ | Phase 1: Requirement -> CSV + Classification |
50
+ | +-- Parse task into pipeline-specific task chain |
51
+ | +-- Assign roles: architect, developer, tester, reviewer |
52
+ | +-- Classify tasks: csv-wave | interactive (exec_mode) |
53
+ | +-- Compute dependency waves (topological sort -> depth grouping) |
54
+ | +-- Generate tasks.csv with wave + exec_mode columns |
55
+ | +-- User validates task breakdown (skip if -y) |
56
+ | |
57
+ | Phase 2: Wave Execution Engine (Extended) |
58
+ | +-- For each wave (1..N): |
59
+ | | +-- Execute pre-wave interactive tasks (if any) |
60
+ | | +-- Build wave CSV (filter csv-wave tasks for this wave) |
61
+ | | +-- Inject previous findings into prev_context column |
62
+ | | +-- spawn_agents_on_csv(wave CSV) |
63
+ | | +-- Execute post-wave interactive tasks (if any) |
64
+ | | +-- Merge all results into master tasks.csv |
65
+ | | +-- Check: any failed? -> skip dependents |
66
+ | +-- discoveries.ndjson shared across all modes (append-only) |
67
+ | |
68
+ | Phase 3: Post-Wave Interactive |
69
+ | +-- Generator-Critic (GC) loop control |
70
+ | +-- If review has critical issues: trigger DEV-fix -> re-REVIEW |
71
+ | +-- Max 3 GC rounds, then force convergence |
72
+ | |
73
+ | Phase 4: Results Aggregation |
74
+ | +-- Export final results.csv |
75
+ | +-- Generate context.md with all findings |
76
+ | +-- Display summary: completed/failed/skipped per wave |
77
+ | +-- Offer: view results | retry failed | done |
78
+ | |
79
+ +-------------------------------------------------------------------------+
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Task Classification Rules
85
+
86
+ Each task is classified by `exec_mode`:
87
+
88
+ | exec_mode | Mechanism | Criteria |
89
+ |-----------|-----------|----------|
90
+ | `csv-wave` | `spawn_agents_on_csv` | One-shot, structured I/O, no multi-round interaction |
91
+ | `interactive` | `spawn_agent`/`wait`/`send_input`/`close_agent` | Multi-round, clarification, inline utility |
92
+
93
+ **Classification Decision**:
94
+
95
+ | Task Property | Classification |
96
+ |---------------|---------------|
97
+ | Architecture design (DESIGN-*) | `csv-wave` |
98
+ | Code implementation (DEV-*) | `csv-wave` |
99
+ | Test execution and fix cycle (VERIFY-*) | `csv-wave` |
100
+ | Code review (REVIEW-*) | `csv-wave` |
101
+ | Fix task from review feedback (DEV-fix-*) | `csv-wave` |
102
+ | GC loop control (decide revision vs convergence) | `interactive` |
103
+ | Task analysis and pipeline selection (Phase 0) | `interactive` |
104
+
105
+ ---
106
+
107
+ ## Pipeline Selection Logic
108
+
109
+ | Signal | Score |
110
+ |--------|-------|
111
+ | Changed files > 10 | +3 |
112
+ | Changed files 3-10 | +2 |
113
+ | Structural change (refactor, architect, restructure) | +3 |
114
+ | Cross-cutting concern (multiple, across, cross) | +2 |
115
+ | Simple fix (fix, bug, typo, patch) | -2 |
116
+
117
+ | Score | Pipeline |
118
+ |-------|----------|
119
+ | >= 5 | multi-sprint |
120
+ | 2-4 | sprint |
121
+ | 0-1 | patch |
122
+
123
+ ### Pipeline Definitions
124
+
125
+ **Patch** (2 tasks, serial):
126
+ ```
127
+ DEV-001 -> VERIFY-001
128
+ ```
129
+
130
+ **Sprint** (4 tasks, with parallel window):
131
+ ```
132
+ DESIGN-001 -> DEV-001 -> [VERIFY-001 + REVIEW-001] (parallel)
133
+ ```
134
+
135
+ **Multi-Sprint** (5+ tasks, iterative with GC loop):
136
+ ```
137
+ Sprint 1: DESIGN-001 -> DEV-001 -> [VERIFY-001 + REVIEW-001] -> DEV-fix (if needed) -> REVIEW-002
138
+ Sprint 2+ created dynamically
139
+ ```
140
+
141
+ ---
142
+
143
+ ## CSV Schema
144
+
145
+ ### tasks.csv (Master State)
146
+
147
+ ```csv
148
+ id,title,description,role,pipeline,sprint_num,gc_round,deps,context_from,exec_mode,wave,status,findings,review_score,gc_signal,error
149
+ "DESIGN-001","Technical design and task breakdown","Explore codebase, create component design, break into implementable tasks with acceptance criteria","architect","sprint","1","0","","","csv-wave","1","pending","","","",""
150
+ "DEV-001","Implement design","Load design and task breakdown, implement tasks in execution order, validate syntax","developer","sprint","1","0","DESIGN-001","DESIGN-001","csv-wave","2","pending","","","",""
151
+ "VERIFY-001","Verify implementation","Detect test framework, run targeted tests, run regression suite","tester","sprint","1","0","DEV-001","DEV-001","csv-wave","3","pending","","","",""
152
+ ```
153
+
154
+ **Columns**:
155
+
156
+ | Column | Phase | Description |
157
+ |--------|-------|-------------|
158
+ | `id` | Input | Unique task identifier (string) |
159
+ | `title` | Input | Short task title |
160
+ | `description` | Input | Detailed task description |
161
+ | `role` | Input | Worker role: architect, developer, tester, reviewer |
162
+ | `pipeline` | Input | Pipeline mode: patch, sprint, multi-sprint |
163
+ | `sprint_num` | Input | Sprint number (1-based, for multi-sprint) |
164
+ | `gc_round` | Input | Generator-Critic round number (0 = initial, 1+ = fix round) |
165
+ | `deps` | Input | Semicolon-separated dependency task IDs |
166
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
167
+ | `exec_mode` | Input | `csv-wave` or `interactive` |
168
+ | `wave` | Computed | Wave number (computed by topological sort, 1-based) |
169
+ | `status` | Output | `pending` -> `completed` / `failed` / `skipped` |
170
+ | `findings` | Output | Key discoveries or implementation notes (max 500 chars) |
171
+ | `review_score` | Output | Quality score 1-10 (reviewer only) |
172
+ | `gc_signal` | Output | `REVISION_NEEDED` or `CONVERGED` (reviewer only) |
173
+ | `error` | Output | Error message if failed (empty if success) |
174
+
175
+ ### Per-Wave CSV (Temporary)
176
+
177
+ Each wave generates a temporary `wave-{N}.csv` with extra `prev_context` column (csv-wave tasks only).
178
+
179
+ ---
180
+
181
+ ## Agent Registry (Interactive Agents)
182
+
183
+ | Agent | Role File | Pattern | Responsibility | Position |
184
+ |-------|-----------|---------|----------------|----------|
185
+ | task-analyzer | agents/task-analyzer.md | 2.3 (wait-respond) | Analyze task complexity, select pipeline mode, detect capabilities | standalone (Phase 0) |
186
+ | gc-controller | agents/gc-controller.md | 2.3 (wait-respond) | Evaluate review severity, decide DEV-fix vs convergence | post-wave (after REVIEW wave) |
187
+
188
+ > **COMPACT PROTECTION**: Agent files are execution documents. When context compression occurs, **you MUST immediately `Read` the corresponding agent.md** to reload.
189
+
190
+ ---
191
+
192
+ ## Output Artifacts
193
+
194
+ | File | Purpose | Lifecycle |
195
+ |------|---------|-----------|
196
+ | `tasks.csv` | Master state -- all tasks with status/findings | Updated after each wave |
197
+ | `wave-{N}.csv` | Per-wave input (temporary, csv-wave tasks only) | Created before wave, deleted after |
198
+ | `results.csv` | Final export of all task results | Created in Phase 4 |
199
+ | `discoveries.ndjson` | Shared exploration board (all agents, both modes) | Append-only, carries across waves |
200
+ | `context.md` | Human-readable execution report | Created in Phase 4 |
201
+ | `interactive/{id}-result.json` | Results from interactive tasks | Created per interactive task |
202
+ | `wisdom/` | Cross-sprint knowledge accumulation | Updated by agents via discoveries |
203
+
204
+ ---
205
+
206
+ ## Session Structure
207
+
208
+ ```
209
+ .workflow/.csv-wave/{session-id}/
210
+ +-- tasks.csv # Master state (all tasks, both modes)
211
+ +-- results.csv # Final results export
212
+ +-- discoveries.ndjson # Shared discovery board (all agents)
213
+ +-- context.md # Human-readable report
214
+ +-- wave-{N}.csv # Temporary per-wave input (csv-wave only)
215
+ +-- interactive/ # Interactive task artifacts
216
+ | +-- {id}-result.json # Per-task results
217
+ +-- wisdom/ # Cross-sprint knowledge
218
+ | +-- learnings.md
219
+ | +-- decisions.md
220
+ | +-- conventions.md
221
+ | +-- issues.md
222
+ +-- design/ # Architect output
223
+ | +-- design-001.md
224
+ | +-- task-breakdown.json
225
+ +-- code/ # Developer tracking
226
+ | +-- dev-log.md
227
+ +-- verify/ # Tester output
228
+ | +-- verify-001.json
229
+ +-- review/ # Reviewer output
230
+ +-- review-001.md
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Implementation
236
+
237
+ ### Session Initialization
238
+
239
+ ```javascript
240
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
241
+
242
+ // Parse flags
243
+ const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
244
+ const continueMode = $ARGUMENTS.includes('--continue')
245
+ const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
246
+ const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 3
247
+
248
+ // Clean requirement text (remove flags)
249
+ const requirement = $ARGUMENTS
250
+ .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+/g, '')
251
+ .trim()
252
+
253
+ const slug = requirement.toLowerCase()
254
+ .replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
255
+ .substring(0, 40)
256
+ const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
257
+ let sessionId = `ids-${slug}-${dateStr}`
258
+ let sessionFolder = `.workflow/.csv-wave/${sessionId}`
259
+
260
+ // Continue mode: find existing session
261
+ if (continueMode) {
262
+ const existing = Bash(`ls -t .workflow/.csv-wave/ids-* 2>/dev/null | head -1`).trim()
263
+ if (existing) {
264
+ sessionId = existing.split('/').pop()
265
+ sessionFolder = existing
266
+ // Read existing tasks.csv, find incomplete waves, resume from Phase 2
267
+ }
268
+ }
269
+
270
+ Bash(`mkdir -p ${sessionFolder}/{interactive,wisdom,design,code,verify,review}`)
271
+
272
+ // Initialize wisdom files
273
+ Write(`${sessionFolder}/wisdom/learnings.md`, `# Learnings\n\n`)
274
+ Write(`${sessionFolder}/wisdom/decisions.md`, `# Decisions\n\n`)
275
+ Write(`${sessionFolder}/wisdom/conventions.md`, `# Conventions\n\n`)
276
+ Write(`${sessionFolder}/wisdom/issues.md`, `# Issues\n\n`)
277
+ ```
278
+
279
+ ---
280
+
281
+ ### Phase 0: Pre-Wave Interactive
282
+
283
+ **Objective**: Analyze task complexity, explore codebase, and select pipeline mode.
284
+
285
+ **Execution**:
286
+
287
+ ```javascript
288
+ const analyzer = spawn_agent({
289
+ message: `
290
+ ## TASK ASSIGNMENT
291
+
292
+ ### MANDATORY FIRST STEPS (Agent Execute)
293
+ 1. **Read role definition**: ~ or <project>/.codex/skills/team-iterdev/agents/task-analyzer.md (MUST read first)
294
+ 2. Read: .workflow/project-tech.json (if exists)
295
+
296
+ ---
297
+
298
+ Goal: Analyze iterative development task and select pipeline mode
299
+ Requirement: ${requirement}
300
+
301
+ ### Task
302
+ 1. Detect capabilities from keywords:
303
+ - design/architect/restructure -> architect role needed
304
+ - implement/build/code/fix -> developer role needed
305
+ - test/verify/validate -> tester role needed
306
+ - review/audit/quality -> reviewer role needed
307
+ 2. Score complexity for pipeline selection:
308
+ - Changed files > 10: +3, 3-10: +2
309
+ - Structural change: +3
310
+ - Cross-cutting: +2
311
+ - Simple fix: -2
312
+ 3. Score >= 5 -> multi-sprint, 2-4 -> sprint, 0-1 -> patch
313
+ 4. Return structured analysis result
314
+ `
315
+ })
316
+
317
+ const analyzerResult = wait({ ids: [analyzer], timeout_ms: 120000 })
318
+
319
+ if (analyzerResult.timed_out) {
320
+ send_input({ id: analyzer, message: "Please finalize and output current findings." })
321
+ const retry = wait({ ids: [analyzer], timeout_ms: 60000 })
322
+ }
323
+
324
+ close_agent({ id: analyzer })
325
+
326
+ // Store analysis result
327
+ Write(`${sessionFolder}/interactive/task-analyzer-result.json`, JSON.stringify({
328
+ task_id: "task-analysis",
329
+ status: "completed",
330
+ pipeline_mode: parsedMode, // "patch" | "sprint" | "multi-sprint"
331
+ capabilities: parsedCapabilities,
332
+ complexity_score: parsedScore,
333
+ roles_needed: parsedRoles,
334
+ timestamp: getUtc8ISOString()
335
+ }))
336
+ ```
337
+
338
+ If not AUTO_YES, present pipeline mode selection for confirmation:
339
+
340
+ ```javascript
341
+ if (!AUTO_YES) {
342
+ const answer = request_user_input({
343
+ questions: [{
344
+ question: `Task: "${requirement}" — Recommended: ${pipeline_mode}. Approve or override?`,
345
+ header: "Pipeline",
346
+ id: "pipeline_select",
347
+ options: [
348
+ { label: "Approve (Recommended)", description: `Use ${pipeline_mode} pipeline (complexity: ${complexity_score})` },
349
+ { label: "Patch", description: "Simple fix: DEV -> VERIFY (2 tasks)" },
350
+ { label: "Sprint/Multi", description: "Standard or complex: DESIGN -> DEV -> VERIFY + REVIEW" }
351
+ ]
352
+ }]
353
+ })
354
+ }
355
+ ```
356
+
357
+ **Success Criteria**:
358
+ - Pipeline mode selected and confirmed
359
+ - Task analysis stored in session
360
+ - Interactive agents closed, results stored
361
+
362
+ ---
363
+
364
+ ### Phase 1: Requirement -> CSV + Classification
365
+
366
+ **Objective**: Build tasks.csv from selected pipeline mode with proper wave assignments.
367
+
368
+ **Decomposition Rules**:
369
+
370
+ | Pipeline | Tasks | Wave Structure |
371
+ |----------|-------|---------------|
372
+ | patch | DEV-001 -> VERIFY-001 | 2 waves, serial |
373
+ | sprint | DESIGN-001 -> DEV-001 -> VERIFY-001 + REVIEW-001 | 3 waves (VERIFY and REVIEW parallel in wave 3) |
374
+ | multi-sprint | DESIGN-001 -> DEV-001 -> VERIFY-001 + REVIEW-001 -> DEV-fix + REVIEW-002 | 4+ waves, with GC loop |
375
+
376
+ **Pipeline Task Definitions**:
377
+
378
+ #### Patch Pipeline (2 csv-wave tasks)
379
+
380
+ | Task ID | Role | Wave | Deps | Description |
381
+ |---------|------|------|------|-------------|
382
+ | DEV-001 | developer | 1 | (none) | Implement fix: load target files, apply changes, validate syntax |
383
+ | VERIFY-001 | tester | 2 | DEV-001 | Verify fix: detect test framework, run targeted tests, check for regressions |
384
+
385
+ #### Sprint Pipeline (4 csv-wave tasks)
386
+
387
+ | Task ID | Role | Wave | Deps | Description |
388
+ |---------|------|------|------|-------------|
389
+ | DESIGN-001 | architect | 1 | (none) | Technical design: explore codebase, create component design, task breakdown |
390
+ | DEV-001 | developer | 2 | DESIGN-001 | Implement design: load design and task breakdown, implement in order, validate syntax |
391
+ | VERIFY-001 | tester | 3 | DEV-001 | Verify implementation: detect framework, run targeted tests, run regression suite |
392
+ | REVIEW-001 | reviewer | 3 | DEV-001 | Code review: load changes and design, review across correctness/completeness/maintainability/security, score quality |
393
+
394
+ #### Multi-Sprint Pipeline (5+ csv-wave tasks + GC control)
395
+
396
+ | Task ID | Role | Wave | Deps | Description |
397
+ |---------|------|------|------|-------------|
398
+ | DESIGN-001 | architect | 1 | (none) | Technical design and task breakdown for sprint 1 |
399
+ | DEV-001 | developer | 2 | DESIGN-001 | First implementation batch |
400
+ | VERIFY-001 | tester | 3 | DEV-001 | Test execution and fix cycle |
401
+ | REVIEW-001 | reviewer | 3 | DEV-001 | Code review with GC signal |
402
+ | GC-CHECK-001 | gc-controller | 4 | REVIEW-001 | GC decision: revision or convergence |
403
+
404
+ Additional DEV-fix and REVIEW tasks created dynamically when GC controller decides REVISION.
405
+
406
+ **Classification Rules**:
407
+
408
+ All work tasks (design, development, testing, review) are `csv-wave`. GC loop control between reviewer and next dev-fix is `interactive` (post-wave, spawned by orchestrator to decide the GC outcome).
409
+
410
+ **Wave Computation**: Kahn's BFS topological sort with depth tracking (csv-wave tasks only).
411
+
412
+ **User Validation**: Display task breakdown with wave + exec_mode assignment (skip if AUTO_YES).
413
+
414
+ **Success Criteria**:
415
+ - tasks.csv created with valid schema, wave, and exec_mode assignments
416
+ - No circular dependencies
417
+ - User approved (or AUTO_YES)
418
+
419
+ ---
420
+
421
+ ### Phase 2: Wave Execution Engine (Extended)
422
+
423
+ **Objective**: Execute tasks wave-by-wave with hybrid mechanism support and cross-wave context propagation.
424
+
425
+ ```javascript
426
+ const failedIds = new Set()
427
+ const skippedIds = new Set()
428
+ const MAX_GC_ROUNDS = 3
429
+ let gcRound = 0
430
+
431
+ for (let wave = 1; wave <= maxWave; wave++) {
432
+ console.log(`\n## Wave ${wave}/${maxWave}\n`)
433
+
434
+ // 1. Read current master CSV
435
+ const masterCsv = parseCsv(Read(`${sessionFolder}/tasks.csv`))
436
+
437
+ // 2. Separate csv-wave and interactive tasks for this wave
438
+ const waveTasks = masterCsv.filter(row => parseInt(row.wave) === wave)
439
+ const csvTasks = waveTasks.filter(t => t.exec_mode === 'csv-wave')
440
+ const interactiveTasks = waveTasks.filter(t => t.exec_mode === 'interactive')
441
+
442
+ // 3. Skip tasks whose deps failed
443
+ const executableCsvTasks = []
444
+ for (const task of csvTasks) {
445
+ const deps = task.deps.split(';').filter(Boolean)
446
+ if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
447
+ skippedIds.add(task.id)
448
+ updateMasterCsvRow(sessionFolder, task.id, {
449
+ status: 'skipped',
450
+ error: 'Dependency failed or skipped'
451
+ })
452
+ continue
453
+ }
454
+ executableCsvTasks.push(task)
455
+ }
456
+
457
+ // 4. Build prev_context for each csv-wave task
458
+ for (const task of executableCsvTasks) {
459
+ const contextIds = task.context_from.split(';').filter(Boolean)
460
+ const prevFindings = contextIds
461
+ .map(id => {
462
+ const prevRow = masterCsv.find(r => r.id === id)
463
+ if (prevRow && prevRow.status === 'completed' && prevRow.findings) {
464
+ return `[Task ${id}: ${prevRow.title}] ${prevRow.findings}`
465
+ }
466
+ return null
467
+ })
468
+ .filter(Boolean)
469
+ .join('\n')
470
+ task.prev_context = prevFindings || 'No previous context available'
471
+ }
472
+
473
+ // 5. Write wave CSV and execute csv-wave tasks
474
+ if (executableCsvTasks.length > 0) {
475
+ const waveHeader = 'id,title,description,role,pipeline,sprint_num,gc_round,deps,context_from,exec_mode,wave,prev_context'
476
+ const waveRows = executableCsvTasks.map(t =>
477
+ [t.id, t.title, t.description, t.role, t.pipeline, t.sprint_num, t.gc_round, t.deps, t.context_from, t.exec_mode, t.wave, t.prev_context]
478
+ .map(cell => `"${String(cell).replace(/"/g, '""')}"`)
479
+ .join(',')
480
+ )
481
+ Write(`${sessionFolder}/wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n'))
482
+
483
+ const waveResult = spawn_agents_on_csv({
484
+ csv_path: `${sessionFolder}/wave-${wave}.csv`,
485
+ id_column: "id",
486
+ instruction: Read(`~ or <project>/.codex/skills/team-iterdev/instructions/agent-instruction.md`),
487
+ max_concurrency: maxConcurrency,
488
+ max_runtime_seconds: 900,
489
+ output_csv_path: `${sessionFolder}/wave-${wave}-results.csv`,
490
+ output_schema: {
491
+ type: "object",
492
+ properties: {
493
+ id: { type: "string" },
494
+ status: { type: "string", enum: ["completed", "failed"] },
495
+ findings: { type: "string" },
496
+ review_score: { type: "string" },
497
+ gc_signal: { type: "string" },
498
+ error: { type: "string" }
499
+ },
500
+ required: ["id", "status", "findings"]
501
+ }
502
+ })
503
+
504
+ // Merge results into master CSV
505
+ const waveResults = parseCsv(Read(`${sessionFolder}/wave-${wave}-results.csv`))
506
+ for (const result of waveResults) {
507
+ updateMasterCsvRow(sessionFolder, result.id, {
508
+ status: result.status,
509
+ findings: result.findings || '',
510
+ review_score: result.review_score || '',
511
+ gc_signal: result.gc_signal || '',
512
+ error: result.error || ''
513
+ })
514
+ if (result.status === 'failed') failedIds.add(result.id)
515
+ }
516
+
517
+ Bash(`rm -f "${sessionFolder}/wave-${wave}.csv"`)
518
+ }
519
+
520
+ // 6. Execute post-wave interactive tasks (GC controller)
521
+ for (const task of interactiveTasks) {
522
+ if (task.status !== 'pending') continue
523
+ const deps = task.deps.split(';').filter(Boolean)
524
+ if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
525
+ skippedIds.add(task.id)
526
+ continue
527
+ }
528
+
529
+ // Spawn GC controller agent
530
+ const gcAgent = spawn_agent({
531
+ message: `
532
+ ## TASK ASSIGNMENT
533
+
534
+ ### MANDATORY FIRST STEPS (Agent Execute)
535
+ 1. **Read role definition**: ~ or <project>/.codex/skills/team-iterdev/agents/gc-controller.md (MUST read first)
536
+ 2. Read: ${sessionFolder}/discoveries.ndjson (shared discoveries)
537
+
538
+ ---
539
+
540
+ Goal: Evaluate review severity and decide DEV-fix vs convergence
541
+ Session: ${sessionFolder}
542
+ GC Round: ${gcRound}
543
+ Max GC Rounds: ${MAX_GC_ROUNDS}
544
+
545
+ ### Context
546
+ Read the latest review file in ${sessionFolder}/review/ and check:
547
+ - review.critical_count > 0 OR review.score < 7 -> REVISION
548
+ - review.critical_count == 0 AND review.score >= 7 -> CONVERGE
549
+ If gcRound >= maxRounds -> CONVERGE (force convergence)
550
+ `
551
+ })
552
+
553
+ const gcResult = wait({ ids: [gcAgent], timeout_ms: 120000 })
554
+ if (gcResult.timed_out) {
555
+ send_input({ id: gcAgent, message: "Please finalize your decision now." })
556
+ wait({ ids: [gcAgent], timeout_ms: 60000 })
557
+ }
558
+ close_agent({ id: gcAgent })
559
+
560
+ Write(`${sessionFolder}/interactive/${task.id}-result.json`, JSON.stringify({
561
+ task_id: task.id, status: "completed",
562
+ gc_decision: gcDecision, gc_round: gcRound,
563
+ timestamp: getUtc8ISOString()
564
+ }))
565
+
566
+ if (gcDecision === "CONVERGE") {
567
+ // Skip remaining GC tasks, mark fix tasks as skipped
568
+ } else {
569
+ gcRound++
570
+ // Dynamically add DEV-fix and REVIEW tasks to master CSV for next waves
571
+ const fixWave = wave + 1
572
+ const reviewWave = wave + 2
573
+ appendMasterCsvRow(sessionFolder, {
574
+ id: `DEV-fix-${gcRound}`, title: `Fix review issues (round ${gcRound})`,
575
+ description: `Fix critical/high issues from REVIEW. Focus on review feedback only.`,
576
+ role: 'developer', pipeline: pipeline_mode, sprint_num: '1',
577
+ gc_round: String(gcRound), deps: task.id, context_from: `REVIEW-001`,
578
+ exec_mode: 'csv-wave', wave: String(fixWave),
579
+ status: 'pending', findings: '', review_score: '', gc_signal: '', error: ''
580
+ })
581
+ appendMasterCsvRow(sessionFolder, {
582
+ id: `REVIEW-${gcRound + 1}`, title: `Re-review (round ${gcRound})`,
583
+ description: `Review fixes from DEV-fix-${gcRound}. Re-evaluate quality.`,
584
+ role: 'reviewer', pipeline: pipeline_mode, sprint_num: '1',
585
+ gc_round: String(gcRound), deps: `DEV-fix-${gcRound}`, context_from: `DEV-fix-${gcRound}`,
586
+ exec_mode: 'csv-wave', wave: String(reviewWave),
587
+ status: 'pending', findings: '', review_score: '', gc_signal: '', error: ''
588
+ })
589
+ maxWave = Math.max(maxWave, reviewWave)
590
+ }
591
+
592
+ updateMasterCsvRow(sessionFolder, task.id, { status: 'completed', findings: `GC decision: ${gcDecision}` })
593
+ }
594
+ }
595
+ ```
596
+
597
+ **Success Criteria**:
598
+ - All waves executed in order
599
+ - Both csv-wave and interactive tasks handled per wave
600
+ - Each wave's results merged into master CSV before next wave starts
601
+ - Dependent tasks skipped when predecessor failed
602
+ - discoveries.ndjson accumulated across all waves and mechanisms
603
+ - GC loop controlled with max 3 rounds
604
+
605
+ ---
606
+
607
+ ### Phase 3: Post-Wave Interactive
608
+
609
+ **Objective**: Handle any final GC loop convergence and multi-sprint transitions.
610
+
611
+ If the pipeline is multi-sprint and the current sprint completed successfully:
612
+ 1. Evaluate sprint metrics (velocity, review scores)
613
+ 2. If more sprints needed, dynamically create next sprint tasks in master CSV
614
+ 3. If sprint metrics are strong (review avg >= 8), consider downgrading next sprint to simpler pipeline
615
+
616
+ If max GC rounds reached and issues remain, log to wisdom/issues.md and proceed.
617
+
618
+ **Success Criteria**:
619
+ - Post-wave interactive processing complete
620
+ - Interactive agents closed, results stored
621
+
622
+ ---
623
+
624
+ ### Phase 4: Results Aggregation
625
+
626
+ **Objective**: Generate final results and human-readable report.
627
+
628
+ ```javascript
629
+ const masterCsv = Read(`${sessionFolder}/tasks.csv`)
630
+ Write(`${sessionFolder}/results.csv`, masterCsv)
631
+
632
+ const tasks = parseCsv(masterCsv)
633
+ const completed = tasks.filter(t => t.status === 'completed')
634
+ const failed = tasks.filter(t => t.status === 'failed')
635
+ const skipped = tasks.filter(t => t.status === 'skipped')
636
+
637
+ const contextContent = `# Team IterDev Report
638
+
639
+ **Session**: ${sessionId}
640
+ **Requirement**: ${requirement}
641
+ **Pipeline**: ${pipeline_mode}
642
+ **Completed**: ${getUtc8ISOString()}
643
+
644
+ ---
645
+
646
+ ## Summary
647
+
648
+ | Metric | Count |
649
+ |--------|-------|
650
+ | Total Tasks | ${tasks.length} |
651
+ | Completed | ${completed.length} |
652
+ | Failed | ${failed.length} |
653
+ | Skipped | ${skipped.length} |
654
+ | GC Rounds | ${gcRound} |
655
+
656
+ ---
657
+
658
+ ## Pipeline Execution
659
+
660
+ ${waveDetails}
661
+
662
+ ---
663
+
664
+ ## Task Details
665
+
666
+ ${taskDetails}
667
+
668
+ ---
669
+
670
+ ## Deliverables
671
+
672
+ | Artifact | Path |
673
+ |----------|------|
674
+ | Design Document | ${sessionFolder}/design/design-001.md |
675
+ | Task Breakdown | ${sessionFolder}/design/task-breakdown.json |
676
+ | Dev Log | ${sessionFolder}/code/dev-log.md |
677
+ | Verification | ${sessionFolder}/verify/verify-001.json |
678
+ | Review Report | ${sessionFolder}/review/review-001.md |
679
+ | Wisdom | ${sessionFolder}/wisdom/ |
680
+ `
681
+
682
+ Write(`${sessionFolder}/context.md`, contextContent)
683
+ ```
684
+
685
+ If not AUTO_YES, offer completion actions:
686
+
687
+ ```javascript
688
+ if (!AUTO_YES) {
689
+ request_user_input({
690
+ questions: [{
691
+ question: "IterDev pipeline complete. Choose next action.",
692
+ header: "Done",
693
+ id: "completion",
694
+ options: [
695
+ { label: "Archive (Recommended)", description: "Archive session, generate final report" },
696
+ { label: "Keep Active", description: "Keep session for follow-up or inspection" },
697
+ { label: "Retry Failed", description: "Re-run failed tasks" }
698
+ ]
699
+ }]
700
+ })
701
+ }
702
+ ```
703
+
704
+ **Success Criteria**:
705
+ - results.csv exported (all tasks, both modes)
706
+ - context.md generated
707
+ - All interactive agents closed
708
+ - Summary displayed to user
709
+
710
+ ---
711
+
712
+ ## Shared Discovery Board Protocol
713
+
714
+ All agents across all waves share `discoveries.ndjson`. This enables cross-role knowledge sharing.
715
+
716
+ **Discovery Types**:
717
+
718
+ | Type | Dedup Key | Data Schema | Description |
719
+ |------|-----------|-------------|-------------|
720
+ | `design_decision` | `data.component` | `{component, approach, rationale, alternatives}` | Architecture decision |
721
+ | `implementation` | `data.file` | `{file, changes, pattern_used, notes}` | Code implementation detail |
722
+ | `test_result` | `data.test_suite` | `{test_suite, pass_rate, failures[], regressions}` | Test execution result |
723
+ | `review_finding` | `data.file_line` | `{file_line, severity, dimension, description, suggestion}` | Review finding |
724
+ | `convention` | `data.name` | `{name, description, example}` | Discovered project convention |
725
+ | `gc_decision` | `data.round` | `{round, signal, critical_count, score}` | GC loop decision |
726
+
727
+ **Format**: NDJSON, each line is self-contained JSON:
728
+
729
+ ```jsonl
730
+ {"ts":"2026-03-08T10:00:00+08:00","worker":"DESIGN-001","type":"design_decision","data":{"component":"AuthModule","approach":"JWT with refresh tokens","rationale":"Stateless auth for microservices","alternatives":"Session-based, OAuth2"}}
731
+ {"ts":"2026-03-08T10:05:00+08:00","worker":"DEV-001","type":"implementation","data":{"file":"src/auth/jwt.ts","changes":"Added JWT middleware","pattern_used":"Express middleware pattern","notes":"Uses existing bcrypt dependency"}}
732
+ {"ts":"2026-03-08T10:10:00+08:00","worker":"REVIEW-001","type":"review_finding","data":{"file_line":"src/auth/jwt.ts:42","severity":"HIGH","dimension":"security","description":"Token expiry not validated","suggestion":"Add exp claim check"}}
733
+ ```
734
+
735
+ **Protocol Rules**:
736
+ 1. Read board before own work -- leverage existing context
737
+ 2. Write discoveries immediately via `echo >>` -- don't batch
738
+ 3. Deduplicate -- check existing entries by type + dedup key
739
+ 4. Append-only -- never modify or delete existing lines
740
+
741
+ ---
742
+
743
+ ## Consensus Severity Routing
744
+
745
+ When the reviewer returns review results with severity-graded verdicts:
746
+
747
+ | Severity | Action |
748
+ |----------|--------|
749
+ | HIGH | Trigger DEV-fix round (GC loop), max 3 rounds total |
750
+ | MEDIUM | Log warning, continue pipeline |
751
+ | LOW | Treat as review passed |
752
+
753
+ **Constraints**: Max 3 GC rounds (fix cycles). If still HIGH after 3 rounds, force convergence and record in wisdom/issues.md.
754
+
755
+ ---
756
+
757
+ ## Error Handling
758
+
759
+ | Error | Resolution |
760
+ |-------|------------|
761
+ | Circular dependency | Detect in wave computation, abort with error message |
762
+ | CSV agent timeout | Mark as failed in results, continue with wave |
763
+ | CSV agent failed | Mark as failed, skip dependent tasks in later waves |
764
+ | Interactive agent timeout | Urge convergence via send_input, then close if still timed out |
765
+ | Interactive agent failed | Mark as failed, skip dependents |
766
+ | All agents in wave failed | Log error, offer retry or abort |
767
+ | CSV parse error | Validate CSV format before execution, show line number |
768
+ | discoveries.ndjson corrupt | Ignore malformed lines, continue with valid entries |
769
+ | GC loop exceeds 3 rounds | Force convergence, record in wisdom/issues.md |
770
+ | Sprint velocity drops below 50% | Report to user, suggest scope reduction |
771
+ | Task ledger corrupted | Rebuild from tasks.csv state |
772
+ | Continue mode: no session found | List available sessions, prompt user to select |
773
+
774
+ ---
775
+
776
+ ## Core Rules
777
+
778
+ 1. **Start Immediately**: First action is session initialization, then Phase 0/1
779
+ 2. **Wave Order is Sacred**: Never execute wave N before wave N-1 completes and results are merged
780
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all state (both csv-wave and interactive)
781
+ 4. **CSV First**: Default to csv-wave for tasks; only use interactive when interaction pattern requires it
782
+ 5. **Context Propagation**: prev_context built from master CSV, not from memory
783
+ 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson -- both mechanisms share it
784
+ 7. **Skip on Failure**: If a dependency failed, skip the dependent task (regardless of mechanism)
785
+ 8. **Lifecycle Balance**: Every spawn_agent MUST have a matching close_agent
786
+ 9. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
787
+ 10. **DO NOT STOP**: Continuous execution until all waves complete or all remaining tasks are skipped
788
+
789
+
790
+ ---
791
+
792
+ ## Coordinator Role Constraints (Main Agent)
793
+
794
+ **CRITICAL**: The coordinator (main agent executing this skill) is responsible for **orchestration only**, NOT implementation.
795
+
796
+ 15. **Coordinator Does NOT Execute Code**: The main agent MUST NOT write, modify, or implement any code directly. All implementation work is delegated to spawned team agents. The coordinator only:
797
+ - Spawns agents with task assignments
798
+ - Waits for agent callbacks
799
+ - Merges results and coordinates workflow
800
+ - Manages workflow transitions between phases
801
+
802
+ 16. **Patient Waiting is Mandatory**: Agent execution takes significant time (typically 10-30 minutes per phase, sometimes longer). The coordinator MUST:
803
+ - Wait patiently for `wait()` calls to complete
804
+ - NOT skip workflow steps due to perceived delays
805
+ - NOT assume agents have failed just because they're taking time
806
+ - Trust the timeout mechanisms defined in the skill
807
+
808
+ 17. **Use send_input for Clarification**: When agents need guidance or appear stuck, the coordinator MUST:
809
+ - Use `send_input()` to ask questions or provide clarification
810
+ - NOT skip the agent or move to next phase prematurely
811
+ - Give agents opportunity to respond before escalating
812
+ - Example: `send_input({ id: agent_id, message: "Please provide status update or clarify blockers" })`
813
+
814
+ 18. **No Workflow Shortcuts**: The coordinator MUST NOT:
815
+ - Skip phases or stages defined in the workflow
816
+ - Bypass required approval or review steps
817
+ - Execute dependent tasks before prerequisites complete
818
+ - Assume task completion without explicit agent callback
819
+ - Make up or fabricate agent results
820
+
821
+ 19. **Respect Long-Running Processes**: This is a complex multi-agent workflow that requires patience:
822
+ - Total execution time may range from 30-90 minutes or longer
823
+ - Each phase may take 10-30 minutes depending on complexity
824
+ - The coordinator must remain active and attentive throughout the entire process
825
+ - Do not terminate or skip steps due to time concerns