claude-code-workflow 7.2.21 → 7.2.22

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.
@@ -1,56 +1,105 @@
1
1
  ---
2
2
  name: brainstorm-with-file
3
- description: Interactive brainstorming with parallel subagent collaboration, idea expansion, and documented thought evolution. Parallel multi-perspective analysis for Codex.
3
+ description: Interactive brainstorming with documented thought evolution, multi-perspective analysis, and iterative refinement. Serial execution with no agent delegation.
4
4
  argument-hint: "TOPIC=\"<idea or topic>\" [--perspectives=creative,pragmatic,systematic] [--max-ideas=<n>]"
5
5
  ---
6
6
 
7
- # Codex Brainstorm-With-File Workflow
7
+ # Codex Brainstorm-With-File Prompt
8
8
 
9
- ## Quick Start
9
+ ## Overview
10
10
 
11
- Interactive brainstorming workflow with **documented thought evolution**. Expands initial ideas through questioning, **parallel subagent analysis**, and iterative refinement.
11
+ Interactive brainstorming workflow with **documented thought evolution**. Expands initial ideas through questioning, inline multi-perspective analysis, and iterative refinement.
12
12
 
13
- **Core workflow**: Seed Idea → Expand → Parallel Subagent Explore → Synthesize → Refine → Crystallize
13
+ **Core workflow**: Seed Idea → Expand → Multi-Perspective Explore → Synthesize → Refine → Crystallize
14
14
 
15
15
  **Key features**:
16
16
  - **brainstorm.md**: Complete thought evolution timeline
17
- - **Parallel multi-perspective**: Creative + Pragmatic + Systematic (concurrent subagents)
17
+ - **Multi-perspective analysis**: Creative + Pragmatic + Systematic (serial, inline)
18
18
  - **Idea expansion**: Progressive questioning and exploration
19
19
  - **Diverge-Converge cycles**: Generate options then focus on best paths
20
20
 
21
- **Codex-Specific Features**:
22
- - Parallel subagent execution via `spawn_agent` + batch `wait({ ids: [...] })`
23
- - Role loading via TOML agent definition (agent_type parameter in spawn_agent)
24
- - Deep interaction with `send_input` for multi-round refinement within single agent
25
- - Explicit lifecycle management with `close_agent`
21
+ ## Auto Mode
26
22
 
27
- ## Overview
23
+ When `--yes` or `-y`: Auto-confirm exploration decisions, use recommended perspectives, skip interactive scoping.
28
24
 
29
- This workflow enables iterative exploration and refinement of ideas through parallel-capable phases:
25
+ ## Quick Start
30
26
 
31
- 1. **Seed Understanding** - Parse the initial idea and identify exploration vectors
32
- 2. **Divergent Exploration** - Gather codebase context and execute parallel multi-perspective analysis
33
- 3. **Interactive Refinement** - Multi-round idea selection, deep-dive, and refinement via send_input
34
- 4. **Convergence & Crystallization** - Synthesize final ideas and generate recommendations
27
+ ```bash
28
+ # Basic usage
29
+ /codex:brainstorm-with-file TOPIC="How to improve developer onboarding experience"
35
30
 
36
- The key innovation is **documented thought evolution** that captures how ideas develop, perspectives differ, and insights emerge across all phases.
31
+ # With perspective selection
32
+ /codex:brainstorm-with-file TOPIC="New caching strategy" --perspectives=creative,pragmatic,systematic
37
33
 
38
- ## Output Structure
34
+ # Continue existing session
35
+ /codex:brainstorm-with-file TOPIC="caching strategy" --continue
39
36
 
37
+ # Auto mode (skip confirmations)
38
+ /codex:brainstorm-with-file -y TOPIC="Plugin architecture ideas"
40
39
  ```
41
- {projectRoot}/.workflow/.brainstorm/BS-{slug}-{date}/
42
- ├── brainstorm.md # ⭐ Complete thought evolution timeline
43
- ├── exploration-codebase.json # Phase 2: Codebase context
44
- ├── perspectives/ # Phase 2: Individual perspective outputs
45
- │ ├── creative.json
46
- │ ├── pragmatic.json
47
- │ └── systematic.json
48
- ├── perspectives.json # Phase 2: Aggregated parallel findings with synthesis
49
- ├── synthesis.json # Phase 4: Final synthesis
50
- └── ideas/ # Phase 3: Individual idea deep-dives
51
- ├── idea-1.md
52
- ├── idea-2.md
53
- └── merged-idea-1.md
40
+
41
+ ## Target Topic
42
+
43
+ **$TOPIC**
44
+
45
+ ## Configuration
46
+
47
+ | Flag | Default | Description |
48
+ |------|---------|-------------|
49
+ | `-y, --yes` | false | Auto-confirm all decisions |
50
+ | `--continue` | false | Continue existing session |
51
+ | `--perspectives` | creative,pragmatic,systematic | Comma-separated perspective list |
52
+ | `--max-ideas` | 15 | Maximum ideas to track |
53
+
54
+ **Session ID format**: `BS-{slug}-{YYYY-MM-DD}`
55
+ - slug: lowercase, alphanumeric + CJK characters, max 40 chars
56
+ - date: YYYY-MM-DD (UTC+8)
57
+ - Auto-detect continue: session folder + brainstorm.md exists → continue mode
58
+
59
+ ## Brainstorm Flow
60
+
61
+ ```
62
+ Step 0: Session Setup
63
+ ├─ Parse topic, flags (--perspectives, --continue, -y)
64
+ ├─ Generate session ID: BS-{slug}-{date}
65
+ └─ Create session folder (or detect existing → continue mode)
66
+
67
+ Step 1: Seed Understanding
68
+ ├─ Parse topic, identify brainstorm dimensions
69
+ ├─ Role/perspective selection with user (or auto)
70
+ ├─ Initial scoping (mode, focus areas, constraints)
71
+ ├─ Expand seed into exploration vectors
72
+ └─ Initialize brainstorm.md
73
+
74
+ Step 2: Divergent Exploration (Inline, No Agents)
75
+ ├─ Detect codebase → search relevant modules, patterns
76
+ │ ├─ Run `ccw spec load --category exploration` (if spec system available)
77
+ │ └─ Use Grep, Glob, Read, mcp__ace-tool__search_context
78
+ ├─ Multi-perspective analysis (serial, inline)
79
+ │ ├─ Creative perspective: innovation, cross-domain, challenge assumptions
80
+ │ ├─ Pragmatic perspective: feasibility, effort, blockers
81
+ │ └─ Systematic perspective: decomposition, patterns, scalability
82
+ ├─ Aggregate findings → perspectives.json
83
+ ├─ Update brainstorm.md with Round 1
84
+ └─ Initial Idea Coverage Check
85
+
86
+ Step 3: Interactive Refinement (Multi-Round, max 6)
87
+ ├─ Present current ideas and perspectives
88
+ ├─ Gather user feedback
89
+ ├─ Process response:
90
+ │ ├─ Deep Dive → deeper inline analysis on selected ideas
91
+ │ ├─ Diverge → new inline analysis with different angles
92
+ │ ├─ Challenge → devil's advocate inline analysis
93
+ │ ├─ Merge → synthesize complementary ideas inline
94
+ │ └─ Converge → exit loop for synthesis
95
+ ├─ Update brainstorm.md with round details
96
+ └─ Repeat until user selects converge or max rounds
97
+
98
+ Step 4: Convergence & Crystallization
99
+ ├─ Consolidate all insights → synthesis.json
100
+ ├─ Update brainstorm.md with final synthesis
101
+ ├─ Interactive Top-Idea Review (per-idea confirm/modify/reject)
102
+ └─ Offer options: show next-step commands / export / done
54
103
  ```
55
104
 
56
105
  ## Output Artifacts
@@ -67,16 +116,17 @@ The key innovation is **documented thought evolution** that captures how ideas d
67
116
  | Artifact | Purpose |
68
117
  |----------|---------|
69
118
  | `exploration-codebase.json` | Codebase context: relevant files, patterns, architecture constraints |
70
- | `perspectives/*.json` | Individual perspective outputs from parallel subagents |
71
- | `perspectives.json` | Aggregated parallel findings with synthesis (convergent/conflicting themes) |
72
- | Updated `brainstorm.md` | Round 2: Exploration results and multi-perspective analysis |
119
+ | `perspectives/*.json` | Individual perspective outputs (creative, pragmatic, systematic) |
120
+ | `perspectives.json` | Aggregated findings with synthesis (convergent/conflicting themes) |
121
+ | Updated `brainstorm.md` | Round 1: Exploration results and multi-perspective analysis |
73
122
 
74
123
  ### Phase 3: Interactive Refinement
75
124
 
76
125
  | Artifact | Purpose |
77
126
  |----------|---------|
78
127
  | `ideas/{idea-slug}.md` | Deep-dive analysis for selected ideas |
79
- | Updated `brainstorm.md` | Round 3-6: User feedback, idea selections, refinement cycles |
128
+ | `ideas/merged-idea-{n}.md` | Merged idea documents |
129
+ | Updated `brainstorm.md` | Round 2-6: User feedback, idea selections, refinement cycles |
80
130
 
81
131
  ### Phase 4: Convergence & Crystallization
82
132
 
@@ -87,68 +137,97 @@ The key innovation is **documented thought evolution** that captures how ideas d
87
137
 
88
138
  ---
89
139
 
90
- ## Implementation Details
140
+ ## Recording Protocol
91
141
 
92
- ### Session Initialization
142
+ **CRITICAL**: During brainstorming, the following situations **MUST** trigger immediate recording to brainstorm.md:
93
143
 
94
- ##### Step 0: Determine Project Root
144
+ | Trigger | What to Record | Target Section |
145
+ |---------|---------------|----------------|
146
+ | **Idea generated** | Idea content, source perspective, novelty/feasibility ratings | `#### Ideas Generated` |
147
+ | **Perspective shift** | Old framing → new framing, trigger reason | `#### Decision Log` |
148
+ | **User feedback** | User's original input, which ideas selected/rejected | `#### User Input` |
149
+ | **Assumption challenged** | Original assumption → challenge result, survivability | `#### Challenged Assumptions` |
150
+ | **Ideas merged** | Source ideas, merged concept, what was preserved/discarded | `#### Decision Log` |
151
+ | **Scope adjustment** | Before/after scope, trigger reason | `#### Decision Log` |
95
152
 
