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,725 +1,724 @@
1
- ---
2
- name: team-brainstorm
3
- description: Multi-agent brainstorming pipeline with Generator-Critic loop. Generates ideas, challenges assumptions, synthesizes themes, and evaluates proposals. Supports Quick, Deep, and Full pipeline modes.
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"topic 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 Brainstorm
13
-
14
- ## Usage
15
-
16
- ```bash
17
- $team-brainstorm "How should we approach microservices migration?"
18
- $team-brainstorm -c 4 "Innovation strategies for AI-powered developer tools"
19
- $team-brainstorm -y "Quick brainstorm on naming conventions"
20
- $team-brainstorm --continue "brs-microservices-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
- Multi-agent brainstorming with Generator-Critic loop: generate ideas across multiple angles, challenge assumptions, synthesize themes, and evaluate proposals. Supports three pipeline modes (Quick/Deep/Full) with configurable depth and parallel ideation.
36
-
37
- **Execution Model**: Hybrid — CSV wave pipeline (primary) + individual agent spawn (secondary for Generator-Critic control)
38
-
39
- ```
40
- ┌─────────────────────────────────────────────────────────────────────────┐
41
- │ TEAM BRAINSTORM WORKFLOW │
42
- ├─────────────────────────────────────────────────────────────────────────┤
43
- │ │
44
- │ Phase 0: Pre-Wave Interactive │
45
- │ ├─ Topic clarification + complexity scoring │
46
- │ ├─ Pipeline mode selection (quick/deep/full) │
47
- │ └─ Output: refined requirements for decomposition │
48
- │ │
49
- │ Phase 1: Requirement → CSV + Classification │
50
- │ ├─ Parse topic into brainstorm tasks per selected pipeline │
51
- │ ├─ Assign roles: ideator, challenger, synthesizer, evaluator │
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 critique severity >= HIGH: trigger revision wave │
71
- │ └─ Max 2 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
- | Idea generation (single angle) | `csv-wave` |
98
- | Parallel ideation (Full pipeline, multiple angles) | `csv-wave` (parallel in same wave) |
99
- | Idea revision (GC loop) | `csv-wave` |
100
- | Critique / challenge | `csv-wave` |
101
- | Synthesis (theme extraction) | `csv-wave` |
102
- | Evaluation (scoring / ranking) | `csv-wave` |
103
- | GC loop control (severity check → decide revision or convergence) | `interactive` |
104
- | Topic clarification (Phase 0) | `interactive` |
105
-
106
- ---
107
-
108
- ## CSV Schema
109
-
110
- ### tasks.csv (Master State)
111
-
112
- ```csv
113
- id,title,description,role,angle,gc_round,deps,context_from,exec_mode,wave,status,findings,gc_signal,severity_summary,error
114
- "IDEA-001","Multi-angle idea generation","Generate 3+ ideas per angle with title, description, assumption, impact","ideator","Technical;Product;Innovation","0","","","csv-wave","1","pending","","","",""
115
- "CHALLENGE-001","Critique generated ideas","Challenge each idea across assumption, feasibility, risk, competition dimensions","challenger","","0","IDEA-001","IDEA-001","csv-wave","2","pending","","","",""
116
- "GC-CHECK-001","GC loop decision","Evaluate critique severity and decide: revision or convergence","gc-controller","","1","CHALLENGE-001","CHALLENGE-001","interactive","3","pending","","","",""
117
- ```
118
-
119
- **Columns**:
120
-
121
- | Column | Phase | Description |
122
- |--------|-------|-------------|
123
- | `id` | Input | Unique task identifier (string) |
124
- | `title` | Input | Short task title |
125
- | `description` | Input | Detailed task description |
126
- | `role` | Input | Worker role: ideator, challenger, synthesizer, evaluator |
127
- | `angle` | Input | Brainstorming angle(s) for ideator tasks (semicolon-separated) |
128
- | `gc_round` | Input | Generator-Critic round number (0 = initial, 1+ = revision) |
129
- | `deps` | Input | Semicolon-separated dependency task IDs |
130
- | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
131
- | `exec_mode` | Input | `csv-wave` or `interactive` |
132
- | `wave` | Computed | Wave number (computed by topological sort, 1-based) |
133
- | `status` | Output | `pending` → `completed` / `failed` / `skipped` |
134
- | `findings` | Output | Key discoveries or implementation notes (max 500 chars) |
135
- | `gc_signal` | Output | Generator-Critic signal: `REVISION_NEEDED` or `CONVERGED` (challenger only) |
136
- | `severity_summary` | Output | Severity count: e.g. "CRITICAL:1 HIGH:2 MEDIUM:3 LOW:1" |
137
- | `error` | Output | Error message if failed (empty if success) |
138
-
139
- ### Per-Wave CSV (Temporary)
140
-
141
- Each wave generates a temporary `wave-{N}.csv` with extra `prev_context` column (csv-wave tasks only).
142
-
143
- ---
144
-
145
- ## Agent Registry (Interactive Agents)
146
-
147
- | Agent | Role File | Pattern | Responsibility | Position |
148
- |-------|-----------|---------|----------------|----------|
149
- | gc-controller | agents/gc-controller.md | 2.3 (wait-respond) | Evaluate critique severity, decide revision vs convergence | post-wave (after challenger wave) |
150
- | topic-clarifier | agents/topic-clarifier.md | 2.3 (wait-respond) | Clarify topic, assess complexity, select pipeline mode | standalone (Phase 0) |
151
-
152
- > **COMPACT PROTECTION**: Agent files are execution documents. When context compression occurs, **you MUST immediately `Read` the corresponding agent.md** to reload.
153
-
154
- ---
155
-
156
- ## Output Artifacts
157
-
158
- | File | Purpose | Lifecycle |
159
- |------|---------|-----------|
160
- | `tasks.csv` | Master state — all tasks with status/findings | Updated after each wave |
161
- | `wave-{N}.csv` | Per-wave input (temporary, csv-wave tasks only) | Created before wave, deleted after |
162
- | `results.csv` | Final export of all task results | Created in Phase 4 |
163
- | `discoveries.ndjson` | Shared exploration board (all agents, both modes) | Append-only, carries across waves |
164
- | `context.md` | Human-readable execution report | Created in Phase 4 |
165
- | `interactive/{id}-result.json` | Results from interactive tasks | Created per interactive task |
166
-
167
- ---
168
-
169
- ## Session Structure
170
-
171
- ```
172
- .workflow/.csv-wave/{session-id}/
173
- ├── tasks.csv # Master state (all tasks, both modes)
174
- ├── results.csv # Final results export
175
- ├── discoveries.ndjson # Shared discovery board (all agents)
176
- ├── context.md # Human-readable report
177
- ├── wave-{N}.csv # Temporary per-wave input (csv-wave only)
178
- └── interactive/ # Interactive task artifacts
179
- └── {id}-result.json # Per-task results
180
- ```
181
-
182
- ---
183
-
184
- ## Implementation
185
-
186
- ### Session Initialization
187
-
188
- ```javascript
189
- const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
190
-
191
- // Parse flags
192
- const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
193
- const continueMode = $ARGUMENTS.includes('--continue')
194
- const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
195
- const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 3
196
-
197
- // Clean requirement text (remove flags)
198
- const topic = $ARGUMENTS
199
- .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+/g, '')
200
- .trim()
201
-
202
- const slug = topic.toLowerCase()
203
- .replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
204
- .substring(0, 40)
205
- const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
206
- let sessionId = `brs-${slug}-${dateStr}`
207
- let sessionFolder = `.workflow/.csv-wave/${sessionId}`
208
-
209
- // Continue mode: find existing session
210
- if (continueMode) {
211
- const existing = Bash(`ls -t .workflow/.csv-wave/brs-* 2>/dev/null | head -1`).trim()
212
- if (existing) {
213
- sessionId = existing.split('/').pop()
214
- sessionFolder = existing
215
- // Read existing tasks.csv, find incomplete waves, resume from Phase 2
216
- }
217
- }
218
-
219
- Bash(`mkdir -p ${sessionFolder}/interactive`)
220
- ```
221
-
222
- ---
223
-
224
- ### Phase 0: Pre-Wave Interactive
225
-
226
- **Objective**: Clarify topic, assess complexity, and select pipeline mode.
227
-
228
- **Execution**:
229
-
230
- ```javascript
231
- const clarifier = spawn_agent({
232
- message: `
233
- ## TASK ASSIGNMENT
234
-
235
- ### MANDATORY FIRST STEPS (Agent Execute)
236
- 1. **Read role definition**: ~ or <project>/.codex/skills/team-brainstorm/agents/topic-clarifier.md (MUST read first)
237
- 2. Read: .workflow/project-tech.json (if exists)
238
-
239
- ---
240
-
241
- Goal: Clarify brainstorming topic and select pipeline mode
242
- Topic: ${topic}
243
-
244
- ### Task
245
- 1. Assess topic complexity using signal detection:
246
- - Strategic/systemic keywords (+3): strategy, architecture, system, framework, paradigm
247
- - Multi-dimensional keywords (+2): multiple, compare, tradeoff, versus, alternative
248
- - Innovation-focused keywords (+2): innovative, creative, novel, breakthrough
249
- - Simple/basic keywords (-2): simple, quick, straightforward, basic
250
- 2. Score >= 4 → full, 2-3 → deep, 0-1 → quick
251
- 3. Suggest divergence angles (e.g., Technical, Product, Innovation, Risk)
252
- 4. Return structured result
253
- `
254
- })
255
-
256
- const clarifierResult = wait({ ids: [clarifier], timeout_ms: 120000 })
257
-
258
- if (clarifierResult.timed_out) {
259
- send_input({ id: clarifier, message: "Please finalize and output current findings." })
260
- const retry = wait({ ids: [clarifier], timeout_ms: 60000 })
261
- }
262
-
263
- // Parse result for pipeline_mode, angles
264
- close_agent({ id: clarifier })
265
-
266
- // Store result
267
- Write(`${sessionFolder}/interactive/topic-clarifier-result.json`, JSON.stringify({
268
- task_id: "topic-clarification",
269
- status: "completed",
270
- pipeline_mode: parsedMode, // "quick" | "deep" | "full"
271
- angles: parsedAngles, // ["Technical", "Product", "Innovation", "Risk"]
272
- complexity_score: parsedScore,
273
- timestamp: getUtc8ISOString()
274
- }))
275
- ```
276
-
277
- If not AUTO_YES, present user with pipeline mode selection for confirmation:
278
-
279
- ```javascript
280
- if (!AUTO_YES) {
281
- const answer = AskUserQuestion({
282
- questions: [{
283
- question: `Topic: "${topic}"\nRecommended pipeline: ${pipeline_mode} (complexity: ${complexity_score})\nAngles: ${angles.join(', ')}\n\nApprove?`,
284
- header: "Pipeline Selection",
285
- multiSelect: false,
286
- options: [
287
- { label: "Approve", description: `Use ${pipeline_mode} pipeline` },
288
- { label: "Quick", description: "3 tasks: generate challenge synthesize" },
289
- { label: "Deep", description: "6 tasks: generate challenge revise → re-challenge → synthesize → evaluate" },
290
- { label: "Full", description: "7 tasks: 3x parallel generation → challenge → revise → synthesize → evaluate" }
291
- ]
292
- }]
293
- })
294
- // Update pipeline_mode based on user choice
295
- }
296
- ```
297
-
298
- **Success Criteria**:
299
- - Refined requirements available for Phase 1 decomposition
300
- - Interactive agents closed, results stored
301
-
302
- ---
303
-
304
- ### Phase 1: Requirement → CSV + Classification
305
-
306
- **Objective**: Build tasks.csv from selected pipeline mode with proper wave assignments.
307
-
308
- **Decomposition Rules**:
309
-
310
- | Pipeline | Tasks | Wave Structure |
311
- |----------|-------|---------------|
312
- | quick | IDEA-001 → CHALLENGE-001 → SYNTH-001 | 3 waves, serial |
313
- | deep | IDEA-001 → CHALLENGE-001 → IDEA-002CHALLENGE-002 → SYNTH-001 → EVAL-001 | 6 waves, serial with GC loop |
314
- | full | IDEA-001,002,003 (parallel) → CHALLENGE-001 → IDEA-004 → SYNTH-001 → EVAL-001 | 5 waves, fan-out + GC |
315
-
316
- **Classification Rules**:
317
-
318
- All brainstorm work tasks (ideation, challenging, synthesis, evaluation) are `csv-wave`. The GC loop controller between challenger and next ideation revision is `interactive` (post-wave, spawned by orchestrator to decide the GC outcome).
319
-
320
- **Wave Computation**: Kahn's BFS topological sort with depth tracking (csv-wave tasks only).
321
-
322
- **User Validation**: Display task breakdown with wave + exec_mode assignment (skip if AUTO_YES).
323
-
324
- **Pipeline Task Definitions**:
325
-
326
- #### Quick Pipeline (3 csv-wave tasks)
327
-
328
- | Task ID | Role | Wave | Deps | Description |
329
- |---------|------|------|------|-------------|
330
- | IDEA-001 | ideator | 1 | (none) | Generate multi-angle ideas: 3+ ideas per angle with title, description, assumption, impact |
331
- | CHALLENGE-001 | challenger | 2 | IDEA-001 | Challenge each idea across 4 dimensions (assumption, feasibility, risk, competition). Assign severity per idea. Output GC signal |
332
- | SYNTH-001 | synthesizer | 3 | CHALLENGE-001 | Synthesize ideas and critiques into 1-3 integrated proposals with feasibility and innovation scores |
333
-
334
- #### Deep Pipeline (6 csv-wave tasks + 1 interactive GC check)
335
-
336
- Same as Quick plus:
337
-
338
- | Task ID | Role | Wave | Deps | Description |
339
- |---------|------|------|------|-------------|
340
- | IDEA-002 | ideator | 4 | CHALLENGE-001 | Revise ideas based on critique feedback (GC Round 1). Address HIGH/CRITICAL challenges |
341
- | CHALLENGE-002 | challenger | 5 | IDEA-002 | Validate revised ideas (GC Round 2). Re-evaluate previously challenged ideas |
342
- | SYNTH-001 | synthesizer | 6 | CHALLENGE-002 | Synthesize all ideas and critiques |
343
- | EVAL-001 | evaluator | 7 | SYNTH-001 | Score and rank proposals: Feasibility 30%, Innovation 25%, Impact 25%, Cost 20% |
344
-
345
- GC-CHECK-001 (interactive) runs post-wave after CHALLENGE-001 to decide whether to proceed with revision or skip to synthesis.
346
-
347
- #### Full Pipeline (7 csv-wave tasks + GC control)
348
-
349
- | Task ID | Role | Wave | Deps | Description |
350
- |---------|------|------|------|-------------|
351
- | IDEA-001 | ideator | 1 | (none) | Generate ideas from angle 1 |
352
- | IDEA-002 | ideator | 1 | (none) | Generate ideas from angle 2 |
353
- | IDEA-003 | ideator | 1 | (none) | Generate ideas from angle 3 |
354
- | CHALLENGE-001 | challenger | 2 | IDEA-001;IDEA-002;IDEA-003 | Critique all generated ideas |
355
- | IDEA-004 | ideator | 3 | CHALLENGE-001 | Revise ideas based on critique |
356
- | SYNTH-001 | synthesizer | 4 | IDEA-004 | Synthesize all ideas and critiques |
357
- | EVAL-001 | evaluator | 5 | SYNTH-001 | Score and rank proposals |
358
-
359
- **Success Criteria**:
360
- - tasks.csv created with valid schema, wave, and exec_mode assignments
361
- - No circular dependencies
362
- - User approved (or AUTO_YES)
363
-
364
- ---
365
-
366
- ### Phase 2: Wave Execution Engine (Extended)
367
-
368
- **Objective**: Execute tasks wave-by-wave with hybrid mechanism support and cross-wave context propagation.
369
-
370
- ```javascript
371
- const failedIds = new Set()
372
- const skippedIds = new Set()
373
- const MAX_GC_ROUNDS = 2
374
- let gcRound = 0
375
-
376
- for (let wave = 1; wave <= maxWave; wave++) {
377
- console.log(`\n## Wave ${wave}/${maxWave}\n`)
378
-
379
- // 1. Read current master CSV
380
- const masterCsv = parseCsv(Read(`${sessionFolder}/tasks.csv`))
381
-
382
- // 2. Separate csv-wave and interactive tasks for this wave
383
- const waveTasks = masterCsv.filter(row => parseInt(row.wave) === wave)
384
- const csvTasks = waveTasks.filter(t => t.exec_mode === 'csv-wave')
385
- const interactiveTasks = waveTasks.filter(t => t.exec_mode === 'interactive')
386
-
387
- // 3. Skip tasks whose deps failed
388
- const executableCsvTasks = []
389
- for (const task of csvTasks) {
390
- const deps = task.deps.split(';').filter(Boolean)
391
- if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
392
- skippedIds.add(task.id)
393
- updateMasterCsvRow(sessionFolder, task.id, {
394
- status: 'skipped',
395
- error: 'Dependency failed or skipped'
396
- })
397
- continue
398
- }
399
- executableCsvTasks.push(task)
400
- }
401
-
402
- // 4. Build prev_context for each csv-wave task
403
- for (const task of executableCsvTasks) {
404
- const contextIds = task.context_from.split(';').filter(Boolean)
405
- const prevFindings = contextIds
406
- .map(id => {
407
- const prevRow = masterCsv.find(r => r.id === id)
408
- if (prevRow && prevRow.status === 'completed' && prevRow.findings) {
409
- return `[Task ${id}: ${prevRow.title}] ${prevRow.findings}`
410
- }
411
- return null
412
- })
413
- .filter(Boolean)
414
- .join('\n')
415
- task.prev_context = prevFindings || 'No previous context available'
416
- }
417
-
418
- // 5. Write wave CSV and execute csv-wave tasks
419
- if (executableCsvTasks.length > 0) {
420
- const waveHeader = 'id,title,description,role,angle,gc_round,deps,context_from,exec_mode,wave,prev_context'
421
- const waveRows = executableCsvTasks.map(t =>
422
- [t.id, t.title, t.description, t.role, t.angle, t.gc_round, t.deps, t.context_from, t.exec_mode, t.wave, t.prev_context]
423
- .map(cell => `"${String(cell).replace(/"/g, '""')}"`)
424
- .join(',')
425
- )
426
- Write(`${sessionFolder}/wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n'))
427
-
428
- const waveResult = spawn_agents_on_csv({
429
- csv_path: `${sessionFolder}/wave-${wave}.csv`,
430
- id_column: "id",
431
- instruction: buildBrainstormInstruction(sessionFolder, wave),
432
- max_concurrency: maxConcurrency,
433
- max_runtime_seconds: 600,
434
- output_csv_path: `${sessionFolder}/wave-${wave}-results.csv`,
435
- output_schema: {
436
- type: "object",
437
- properties: {
438
- id: { type: "string" },
439
- status: { type: "string", enum: ["completed", "failed"] },
440
- findings: { type: "string" },
441
- gc_signal: { type: "string" },
442
- severity_summary: { type: "string" },
443
- error: { type: "string" }
444
- },
445
- required: ["id", "status", "findings"]
446
- }
447
- })
448
- // Blocks until wave completes
449
-
450
- // Merge results into master CSV
451
- const waveResults = parseCsv(Read(`${sessionFolder}/wave-${wave}-results.csv`))
452
- for (const result of waveResults) {
453
- updateMasterCsvRow(sessionFolder, result.id, {
454
- status: result.status,
455
- findings: result.findings || '',
456
- gc_signal: result.gc_signal || '',
457
- severity_summary: result.severity_summary || '',
458
- error: result.error || ''
459
- })
460
- if (result.status === 'failed') failedIds.add(result.id)
461
- }
462
-
463
- Bash(`rm -f "${sessionFolder}/wave-${wave}.csv"`)
464
- }
465
-
466
- // 6. Execute post-wave interactive tasks (GC controller)
467
- for (const task of interactiveTasks) {
468
- if (task.status !== 'pending') continue
469
- const deps = task.deps.split(';').filter(Boolean)
470
- if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
471
- skippedIds.add(task.id)
472
- continue
473
- }
474
-
475
- // Spawn GC controller agent
476
- const gcAgent = spawn_agent({
477
- message: `
478
- ## TASK ASSIGNMENT
479
-
480
- ### MANDATORY FIRST STEPS (Agent Execute)
481
- 1. **Read role definition**: ~ or <project>/.codex/skills/team-brainstorm/agents/gc-controller.md (MUST read first)
482
- 2. Read: ${sessionFolder}/discoveries.ndjson (shared discoveries)
483
-
484
- ---
485
-
486
- Goal: Evaluate critique severity and decide revision vs convergence
487
- Session: ${sessionFolder}
488
- GC Round: ${gcRound}
489
- Max GC Rounds: ${MAX_GC_ROUNDS}
490
-
491
- ### Context
492
- Read the latest critique file and determine the GC signal.
493
- If REVISION_NEEDED and gcRound < maxRounds: output "REVISION"
494
- If CONVERGED or gcRound >= maxRounds: output "CONVERGE"
495
- `
496
- })
497
-
498
- const gcResult = wait({ ids: [gcAgent], timeout_ms: 120000 })
499
- if (gcResult.timed_out) {
500
- send_input({ id: gcAgent, message: "Please finalize your decision now." })
501
- wait({ ids: [gcAgent], timeout_ms: 60000 })
502
- }
503
- close_agent({ id: gcAgent })
504
-
505
- // Parse GC decision and potentially create/skip revision tasks
506
- Write(`${sessionFolder}/interactive/${task.id}-result.json`, JSON.stringify({
507
- task_id: task.id, status: "completed",
508
- gc_decision: gcDecision, gc_round: gcRound,
509
- timestamp: getUtc8ISOString()
510
- }))
511
-
512
- if (gcDecision === "CONVERGE") {
513
- // Skip remaining GC tasks, mark revision tasks as skipped
514
- // Unblock SYNTH directly
515
- } else {
516
- gcRound++
517
- // Let the revision wave proceed naturally
518
- }
519
-
520
- updateMasterCsvRow(sessionFolder, task.id, { status: 'completed', findings: `GC decision: ${gcDecision}` })
521
- }
522
- }
523
- ```
524
-
525
- **Success Criteria**:
526
- - All waves executed in order
527
- - Both csv-wave and interactive tasks handled per wave
528
- - Each wave's results merged into master CSV before next wave starts
529
- - Dependent tasks skipped when predecessor failed
530
- - discoveries.ndjson accumulated across all waves and mechanisms
531
- - GC loop controlled with max 2 rounds
532
-
533
- ---
534
-
535
- ### Phase 3: Post-Wave Interactive
536
-
537
- **Objective**: Handle any final GC loop convergence and prepare for synthesis.
538
-
539
- If the pipeline used GC loops and the final GC decision was CONVERGE or max rounds reached, ensure SYNTH-001 is unblocked and all remaining GC-related tasks are properly marked.
540
-
541
- **Success Criteria**:
542
- - Post-wave interactive processing complete
543
- - Interactive agents closed, results stored
544
-
545
- ---
546
-
547
- ### Phase 4: Results Aggregation
548
-
549
- **Objective**: Generate final results and human-readable report.
550
-
551
- ```javascript
552
- const masterCsv = Read(`${sessionFolder}/tasks.csv`)
553
- Write(`${sessionFolder}/results.csv`, masterCsv)
554
-
555
- const tasks = parseCsv(masterCsv)
556
- const completed = tasks.filter(t => t.status === 'completed')
557
- const failed = tasks.filter(t => t.status === 'failed')
558
- const skipped = tasks.filter(t => t.status === 'skipped')
559
-
560
- const contextContent = `# Team Brainstorm Report
561
-
562
- **Session**: ${sessionId}
563
- **Topic**: ${topic}
564
- **Pipeline**: ${pipeline_mode}
565
- **Completed**: ${getUtc8ISOString()}
566
-
567
- ---
568
-
569
- ## Summary
570
-
571
- | Metric | Count |
572
- |--------|-------|
573
- | Total Tasks | ${tasks.length} |
574
- | Completed | ${completed.length} |
575
- | Failed | ${failed.length} |
576
- | Skipped | ${skipped.length} |
577
- | GC Rounds | ${gcRound} |
578
-
579
- ---
580
-
581
- ## Wave Execution
582
-
583
- ${waveDetails}
584
-
585
- ---
586
-
587
- ## Task Details
588
-
589
- ${taskDetails}
590
-
591
- ---
592
-
593
- ## Brainstorm Artifacts
594
-
595
- - Ideas: discoveries with type "idea" in discoveries.ndjson
596
- - Critiques: discoveries with type "critique" in discoveries.ndjson
597
- - Synthesis: discoveries with type "synthesis" in discoveries.ndjson
598
- - Evaluation: discoveries with type "evaluation" in discoveries.ndjson
599
- `
600
-
601
- Write(`${sessionFolder}/context.md`, contextContent)
602
- ```
603
-
604
- If not AUTO_YES and there are failed tasks, offer retry or view report.
605
-
606
- **Success Criteria**:
607
- - results.csv exported (all tasks, both modes)
608
- - context.md generated
609
- - All interactive agents closed
610
- - Summary displayed to user
611
-
612
- ---
613
-
614
- ## Shared Discovery Board Protocol
615
-
616
- All agents across all waves share `discoveries.ndjson`. This enables cross-role knowledge sharing.
617
-
618
- **Discovery Types**:
619
-
620
- | Type | Dedup Key | Data Schema | Description |
621
- |------|-----------|-------------|-------------|
622
- | `idea` | `data.title` | `{title, angle, description, assumption, impact}` | Generated idea |
623
- | `critique` | `data.idea_title` | `{idea_title, dimension, severity, challenge, rationale}` | Critique of an idea |
624
- | `theme` | `data.name` | `{name, strength, supporting_ideas[]}` | Extracted theme from synthesis |
625
- | `proposal` | `data.title` | `{title, source_ideas[], feasibility, innovation, description}` | Integrated proposal |
626
- | `evaluation` | `data.proposal_title` | `{proposal_title, weighted_score, rank, recommendation}` | Proposal evaluation |
627
- | `gc_decision` | `data.round` | `{round, signal, severity_counts}` | GC loop decision |
628
-
629
- **Format**: NDJSON, each line is self-contained JSON:
630
-
631
- ```jsonl
632
- {"ts":"2026-03-08T10:00:00+08:00","worker":"IDEA-001","type":"idea","data":{"title":"API Gateway Pattern","angle":"Technical","description":"Centralized API gateway for microservice routing","assumption":"Services need unified entry point","impact":"Simplifies client integration"}}
633
- {"ts":"2026-03-08T10:05:00+08:00","worker":"CHALLENGE-001","type":"critique","data":{"idea_title":"API Gateway Pattern","dimension":"feasibility","severity":"MEDIUM","challenge":"Single point of failure","rationale":"Requires high availability design"}}
634
- ```
635
-
636
- **Protocol Rules**:
637
- 1. Read board before own workleverage existing context
638
- 2. Write discoveries immediately via `echo >>` don't batch
639
- 3. Deduplicatecheck existing entries by type + dedup key
640
- 4. Append-only — never modify or delete existing lines
641
-
642
- ---
643
-
644
- ## Consensus Severity Routing
645
-
646
- When the challenger returns critique results with severity-graded verdicts:
647
-
648
- | Severity | Action |
649
- |----------|--------|
650
- | HIGH | Trigger revision round (GC loop), max 2 rounds total |
651
- | MEDIUM | Log warning, continue pipeline |
652
- | LOW | Treat as consensus reached |
653
-
654
- **Constraints**: Max 2 GC rounds (revision cycles). If still HIGH after 2 rounds, force convergence to synthesizer.
655
-
656
- ---
657
-
658
- ## Error Handling
659
-
660
- | Error | Resolution |
661
- |-------|------------|
662
- | Circular dependency | Detect in wave computation, abort with error message |
663
- | CSV agent timeout | Mark as failed in results, continue with wave |
664
- | CSV agent failed | Mark as failed, skip dependent tasks in later waves |
665
- | Interactive agent timeout | Urge convergence via send_input, then close if still timed out |
666
- | Interactive agent failed | Mark as failed, skip dependents |
667
- | All agents in wave failed | Log error, offer retry or abort |
668
- | CSV parse error | Validate CSV format before execution, show line number |
669
- | discoveries.ndjson corrupt | Ignore malformed lines, continue with valid entries |
670
- | GC loop exceeds 2 rounds | Force convergence to synthesizer |
671
- | No ideas generated | Report failure, suggest refining topic |
672
- | Continue mode: no session found | List available sessions, prompt user to select |
673
-
674
- ---
675
-
676
- ## Core Rules
677
-
678
- 1. **Start Immediately**: First action is session initialization, then Phase 0/1
679
- 2. **Wave Order is Sacred**: Never execute wave N before wave N-1 completes and results are merged
680
- 3. **CSV is Source of Truth**: Master tasks.csv holds all state (both csv-wave and interactive)
681
- 4. **CSV First**: Default to csv-wave for tasks; only use interactive when interaction pattern requires it
682
- 5. **Context Propagation**: prev_context built from master CSV, not from memory
683
- 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson both mechanisms share it
684
- 7. **Skip on Failure**: If a dependency failed, skip the dependent task (regardless of mechanism)
685
- 8. **Lifecycle Balance**: Every spawn_agent MUST have a matching close_agent
686
- 9. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
687
- 10. **DO NOT STOP**: Continuous execution until all waves complete or all remaining tasks are skipped
688
-
689
-
690
- ---
691
-
692
- ## Coordinator Role Constraints (Main Agent)
693
-
694
- **CRITICAL**: The coordinator (main agent executing this skill) is responsible for **orchestration only**, NOT implementation.
695
-
696
- 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:
697
- - Spawns agents with task assignments
698
- - Waits for agent callbacks
699
- - Merges results and coordinates workflow
700
- - Manages workflow transitions between phases
701
-
702
- 16. **Patient Waiting is Mandatory**: Agent execution takes significant time (typically 10-30 minutes per phase, sometimes longer). The coordinator MUST:
703
- - Wait patiently for `wait()` calls to complete
704
- - NOT skip workflow steps due to perceived delays
705
- - NOT assume agents have failed just because they're taking time
706
- - Trust the timeout mechanisms defined in the skill
707
-
708
- 17. **Use send_input for Clarification**: When agents need guidance or appear stuck, the coordinator MUST:
709
- - Use `send_input()` to ask questions or provide clarification
710
- - NOT skip the agent or move to next phase prematurely
711
- - Give agents opportunity to respond before escalating
712
- - Example: `send_input({ id: agent_id, message: "Please provide status update or clarify blockers" })`
713
-
714
- 18. **No Workflow Shortcuts**: The coordinator MUST NOT:
715
- - Skip phases or stages defined in the workflow
716
- - Bypass required approval or review steps
717
- - Execute dependent tasks before prerequisites complete
718
- - Assume task completion without explicit agent callback
719
- - Make up or fabricate agent results
720
-
721
- 19. **Respect Long-Running Processes**: This is a complex multi-agent workflow that requires patience:
722
- - Total execution time may range from 30-90 minutes or longer
723
- - Each phase may take 10-30 minutes depending on complexity
724
- - The coordinator must remain active and attentive throughout the entire process
725
- - Do not terminate or skip steps due to time concerns
1
+ ---
2
+ name: team-brainstorm
3
+ description: Multi-agent brainstorming pipeline with Generator-Critic loop. Generates ideas, challenges assumptions, synthesizes themes, and evaluates proposals. Supports Quick, Deep, and Full pipeline modes.
4
+ argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"topic 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 Brainstorm
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ $team-brainstorm "How should we approach microservices migration?"
18
+ $team-brainstorm -c 4 "Innovation strategies for AI-powered developer tools"
19
+ $team-brainstorm -y "Quick brainstorm on naming conventions"
20
+ $team-brainstorm --continue "brs-microservices-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
+ Multi-agent brainstorming with Generator-Critic loop: generate ideas across multiple angles, challenge assumptions, synthesize themes, and evaluate proposals. Supports three pipeline modes (Quick/Deep/Full) with configurable depth and parallel ideation.
36
+
37
+ **Execution Model**: Hybrid — CSV wave pipeline (primary) + individual agent spawn (secondary for Generator-Critic control)
38
+
39
+ ```
40
+ ┌─────────────────────────────────────────────────────────────────────────┐
41
+ │ TEAM BRAINSTORM WORKFLOW │
42
+ ├─────────────────────────────────────────────────────────────────────────┤
43
+ │ │
44
+ │ Phase 0: Pre-Wave Interactive │
45
+ │ ├─ Topic clarification + complexity scoring │
46
+ │ ├─ Pipeline mode selection (quick/deep/full) │
47
+ │ └─ Output: refined requirements for decomposition │
48
+ │ │
49
+ │ Phase 1: Requirement → CSV + Classification │
50
+ │ ├─ Parse topic into brainstorm tasks per selected pipeline │
51
+ │ ├─ Assign roles: ideator, challenger, synthesizer, evaluator │
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 critique severity >= HIGH: trigger revision wave │
71
+ │ └─ Max 2 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
+ | Idea generation (single angle) | `csv-wave` |
98
+ | Parallel ideation (Full pipeline, multiple angles) | `csv-wave` (parallel in same wave) |
99
+ | Idea revision (GC loop) | `csv-wave` |
100
+ | Critique / challenge | `csv-wave` |
101
+ | Synthesis (theme extraction) | `csv-wave` |
102
+ | Evaluation (scoring / ranking) | `csv-wave` |
103
+ | GC loop control (severity check → decide revision or convergence) | `interactive` |
104
+ | Topic clarification (Phase 0) | `interactive` |
105
+
106
+ ---
107
+
108
+ ## CSV Schema
109
+
110
+ ### tasks.csv (Master State)
111
+
112
+ ```csv
113
+ id,title,description,role,angle,gc_round,deps,context_from,exec_mode,wave,status,findings,gc_signal,severity_summary,error
114
+ "IDEA-001","Multi-angle idea generation","Generate 3+ ideas per angle with title, description, assumption, impact","ideator","Technical;Product;Innovation","0","","","csv-wave","1","pending","","","",""
115
+ "CHALLENGE-001","Critique generated ideas","Challenge each idea across assumption, feasibility, risk, competition dimensions","challenger","","0","IDEA-001","IDEA-001","csv-wave","2","pending","","","",""
116
+ "GC-CHECK-001","GC loop decision","Evaluate critique severity and decide: revision or convergence","gc-controller","","1","CHALLENGE-001","CHALLENGE-001","interactive","3","pending","","","",""
117
+ ```
118
+
119
+ **Columns**:
120
+
121
+ | Column | Phase | Description |
122
+ |--------|-------|-------------|
123
+ | `id` | Input | Unique task identifier (string) |
124
+ | `title` | Input | Short task title |
125
+ | `description` | Input | Detailed task description |
126
+ | `role` | Input | Worker role: ideator, challenger, synthesizer, evaluator |
127
+ | `angle` | Input | Brainstorming angle(s) for ideator tasks (semicolon-separated) |
128
+ | `gc_round` | Input | Generator-Critic round number (0 = initial, 1+ = revision) |
129
+ | `deps` | Input | Semicolon-separated dependency task IDs |
130
+ | `context_from` | Input | Semicolon-separated task IDs whose findings this task needs |
131
+ | `exec_mode` | Input | `csv-wave` or `interactive` |
132
+ | `wave` | Computed | Wave number (computed by topological sort, 1-based) |
133
+ | `status` | Output | `pending` → `completed` / `failed` / `skipped` |
134
+ | `findings` | Output | Key discoveries or implementation notes (max 500 chars) |
135
+ | `gc_signal` | Output | Generator-Critic signal: `REVISION_NEEDED` or `CONVERGED` (challenger only) |
136
+ | `severity_summary` | Output | Severity count: e.g. "CRITICAL:1 HIGH:2 MEDIUM:3 LOW:1" |
137
+ | `error` | Output | Error message if failed (empty if success) |
138
+
139
+ ### Per-Wave CSV (Temporary)
140
+
141
+ Each wave generates a temporary `wave-{N}.csv` with extra `prev_context` column (csv-wave tasks only).
142
+
143
+ ---
144
+
145
+ ## Agent Registry (Interactive Agents)
146
+
147
+ | Agent | Role File | Pattern | Responsibility | Position |
148
+ |-------|-----------|---------|----------------|----------|
149
+ | gc-controller | agents/gc-controller.md | 2.3 (wait-respond) | Evaluate critique severity, decide revision vs convergence | post-wave (after challenger wave) |
150
+ | topic-clarifier | agents/topic-clarifier.md | 2.3 (wait-respond) | Clarify topic, assess complexity, select pipeline mode | standalone (Phase 0) |
151
+
152
+ > **COMPACT PROTECTION**: Agent files are execution documents. When context compression occurs, **you MUST immediately `Read` the corresponding agent.md** to reload.
153
+
154
+ ---
155
+
156
+ ## Output Artifacts
157
+
158
+ | File | Purpose | Lifecycle |
159
+ |------|---------|-----------|
160
+ | `tasks.csv` | Master state — all tasks with status/findings | Updated after each wave |
161
+ | `wave-{N}.csv` | Per-wave input (temporary, csv-wave tasks only) | Created before wave, deleted after |
162
+ | `results.csv` | Final export of all task results | Created in Phase 4 |
163
+ | `discoveries.ndjson` | Shared exploration board (all agents, both modes) | Append-only, carries across waves |
164
+ | `context.md` | Human-readable execution report | Created in Phase 4 |
165
+ | `interactive/{id}-result.json` | Results from interactive tasks | Created per interactive task |
166
+
167
+ ---
168
+
169
+ ## Session Structure
170
+
171
+ ```
172
+ .workflow/.csv-wave/{session-id}/
173
+ ├── tasks.csv # Master state (all tasks, both modes)
174
+ ├── results.csv # Final results export
175
+ ├── discoveries.ndjson # Shared discovery board (all agents)
176
+ ├── context.md # Human-readable report
177
+ ├── wave-{N}.csv # Temporary per-wave input (csv-wave only)
178
+ └── interactive/ # Interactive task artifacts
179
+ └── {id}-result.json # Per-task results
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Implementation
185
+
186
+ ### Session Initialization
187
+
188
+ ```javascript
189
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
190
+
191
+ // Parse flags
192
+ const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
193
+ const continueMode = $ARGUMENTS.includes('--continue')
194
+ const concurrencyMatch = $ARGUMENTS.match(/(?:--concurrency|-c)\s+(\d+)/)
195
+ const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 3
196
+
197
+ // Clean requirement text (remove flags)
198
+ const topic = $ARGUMENTS
199
+ .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+/g, '')
200
+ .trim()
201
+
202
+ const slug = topic.toLowerCase()
203
+ .replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-')
204
+ .substring(0, 40)
205
+ const dateStr = getUtc8ISOString().substring(0, 10).replace(/-/g, '')
206
+ let sessionId = `brs-${slug}-${dateStr}`
207
+ let sessionFolder = `.workflow/.csv-wave/${sessionId}`
208
+
209
+ // Continue mode: find existing session
210
+ if (continueMode) {
211
+ const existing = Bash(`ls -t .workflow/.csv-wave/brs-* 2>/dev/null | head -1`).trim()
212
+ if (existing) {
213
+ sessionId = existing.split('/').pop()
214
+ sessionFolder = existing
215
+ // Read existing tasks.csv, find incomplete waves, resume from Phase 2
216
+ }
217
+ }
218
+
219
+ Bash(`mkdir -p ${sessionFolder}/interactive`)
220
+ ```
221
+
222
+ ---
223
+
224
+ ### Phase 0: Pre-Wave Interactive
225
+
226
+ **Objective**: Clarify topic, assess complexity, and select pipeline mode.
227
+
228
+ **Execution**:
229
+
230
+ ```javascript
231
+ const clarifier = spawn_agent({
232
+ message: `
233
+ ## TASK ASSIGNMENT
234
+
235
+ ### MANDATORY FIRST STEPS (Agent Execute)
236
+ 1. **Read role definition**: ~ or <project>/.codex/skills/team-brainstorm/agents/topic-clarifier.md (MUST read first)
237
+ 2. Read: .workflow/project-tech.json (if exists)
238
+
239
+ ---
240
+
241
+ Goal: Clarify brainstorming topic and select pipeline mode
242
+ Topic: ${topic}
243
+
244
+ ### Task
245
+ 1. Assess topic complexity using signal detection:
246
+ - Strategic/systemic keywords (+3): strategy, architecture, system, framework, paradigm
247
+ - Multi-dimensional keywords (+2): multiple, compare, tradeoff, versus, alternative
248
+ - Innovation-focused keywords (+2): innovative, creative, novel, breakthrough
249
+ - Simple/basic keywords (-2): simple, quick, straightforward, basic
250
+ 2. Score >= 4 → full, 2-3 → deep, 0-1 → quick
251
+ 3. Suggest divergence angles (e.g., Technical, Product, Innovation, Risk)
252
+ 4. Return structured result
253
+ `
254
+ })
255
+
256
+ const clarifierResult = wait({ ids: [clarifier], timeout_ms: 120000 })
257
+
258
+ if (clarifierResult.timed_out) {
259
+ send_input({ id: clarifier, message: "Please finalize and output current findings." })
260
+ const retry = wait({ ids: [clarifier], timeout_ms: 60000 })
261
+ }
262
+
263
+ // Parse result for pipeline_mode, angles
264
+ close_agent({ id: clarifier })
265
+
266
+ // Store result
267
+ Write(`${sessionFolder}/interactive/topic-clarifier-result.json`, JSON.stringify({
268
+ task_id: "topic-clarification",
269
+ status: "completed",
270
+ pipeline_mode: parsedMode, // "quick" | "deep" | "full"
271
+ angles: parsedAngles, // ["Technical", "Product", "Innovation", "Risk"]
272
+ complexity_score: parsedScore,
273
+ timestamp: getUtc8ISOString()
274
+ }))
275
+ ```
276
+
277
+ If not AUTO_YES, present user with pipeline mode selection for confirmation:
278
+
279
+ ```javascript
280
+ if (!AUTO_YES) {
281
+ const answer = request_user_input({
282
+ questions: [{
283
+ question: `Topic: "${topic}" — Recommended: ${pipeline_mode}. Approve or override?`,
284
+ header: "Pipeline",
285
+ id: "pipeline_select",
286
+ options: [
287
+ { label: "Approve (Recommended)", description: `Use ${pipeline_mode} pipeline (complexity: ${complexity_score})` },
288
+ { label: "Quick", description: "3 tasks: generate -> challenge -> synthesize" },
289
+ { label: "Deep/Full", description: "6-7 tasks: parallel generation, GC loop, evaluation" }
290
+ ]
291
+ }]
292
+ })
293
+ // Update pipeline_mode based on user choice
294
+ }
295
+ ```
296
+
297
+ **Success Criteria**:
298
+ - Refined requirements available for Phase 1 decomposition
299
+ - Interactive agents closed, results stored
300
+
301
+ ---
302
+
303
+ ### Phase 1: Requirement → CSV + Classification
304
+
305
+ **Objective**: Build tasks.csv from selected pipeline mode with proper wave assignments.
306
+
307
+ **Decomposition Rules**:
308
+
309
+ | Pipeline | Tasks | Wave Structure |
310
+ |----------|-------|---------------|
311
+ | quick | IDEA-001 → CHALLENGE-001 → SYNTH-001 | 3 waves, serial |
312
+ | deep | IDEA-001 → CHALLENGE-001 → IDEA-002 → CHALLENGE-002 → SYNTH-001 → EVAL-001 | 6 waves, serial with GC loop |
313
+ | full | IDEA-001,002,003 (parallel) → CHALLENGE-001 → IDEA-004 → SYNTH-001 → EVAL-001 | 5 waves, fan-out + GC |
314
+
315
+ **Classification Rules**:
316
+
317
+ All brainstorm work tasks (ideation, challenging, synthesis, evaluation) are `csv-wave`. The GC loop controller between challenger and next ideation revision is `interactive` (post-wave, spawned by orchestrator to decide the GC outcome).
318
+
319
+ **Wave Computation**: Kahn's BFS topological sort with depth tracking (csv-wave tasks only).
320
+
321
+ **User Validation**: Display task breakdown with wave + exec_mode assignment (skip if AUTO_YES).
322
+
323
+ **Pipeline Task Definitions**:
324
+
325
+ #### Quick Pipeline (3 csv-wave tasks)
326
+
327
+ | Task ID | Role | Wave | Deps | Description |
328
+ |---------|------|------|------|-------------|
329
+ | IDEA-001 | ideator | 1 | (none) | Generate multi-angle ideas: 3+ ideas per angle with title, description, assumption, impact |
330
+ | CHALLENGE-001 | challenger | 2 | IDEA-001 | Challenge each idea across 4 dimensions (assumption, feasibility, risk, competition). Assign severity per idea. Output GC signal |
331
+ | SYNTH-001 | synthesizer | 3 | CHALLENGE-001 | Synthesize ideas and critiques into 1-3 integrated proposals with feasibility and innovation scores |
332
+
333
+ #### Deep Pipeline (6 csv-wave tasks + 1 interactive GC check)
334
+
335
+ Same as Quick plus:
336
+
337
+ | Task ID | Role | Wave | Deps | Description |
338
+ |---------|------|------|------|-------------|
339
+ | IDEA-002 | ideator | 4 | CHALLENGE-001 | Revise ideas based on critique feedback (GC Round 1). Address HIGH/CRITICAL challenges |
340
+ | CHALLENGE-002 | challenger | 5 | IDEA-002 | Validate revised ideas (GC Round 2). Re-evaluate previously challenged ideas |
341
+ | SYNTH-001 | synthesizer | 6 | CHALLENGE-002 | Synthesize all ideas and critiques |
342
+ | EVAL-001 | evaluator | 7 | SYNTH-001 | Score and rank proposals: Feasibility 30%, Innovation 25%, Impact 25%, Cost 20% |
343
+
344
+ GC-CHECK-001 (interactive) runs post-wave after CHALLENGE-001 to decide whether to proceed with revision or skip to synthesis.
345
+
346
+ #### Full Pipeline (7 csv-wave tasks + GC control)
347
+
348
+ | Task ID | Role | Wave | Deps | Description |
349
+ |---------|------|------|------|-------------|
350
+ | IDEA-001 | ideator | 1 | (none) | Generate ideas from angle 1 |
351
+ | IDEA-002 | ideator | 1 | (none) | Generate ideas from angle 2 |
352
+ | IDEA-003 | ideator | 1 | (none) | Generate ideas from angle 3 |
353
+ | CHALLENGE-001 | challenger | 2 | IDEA-001;IDEA-002;IDEA-003 | Critique all generated ideas |
354
+ | IDEA-004 | ideator | 3 | CHALLENGE-001 | Revise ideas based on critique |
355
+ | SYNTH-001 | synthesizer | 4 | IDEA-004 | Synthesize all ideas and critiques |
356
+ | EVAL-001 | evaluator | 5 | SYNTH-001 | Score and rank proposals |
357
+
358
+ **Success Criteria**:
359
+ - tasks.csv created with valid schema, wave, and exec_mode assignments
360
+ - No circular dependencies
361
+ - User approved (or AUTO_YES)
362
+
363
+ ---
364
+
365
+ ### Phase 2: Wave Execution Engine (Extended)
366
+
367
+ **Objective**: Execute tasks wave-by-wave with hybrid mechanism support and cross-wave context propagation.
368
+
369
+ ```javascript
370
+ const failedIds = new Set()
371
+ const skippedIds = new Set()
372
+ const MAX_GC_ROUNDS = 2
373
+ let gcRound = 0
374
+
375
+ for (let wave = 1; wave <= maxWave; wave++) {
376
+ console.log(`\n## Wave ${wave}/${maxWave}\n`)
377
+
378
+ // 1. Read current master CSV
379
+ const masterCsv = parseCsv(Read(`${sessionFolder}/tasks.csv`))
380
+
381
+ // 2. Separate csv-wave and interactive tasks for this wave
382
+ const waveTasks = masterCsv.filter(row => parseInt(row.wave) === wave)
383
+ const csvTasks = waveTasks.filter(t => t.exec_mode === 'csv-wave')
384
+ const interactiveTasks = waveTasks.filter(t => t.exec_mode === 'interactive')
385
+
386
+ // 3. Skip tasks whose deps failed
387
+ const executableCsvTasks = []
388
+ for (const task of csvTasks) {
389
+ const deps = task.deps.split(';').filter(Boolean)
390
+ if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
391
+ skippedIds.add(task.id)
392
+ updateMasterCsvRow(sessionFolder, task.id, {
393
+ status: 'skipped',
394
+ error: 'Dependency failed or skipped'
395
+ })
396
+ continue
397
+ }
398
+ executableCsvTasks.push(task)
399
+ }
400
+
401
+ // 4. Build prev_context for each csv-wave task
402
+ for (const task of executableCsvTasks) {
403
+ const contextIds = task.context_from.split(';').filter(Boolean)
404
+ const prevFindings = contextIds
405
+ .map(id => {
406
+ const prevRow = masterCsv.find(r => r.id === id)
407
+ if (prevRow && prevRow.status === 'completed' && prevRow.findings) {
408
+ return `[Task ${id}: ${prevRow.title}] ${prevRow.findings}`
409
+ }
410
+ return null
411
+ })
412
+ .filter(Boolean)
413
+ .join('\n')
414
+ task.prev_context = prevFindings || 'No previous context available'
415
+ }
416
+
417
+ // 5. Write wave CSV and execute csv-wave tasks
418
+ if (executableCsvTasks.length > 0) {
419
+ const waveHeader = 'id,title,description,role,angle,gc_round,deps,context_from,exec_mode,wave,prev_context'
420
+ const waveRows = executableCsvTasks.map(t =>
421
+ [t.id, t.title, t.description, t.role, t.angle, t.gc_round, t.deps, t.context_from, t.exec_mode, t.wave, t.prev_context]
422
+ .map(cell => `"${String(cell).replace(/"/g, '""')}"`)
423
+ .join(',')
424
+ )
425
+ Write(`${sessionFolder}/wave-${wave}.csv`, [waveHeader, ...waveRows].join('\n'))
426
+
427
+ const waveResult = spawn_agents_on_csv({
428
+ csv_path: `${sessionFolder}/wave-${wave}.csv`,
429
+ id_column: "id",
430
+ instruction: buildBrainstormInstruction(sessionFolder, wave),
431
+ max_concurrency: maxConcurrency,
432
+ max_runtime_seconds: 600,
433
+ output_csv_path: `${sessionFolder}/wave-${wave}-results.csv`,
434
+ output_schema: {
435
+ type: "object",
436
+ properties: {
437
+ id: { type: "string" },
438
+ status: { type: "string", enum: ["completed", "failed"] },
439
+ findings: { type: "string" },
440
+ gc_signal: { type: "string" },
441
+ severity_summary: { type: "string" },
442
+ error: { type: "string" }
443
+ },
444
+ required: ["id", "status", "findings"]
445
+ }
446
+ })
447
+ // Blocks until wave completes
448
+
449
+ // Merge results into master CSV
450
+ const waveResults = parseCsv(Read(`${sessionFolder}/wave-${wave}-results.csv`))
451
+ for (const result of waveResults) {
452
+ updateMasterCsvRow(sessionFolder, result.id, {
453
+ status: result.status,
454
+ findings: result.findings || '',
455
+ gc_signal: result.gc_signal || '',
456
+ severity_summary: result.severity_summary || '',
457
+ error: result.error || ''
458
+ })
459
+ if (result.status === 'failed') failedIds.add(result.id)
460
+ }
461
+
462
+ Bash(`rm -f "${sessionFolder}/wave-${wave}.csv"`)
463
+ }
464
+
465
+ // 6. Execute post-wave interactive tasks (GC controller)
466
+ for (const task of interactiveTasks) {
467
+ if (task.status !== 'pending') continue
468
+ const deps = task.deps.split(';').filter(Boolean)
469
+ if (deps.some(d => failedIds.has(d) || skippedIds.has(d))) {
470
+ skippedIds.add(task.id)
471
+ continue
472
+ }
473
+
474
+ // Spawn GC controller agent
475
+ const gcAgent = spawn_agent({
476
+ message: `
477
+ ## TASK ASSIGNMENT
478
+
479
+ ### MANDATORY FIRST STEPS (Agent Execute)
480
+ 1. **Read role definition**: ~ or <project>/.codex/skills/team-brainstorm/agents/gc-controller.md (MUST read first)
481
+ 2. Read: ${sessionFolder}/discoveries.ndjson (shared discoveries)
482
+
483
+ ---
484
+
485
+ Goal: Evaluate critique severity and decide revision vs convergence
486
+ Session: ${sessionFolder}
487
+ GC Round: ${gcRound}
488
+ Max GC Rounds: ${MAX_GC_ROUNDS}
489
+
490
+ ### Context
491
+ Read the latest critique file and determine the GC signal.
492
+ If REVISION_NEEDED and gcRound < maxRounds: output "REVISION"
493
+ If CONVERGED or gcRound >= maxRounds: output "CONVERGE"
494
+ `
495
+ })
496
+
497
+ const gcResult = wait({ ids: [gcAgent], timeout_ms: 120000 })
498
+ if (gcResult.timed_out) {
499
+ send_input({ id: gcAgent, message: "Please finalize your decision now." })
500
+ wait({ ids: [gcAgent], timeout_ms: 60000 })
501
+ }
502
+ close_agent({ id: gcAgent })
503
+
504
+ // Parse GC decision and potentially create/skip revision tasks
505
+ Write(`${sessionFolder}/interactive/${task.id}-result.json`, JSON.stringify({
506
+ task_id: task.id, status: "completed",
507
+ gc_decision: gcDecision, gc_round: gcRound,
508
+ timestamp: getUtc8ISOString()
509
+ }))
510
+
511
+ if (gcDecision === "CONVERGE") {
512
+ // Skip remaining GC tasks, mark revision tasks as skipped
513
+ // Unblock SYNTH directly
514
+ } else {
515
+ gcRound++
516
+ // Let the revision wave proceed naturally
517
+ }
518
+
519
+ updateMasterCsvRow(sessionFolder, task.id, { status: 'completed', findings: `GC decision: ${gcDecision}` })
520
+ }
521
+ }
522
+ ```
523
+
524
+ **Success Criteria**:
525
+ - All waves executed in order
526
+ - Both csv-wave and interactive tasks handled per wave
527
+ - Each wave's results merged into master CSV before next wave starts
528
+ - Dependent tasks skipped when predecessor failed
529
+ - discoveries.ndjson accumulated across all waves and mechanisms
530
+ - GC loop controlled with max 2 rounds
531
+
532
+ ---
533
+
534
+ ### Phase 3: Post-Wave Interactive
535
+
536
+ **Objective**: Handle any final GC loop convergence and prepare for synthesis.
537
+
538
+ If the pipeline used GC loops and the final GC decision was CONVERGE or max rounds reached, ensure SYNTH-001 is unblocked and all remaining GC-related tasks are properly marked.
539
+
540
+ **Success Criteria**:
541
+ - Post-wave interactive processing complete
542
+ - Interactive agents closed, results stored
543
+
544
+ ---
545
+
546
+ ### Phase 4: Results Aggregation
547
+
548
+ **Objective**: Generate final results and human-readable report.
549
+
550
+ ```javascript
551
+ const masterCsv = Read(`${sessionFolder}/tasks.csv`)
552
+ Write(`${sessionFolder}/results.csv`, masterCsv)
553
+
554
+ const tasks = parseCsv(masterCsv)
555
+ const completed = tasks.filter(t => t.status === 'completed')
556
+ const failed = tasks.filter(t => t.status === 'failed')
557
+ const skipped = tasks.filter(t => t.status === 'skipped')
558
+
559
+ const contextContent = `# Team Brainstorm Report
560
+
561
+ **Session**: ${sessionId}
562
+ **Topic**: ${topic}
563
+ **Pipeline**: ${pipeline_mode}
564
+ **Completed**: ${getUtc8ISOString()}
565
+
566
+ ---
567
+
568
+ ## Summary
569
+
570
+ | Metric | Count |
571
+ |--------|-------|
572
+ | Total Tasks | ${tasks.length} |
573
+ | Completed | ${completed.length} |
574
+ | Failed | ${failed.length} |
575
+ | Skipped | ${skipped.length} |
576
+ | GC Rounds | ${gcRound} |
577
+
578
+ ---
579
+
580
+ ## Wave Execution
581
+
582
+ ${waveDetails}
583
+
584
+ ---
585
+
586
+ ## Task Details
587
+
588
+ ${taskDetails}
589
+
590
+ ---
591
+
592
+ ## Brainstorm Artifacts
593
+
594
+ - Ideas: discoveries with type "idea" in discoveries.ndjson
595
+ - Critiques: discoveries with type "critique" in discoveries.ndjson
596
+ - Synthesis: discoveries with type "synthesis" in discoveries.ndjson
597
+ - Evaluation: discoveries with type "evaluation" in discoveries.ndjson
598
+ `
599
+
600
+ Write(`${sessionFolder}/context.md`, contextContent)
601
+ ```
602
+
603
+ If not AUTO_YES and there are failed tasks, offer retry or view report.
604
+
605
+ **Success Criteria**:
606
+ - results.csv exported (all tasks, both modes)
607
+ - context.md generated
608
+ - All interactive agents closed
609
+ - Summary displayed to user
610
+
611
+ ---
612
+
613
+ ## Shared Discovery Board Protocol
614
+
615
+ All agents across all waves share `discoveries.ndjson`. This enables cross-role knowledge sharing.
616
+
617
+ **Discovery Types**:
618
+
619
+ | Type | Dedup Key | Data Schema | Description |
620
+ |------|-----------|-------------|-------------|
621
+ | `idea` | `data.title` | `{title, angle, description, assumption, impact}` | Generated idea |
622
+ | `critique` | `data.idea_title` | `{idea_title, dimension, severity, challenge, rationale}` | Critique of an idea |
623
+ | `theme` | `data.name` | `{name, strength, supporting_ideas[]}` | Extracted theme from synthesis |
624
+ | `proposal` | `data.title` | `{title, source_ideas[], feasibility, innovation, description}` | Integrated proposal |
625
+ | `evaluation` | `data.proposal_title` | `{proposal_title, weighted_score, rank, recommendation}` | Proposal evaluation |
626
+ | `gc_decision` | `data.round` | `{round, signal, severity_counts}` | GC loop decision |
627
+
628
+ **Format**: NDJSON, each line is self-contained JSON:
629
+
630
+ ```jsonl
631
+ {"ts":"2026-03-08T10:00:00+08:00","worker":"IDEA-001","type":"idea","data":{"title":"API Gateway Pattern","angle":"Technical","description":"Centralized API gateway for microservice routing","assumption":"Services need unified entry point","impact":"Simplifies client integration"}}
632
+ {"ts":"2026-03-08T10:05:00+08:00","worker":"CHALLENGE-001","type":"critique","data":{"idea_title":"API Gateway Pattern","dimension":"feasibility","severity":"MEDIUM","challenge":"Single point of failure","rationale":"Requires high availability design"}}
633
+ ```
634
+
635
+ **Protocol Rules**:
636
+ 1. Read board before own work → leverage existing context
637
+ 2. Write discoveries immediately via `echo >>` don't batch
638
+ 3. Deduplicate check existing entries by type + dedup key
639
+ 4. Append-onlynever modify or delete existing lines
640
+
641
+ ---
642
+
643
+ ## Consensus Severity Routing
644
+
645
+ When the challenger returns critique results with severity-graded verdicts:
646
+
647
+ | Severity | Action |
648
+ |----------|--------|
649
+ | HIGH | Trigger revision round (GC loop), max 2 rounds total |
650
+ | MEDIUM | Log warning, continue pipeline |
651
+ | LOW | Treat as consensus reached |
652
+
653
+ **Constraints**: Max 2 GC rounds (revision cycles). If still HIGH after 2 rounds, force convergence to synthesizer.
654
+
655
+ ---
656
+
657
+ ## Error Handling
658
+
659
+ | Error | Resolution |
660
+ |-------|------------|
661
+ | Circular dependency | Detect in wave computation, abort with error message |
662
+ | CSV agent timeout | Mark as failed in results, continue with wave |
663
+ | CSV agent failed | Mark as failed, skip dependent tasks in later waves |
664
+ | Interactive agent timeout | Urge convergence via send_input, then close if still timed out |
665
+ | Interactive agent failed | Mark as failed, skip dependents |
666
+ | All agents in wave failed | Log error, offer retry or abort |
667
+ | CSV parse error | Validate CSV format before execution, show line number |
668
+ | discoveries.ndjson corrupt | Ignore malformed lines, continue with valid entries |
669
+ | GC loop exceeds 2 rounds | Force convergence to synthesizer |
670
+ | No ideas generated | Report failure, suggest refining topic |
671
+ | Continue mode: no session found | List available sessions, prompt user to select |
672
+
673
+ ---
674
+
675
+ ## Core Rules
676
+
677
+ 1. **Start Immediately**: First action is session initialization, then Phase 0/1
678
+ 2. **Wave Order is Sacred**: Never execute wave N before wave N-1 completes and results are merged
679
+ 3. **CSV is Source of Truth**: Master tasks.csv holds all state (both csv-wave and interactive)
680
+ 4. **CSV First**: Default to csv-wave for tasks; only use interactive when interaction pattern requires it
681
+ 5. **Context Propagation**: prev_context built from master CSV, not from memory
682
+ 6. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson — both mechanisms share it
683
+ 7. **Skip on Failure**: If a dependency failed, skip the dependent task (regardless of mechanism)
684
+ 8. **Lifecycle Balance**: Every spawn_agent MUST have a matching close_agent
685
+ 9. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
686
+ 10. **DO NOT STOP**: Continuous execution until all waves complete or all remaining tasks are skipped
687
+
688
+
689
+ ---
690
+
691
+ ## Coordinator Role Constraints (Main Agent)
692
+
693
+ **CRITICAL**: The coordinator (main agent executing this skill) is responsible for **orchestration only**, NOT implementation.
694
+
695
+ 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:
696
+ - Spawns agents with task assignments
697
+ - Waits for agent callbacks
698
+ - Merges results and coordinates workflow
699
+ - Manages workflow transitions between phases
700
+
701
+ 16. **Patient Waiting is Mandatory**: Agent execution takes significant time (typically 10-30 minutes per phase, sometimes longer). The coordinator MUST:
702
+ - Wait patiently for `wait()` calls to complete
703
+ - NOT skip workflow steps due to perceived delays
704
+ - NOT assume agents have failed just because they're taking time
705
+ - Trust the timeout mechanisms defined in the skill
706
+
707
+ 17. **Use send_input for Clarification**: When agents need guidance or appear stuck, the coordinator MUST:
708
+ - Use `send_input()` to ask questions or provide clarification
709
+ - NOT skip the agent or move to next phase prematurely
710
+ - Give agents opportunity to respond before escalating
711
+ - Example: `send_input({ id: agent_id, message: "Please provide status update or clarify blockers" })`
712
+
713
+ 18. **No Workflow Shortcuts**: The coordinator MUST NOT:
714
+ - Skip phases or stages defined in the workflow
715
+ - Bypass required approval or review steps
716
+ - Execute dependent tasks before prerequisites complete
717
+ - Assume task completion without explicit agent callback
718
+ - Make up or fabricate agent results
719
+
720
+ 19. **Respect Long-Running Processes**: This is a complex multi-agent workflow that requires patience:
721
+ - Total execution time may range from 30-90 minutes or longer
722
+ - Each phase may take 10-30 minutes depending on complexity
723
+ - The coordinator must remain active and attentive throughout the entire process
724
+ - Do not terminate or skip steps due to time concerns