- name
- brainstorm
- description
- Dual-mode brainstorming pipeline. Auto mode: framework generation → parallel role analysis
(spawn_agents_on_csv) → cross-role synthesis. Single role mode: individual role analysis.
CSV-driven parallel coordination with NDJSON discovery board.
- argument-hint
- [-y|--yes] [--count N] [--session ID] [--skip-questions] [--style-skill PKG] "topic" | <role-name> [--session ID]
- allowed-tools
- spawn_agents_on_csv, spawn_agent, wait_agent, send_message, followup_task, close_agent, request_user_input, Read, Write, Edit, Bash, Glob, Grep
## Auto Mode
When `--yes` or `-y`: Auto-select auto mode, auto-select recommended roles, skip all clarification questions, use defaults. **This skill is brainstorming-only — it produces analysis and feature specs but NEVER executes code or modifies source files.**
# Brainstorm
## Usage
```bash
$brainstorm "Build real-time collaboration platform" --count 3
$brainstorm -y "Design payment system" --count 5
$brainstorm "Build notification system" --style-skill material-design
$brainstorm system-architect --session WFS-xxx
$brainstorm ux-expert --include-questions
```
**Flags**:
- `-y, --yes`: Skip all confirmations (auto mode)
- `--count N`: Number of roles to select (default: 3, max: 9)
- `--session ID`: Use existing session
- `--skip-questions / --include-questions`: Control interactive Q&A per role
- `--style-skill PKG`: Style skill package for ui-designer
- `--update`: Update existing role analysis
---
## Overview
Dual-mode brainstorming with CSV-driven parallel role analysis. Auto mode runs a full pipeline; single role mode runs one role analysis independently.
```
┌──────────────────────────────────────────────────────────────────┐
│ BRAINSTORM PIPELINE │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Phase 1: Mode Detection & Routing │
│ ├─ Parse flags and arguments │
│ └─ Route to Auto Mode or Single Role Mode │
│ │
│ ═══ Auto Mode ═══ │
│ │
│ Phase 2: Interactive Framework Generation │
│ ├─ Context collection → Topic analysis → Role selection │
│ ├─ Generate guidance-specification.md │
│ ├─ Generate roles.csv (1 row per selected role) │
│ └─ User validates (skip if -y) │
│ │
│ Phase 3: Wave Role Analysis (spawn_agents_on_csv) │
│ ├─ spawn_agents_on_csv(role instruction template) │
│ ├─ Each role agent produces analysis.md + sub-documents │
│ └─ discoveries.ndjson shared across role agents │
│ │
│ Phase 4: Synthesis Integration │
│ ├─ Read all role analyses (read-only) │
│ ├─ Cross-role analysis → conflict detection │
│ ├─ Feature spec generation │
│ └─ Output: feature-specs/ + feature-index.json │
│ │
│ ═══ Single Role Mode ═══ │
│ │
│ Phase 3S: Single Role Analysis (spawn_agent) │
│ ├─ spawn_agent(conceptual_planning_agent) │
│ └─ Output: {role}/analysis*.md │
│ │
└──────────────────────────────────────────────────────────────────┘
```
---
## Context Flow
```
roles.csv feature-specs/
┌──────────────┐ ┌──────────────────┐
│ R1: sys-arch │──findings───→│ F-001-auth.md │
│ analysis.md │ │ (cross-role spec) │
├──────────────┤ ├──────────────────┤
│ R2: ui-design│──findings───→│ F-002-ui.md │
│ analysis.md │ │ (cross-role spec) │
├──────────────┤ ├──────────────────┤
│ R3: test-str │──findings───→│ F-003-test.md │
│ analysis.md │ │ (cross-role spec) │
└──────────────┘ └──────────────────┘
Two context channels:
1. Directed: role findings → synthesis → feature specs
2. Broadcast: discoveries.ndjson (append-only shared board)
```
---
## CSV Schema
### roles.csv
```csv
id,role,title,focus,deps,wave,status,findings,output_files,error
"R1","system-architect","系统架构师","Technical architecture, scalability","","1","pending","","",""
"R2","ui-designer","UI设计师","Visual design, mockups","","1","pending","","",""
"R3","test-strategist","测试策略师","Test strategy, quality","","1","pending","","",""
```
**Columns**:
| Column | Phase | Description |
|--------|-------|-------------|
| `id` | Input | Role ID: R1, R2, ... |
| `role` | Input | Role identifier (e.g., system-architect) |
| `title` | Input | Role display title |
| `focus` | Input | Role focus areas and keywords |
| `deps` | Input | Dependency IDs (usually empty — all wave 1) |
| `wave` | Computed | Wave number (usually 1 for all roles) |
| `status` | Output | `pending` → `completed` / `failed` |
| `findings` | Output | Key discoveries (max 800 chars) |
| `output_files` | Output | Generated analysis files (semicolon-separated) |
| `error` | Output | Error message if failed |
---
## Available Roles
| Role ID | Title | Focus Area |
|---------|-------|------------|
| `data-architect` | 数据架构师 | Data models, storage strategies, data flow |
| `product-manager` | 产品经理 | Product strategy, roadmap, prioritization |
| `product-owner` | 产品负责人 | Backlog management, user stories, acceptance criteria |
| `scrum-master` | 敏捷教练 | Process facilitation, impediment removal |
| `subject-matter-expert` | 领域专家 | Domain knowledge, business rules, compliance |
| `system-architect` | 系统架构师 | Technical architecture, scalability, integration |
| `test-strategist` | 测试策略师 | Test strategy, quality assurance |
| `ui-designer` | UI设计师 | Visual design, mockups, design systems |
| `ux-expert` | UX专家 | User research, information architecture, journey |
---
## Session Structure
```
.workflow/active/WFS-{topic}/
├── workflow-session.json # Session metadata
├── .process/
│ └── context-package.json # Phase 0 context
├── roles.csv # Role analysis state (Phase 2-3)
├── discoveries.ndjson # Shared discovery board
└── .brainstorming/
├── guidance-specification.md # Framework (Phase 2)
├── feature-index.json # Feature index (Phase 4)
├── synthesis-changelog.md # Synthesis audit trail (Phase 4)
├── feature-specs/ # Feature specs (Phase 4)
│ ├── F-001-{slug}.md
│ └── F-00N-{slug}.md
└── {role}/ # Role analyses (Phase 3, immutable)
├── {role}-context.md # Interactive Q&A
├── analysis.md # Main/index document
├── analysis-cross-cutting.md # Cross-feature
└── analysis-F-{id}-{slug}.md # Per-feature
```
---
## Implementation
### Session Initialization
```javascript
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
// Parse flags
const AUTO_YES = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
const countMatch = $ARGUMENTS.match(/--count\s+(\d+)/)
const roleCount = countMatch ? Math.min(parseInt(countMatch[1]), 9) : 3
const sessionMatch = $ARGUMENTS.match(/--session\s+(\S+)/)
const existingSessionId = sessionMatch ? sessionMatch[1] : null
const skipQuestions = $ARGUMENTS.includes('--skip-questions')
const includeQuestions = $ARGUMENTS.includes('--include-questions')
const styleSkillMatch = $ARGUMENTS.match(/--style-skill\s+(\S+)/)
const styleSkill = styleSkillMatch ? styleSkillMatch[1] : null
const updateMode = $ARGUMENTS.includes('--update')
// Role detection
const VALID_ROLES = [
'data-architect', 'product-manager', 'product-owner', 'scrum-master',
'subject-matter-expert', 'system-architect', 'test-strategist',
'ui-designer', 'ux-expert'
]
const cleanArgs = $ARGUMENTS
.replace(/--yes|-y|--count\s+\d+|--session\s+\S+|--skip-questions|--include-questions|--style-skill\s+\S+|--update/g, '')
.trim()
const firstArg = cleanArgs.split(/\s+/)[0]
const isRole = VALID_ROLES.includes(firstArg)
// Mode detection
let executionMode
if (AUTO_YES) {
executionMode = 'auto'
} else if (isRole) {
executionMode = 'single-role'
} else if (cleanArgs) {
executionMode = 'auto'
} else {
executionMode = null // Ask user
}
const topic = isRole
? cleanArgs.replace(firstArg, '').trim()
: cleanArgs.replace(/^["']|["']$/g, '')
```
---
### Phase 1: Mode Detection & Routing
**Objective**: Parse arguments, determine execution mode, prepare session.
**Steps**:
1. **Detect Mode**
```javascript
if (executionMode === null) {
const modeAnswer = functions.request_user_input({
questions: [{
question: "Choose brainstorming mode:",
header: "Mode",
options: [
{ label: "Auto Mode (Recommended)", description: "Full pipeline: framework → parallel roles → synthesis" },
{ label: "Single Role", description: "Run one role analysis independently" }
]
}]
})
executionMode = modeAnswer.Mode.startsWith('Auto') ? 'auto' : 'single-role'
}
```
2. **Session Setup**
```javascript
let sessionId, sessionFolder
if (existingSessionId) {
sessionId = existingSessionId
sessionFolder = `.workflow/active/${sessionId}`
} else if (executionMode === 'auto') {
const slug = topic.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
sessionId = `WFS-${slug}`
sessionFolder = `.workflow/active/${sessionId}`
Bash(`mkdir -p "${sessionFolder}/.brainstorming" "${sessionFolder}/.process"`)
// Initialize workflow-session.json
Write(`${sessionFolder}/workflow-session.json`, JSON.stringify({
session_id: sessionId,
topic: topic,
status: 'brainstorming',
execution_mode: executionMode,
created_at: getUtc8ISOString()
}, null, 2))
} else {
// Single role mode requires existing session
const existing = Bash(`ls -d .workflow/active/WFS-* 2>/dev/null | head -1`).trim()
if (!existing) {
console.log('ERROR: No active session found. Run auto mode first to create a session.')
return
}
sessionId = existing.split('/').pop()
sessionFolder = existing
}
```
**Route**:
- `executionMode === 'auto'` → Phase 2
- `executionMode === 'single-role'` → Phase 3S
---
### Phase 2: Interactive Framework Generation (Auto Mode)
**Objective**: Analyze topic, select roles, generate guidance-specification.md and roles.csv.
**Steps**:
1. **Analyze Topic & Select Roles**
```javascript
Bash({
command: `ccw cli -p "PURPOSE: Analyze brainstorming topic and recommend ${roleCount} expert roles for multi-perspective analysis. Success = well-matched roles with clear focus areas.
TASK:
• Analyze topic domain, complexity, and key dimensions
• Select ${roleCount} roles from: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
• For each role: define focus area, key questions, and analysis scope
• Identify potential cross-role conflicts or synergies
• Generate feature decomposition if topic has distinct components
MODE: analysis
CONTEXT: @**/*
EXPECTED: JSON: {analysis: {domain, complexity, dimensions[]}, roles: [{id, role, title, focus, key_questions[]}], features: [{id, title, description}]}
CONSTRAINTS: Select exactly ${roleCount} roles | Each role must have distinct perspective | Roles must cover topic comprehensively
TOPIC: ${topic}" --tool gemini --mode analysis --rule planning-breakdown-task-steps`,
run_in_background: true
})
// Wait for CLI completion → { analysis, roles[], features[] }
```
2. **User Validation** (skip if AUTO_YES)
```javascript
if (!AUTO_YES) {
console.log(`\n## Brainstorm Framework\n`)
console.log(`Topic: ${topic}`)
console.log(`Domain: ${analysis.domain} | Complexity: ${analysis.complexity}`)
console.log(`\nSelected Roles (${roles.length}):`)
roles.forEach(r => console.log(` - [${r.id}] ${r.title}: ${r.focus}`))
if (features.length > 0) {
console.log(`\nFeatures (${features.length}):`)
features.forEach(f => console.log(` - [${f.id}] ${f.title}`))
}
const answer = functions.request_user_input({
questions: [{
question: "Approve brainstorm framework?",
header: "Validate",
options: [
{ label: "Approve", description: "Proceed with role analysis" },
{ label: "Modify Roles", description: "Change role selection" },
{ label: "Cancel", description: "Abort" }
]
}]
})
if (answer.Validate === "Cancel") return
Ver no GitHub