96
- 检测项目根目录,确保 `.workflow/` 产物位置正确:
153
+ ### Decision Record Format
97
154
 
98
- ```bash
99
- PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
155
+ ```markdown
156
+ > **Decision**: [Description of the decision]
157
+ > - **Context**: [What triggered this decision]
158
+ > - **Options considered**: [Alternatives evaluated]
159
+ > - **Chosen**: [Selected approach] — **Reason**: [Rationale]
160
+ > - **Rejected**: [Why other options were discarded]
161
+ > - **Impact**: [Effect on brainstorming direction]
100
162
  ```
101
163
 
102
- 优先通过 git 获取仓库根目录;非 git 项目回退到 `pwd` 取当前绝对路径。
103
- 存储为 `{projectRoot}`,后续所有 `.workflow/` 路径必须以此为前缀。
104
-
105
- The workflow automatically generates a unique session identifier and directory structure based on the topic and current date (UTC+8).
164
+ ### Narrative Synthesis Format
106
165
 
107
- **Session ID Format**: `BS-{slug}-{date}`
108
- - `slug`: Lowercase alphanumeric + Chinese characters, max 40 chars
109
- - `date`: YYYY-MM-DD format (UTC+8)
166
+ Append after each round update:
110
167
 
111
- **Session Directory**: `{projectRoot}/.workflow/.brainstorm/{sessionId}/`
168
+ ```markdown
169
+ ### Round N: Narrative Synthesis
170
+ **Starting point**: Based on previous round's [conclusions/questions], this round explored [starting point].
171
+ **Key progress**: [New ideas/findings] [confirmed/refuted/expanded] previous understanding of [topic area].
172
+ **Decision impact**: User selected [feedback type], directing brainstorming toward [adjusted/deepened/maintained].
173
+ **Current state**: After this round, top ideas are [updated idea rankings].
174
+ **Open directions**: [remaining exploration angles for next round]
175
+ ```
112
176
 
113
- **Auto-Detection**: If session folder exists with brainstorm.md, automatically enters continue mode. Otherwise, creates new session.
177
+ ## Implementation Details
114
178
 
115
- **Brainstorm Modes**:
116
- - `creative`: Emphasize novelty and innovation, relaxed constraints
117
- - `structured`: Balance creativity with feasibility, realistic scope
118
- - `balanced`: Default, moderate innovation with practical considerations
179
+ ### Phase 0: Session Initialization
119
180
 
120
- ---
181
+ ```javascript
182
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
183
+
184
+ // Parse flags
185
+ const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
186
+ const continueMode = $ARGUMENTS.includes('--continue')
187
+ const perspectivesMatch = $ARGUMENTS.match(/--perspectives[=\s]([\w,]+)/)
188
+ const selectedPerspectiveNames = perspectivesMatch
189
+ ? perspectivesMatch[1].split(',')
190
+ : ['creative', 'pragmatic', 'systematic']
191
+
192
+ // Extract topic
193
+ const topic = $ARGUMENTS.replace(/--yes|-y|--continue|--perspectives[=\s][\w,]+|--max-ideas[=\s]\d+|TOPIC=/g, '').replace(/^["']|["']$/g, '').trim()
194
+
195
+ // Determine project root
196
+ const projectRoot = Bash('git rev-parse --show-toplevel 2>/dev/null || pwd').trim()
197
+
198
+ const slug = topic.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
199
+ const dateStr = getUtc8ISOString().substring(0, 10)
200
+ const sessionId = `BS-${slug}-${dateStr}`
201
+ const sessionFolder = `${projectRoot}/.workflow/.brainstorm/${sessionId}`
202
+
203
+ // Auto-detect continue: session folder + brainstorm.md exists → continue mode
204
+ // If continue → load brainstorm.md + perspectives, resume from last round
205
+ Bash(`mkdir -p ${sessionFolder}`)
206
+ ```
121
207
 
122
- ## Phase 1: Seed Understanding
208
+ ### Phase 1: Seed Understanding
123
209
 
124
210
  **Objective**: Parse the initial idea, identify exploration vectors, scope preferences, and initialize the brainstorm document.
125
211
 
126
- ### Step 1.1: Parse Seed & Identify Dimensions
127
-
128
- The workflow analyzes the topic text against predefined brainstorm dimensions.
212
+ ##### Step 1.1: Parse Seed & Identify Dimensions
129
213
 
130
- **Brainstorm Dimensions**:
214
+ Match topic keywords against brainstorm dimensions (see [Dimensions Reference](#brainstorm-dimensions)):
131
215
 
132
- | Dimension | Keywords |
133
- |-----------|----------|
134
- | technical | 技术, technical, implementation, code, 实现, architecture |
135
- | ux | 用户, user, experience, UX, UI, 体验, interaction |
136
- | business | 业务, business, value, ROI, 价值, market |
137
- | innovation | 创新, innovation, novel, creative, 新颖 |
138
- | feasibility | 可行, feasible, practical, realistic, 实际 |
139
- | scalability | 扩展, scale, growth, performance, 性能 |
140
- | security | 安全, security, risk, protection, 风险 |
141
-
142
- **Matching Logic**: Compare topic text against keyword lists to identify relevant dimensions.
216
+ ```javascript
217
+ // Match topic text against keyword lists from Dimensions Reference
218
+ // If multiple dimensions match, include all
219
+ // If none match, default to "technical" and "innovation"
220
+ const dimensions = identifyDimensions(topic, BRAINSTORM_DIMENSIONS)
221
+ ```
143
222
 
144
- ### Step 1.2: Role Selection
223
+ ##### Step 1.2: Role Selection
145
224
 
146
225
  Recommend roles based on topic keywords, then let user confirm or override.
147
226
 
148
227
  **Professional Roles** (recommended based on topic keywords):
149
228
 
150
- | Role | Perspective Agent Focus | Keywords |
151
- |------|------------------------|----------|
229
+ | Role | Perspective Focus | Keywords |
230
+ |------|------------------|----------|
152
231
  | system-architect | Architecture, patterns | 架构, architecture, system, 系统, design pattern |
153
232
  | product-manager | Business value, roadmap | 产品, product, feature, 功能, roadmap |
154
233
  | ui-designer | Visual design, interaction | UI, 界面, interface, visual, 视觉 |
@@ -157,7 +236,7 @@ Recommend roles based on topic keywords, then let user confirm or override.
157
236
  | test-strategist | Quality, testing | 测试, test, quality, 质量, QA |
158
237
  | subject-matter-expert | Domain knowledge | 领域, domain, industry, 行业, expert |
159
238
 
160
- **Simple Perspectives** (fallback - always available):
239
+ **Simple Perspectives** (fallback always available):
161
240
 
162
241
  | Perspective | Focus | Best For |
163
242
  |-------------|-------|----------|
@@ -170,30 +249,56 @@ Recommend roles based on topic keywords, then let user confirm or override.
170
249
  2. **Manual mode**: Present recommended roles + "Use simple perspectives" option
171
250
  3. **Continue mode**: Use roles from previous session
172
251
 
173
- ### Step 1.3: Initial Scoping (New Session Only)
252
+ ##### Step 1.3: Initial Scoping (New Session Only)
174
253
 
175
- For new brainstorm sessions, gather user preferences before exploration.
254
+ For new brainstorm sessions, gather user preferences before exploration (skipped in auto mode or continue mode):
176
255
 
177
- **Brainstorm Mode** (Single-select):
178
- - 创意模式 (Creative mode - 15-20 minutes, 1 subagent)
179
- - 平衡模式 (Balanced mode - 30-60 minutes, 3 parallel subagents)
180
- - 深度模式 (Deep mode - 1-2+ hours, 3 parallel subagents + deep refinement)
256
+ ```javascript
257
+ if (!autoYes && !continueMode) {
258
+ // 1. Brainstorm Mode (single-select)
259
+ const mode = request_user_input({
260
+ questions: [{
261
+ header: "Brainstorm Mode",
262
+ id: "mode",
263
+ question: "Select brainstorming intensity:",
264
+ options: [
265
+ { label: "Creative Mode", description: "Fast, high novelty, 1 perspective" },
266
+ { label: "Balanced Mode(Recommended)", description: "Moderate, 3 perspectives" },
267
+ { label: "Deep Mode", description: "Comprehensive, 3 perspectives + deep refinement" }
268
+ ]
269
+ }]
270
+ })
181
271
 
182
- **Focus Areas** (Multi-select):
183
- - 技术方案 (Technical solutions)
184
- - 用户体验 (User experience)
185
- - 创新突破 (Innovation breakthroughs)
186
- - 可行性评估 (Feasibility assessment)
272
+ // 2. Focus Areas (multi-select)
273
+ const focusAreas = request_user_input({
274
+ questions: [{
275
+ header: "Focus Areas",
276
+ id: "focus",
277
+ question: "Select brainstorming focus:",
278
+ options: generateFocusOptions(dimensions) // Dynamic based on dimensions
279
+ }]
280
+ })
187
281
 
188
- **Constraints** (Multi-select):
189
- - 现有架构 (Existing architecture constraints)
190
- - 时间限制 (Time constraints)
191
- - 资源限制 (Resource constraints)
192
- - 无约束 (No constraints)
282
+ // 3. Constraints (multi-select)
283
+ const constraints = request_user_input({
284
+ questions: [{
285
+ header: "Constraints",
286
+ id: "constraints",
287
+ question: "Any constraints to consider?",
288
+ options: [
289
+ { label: "Existing Architecture", description: "Must fit current system" },
290
+ { label: "Time Constraints", description: "Short implementation timeline" },
291
+ { label: "Resource Constraints", description: "Limited team/budget" },
292
+ { label: "No Constraints", description: "Blue-sky thinking" }
293
+ ]
294
+ }]
295
+ })
296
+ }
297
+ ```
193
298
 
194
- ### Step 1.4: Expand Seed into Exploration Vectors
299
+ ##### Step 1.4: Expand Seed into Exploration Vectors
195
300
 
196
- Generate key questions that guide the brainstorming exploration. Use a subagent for vector generation.
301
+ Generate key questions that guide the brainstorming exploration. Done inline no agent delegation.
197
302
 
198
303
  **Exploration Vectors**:
199
304
  1. **Core question**: What is the fundamental problem/opportunity?
@@ -204,578 +309,368 @@ Generate key questions that guide the brainstorming exploration. Use a subagent
204
309
  6. **Innovation angle**: What would make this 10x better?
205
310
  7. **Integration**: How does this fit with existing systems/processes?
206
311
 
207
- **Subagent for Vector Generation**:
312
+ Analyze the topic inline against user focus areas and constraints to produce 5-7 exploration vectors.
313
+
314
+ ##### Step 1.5: Initialize brainstorm.md
208
315
 
209
316
  ```javascript
210
- const vectorAgent = spawn_agent({
211
- agent_type: "cli_explore_agent",
212
- message: `
213
- ## TASK ASSIGNMENT
317
+ const brainstormMd = `# Brainstorm Session
214
318
 
215
- ---
319
+ **Session ID**: ${sessionId}
320
+ **Topic**: ${topic}
321
+ **Started**: ${getUtc8ISOString()}
322
+ **Dimensions**: ${dimensions.join(', ')}
323
+ **Mode**: ${brainstormMode}
216
324
 
217
- ## Context
218
- Topic: ${idea_or_topic}
219
- User focus areas: ${userFocusAreas.join(', ')}
220
- Constraints: ${constraints.join(', ')}
221
-
222
- ## Task
223
- Generate 5-7 exploration vectors (questions/directions) to expand this idea:
224
- 1. Core question: What is the fundamental problem/opportunity?
225
- 2. User perspective: Who benefits and how?
226
- 3. Technical angle: What enables this technically?
227
- 4. Alternative approaches: What other ways could this be solved?
228
- 5. Challenges: What could go wrong or block success?
229
- 6. Innovation angle: What would make this 10x better?
230
- 7. Integration: How does this fit with existing systems/processes?
231
-
232
- ## Deliverables
233
- Return structured exploration vectors for multi-perspective analysis.
234
- `
235
- })
325
+ ## Table of Contents
326
+ <!-- TOC: Auto-updated after each round/phase. -->
327
+ - [Session Context](#session-context)
328
+ - [Current Ideas](#current-ideas)
329
+ - [Thought Evolution Timeline](#thought-evolution-timeline)
236
330
 
237
- const result = wait({ ids: [vectorAgent], timeout_ms: 120000 })
238
- close_agent({ id: vectorAgent })
239
- ```
240
-
241
- **Purpose**: These vectors guide each perspective subagent's analysis and ensure comprehensive exploration.
331
+ ## Current Ideas
332
+ <!-- REPLACEABLE BLOCK: Overwrite (not append) after each round with latest ranked ideas. -->
242
333
 
243
- ### Step 1.5: Initialize brainstorm.md
334
+ > To be populated after exploration.
244
335
 
245
- Create the main brainstorm document with session metadata and expansion content.
336
+ ## Session Context
337
+ - Focus areas: ${focusAreas.join(', ')}
338
+ - Perspectives: ${selectedPerspectiveNames.join(', ')}
339
+ - Constraints: ${constraints.join(', ')}
340
+ - Mode: ${brainstormMode}
246
341
 
247
- **brainstorm.md Structure**:
248
- - **Header**: Session ID, topic, start time, brainstorm mode, dimensions
249
- - **Initial Context**: Focus areas, depth level, constraints
250
- - **Roles**: Selected roles (professional or simple perspectives)
251
- - **Seed Expansion**: Original idea + exploration vectors
252
- - **Thought Evolution Timeline**: Round-by-round findings
253
- - **Current Ideas**: To be populated after exploration
342
+ ## Exploration Vectors
343
+ ${explorationVectors.map((v, i) => `${i+1}. ${v}`).join('\n')}
254
344
 
255
- **Success Criteria**:
256
- - Session folder created successfully
257
- - brainstorm.md initialized with all metadata
258
- - 1-3 roles selected (professional or simple perspectives)
259
- - Brainstorm mode and dimensions identified
260
- - Exploration vectors generated
261
- - User preferences captured
345
+ ## Initial Decisions
346
+ > Record why these perspectives and focus areas were selected.
262
347
 
263
348
  ---
264
349
 
265
- ## Phase 2: Divergent Exploration
350
+ ## Thought Evolution Timeline
266
351
 
267
- **Objective**: Gather codebase context and execute parallel multi-perspective analysis via subagents to generate diverse viewpoints.
352
+ > Rounds will be appended below as brainstorming progresses.
268
353
 
269
- **Execution Model**: Parallel subagent execution - spawn 3 perspective agents simultaneously, batch wait for all results, then aggregate.
354
+ ---
270
355
 
271
- **Key API Pattern**:
272
- ```
273
- spawn_agent × 3 wait({ ids: [...] }) aggregate → close_agent × 3
356
+ ## Decision Trail
357
+
358
+ > Consolidated critical decisions across all rounds (populated in Phase 4).
359
+ `
360
+ Write(`${sessionFolder}/brainstorm.md`, brainstormMd)
274
361
  ```
275
362
 
276
- ### Step 2.1: Codebase Context Gathering
363
+ **Success Criteria**:
364
+ - Session folder created with brainstorm.md initialized
365
+ - Brainstorm dimensions identified and user preferences captured
366
+ - **Initial decisions recorded**: Perspective selection rationale, excluded options with reasons
367
+ - Exploration vectors generated
368
+ - 1-3 perspectives selected
277
369
 
278
- Use built-in tools to understand the codebase structure before spawning perspective agents.
370
+ ### Phase 2: Divergent Exploration
279
371
 
280
- **Context Gathering Activities**:
281
- 1. **Get project structure** - Execute `ccw tool exec get_modules_by_depth '{}'`
282
- 2. **Search for related code** - Use Grep/Glob to find files matching topic keywords
283
- 3. **Read project tech context** - Run `ccw spec load --category "exploration planning"` if spec system available
284
- 4. **Analyze patterns** - Identify common code patterns and architecture decisions
372
+ **Objective**: Gather codebase context and execute multi-perspective analysis to generate diverse viewpoints. All exploration done inline — no agent delegation.
285
373
 
286
- **exploration-codebase.json Structure**:
287
- - `relevant_files[]`: Files related to the topic with relevance indicators
288
- - `existing_patterns[]`: Common code patterns and architectural styles
289
- - `architecture_constraints[]`: Project-level constraints
290
- - `integration_points[]`: Key integration patterns between modules
291
- - `_metadata`: Timestamp and context information
374
+ ##### Step 2.1: Detect Codebase & Explore
292
375
 
293
- ### Step 2.2: Parallel Multi-Perspective Analysis
376
+ ```javascript
377
+ const hasCodebase = Bash(`
378
+ test -f package.json && echo "nodejs" ||
379
+ test -f go.mod && echo "golang" ||
380
+ test -f Cargo.toml && echo "rust" ||
381
+ test -f pyproject.toml && echo "python" ||
382
+ test -f pom.xml && echo "java" ||
383
+ test -d src && echo "generic" ||
384
+ echo "none"
385
+ `).trim()
386
+
387
+ if (hasCodebase !== 'none') {
388
+ // 1. Read project metadata (if exists)
389
+ // - Run `ccw spec load --category exploration` (load project specs)
390
+ // - Run `ccw spec load --category debug` (known issues and root-cause notes)
391
+ // - .workflow/specs/*.md (project conventions)
392
+
393
+ // 2. Search codebase for relevant content
394
+ // Use: Grep, Glob, Read, or mcp__ace-tool__search_context
395
+ // Focus on: modules/components, patterns/structure, integration points, config/dependencies
396
+
397
+ // 3. Write findings
398
+ Write(`${sessionFolder}/exploration-codebase.json`, JSON.stringify({
399
+ project_type: hasCodebase,
400
+ relevant_files: [...], // [{path, relevance, summary}]
401
+ existing_patterns: [...], // [{pattern, files, description}]
402
+ architecture_constraints: [...], // Constraints found
403
+ integration_points: [...], // [{location, description}]
404
+ key_findings: [...], // Main insights from code search
405
+ _metadata: { timestamp: getUtc8ISOString(), exploration_scope: '...' }
406
+ }, null, 2))
407
+ }
408
+ ```
294
409
 
295
- **⚠️ IMPORTANT**: Role files are NOT read by main process. Pass path in message, agent reads itself.
410
+ ##### Step 2.2: Multi-Perspective Analysis (Serial, Inline)
296
411
 
297
- Spawn 3 perspective agents in parallel: Creative + Pragmatic + Systematic.
412
+ Analyze from each selected perspective. All analysis done inline by the AI — no agents.
298
413
 
299
414
  **Perspective Definitions**:
300
415
 
301
- | Perspective | Role File | Focus |
302
- |-------------|-----------|-------|
303
- | Creative | `cli_explore_agent` | Innovation, cross-domain inspiration, challenging assumptions |
304
- | Pragmatic | `cli_explore_agent` | Implementation feasibility, effort estimates, blockers |
305
- | Systematic | `cli_explore_agent` | Problem decomposition, patterns, scalability |
416
+ | Perspective | Focus | Tasks |
417
+ |-------------|-------|-------|
418
+ | Creative | Innovation, cross-domain | Think beyond obvious, explore cross-domain inspiration, challenge assumptions, generate moonshot ideas |
419
+ | Pragmatic | Implementation reality | Evaluate feasibility, identify existing patterns/libraries, estimate complexity, highlight blockers |
420
+ | Systematic | Architecture thinking | Decompose problem, identify architectural patterns, map dependencies, consider scalability |
306
421
 
307
- **Parallel Subagent Execution**:
422
+ **Serial execution** — analyze each perspective sequentially:
308
423
 
309
424
  ```javascript
310
- // Build shared context from codebase exploration
311
- const explorationContext = `
312
- CODEBASE CONTEXT:
313
- - Key files: ${explorationResults.relevant_files.slice(0,5).map(f => f.path).join(', ')}
314
- - Existing patterns: ${explorationResults.existing_patterns.slice(0,3).join(', ')}
315
- - Architecture constraints: ${explorationResults.architecture_constraints.slice(0,3).join(', ')}`
316
-
317
- // Define perspectives
318
- const perspectives = [
319
- {
320
- name: 'creative',
321
- focus: 'Innovation and novelty',
322
- tasks: [
323
- 'Think beyond obvious solutions - what would be surprising/delightful?',
324
- 'Explore cross-domain inspiration',
325
- 'Challenge assumptions - what if the opposite were true?',
326
- 'Generate moonshot ideas alongside practical ones'
327
- ]
328
- },
329
- {
330
- name: 'pragmatic',
331
- focus: 'Implementation reality',
332
- tasks: [
333
- 'Evaluate technical feasibility of core concept',
334
- 'Identify existing patterns/libraries that could help',
335
- 'Estimate implementation complexity',
336
- 'Highlight potential technical blockers'
337
- ]
338
- },
339
- {
340
- name: 'systematic',
341
- focus: 'Architecture thinking',
342
- tasks: [
343
- 'Decompose the problem into sub-problems',
344
- 'Identify architectural patterns that apply',
345
- 'Map dependencies and interactions',
346
- 'Consider scalability implications'
347
- ]
348
- }
349
- ]
350
-
351
- // Parallel spawn - all agents start immediately
352
- const agentIds = perspectives.map(perspective => {
353
- return spawn_agent({
354
- agent_type: "cli_explore_agent",
355
- message: `
356
- ## TASK ASSIGNMENT
357
-
358
- ### MANDATORY FIRST STEPS (Agent Execute)
359
- 1. Run: `ccw spec load --category "exploration planning"`
360
- 2. Read project tech context from loaded specs
361
-
362
- ---
363
-
364
- ## Brainstorm Context
365
- Topic: ${idea_or_topic}
366
- Perspective: ${perspective.name} - ${perspective.focus}
367
- Session: ${sessionFolder}
368
-
369
- ${explorationContext}
370
-
371
- ## ${perspective.name.toUpperCase()} Perspective Tasks
372
- ${perspective.tasks.map(t => `• ${t}`).join('\n')}
373
-
374
- ## Deliverables
375
- Write findings to: ${sessionFolder}/perspectives/${perspective.name}.json
376
-
377
- Schema: {
378
- perspective: "${perspective.name}",
379
- ideas: [{ title, description, novelty, feasibility, rationale }],
380
- key_findings: [],
381
- challenged_assumptions: [],
382
- open_questions: [],
383
- _metadata: { perspective, timestamp }
384
- }
385
-
386
- ## Success Criteria
387
- - [ ] Role definition read
388
- - [ ] 3-5 ideas generated with ratings
389
- - [ ] Key findings documented
390
- - [ ] JSON output follows schema
391
- `
392
- })
393
- })
394
-
395
- // Batch wait - TRUE PARALLELISM (key Codex advantage)
396
- const results = wait({
397
- ids: agentIds,
398
- timeout_ms: 600000 // 10 minutes for all
425
+ const perspectives = ['creative', 'pragmatic', 'systematic']
426
+
427
+ perspectives.forEach(perspective => {
428
+ // Analyze inline using exploration-codebase.json as context
429
+ // Generate ideas from this perspective's focus
430
+ Write(`${sessionFolder}/perspectives/${perspective}.json`, JSON.stringify({
431
+ perspective: perspective,
432
+ ideas: [ // 3-5 ideas per perspective
433
+ { title: '...', description: '...', novelty: 1-5, feasibility: 1-5, rationale: '...' }
434
+ ],
435
+ key_findings: [...],
436
+ challenged_assumptions: [...],
437
+ open_questions: [...],
438
+ _metadata: { perspective, timestamp: getUtc8ISOString() }
439
+ }, null, 2))
399
440
  })
400
-
401
- // Handle timeout
402
- if (results.timed_out) {
403
- // Some agents may still be running
404
- // Option: continue waiting or use completed results
405
- }
406
-
407
- // Collect results from all perspectives
408
- const completedFindings = {}
409
- agentIds.forEach((agentId, index) => {
410
- const perspective = perspectives[index]
411
- if (results.status[agentId].completed) {
412
- completedFindings[perspective.name] = results.status[agentId].completed
413
- }
414
- })
415
-
416
- // Batch cleanup
417
- agentIds.forEach(id => close_agent({ id }))
418
441
  ```
419
442
 
420
- ### Step 2.3: Aggregate Multi-Perspective Findings
421
-
422
- Consolidate results from all three parallel perspective agents.
423
-
424
- **perspectives.json Structure**:
425
- - `session_id`: Reference to brainstorm session
426
- - `timestamp`: Completion time
427
- - `topic`: Original idea/topic
428
- - `creative`: Creative perspective findings (ideas with novelty ratings)
429
- - `pragmatic`: Pragmatic perspective findings (approaches with effort ratings)
430
- - `systematic`: Systematic perspective findings (architectural options)
431
- - `synthesis`: {convergent_themes, conflicting_views, unique_contributions}
432
- - `aggregated_ideas[]`: Merged ideas from all perspectives
433
- - `key_findings[]`: Main insights across all perspectives
434
-
435
- **Aggregation Activities**:
436
- 1. Extract ideas and findings from each perspective's output
437
- 2. Identify themes all perspectives agree on (convergent)
438
- 3. Note conflicting views and tradeoffs
439
- 4. Extract unique contributions from each perspective
440
- 5. Merge and deduplicate similar ideas
443
+ ##### Step 2.3: Aggregate Multi-Perspective Findings
441
444
 
442
445
  ```javascript
443
446
  const synthesis = {
444
447
  session_id: sessionId,
445
- timestamp: new Date().toISOString(),
446
- topic: idea_or_topic,
448
+ timestamp: getUtc8ISOString(),
449
+ topic,
447
450
 
448
451
  // Individual perspective findings
449
- creative: completedFindings.creative || {},
450
- pragmatic: completedFindings.pragmatic || {},
451
- systematic: completedFindings.systematic || {},
452
+ creative: readJson(`${sessionFolder}/perspectives/creative.json`),
453
+ pragmatic: readJson(`${sessionFolder}/perspectives/pragmatic.json`),
454
+ systematic: readJson(`${sessionFolder}/perspectives/systematic.json`),
452
455
 
453
456
  // Cross-perspective synthesis
454
457
  synthesis: {
455
- convergent_themes: extractConvergentThemes(completedFindings),
456
- conflicting_views: extractConflicts(completedFindings),
457
- unique_contributions: extractUniqueInsights(completedFindings)
458
+ convergent_themes: [...], // What all perspectives agree on
459
+ conflicting_views: [...], // Where perspectives differ
460
+ unique_contributions: [...] // Insights unique to specific perspectives
458
461
  },
459
462
 
460
463
  // Aggregated for refinement
461
- aggregated_ideas: mergeAllIdeas(completedFindings),
462
- key_findings: mergeKeyFindings(completedFindings)
464
+ aggregated_ideas: [...], // Merged and deduplicated ideas from all perspectives
465
+ key_findings: [...] // Main insights across all perspectives
463
466
  }
467
+ Write(`${sessionFolder}/perspectives.json`, JSON.stringify(synthesis, null, 2))
464
468
  ```
465
469
 
466
- ### Step 2.4: Update brainstorm.md
470
+ ##### Step 2.4: Update brainstorm.md
467
471
 
468
- Append exploration results to the brainstorm timeline.
472
+ Append Round 1 with exploration results using the [Round Documentation Pattern](#round-documentation-pattern).
469
473
 
470
- **Round 2 Sections** (Multi-Perspective Exploration):
474
+ **Round 1 Sections** (Multi-Perspective Exploration):
471
475
  - **Creative Perspective**: Novel ideas with novelty/impact ratings
472
476
  - **Pragmatic Perspective**: Practical approaches with effort/risk ratings
473
477
  - **Systematic Perspective**: Architectural options with tradeoff analysis
474
478
  - **Perspective Synthesis**: Convergent themes, conflicts, unique contributions
475
479
 
476
- **Documentation Standards**:
477
- - Include evidence from codebase exploration
478
- - Organize findings by perspective
479
- - Highlight areas of agreement and disagreement
480
- - Note key assumptions and reasoning
481
-
482
- **Success Criteria**:
483
- - All 3 subagents spawned and completed (or timeout handled)
484
- - `exploration-codebase.json` created with comprehensive context
485
- - `perspectives/*.json` created for each perspective
486
- - `perspectives.json` created with aggregated findings and synthesis
487
- - `brainstorm.md` updated with Round 2 results
488
- - All agents closed properly
489
- - Ready for interactive refinement phase
490
-
491
- ---
492
-
493
- ## Phase 3: Interactive Refinement
480
+ ##### Step 2.5: Initial Idea Coverage Check
494
481
 
495
- **Objective**: Iteratively refine ideas through multi-round user-guided exploration cycles with deep dives, challenge testing, and idea merging.
496
-
497
- **Max Rounds**: 6 refinement rounds (can exit earlier if user indicates completion)
498
-
499
- **Execution Model**: Use `send_input` for deep interaction within same agent context, or spawn new agent for significantly different exploration angles.
500
-
501
- ### Step 3.1: Present Findings & Gather User Direction
502
-
503
- Display current ideas and perspectives to the user.
482
+ ```javascript
483
+ // Check exploration vectors against Round 1 findings
484
+ appendToBrainstorm(`
485
+ #### Initial Idea Coverage Check (Post-Exploration)
486
+ ${explorationVectors.map((vector, i) => {
487
+ const status = assessCoverage(vector, explorationFindings)
488
+ return `- ${status.icon} Vector ${i+1}: ${vector} ${status.detail}`
489
+ }).join('\n')}
490
+
491
+ > Next rounds will focus on uncovered and in-progress vectors.
492
+ `)
493
+ ```
504
494
 
505
- **Presentation Content**:
506
- - Top ideas from each perspective with ratings
507
- - Convergent themes and areas of agreement
508
- - Conflicting views and tradeoffs
509
- - Open questions for further exploration
495
+ **Success Criteria**:
496
+ - exploration-codebase.json created with codebase context (if codebase exists)
497
+ - perspectives/*.json created for each perspective
498
+ - perspectives.json created with aggregated findings and synthesis
499
+ - brainstorm.md updated with Round 1 results
500
+ - **Initial Idea Coverage Check** completed
501
+ - **Key findings recorded** with evidence and ratings
510
502
 
511
- **User Feedback Options** (Single-select):
503
+ ### Phase 3: Interactive Refinement
512
504
 
513
- | Option | Purpose | Next Action |
514
- |--------|---------|------------|
515
- | **深入探索** | Explore selected ideas in detail | `send_input` to active agent OR spawn deep-dive agent |
516
- | **继续发散** | Generate more ideas | Spawn new agent with different angles |
517
- | **挑战验证** | Test ideas critically | Spawn challenge agent (devil's advocate) |
518
- | **合并综合** | Combine multiple ideas | Spawn merge agent to synthesize |
519
- | **准备收敛** | Begin convergence | Exit refinement loop for synthesis |
505
+ **Objective**: Iteratively refine ideas through multi-round user-guided exploration cycles. **Max Rounds**: 6. All analysis done inline.
520
506
 
521
- ### Step 3.2: Deep Dive on Selected Ideas (via send_input or new agent)
507
+ **Auto mode behavior** (`--yes`):
508
+ - Balanced/Deep mode: Run 2 auto-rounds (1× Deep Dive on top 2 ideas, 1× Challenge on top 3 ideas), then auto-converge
509
+ - Creative mode: Run 1 auto-round (1× Diverge), then auto-converge
510
+ - Skip user direction prompts; auto-select based on idea scores
522
511
 
523
- When user selects "deep dive", provide comprehensive analysis.
512
+ ##### Step 3.1: Present Findings & Gather User Direction
524
513
 
525
- **Option A: send_input to Existing Agent** (preferred if agent still active)
514
+ **Current Understanding Summary** (Round >= 2, BEFORE presenting new findings):
515
+ - Generate 1-2 sentence recap of top ideas and last round's direction
516
+ - Example: "Top ideas so far: [idea1], [idea2]. Last round [deepened/challenged/merged]. Here are the latest findings:"
526
517
 
527
518
  ```javascript
528
- // Continue with existing agent context
529
- send_input({
530
- id: perspectiveAgent, // Reuse agent from Phase 2 if not closed
531
- message: `
532
- ## CONTINUATION: Deep Dive Analysis
533
-
534
- Based on your initial exploration, the user wants deeper investigation on these ideas:
535
- ${selectedIdeas.map((idea, i) => `${i+1}. ${idea.title}`).join('\n')}
536
-
537
- ## Deep Dive Tasks
538
- Elaborate each concept in detail
539
- Identify implementation requirements and dependencies
540
- • Analyze potential challenges and propose mitigations
541
- • Suggest proof-of-concept approach
542
- • Define success metrics
543
-
544
- ## Deliverables
545
- Write to: ${sessionFolder}/ideas/{idea-slug}.md for each selected idea
546
-
547
- ## Success Criteria
548
- - [ ] Each idea has detailed breakdown
549
- - [ ] Technical requirements documented
550
- - [ ] Risk analysis with mitigations
551
- `
552
- })
553
-
554
- const deepDiveResult = wait({ ids: [perspectiveAgent], timeout_ms: 600000 })
519
+ if (!autoYes) {
520
+ const feedback = request_user_input({
521
+ questions: [{
522
+ header: "Brainstorm Direction",
523
+ id: "direction",
524
+ question: `Brainstorm round ${round}: What would you like to do next?`,
525
+ options: [
526
+ { label: "Deep Dive", description: "Explore selected ideas in detail" },
527
+ { label: "Diverge More", description: "Generate more ideas from different angles" },
528
+ { label: "Challenge", description: "Devil's advocate — test ideas critically" },
529
+ { label: "Merge Ideas", description: "Combine complementary ideas" },
530
+ { label: "Ready to Converge", description: "Sufficient ideas, proceed to synthesis" }
531
+ ]
532
+ }]
533
+ })
534
+ }
555
535
  ```
556
536
 
557
- **Option B: Spawn New Deep-Dive Agent** (if prior agents closed)
537
+ ##### Step 3.2: Process User Response
558
538
 
559
- ```javascript
560
- const deepDiveAgent = spawn_agent({
561
- agent_type: "cli_explore_agent",
562
- message: `
563
- ## TASK ASSIGNMENT
539
+ **Recording Checkpoint**: Regardless of option selected, MUST record to brainstorm.md:
540
+ - User's original choice and expression
541
+ - Impact on brainstorming direction
542
+ - If direction changed, record a full Decision Record
564
543
 
565
- ### MANDATORY FIRST STEPS (Agent Execute)
566
- 1. Read: ${sessionFolder}/perspectives.json (prior findings)
567
- 2. Run: `ccw spec load --category "exploration planning"`
544
+ | Response | Action |
545
+ |----------|--------|
546
+ | **Deep Dive** | Ask which ideas to explore. Inline analysis: elaborate concept, identify requirements/dependencies, analyze challenges, suggest PoC approach, define success metrics. Write to `ideas/{idea-slug}.md`. |
547
+ | **Diverge More** | Inline analysis with different angles: alternative framings, cross-domain inspiration, what-if scenarios, constraint relaxation. Generate new ideas. |
548
+ | **Challenge** | Inline devil's advocate analysis: 3 strongest objections per idea, challenge assumptions, failure scenarios, competitive alternatives, survivability rating (1-5). |
549
+ | **Merge Ideas** | Ask which ideas to merge. Inline synthesis: identify complementary elements, resolve contradictions, create unified concept, preserve strengths. Write to `ideas/merged-idea-{n}.md`. |
550
+ | **Ready to Converge** | Record why concluding. Exit loop → Phase 4. |
568
551
 
569
- ---
552
+ ##### Step 3.3: Deep Dive on Selected Ideas
570
553
 
571
- ## Deep Dive Context
572
- Topic: ${idea_or_topic}
573
- Selected Ideas: ${selectedIdeas.map(i => i.title).join(', ')}
574
-
575
- ## Deep Dive Tasks
576
- ${selectedIdeas.map(idea => `
577
- ### ${idea.title}
578
- • Elaborate the core concept in detail
579
- • Identify implementation requirements
580
- • List potential challenges and mitigations
581
- • Suggest proof-of-concept approach
582
- • Define success metrics
583
- `).join('\n')}
584
-
585
- ## Deliverables
586
- Write: ${sessionFolder}/ideas/{idea-slug}.md for each idea
587
-
588
- Include for each:
589
- - Detailed concept description
590
- - Technical requirements list
591
- - Risk/challenge matrix
592
- - MVP definition
593
- - Success criteria
594
- `
595
- })
554
+ When user selects "deep dive", provide comprehensive inline analysis:
596
555
 
597
- const result = wait({ ids: [deepDiveAgent], timeout_ms: 600000 })
598
- close_agent({ id: deepDiveAgent })
556
+ ```javascript
557
+ // For each selected idea, analyze inline
558
+ selectedIdeas.forEach(idea => {
559
+ const deepDive = {
560
+ title: idea.title,
561
+ detailed_description: '...', // Elaborated concept
562
+ technical_requirements: [...], // Implementation needs
563
+ dependencies: [...], // What this depends on
564
+ challenges: [ // Risk/challenge matrix
565
+ { challenge: '...', severity: 'high|medium|low', mitigation: '...' }
566
+ ],
567
+ poc_approach: '...', // Proof-of-concept suggestion
568
+ success_metrics: [...], // How to measure success
569
+ source_perspectives: [...] // Which perspectives contributed
570
+ }
571
+ Write(`${sessionFolder}/ideas/${ideaSlug}.md`, formatIdeaMarkdown(deepDive))
572
+ })
599
573
  ```
600
574
 
601
- ### Step 3.3: Devil's Advocate Challenge (spawn new agent)
575
+ ##### Step 3.4: Devil's Advocate Challenge
602
576
 
603
- When user selects "challenge", spawn a dedicated challenge agent.
577
+ When user selects "challenge", perform inline critical analysis:
604
578
 
605
579
  ```javascript
606
- const challengeAgent = spawn_agent({
607
- agent_type: "cli_explore_agent",
608
- message: `
609
- ## TASK ASSIGNMENT
610
-
611
- ### MANDATORY FIRST STEPS (Agent Execute)
612
- 1. Read: ${sessionFolder}/perspectives.json (ideas to challenge)
613
-
614
- ---
615
-
616
- ## Challenge Context
617
- Topic: ${idea_or_topic}
618
- Ideas to Challenge:
619
- ${selectedIdeas.map((idea, i) => `${i+1}. ${idea.title}: ${idea.description}`).join('\n')}
620
-
621
- ## Devil's Advocate Tasks
622
- • For each idea, identify 3 strongest objections
623
- • Challenge core assumptions
624
- • Identify scenarios where this fails
625
- • Consider competitive/alternative solutions
626
- • Assess whether this solves the right problem
627
- • Rate survivability after challenge (1-5)
628
-
629
- ## Deliverables
630
- Return structured challenge results:
631
- {
632
- challenges: [{
633
- idea: "...",
634
- objections: [],
635
- challenged_assumptions: [],
636
- failure_scenarios: [],
637
- alternatives: [],
638
- survivability_rating: 1-5,
639
- strengthened_version: "..."
640
- }]
641
- }
642
-
643
- ## Success Criteria
644
- - [ ] 3+ objections per idea
645
- - [ ] Assumptions explicitly challenged
646
- - [ ] Survivability ratings assigned
647
- `
580
+ selectedIdeas.forEach(idea => {
581
+ const challenge = {
582
+ idea: idea.title,
583
+ objections: [...], // 3+ strongest objections
584
+ challenged_assumptions: [...], // Core assumptions tested
585
+ failure_scenarios: [...], // When/how this fails
586
+ alternatives: [...], // Competitive/alternative solutions
587
+ survivability_rating: 1-5, // How well idea survives challenge
588
+ strengthened_version: '...' // Improved version post-challenge
589
+ }
590
+ // Record in brainstorm.md
648
591
  })
649
-
650
- const result = wait({ ids: [challengeAgent], timeout_ms: 300000 })
651
- close_agent({ id: challengeAgent })
652
592
  ```
653
593
 
654
- ### Step 3.4: Merge Multiple Ideas (spawn merge agent)
594
+ ##### Step 3.5: Merge Multiple Ideas
655
595
 
656
- When user selects "merge", synthesize complementary ideas.
596
+ When user selects "merge", synthesize inline:
657
597
 
658
598
  ```javascript
659
- const mergeAgent = spawn_agent({
660
- agent_type: "cli_explore_agent",
661
- message: `
662
- ## TASK ASSIGNMENT
663
-
664
- ### MANDATORY FIRST STEPS (Agent Execute)
665
- 1. Read: ${sessionFolder}/perspectives.json (source ideas)
666
-
667
- ---
668
-
669
- ## Merge Context
670
- Topic: ${idea_or_topic}
671
- Ideas to Merge:
672
- ${selectedIdeas.map((idea, i) => `
673
- ${i+1}. ${idea.title} (${idea.source_perspective})
674
- ${idea.description}
675
- Strengths: ${idea.strengths?.join(', ') || 'N/A'}
676
- `).join('\n')}
677
-
678
- ## Merge Tasks
679
- • Identify complementary elements
680
- • Resolve contradictions
681
- • Create unified concept
682
- • Preserve key strengths from each
683
- • Describe the merged solution
684
- • Assess viability of merged idea
685
-
686
- ## Deliverables
687
- Write to: ${sessionFolder}/ideas/merged-idea-{n}.md
688
-
689
- Include:
690
- - Merged concept description
691
- - Elements taken from each source idea
692
- - Contradictions resolved (or noted as tradeoffs)
693
- - New combined strengths
694
- - Implementation considerations
695
-
696
- ## Success Criteria
697
- - [ ] Coherent merged concept
698
- - [ ] Source attributions clear
699
- - [ ] Contradictions addressed
700
- `
701
- })
702
-
703
- const result = wait({ ids: [mergeAgent], timeout_ms: 300000 })
704
- close_agent({ id: mergeAgent })
599
+ const merged = {
600
+ title: '...', // New merged concept name
601
+ description: '...', // Unified concept description
602
+ source_ideas: [...], // Which ideas were merged
603
+ elements_from_each: [...], // What was taken from each source
604
+ contradictions_resolved: [...], // How conflicts were handled
605
+ combined_strengths: [...], // New combined advantages
606
+ implementation_considerations: '...'
607
+ }
608
+ Write(`${sessionFolder}/ideas/merged-idea-${n}.md`, formatMergedIdeaMarkdown(merged))
705
609
  ```
706
610
 
707
- ### Step 3.5: Document Each Round
611
+ ##### Step 3.6: Document Each Round
708
612
 
709
- Update brainstorm.md with results from each refinement round.
613
+ Update brainstorm.md using the [Round Documentation Pattern](#round-documentation-pattern).
710
614
 
711
- **Round N Sections** (Rounds 3-6):
615
+ **Append** to Thought Evolution Timeline: User Direction, Decision Log, Ideas Generated/Updated, Analysis Results, Challenged Assumptions, Open Items, Narrative Synthesis.
712
616
 
713
- | Section | Content |
714
- |---------|---------|
715
- | User Direction | Action taken and ideas selected |
716
- | Findings | New findings and clarifications |
717
- | Idea Updates | Changes to idea scores and status |
718
- | Insights | Key learnings and realizations |
719
- | Next Directions | Suggested follow-up investigations |
617
+ **Replace** (not append):
720
618
 
721
- **Documentation Standards**:
722
- - Clear timestamps and action taken
723
- - Evidence-based findings with code references
724
- - Updated idea rankings and status changes
725
- - Explicit tracking of assumption changes
726
- - Organized by exploration vector
619
+ | Section | Update Rule |
620
+ |---------|-------------|
621
+ | `## Current Ideas` | Overwrite with latest ranked idea list |
622
+ | `## Table of Contents` | Update links to include new Round N sections |
727
623
 
728
624
  **Success Criteria**:
729
625
  - User feedback processed for each round
730
- - `brainstorm.md` updated with all refinement rounds
626
+ - brainstorm.md updated with all refinement rounds
731
627
  - Ideas in `ideas/` folder for selected deep-dives
732
- - All spawned agents closed properly
733
628
  - Exit condition reached (user selects converge or max rounds)
734
629
 
735
- ---
736
-
737
- ## Phase 4: Convergence & Crystallization
630
+ ### Phase 4: Convergence & Crystallization
738
631
 
739
632
  **Objective**: Synthesize final ideas, generate conclusions and recommendations, and offer next steps.
740
633
 
741
- ### Step 4.1: Consolidate Insights
742
-
743
- Extract and synthesize all findings from refinement rounds into final conclusions.
744
-
745
- **Consolidation Activities**:
746
- 1. Review all refinement rounds and accumulated findings
747
- 2. Rank ideas by score, feasibility, and impact
748
- 3. Identify top 5 viable ideas
749
- 4. Extract key learnings and insights
750
- 5. Generate recommendations with rationale
751
-
752
- **synthesis.json Structure**:
753
- - `session_id`: Session identifier
754
- - `topic`: Original idea/topic
755
- - `completed`: Completion timestamp
756
- - `total_rounds`: Number of refinement rounds
757
- - `top_ideas[]`: Top 5 ranked ideas with scores and next steps
758
- - `parked_ideas[]`: Ideas parked for future consideration
759
- - `key_insights[]`: Key learnings from brainstorming process
760
- - `recommendations`: Primary recommendation and alternatives
761
- - `follow_up[]`: Suggested next steps (implementation, research, validation)
762
-
763
- **Idea Format**:
764
- - `title`: Clear, descriptive title
765
- - `description`: Complete concept description
766
- - `source_perspective`: Which perspective(s) contributed
767
- - `score`: Final viability score (1-10)
768
- - `novelty`: Novelty/innovation rating (1-5)
769
- - `feasibility`: Implementation feasibility (1-5)
770
- - `key_strengths`: Main advantages and benefits
771
- - `main_challenges`: Key challenges and limitations
772
- - `next_steps`: Recommended actions to pursue
773
-
774
- ### Step 4.2: Final brainstorm.md Update
775
-
776
- Append conclusions section and finalize the thinking document.
777
-
778
- **Synthesis & Conclusions Section**:
634
+ ##### Step 4.1: Consolidate Insights
635
+
636
+ ```javascript
637
+ const synthesis = {
638
+ session_id: sessionId,
639
+ topic,
640
+ completed: getUtc8ISOString(),
641
+ total_rounds: roundCount,
642
+ top_ideas: [ // Top 5 ranked ideas
643
+ {
644
+ title: '...', description: '...',
645
+ source_perspective: '...',
646
+ score: 1-10, // Final viability score
647
+ novelty: 1-5, // Innovation rating
648
+ feasibility: 1-5, // Implementation feasibility
649
+ key_strengths: [...],
650
+ main_challenges: [...],
651
+ next_steps: [...],
652
+ review_status: 'accepted|modified|rejected|pending'
653
+ }
654
+ ],
655
+ parked_ideas: [...], // Ideas for future consideration
656
+ key_insights: [...], // Key learnings from brainstorming
657
+ recommendations: {
658
+ primary: '...', // Best path forward
659
+ alternatives: [...] // Other viable options
660
+ },
661
+ follow_up: [ // Suggested next steps
662
+ { type: 'implement|research|validate', summary: '...' }
663
+ ],
664
+ decision_trail: [ // Consolidated from all phases
665
+ { round: 1, decision: '...', context: '...', chosen: '...', reason: '...', impact: '...' }
666
+ ]
667
+ }
668
+ Write(`${sessionFolder}/synthesis.json`, JSON.stringify(synthesis, null, 2))
669
+ ```
670
+
671
+ ##### Step 4.2: Final brainstorm.md Update
672
+
673
+ **Synthesis & Conclusions**:
779
674
  - **Executive Summary**: High-level overview of brainstorming results
780
675
  - **Top Ideas**: Ranked list with descriptions and strengths/challenges
781
676
  - **Primary Recommendation**: Best path forward with clear rationale
@@ -783,24 +678,67 @@ Append conclusions section and finalize the thinking document.
783
678
  - **Parked Ideas**: Future considerations with potential triggers
784
679
  - **Key Insights**: Important learnings from the process
785
680
 
786
- **Session Statistics**:
787
- - Total refinement rounds completed
788
- - Ideas generated and evaluated
789
- - Ideas survived challenges
790
- - Perspectives used (creative, pragmatic, systematic)
791
- - Artifacts generated
681
+ **Current Ideas (Final)**:
682
+
683
+ | Subsection | Content |
684
+ |------------|---------|
685
+ | Top Ideas | Ranked by score with strengths/challenges |
686
+ | Idea Evolution | How top ideas developed across rounds |
687
+ | Key Insights | Valuable learnings for future reference |
792
688
 
793
- ### Step 4.3: Post-Completion Options
689
+ **Decision Trail**:
794
690
 
795
- Offer user follow-up actions based on brainstorming results.
691
+ | Subsection | Content |
692
+ |------------|---------|
693
+ | Critical Decisions | Pivotal decisions that shaped the outcome |
694
+ | Direction Changes | Timeline of scope/focus adjustments with rationale |
695
+ | Trade-offs Made | Key trade-offs and why certain paths were chosen |
696
+
697
+ **Session Statistics**: Total rounds, ideas generated, ideas survived challenges, perspectives used, artifacts generated.
698
+
699
+ ##### Step 4.3: Interactive Top-Idea Review (skip in auto mode)
700
+
701
+ Walk through top ideas one-by-one (ordered by score):
702
+
703
+ ```javascript
704
+ for (const [index, idea] of rankedIdeas.entries()) {
705
+ const review = request_user_input({
706
+ questions: [{
707
+ header: `Idea #${index + 1}`,
708
+ id: `idea_${index + 1}`,
709
+ question: `Idea #${index + 1}: "${idea.title}" (score: ${idea.score}, novelty: ${idea.novelty}, feasibility: ${idea.feasibility}). Your decision:`,
710
+ options: [
711
+ { label: "Accept(Recommended)", description: "Keep this idea in final recommendations" },
712
+ { label: "Modify", description: "Adjust scope, description, or priority" },
713
+ { label: "Reject", description: "Remove from final recommendations" }
714
+ ]
715
+ }]
716
+ })
717
+ // Accept → "accepted" | Modify → gather text → "modified" | Reject → gather reason → "rejected"
718
+ // Accept All Remaining → mark all remaining as "accepted", break loop
719
+ // Record review decision to brainstorm.md Decision Log + update synthesis.json
720
+ }
721
+ ```
722
+
723
+ **Review Summary** (append to brainstorm.md):
724
+ ```markdown
725
+ ### Top Idea Review Summary
726
+ | # | Idea | Score | Novelty | Feasibility | Review Status | Notes |
727
+ |---|------|-------|---------|-------------|---------------|-------|
728
+ | 1 | [title] | 8 | 4 | 3 | Accepted | |
729
+ | 2 | [title] | 7 | 5 | 2 | Modified | [notes] |
730
+ | 3 | [title] | 6 | 3 | 4 | Rejected | [reason] |
731
+ ```
732
+
733
+ ##### Step 4.4: Post-Completion Options
796
734
 
797
735
  **Available Options** (this skill is brainstorming-only — NEVER auto-launch other skills):
798
736
 
799
737
  | Option | Purpose | Action |
800
738
  |--------|---------|--------|
801
- | **显示后续命令** | Show available next-step commands | Display command list for user to manually run |
802
- | **导出分享** | Generate shareable report | Create formatted report document |
803
- | **完成** | No further action | End workflow |
739
+ | **Show Next-Step Commands** | Show available commands | Display command list for user to manually run |
740
+ | **Export Report** | Generate shareable report | Create formatted report document |
741
+ | **Done** | No further action | End workflow |
804
742
 
805
743
  **Next-step commands to display** (user runs manually, NOT auto-launched):
806
744
  - `/workflow-lite-plan "..."` → Generate implementation plan
@@ -808,49 +746,128 @@ Offer user follow-up actions based on brainstorming results.
808
746
  - `/workflow:analyze-with-file "..."` → Analyze top idea in detail
809
747
 
810
748
  **Success Criteria**:
811
- - `synthesis.json` created with complete synthesis
812
- - `brainstorm.md` finalized with all conclusions
749
+ - synthesis.json created with complete synthesis
750
+ - brainstorm.md finalized with all conclusions
813
751
  - User offered meaningful next step options
814
752
  - Session complete and all artifacts available
815
753
 
816
- ---
754
+ ## Templates
817
755
 
818
- ## Configuration
756
+ ### Round Documentation Pattern
757
+
758
+ Each round follows this structure in brainstorm.md:
759
+
760
+ ```markdown
761
+ ### Round N - [DeepDive|Diverge|Challenge|Merge] (timestamp)
819
762
 
820
- ### Brainstorm Dimensions Reference
763
+ #### User Input
764
+ What the user indicated they wanted to focus on
765
+
766
+ #### Decision Log
767
+ <!-- Use Decision Record Format from Recording Protocol -->
768
+
769
+ #### Ideas Generated
770
+ New ideas from this round with ratings
771
+
772
+ #### Analysis Results
773
+ Detailed findings from this round's analysis
774
+ - Finding 1 (evidence: file:line or rationale)
775
+ - Finding 2 (evidence: file:line or rationale)
776
+
777
+ #### Challenged Assumptions
778
+ - ~~Previous assumption~~ → New understanding
779
+ - Reason: Why the assumption was wrong
780
+
781
+ #### Open Items
782
+ Remaining questions or exploration directions
783
+
784
+ #### Narrative Synthesis
785
+ <!-- Use Narrative Synthesis Format from Recording Protocol -->
786
+ ```
787
+
788
+ ### brainstorm.md Evolution Summary
789
+
790
+ - **Header**: Session ID, topic, start time, dimensions, mode
791
+ - **Session Context**: Focus areas, perspectives, constraints
792
+ - **Exploration Vectors**: Key questions guiding exploration
793
+ - **Initial Decisions**: Why these perspectives and focus areas were selected
794
+ - **Thought Evolution Timeline**: Round-by-round findings
795
+ - Round 1: Exploration Results + Decision Log + Narrative Synthesis
796
+ - Round 2-N: Current Ideas Summary + User feedback + direction adjustments + new ideas + Decision Log + Narrative Synthesis
797
+ - **Decision Trail**: Consolidated critical decisions across all rounds
798
+ - **Synthesis & Conclusions**: Summary, top ideas, recommendations
799
+ - **Current Ideas (Final)**: Consolidated ranked ideas
800
+ - **Session Statistics**: Rounds completed, ideas generated, artifacts produced
801
+
802
+ ## Reference
803
+
804
+ ### Output Structure
805
+
806
+ ```
807
+ {projectRoot}/.workflow/.brainstorm/BS-{slug}-{date}/
808
+ ├── brainstorm.md # Complete thought evolution timeline
809
+ ├── exploration-codebase.json # Phase 2: Codebase context
810
+ ├── perspectives/ # Phase 2: Individual perspective outputs
811
+ │ ├── creative.json
812
+ │ ├── pragmatic.json
813
+ │ └── systematic.json
814
+ ├── perspectives.json # Phase 2: Aggregated findings with synthesis
815
+ ├── synthesis.json # Phase 4: Final synthesis
816
+ └── ideas/ # Phase 3: Individual idea deep-dives
817
+ ├── idea-1.md
818
+ ├── idea-2.md
819
+ └── merged-idea-1.md
820
+ ```
821
821
 
822
- Dimensions guide brainstorming scope and focus:
822
+ | File | Phase | Description |
823
+ |------|-------|-------------|
824
+ | `brainstorm.md` | 1-4 | Session metadata → thought evolution → conclusions |
825
+ | `exploration-codebase.json` | 2 | Codebase context: relevant files, patterns, constraints |
826
+ | `perspectives/*.json` | 2 | Per-perspective idea generation results |
827
+ | `perspectives.json` | 2 | Aggregated findings with cross-perspective synthesis |
828
+ | `ideas/*.md` | 3 | Individual idea deep-dives and merged ideas |
829
+ | `synthesis.json` | 4 | Final synthesis: top ideas, recommendations, insights |
830
+
831
+ ### Brainstorm Dimensions
832
+
833
+ | Dimension | Keywords | Description |
834
+ |-----------|----------|-------------|
835
+ | technical | 技术, technical, implementation, code, 实现, architecture | Implementation approaches |
836
+ | ux | 用户, user, experience, UX, UI, 体验, interaction | User-facing design ideas |
837
+ | business | 业务, business, value, ROI, 价值, market | Business model innovations |
838
+ | innovation | 创新, innovation, novel, creative, 新颖 | Breakthrough ideas |
839
+ | feasibility | 可行, feasible, practical, realistic, 实际 | Realistic approaches |
840
+ | scalability | 扩展, scale, growth, performance, 性能 | Large-scale solutions |
841
+ | security | 安全, security, risk, protection, 风险 | Security considerations |
842
+
843
+ ### Brainstorm Perspectives
823
844
 
824
- | Dimension | Keywords | Best For |
825
- |-----------|----------|----------|
826
- | technical | 技术, technical, implementation, code | Implementation approaches |
827
- | ux | 用户, user, experience, UI | User-facing design ideas |
828
- | business | 业务, business, value | Business model innovations |
829
- | innovation | 创新, innovation, novel | Breakthrough ideas |
830
- | feasibility | 可行, feasible, practical | Realistic approaches |
831
- | scalability | 扩展, scale, growth | Large-scale solutions |
832
- | security | 安全, security, risk | Security considerations |
845
+ | Perspective | Focus | Best For |
846
+ |-------------|-------|----------|
847
+ | **Creative** | Innovation, cross-domain inspiration, challenging assumptions | Generating novel and surprising ideas |
848
+ | **Pragmatic** | Implementation feasibility, effort estimates, blockers | Reality-checking ideas |
849
+ | **Systematic** | Problem decomposition, patterns, scalability, architecture | Organizing and structuring solutions |
833
850
 
834
851
  ### Brainstorm Modes
835
852
 
836
- | Mode | Duration | Intensity | Subagents |
837
- |------|----------|-----------|-----------|
838
- | Creative | 15-20 min | High novelty | 1 agent, short timeout |
839
- | Balanced | 30-60 min | Mixed | 3 parallel agents |
840
- | Deep | 1-2+ hours | Comprehensive | 3 parallel agents + deep refinement |
853
+ | Mode | Intensity | Perspectives | Description |
854
+ |------|-----------|-------------|-------------|
855
+ | Creative | High novelty | 1 perspective | Fast, focus on novel ideas |
856
+ | Balanced | Mixed | 3 perspectives | Moderate, balanced exploration (default) |
857
+ | Deep | Comprehensive | 3 perspectives + deep refinement | Thorough multi-round investigation |
841
858
 
842
859
  ### Collaboration Patterns
843
860
 
844
861
  | Pattern | Usage | Description |
845
862
  |---------|-------|-------------|
846
- | Parallel Divergence | New topic | All perspectives explore simultaneously via parallel subagents |
847
- | Sequential Deep-Dive | Promising idea | `send_input` to one agent for elaboration, others critique via new agents |
848
- | Debate Mode | Controversial approach | Spawn opposing agents to argue for/against |
849
- | Synthesis Mode | Ready to decide | Spawn synthesis agent combining insights from all perspectives |
863
+ | Parallel Divergence | New topic | All perspectives explored serially for comprehensive coverage |
864
+ | Sequential Deep-Dive | Promising idea | One perspective elaborates, others critique |
865
+ | Debate Mode | Controversial approach | Inline analysis arguing for/against |
866
+ | Synthesis Mode | Ready to decide | Inline synthesis combining insights from all perspectives |
850
867
 
851
868
  ### Context Overflow Protection
852
869
 
853
- **Per-Agent Limits**:
870
+ **Per-Perspective Limits**:
854
871
  - Main analysis output: < 3000 words
855
872
  - Sub-document (if any): < 2000 words each
856
873
  - Maximum sub-documents: 5 per perspective
@@ -860,143 +877,33 @@ Dimensions guide brainstorming scope and focus:
860
877
  - Large ideas automatically split into separate idea documents in ideas/ folder
861
878
 
862
879
  **Recovery Steps**:
863
- 1. Check agent outputs for truncation or overflow
880
+ 1. Check outputs for truncation or overflow
864
881
  2. Reduce scope: fewer perspectives or simpler topic
865
882
  3. Use structured brainstorm mode for more focused output
866
883
  4. Split complex topics into multiple sessions
867
884
 
868
- ---
869
-
870
- ## Error Handling & Recovery
885
+ ### Error Handling
871
886
 
872
887
  | Situation | Action | Recovery |
873
888
  |-----------|--------|----------|
874
- | **Subagent timeout** | Check `results.timed_out`, continue `wait()` or use partial results | Reduce scope, use 2 perspectives instead of 3 |
875
- | **Agent closed prematurely** | Cannot recover closed agent | Spawn new agent with prior context from perspectives.json |
876
- | **Parallel agent partial failure** | Some perspectives complete, some fail | Use completed results, note gaps in synthesis |
877
- | **send_input to closed agent** | Error: agent not found | Spawn new agent with prior findings as context |
878
- | **No good ideas** | Reframe problem or adjust constraints | Try new exploration angles |
879
- | **User disengaged** | Summarize progress and offer break | Save state, keep agents alive for resume |
880
- | **Perspectives conflict** | Present as tradeoff options | Let user select preferred direction |
881
- | **Max rounds reached** | Force synthesis phase | Highlight unresolved questions |
882
- | **Session folder conflict** | Append timestamp suffix | Create unique folder |
883
-
884
- ### Codex-Specific Error Patterns
885
-
886
- ```javascript
887
- // Safe parallel execution with error handling
888
- try {
889
- const agentIds = perspectives.map(p => spawn_agent({ agent_type: "cli_explore_agent", message: buildPrompt(p) }))
890
-
891
- const results = wait({ ids: agentIds, timeout_ms: 600000 })
892
-
893
- if (results.timed_out) {
894
- // Handle partial completion
895
- const completed = agentIds.filter(id => results.status[id].completed)
896
- const pending = agentIds.filter(id => !results.status[id].completed)
897
-
898
- // Option 1: Continue waiting for pending
899
- // const moreResults = wait({ ids: pending, timeout_ms: 300000 })
900
-
901
- // Option 2: Use partial results
902
- // processPartialResults(completed, results)
903
- }
904
-
905
- // Process all results
906
- processResults(agentIds, results)
907
-
908
- } finally {
909
- // ALWAYS cleanup, even on errors
910
- agentIds.forEach(id => {
911
- try { close_agent({ id }) } catch (e) { /* ignore */ }
912
- })
913
- }
914
- ```
915
-
916
- ---
917
-
918
- ## Iteration Patterns
919
-
920
- ### First Brainstorm Session (Parallel Mode)
921
-
922
- ```
923
- User initiates: TOPIC="idea or topic"
924
- ├─ No session exists → New session mode
925
- ├─ Parse topic and identify dimensions
926
- ├─ Scope with user (focus, depth, mode)
927
- ├─ Create brainstorm.md
928
- ├─ Expand seed into vectors
929
- ├─ Gather codebase context
930
-
931
- ├─ Execute parallel perspective exploration:
932
- │ ├─ spawn_agent × 3 (Creative + Pragmatic + Systematic)
933
- │ ├─ wait({ ids: [...] }) ← TRUE PARALLELISM
934
- │ └─ close_agent × 3
935
-
936
- ├─ Aggregate findings with synthesis
937
- └─ Enter multi-round refinement loop
938
- ```
939
-
940
- ### Continue Existing Session
941
-
942
- ```
943
- User resumes: TOPIC="same topic"
944
- ├─ Session exists → Continue mode
945
- ├─ Load previous brainstorm.md
946
- ├─ Load perspectives.json
947
- └─ Resume from last refinement round
948
- ```
949
-
950
- ### Refinement Loop (Rounds 3-6)
951
-
952
- ```
953
- Each round:
954
- ├─ Present current findings and top ideas
955
- ├─ Gather user feedback (deep dive/diverge/challenge/merge/converge)
956
- ├─ Process response:
957
- │ ├─ Deep Dive → send_input to active agent OR spawn deep-dive agent
958
- │ ├─ Diverge → spawn new agent with different angles
959
- │ ├─ Challenge → spawn challenge agent (devil's advocate)
960
- │ ├─ Merge → spawn merge agent to synthesize
961
- │ └─ Converge → Exit loop for synthesis
962
- ├─ wait({ ids: [...] }) for result
963
- ├─ Update brainstorm.md
964
- └─ Repeat until user selects converge or max rounds reached
965
- ```
889
+ | No codebase detected | Normal flow, pure topic brainstorming | Proceed without exploration-codebase.json |
890
+ | Codebase search fails | Continue with available context | Note limitation in brainstorm.md |
891
+ | No good ideas | Reframe problem or adjust constraints | Try new exploration angles |
892
+ | Perspectives conflict | Present as tradeoff options | Let user select preferred direction |
893
+ | Max rounds reached (6) | Force synthesis phase | Highlight unresolved questions |
894
+ | Session folder conflict | Append timestamp suffix | Create unique folder |
895
+ | User timeout | Save state, show resume command | Use `--continue` to resume |
966
896
 
967
- ### Agent Lifecycle Management
968
-
969
- ```
970
- Subagent lifecycle:
971
- ├─ spawn_agent({ message }) → Create with role path + task
972
- ├─ wait({ ids, timeout_ms }) → Get results (ONLY way to get output)
973
- ├─ send_input({ id, message }) → Continue interaction (if not closed)
974
- └─ close_agent({ id }) → Cleanup (MUST do, cannot recover)
975
-
976
- Key rules:
977
- ├─ NEVER close before you're done with an agent
978
- ├─ ALWAYS use wait() to get results, NOT close_agent()
979
- ├─ Batch wait for parallel agents: wait({ ids: [a, b, c] })
980
- └─ Consider keeping agents alive for send_input during refinement
981
- ```
982
-
983
- ### Completion Flow
984
-
985
- ```
986
- Final synthesis:
987
- ├─ Consolidate all findings into top ideas
988
- ├─ Generate synthesis.json
989
- ├─ Update brainstorm.md with final conclusions
990
- ├─ close_agent for any remaining active agents
991
- ├─ Offer follow-up options
992
- └─ Archive session artifacts
993
- ```
897
+ ## Best Practices
994
898
 
995
- ---
899
+ ### Core Principles
996
900
 
997
- ## Best Practices
901
+ 1. **No code modifications**: This skill is strictly read-only. It produces analysis and idea documents but NEVER modifies source code.
902
+ 2. **Record Decisions Immediately**: Capture decisions as they happen using the Decision Record format
903
+ 3. **Evidence-Based**: Ideas referencing codebase patterns should include file:line evidence
904
+ 4. **Embrace Conflicts**: Perspective conflicts often reveal important tradeoffs
998
905
 
999
- ### Before Starting Brainstorm
906
+ ### Before Starting
1000
907
 
1001
908
  1. **Clear Topic Definition**: Detailed topics lead to better dimension identification
1002
909
  2. **User Context**: Understanding preferences helps guide brainstorming intensity
@@ -1004,30 +911,33 @@ Final synthesis:
1004
911
 
1005
912
  ### During Brainstorming
1006
913
 
1007
- 1. **Review Perspectives**: Check all three perspectives before refinement rounds
914
+ 1. **Review Perspectives**: Check all perspective results before refinement rounds
1008
915
  2. **Document Assumptions**: Track what you think is true for correction later
1009
916
  3. **Use Continue Mode**: Resume sessions to build on previous exploration
1010
- 4. **Embrace Conflicts**: Perspective conflicts often reveal important tradeoffs
1011
- 5. **Iterate Thoughtfully**: Each refinement round should meaningfully advance ideas
1012
-
1013
- ### Codex Subagent Best Practices
1014
-
1015
- 1. **Agent Type, Not Path**: Use `agent_type` parameter in spawn_agent, not manual file path reading
1016
- 2. **Parallel for Perspectives**: Use batch spawn + wait for 3 perspective agents
1017
- 3. **Delay close_agent for Refinement**: Keep perspective agents alive for `send_input` reuse
1018
- 4. **Batch wait**: Use `wait({ ids: [a, b, c] })` for parallel agents, not sequential waits
1019
- 5. **Handle Timeouts**: Check `results.timed_out` and decide: continue waiting or use partial results
1020
- 6. **Explicit Cleanup**: Always `close_agent` when done, even on errors (use try/finally pattern)
1021
- 7. **send_input vs spawn**: Prefer `send_input` for same-context deep-dive, `spawn` for new exploration angles
917
+ 4. **Iterate Thoughtfully**: Each refinement round should meaningfully advance ideas
918
+ 5. **Track Idea Evolution**: Document how ideas changed across rounds
1022
919
 
1023
920
  ### Documentation Practices
1024
921
 
1025
- 1. **Evidence-Based**: Every idea should reference codebase patterns or feasibility analysis
1026
- 2. **Perspective Diversity**: Capture viewpoints from all three perspectives
1027
- 3. **Timeline Clarity**: Use clear timestamps for traceability
1028
- 4. **Evolution Tracking**: Document how ideas changed and evolved
1029
- 5. **Action Items**: Generate specific, implementable recommendations
1030
- 6. **Synthesis Quality**: Ensure convergent/conflicting themes are clearly documented
922
+ 1. **Timeline Clarity**: Use clear timestamps for traceability
923
+ 2. **Evolution Tracking**: Document how ideas developed and morphed
924
+ 3. **Multi-Perspective Synthesis**: Document convergent/conflicting themes
925
+ 4. **Action Items**: Generate specific, implementable recommendations
926
+
927
+ ## When to Use
928
+
929
+ **Use brainstorm-with-file when:**
930
+ - Generating new ideas and solutions for a topic
931
+ - Need multi-perspective exploration of possibilities
932
+ - Want documented thought evolution showing how ideas develop
933
+ - Exploring creative solutions before committing to implementation
934
+ - Need diverge-converge cycles to refine ideas
935
+
936
+ **Consider alternatives when:**
937
+ - Analyzing existing code/architecture → use `analyze-with-file`
938
+ - Specific bug diagnosis needed → use `debug-with-file`
939
+ - Complex planning with requirements → use `collaborative-plan-with-file`
940
+ - Ready to implement → use `lite-plan`
1031
941
 
1032
942
  ---
1033
943