- name
- brainstorm-with-file
- description
- Interactive brainstorming with documented thought evolution, multi-perspective analysis, and iterative refinement. Serial execution with no agent delegation.
- argument-hint
- TOPIC="<idea or topic>" [--perspectives=creative,pragmatic,systematic] [--max-ideas=<n>]
# Codex Brainstorm-With-File Prompt
## Overview
Interactive brainstorming workflow with **documented thought evolution**. Expands initial ideas through questioning, inline multi-perspective analysis, external research, and iterative refinement.
**Core workflow**: Seed Idea → Expand → Multi-Perspective Explore → Research → Refine → Crystallize → Next Step
**Key features**:
- **brainstorm.md**: Complete thought evolution timeline
- **Multi-perspective analysis**: Creative + Pragmatic + Systematic (serial, inline)
- **External research**: Web search for inspiration, patterns, and best practices via `web.run`
- **Idea expansion**: Progressive questioning and exploration
- **Diverge-Converge cycles**: Generate options then focus on best paths
- **Progress tracking**: `functions.update_plan` for real-time phase progress visibility
- **Structured handoff**: Terminal gate with execution planning, issue creation, or completion
## Auto Mode
When `--yes` or `-y`: Auto-confirm exploration decisions, use recommended perspectives, skip interactive scoping.
## Quick Start
```bash
# Basic usage
/codex:brainstorm-with-file TOPIC="How to improve developer onboarding experience"
# With perspective selection
/codex:brainstorm-with-file TOPIC="New caching strategy" --perspectives=creative,pragmatic,systematic
# Continue existing session
/codex:brainstorm-with-file TOPIC="caching strategy" --continue
# Auto mode (skip confirmations)
/codex:brainstorm-with-file -y TOPIC="Plugin architecture ideas"
```
## Target Topic
**$TOPIC**
## Configuration
| Flag | Default | Description |
|------|---------|-------------|
| `-y, --yes` | false | Auto-confirm all decisions |
| `--continue` | false | Continue existing session |
| `--perspectives` | creative,pragmatic,systematic | Comma-separated perspective list |
| `--max-ideas` | 15 | Maximum ideas to track |
**Session ID format**: `BS-{YYYY-MM-DD}-{slug}`
- slug: lowercase, alphanumeric + CJK characters, max 40 chars
- date: YYYY-MM-DD (UTC+8)
- Auto-detect continue: session folder + brainstorm.md exists → continue mode
## Brainstorm Flow
```
Step 0: Session Setup
├─ Parse topic, flags (--perspectives, --continue, -y)
├─ Generate session ID: BS-{date}-{slug}
├─ Create session folder (or detect existing → continue mode)
└─ functions.update_plan (5 phases: Seed → Explore → Refine → Converge → GATE)
Step 1: Seed Understanding
├─ Parse topic, identify brainstorm dimensions
├─ Role/perspective selection with user (or auto)
├─ Initial scoping via functions.request_user_input (mode, focus, constraints)
├─ Expand seed into exploration vectors
└─ Initialize brainstorm.md
Step 2: Divergent Exploration (Inline, No Agents)
├─ Detect codebase → search relevant modules, patterns
│ ├─ Run `ccw spec load --category exploration` (if spec system available)
│ └─ Use Grep, Glob, Read, mcp__ace-tool__search_context
├─ Multi-perspective analysis (serial, inline)
│ ├─ Creative perspective: innovation, cross-domain, challenge assumptions
│ ├─ Pragmatic perspective: feasibility, effort, blockers
│ └─ Systematic perspective: decomposition, patterns, scalability
├─ External research via web.run (optional — patterns, best practices, inspiration)
├─ Aggregate findings → perspectives.json + research.json
├─ Update brainstorm.md with Round 1
└─ Initial Idea Coverage Check
Step 3: Interactive Refinement (Multi-Round, max 6)
├─ Present current ideas and perspectives (Cumulative Context)
├─ Record findings to brainstorm.md BEFORE updating Current Ideas
├─ Gather user feedback via functions.request_user_input
├─ Process response:
│ ├─ Deep Dive → deeper inline analysis on selected ideas
│ ├─ Diverge → new inline analysis with different angles
│ ├─ Challenge → devil's advocate inline analysis
│ ├─ Merge → synthesize complementary ideas inline
│ ├─ 外部研究 → web.run for external inspiration/validation
│ └─ Converge → exit loop for synthesis
├─ Update brainstorm.md with round details
└─ Repeat until user selects converge or max rounds
Step 4: Convergence & Crystallization
├─ Consolidate all insights → synthesis.json
├─ Update brainstorm.md with final synthesis
├─ Batch top-idea review via functions.request_user_input
└─ MANDATORY Terminal Gate: 执行任务 / 产出Issue / 完成
├─ Execute Task → handoff-spec.json with implementation scope
├─ Create Issue → display issue creation command
└─ Done → end workflow
```
## Output Artifacts
### Phase 1: Seed Understanding
| Artifact | Purpose |
|----------|---------|
| `brainstorm.md` | Initialized with session metadata, seed expansion, and exploration vectors |
| Session variables | Topic slug, brainstorm mode, dimensions, exploration vectors |
### Phase 2: Divergent Exploration
| Artifact | Purpose |
|----------|---------|
| `exploration-codebase.json` | Codebase context: relevant files, patterns, architecture constraints |
| `perspectives/*.json` | Individual perspective outputs (creative, pragmatic, systematic) |
| `perspectives.json` | Aggregated findings with synthesis (convergent/conflicting themes) |
| Updated `brainstorm.md` | Round 1: Exploration results and multi-perspective analysis |
### Phase 3: Interactive Refinement
| Artifact | Purpose |
|----------|---------|
| `ideas/{idea-slug}.md` | Deep-dive analysis for selected ideas |
| `ideas/merged-idea-{n}.md` | Merged idea documents |
| Updated `brainstorm.md` | Round 2-6: User feedback, idea selections, refinement cycles |
### Phase 4: Convergence & Crystallization
| Artifact | Purpose |
|----------|---------|
| `synthesis.json` | Final synthesis: top ideas, recommendations, insights |
| Final `brainstorm.md` | Complete thought evolution with conclusions |
---
## Recording Protocol
**CRITICAL**: During brainstorming, the following situations **MUST** trigger immediate recording to brainstorm.md:
| Trigger | What to Record | Target Section |
|---------|---------------|----------------|
| **Idea generated** | Idea content, source perspective, novelty/feasibility ratings | `#### Ideas Generated` |
| **Perspective shift** | Old framing → new framing, trigger reason | `#### Decision Log` |
| **User feedback** | User's original input, which ideas selected/rejected | `#### User Input` |
| **Assumption challenged** | Original assumption → challenge result, survivability | `#### Challenged Assumptions` |
| **Ideas merged** | Source ideas, merged concept, what was preserved/discarded | `#### Decision Log` |
| **Scope adjustment** | Before/after scope, trigger reason | `#### Decision Log` |
### Decision Record Format
```markdown
> **Decision**: [Description of the decision]
> - **Context**: [What triggered this decision]
> - **Options considered**: [Alternatives evaluated]
> - **Chosen**: [Selected approach] — **Reason**: [Rationale]
> - **Rejected**: [Why other options were discarded]
> - **Impact**: [Effect on brainstorming direction]
```
### Narrative Synthesis Format
Append after each round update:
```markdown
### Round N: Narrative Synthesis
**Starting point**: Based on previous round's [conclusions/questions], this round explored [starting point].
**Key progress**: [New ideas/findings] [confirmed/refuted/expanded] previous understanding of [topic area].
**Decision impact**: User selected [feedback type], directing brainstorming toward [adjusted/deepened/maintained].
**Current state**: After this round, top ideas are [updated idea rankings].
**Open directions**: [remaining exploration angles for next round]
```
## Implementation Details
### Phase 0: Session Initialization
```javascript
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
// Parse flags
const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
const continueMode = $ARGUMENTS.includes('--continue')
const perspectivesMatch = $ARGUMENTS.match(/--perspectives[=\s]([\w,]+)/)
const selectedPerspectiveNames = perspectivesMatch
? perspectivesMatch[1].split(',')
: ['creative', 'pragmatic', 'systematic']
// Extract topic
const topic = $ARGUMENTS.replace(/--yes|-y|--continue|--perspectives[=\s][\w,]+|--max-ideas[=\s]\d+|TOPIC=/g, '').replace(/^["']|["']$/g, '').trim()
// Determine project root
const projectRoot = functions.exec_command('git rev-parse --show-toplevel 2>/dev/null || pwd').trim()
const slug = topic.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
const dateStr = getUtc8ISOString().substring(0, 10)
const sessionId = `BS-${dateStr}-${slug}`
const sessionFolder = `${projectRoot}/.workflow/.brainstorm/${sessionId}`
// Auto-detect continue: session folder + brainstorm.md exists → continue mode
// If continue → load brainstorm.md + perspectives, resume from last round
functions.exec_command(`mkdir -p ${sessionFolder}`)
// Initialize progress tracking (MANDATORY)
functions.update_plan([
{ id: "phase-1", title: "Phase 1: Seed Understanding", status: "in_progress" },
{ id: "phase-2", title: "Phase 2: Divergent Exploration", status: "pending" },
{ id: "phase-3", title: "Phase 3: Interactive Refinement", status: "pending" },
{ id: "phase-4", title: "Phase 4: Convergence & Crystallization", status: "pending" },
{ id: "next-step", title: "GATE: Post-Completion Next Step", status: "pending" }
])
```
### Phase 1: Seed Understanding
**Objective**: Parse the initial idea, identify exploration vectors, scope preferences, and initialize the brainstorm document.
##### Step 1.1: Parse Seed & Identify Dimensions
Match topic keywords against brainstorm dimensions (see [Dimensions Reference](#brainstorm-dimensions)):
```javascript
// Match topic text against keyword lists from Dimensions Reference
// If multiple dimensions match, include all
// If none match, default to "technical" and "innovation"
const dimensions = identifyDimensions(topic, BRAINSTORM_DIMENSIONS)
```
##### Step 1.2: Role Selection
Recommend roles based on topic keywords, then let user confirm or override.
**Professional Roles** (recommended based on topic keywords):
| Role | Perspective Focus | Keywords |
|------|------------------|----------|
| system-architect | Architecture, patterns | 架构, architecture, system, 系统, design pattern |
| product-manager | Business value, roadmap | 产品, product, feature, 功能, roadmap |
| ui-designer | Visual design, interaction | UI, 界面, interface, visual, 视觉 |
| ux-expert | User research, usability | UX, 体验, experience, user, 用户 |
| data-architect | Data modeling, storage | 数据, data, database, 存储, storage |
| test-strategist | Quality, testing | 测试, test, quality, 质量, QA |
| subject-matter-expert | Domain knowledge | 领域, domain, industry, 行业, expert |
**Simple Perspectives** (fallback — always available):
| Perspective | Focus | Best For |
|-------------|-------|----------|
| creative | Innovation, cross-domain | Generating novel ideas |
| pragmatic | Implementation, feasibility | Reality-checking ideas |
| systematic | Architecture, structure | Organizing solutions |
**Selection Strategy**:
1. **Auto mode**: Select top 3 recommended professional roles based on keyword matching
2. **Manual mode**: Present recommended roles + "Use simple perspectives" option
3. **Continue mode**: Use roles from previous session
##### Step 1.3: Initial Scoping (New Session Only)
For new brainstorm sessions, gather user preferences before exploration (skipped in auto mode or continue mode):
```javascript
if (!autoYes && !continueMode) {
// Single batch: Mode + Focus + Constraints (max 4 questions per call)
const scoping = functions.request_user_input({
questions: [
{
header: "Mode", // max 12 chars
question: "Select brainstorming intensity:",
multiSelect: false,
options: [
{ label: "Balanced (Recommended)", description: "Moderate, 3 perspectives" },
{ label: "Creative", description: "Fast, high novelty, 1 perspective" },
{ label: "Deep", description: "Comprehensive, 3 perspectives + deep refinement" }
]
},
{
header: "Focus",
question: "Select brainstorming focus areas:",
multiSelect: true,
options: generateFocusOptions(dimensions) // Dynamic based on dimensions
},
{
header: "Constraints",
question: "Any constraints to consider?",
multiSelect: true,
options: [
{ label: "Existing Arch", description: "Must fit current system" },
{ label: "Time Limited", description: "Short implementation timeline" },
{ label: "Resource Limited", description: "Limited team/budget" },
{ label: "No Constraints", description: "Blue-sky thinking" }
]
Ver en GitHub