brainstorm-with-file
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCodex Brainstorm-With-File Workflow
Codex 带文件支持的头脑风暴工作流
Quick Start
快速开始
Interactive brainstorming workflow with documented thought evolution. Expands initial ideas through questioning, parallel subagent analysis, and iterative refinement.
Core workflow: Seed Idea → Expand → Parallel Subagent Explore → Synthesize → Refine → Crystallize
Key features:
- brainstorm.md: Complete thought evolution timeline
- Parallel multi-perspective: Creative + Pragmatic + Systematic (concurrent subagents)
- Idea expansion: Progressive questioning and exploration
- Diverge-Converge cycles: Generate options then focus on best paths
Codex-Specific Features:
- Parallel subagent execution via + batch
spawn_agentwait({ ids: [...] }) - Role loading via path (agent reads itself)
~/.codex/agents/*.md - Deep interaction with for multi-round refinement within single agent
send_input - Explicit lifecycle management with
close_agent
支持思维演进记录的交互式头脑风暴工作流。通过提问、并行子代理分析和迭代优化来拓展初始创意。
核心工作流:初始创意 → 拓展 → 并行子代理探索 → 综合 → 优化 → 固化
关键特性:
- brainstorm.md:完整的思维演进时间线
- 多视角并行分析:创意型+务实型+系统型(并发子代理)
- 创意拓展:渐进式提问与探索
- 发散-收敛循环:先生成多种方案,再聚焦最优路径
Codex专属特性:
- 通过 + 批量
spawn_agent实现并行子代理执行wait({ ids: [...] }) - 通过路径加载角色(代理自行读取 )
~/.codex/agents/*.md - 利用 实现单代理内多轮优化的深度交互
send_input - 用 进行显式生命周期管理
close_agent
Overview
概述
This workflow enables iterative exploration and refinement of ideas through parallel-capable phases:
- Seed Understanding - Parse the initial idea and identify exploration vectors
- Divergent Exploration - Gather codebase context and execute parallel multi-perspective analysis
- Interactive Refinement - Multi-round idea selection, deep-dive, and refinement via send_input
- Convergence & Crystallization - Synthesize final ideas and generate recommendations
The key innovation is documented thought evolution that captures how ideas develop, perspectives differ, and insights emerge across all phases.
该工作流通过支持并行的多个阶段,实现创意的迭代探索与优化:
- 初始创意理解 - 解析初始创意,确定探索方向
- 发散探索 - 收集代码库上下文,执行多视角并行分析
- 交互式优化 - 通过send_input进行多轮创意选择、深度挖掘与优化
- 收敛与固化 - 综合最终创意,生成建议方案
核心创新点是思维演进记录,它能捕捉创意如何发展、视角有何差异,以及各阶段产生的洞察。
Output Structure
输出结构
{projectRoot}/.workflow/.brainstorm/BS-{slug}-{date}/
├── brainstorm.md # ⭐ Complete thought evolution timeline
├── exploration-codebase.json # Phase 2: Codebase context
├── perspectives/ # Phase 2: Individual perspective outputs
│ ├── creative.json
│ ├── pragmatic.json
│ └── systematic.json
├── perspectives.json # Phase 2: Aggregated parallel findings with synthesis
├── synthesis.json # Phase 4: Final synthesis
└── ideas/ # Phase 3: Individual idea deep-dives
├── idea-1.md
├── idea-2.md
└── merged-idea-1.md{projectRoot}/.workflow/.brainstorm/BS-{slug}-{date}/
├── brainstorm.md # ⭐ 完整的思维演进时间线
├── exploration-codebase.json # 阶段2:代码库上下文
├── perspectives/ # 阶段2:各视角独立输出
│ ├── creative.json
│ ├── pragmatic.json
│ └── systematic.json
├── perspectives.json # 阶段2:并行分析结果汇总与综合
├── synthesis.json # 阶段4:最终综合结果
└── ideas/ # 阶段3:单个创意的深度挖掘文档
├── idea-1.md
├── idea-2.md
└── merged-idea-1.mdOutput Artifacts
输出产物
Phase 1: Seed Understanding
阶段1:初始创意理解
| Artifact | Purpose |
|---|---|
| Initialized with session metadata, seed expansion, and exploration vectors |
| Session variables | Topic slug, brainstorm mode, dimensions, exploration vectors |
| 产物 | 用途 |
|---|---|
| 初始化时包含会话元数据、初始创意拓展内容和探索方向 |
| 会话变量 | 主题缩写、头脑风暴模式、维度、探索方向 |
Phase 2: Divergent Exploration
阶段2:发散探索
| Artifact | Purpose |
|---|---|
| Codebase context: relevant files, patterns, architecture constraints |
| Individual perspective outputs from parallel subagents |
| Aggregated parallel findings with synthesis (convergent/conflicting themes) |
Updated | Round 2: Exploration results and multi-perspective analysis |
| 产物 | 用途 |
|---|---|
| 代码库上下文:相关文件、模式、架构约束 |
| 各并行子代理的独立视角输出 |
| 并行分析结果汇总与综合(包含共识与冲突点) |
更新后的 | 第2轮:探索结果与多视角分析内容 |
Phase 3: Interactive Refinement
阶段3:交互式优化
| Artifact | Purpose |
|---|---|
| Deep-dive analysis for selected ideas |
Updated | Round 3-6: User feedback, idea selections, refinement cycles |
| 产物 | 用途 |
|---|---|
| 选中创意的深度分析文档 |
更新后的 | 第3-6轮:用户反馈、创意选择、优化循环记录 |
Phase 4: Convergence & Crystallization
阶段4:收敛与固化
| Artifact | Purpose |
|---|---|
| Final synthesis: top ideas, recommendations, insights |
Final | Complete thought evolution with conclusions |
| 产物 | 用途 |
|---|---|
| 最终综合结果:最优创意、建议方案、关键洞察 |
最终版 | 包含结论的完整思维演进记录 |
Implementation Details
实现细节
Session Initialization
会话初始化
Step 0: Determine Project Root
步骤0:确定项目根目录
检测项目根目录,确保 产物位置正确:
.workflow/bash
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)优先通过 git 获取仓库根目录;非 git 项目回退到 取当前绝对路径。
存储为 ,后续所有 路径必须以此为前缀。
pwd{projectRoot}.workflow/The workflow automatically generates a unique session identifier and directory structure based on the topic and current date (UTC+8).
Session ID Format:
BS-{slug}-{date}- : Lowercase alphanumeric + Chinese characters, max 40 chars
slug - : YYYY-MM-DD format (UTC+8)
date
Session Directory:
{projectRoot}/.workflow/.brainstorm/{sessionId}/Auto-Detection: If session folder exists with brainstorm.md, automatically enters continue mode. Otherwise, creates new session.
Brainstorm Modes:
- : Emphasize novelty and innovation, relaxed constraints
creative - : Balance creativity with feasibility, realistic scope
structured - : Default, moderate innovation with practical considerations
balanced
检测项目根目录,确保 产物位置正确:
.workflow/bash
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)优先通过 git 获取仓库根目录;非 git 项目回退到 取当前绝对路径。
存储为 ,后续所有 路径必须以此为前缀。
pwd{projectRoot}.workflow/工作流会根据主题和当前日期(UTC+8)自动生成唯一的会话标识符和目录结构。
会话ID格式:
BS-{slug}-{date}- :小写字母数字+中文,最多40个字符
slug - :YYYY-MM-DD格式(UTC+8)
date
会话目录:
{projectRoot}/.workflow/.brainstorm/{sessionId}/自动检测:如果已存在包含brainstorm.md的会话文件夹,自动进入续会模式;否则创建新会话。
头脑风暴模式:
- :强调新颖性与创新性,约束宽松
creative - :平衡创意与可行性,范围贴合实际
structured - :默认模式,适度创新结合实用考量
balanced
Phase 1: Seed Understanding
阶段1:初始创意理解
Objective: Parse the initial idea, identify exploration vectors, scope preferences, and initialize the brainstorm document.
目标:解析初始创意,确定探索方向、范围偏好,并初始化头脑风暴文档。
Step 1.1: Parse Seed & Identify Dimensions
步骤1.1:解析初始创意,确定维度
The workflow analyzes the topic text against predefined brainstorm dimensions.
Brainstorm Dimensions:
| Dimension | Keywords |
|---|---|
| technical | 技术, technical, implementation, code, 实现, architecture |
| ux | 用户, user, experience, UX, UI, 体验, interaction |
| business | 业务, business, value, ROI, 价值, market |
| innovation | 创新, innovation, novel, creative, 新颖 |
| feasibility | 可行, feasible, practical, realistic, 实际 |
| scalability | 扩展, scale, growth, performance, 性能 |
| security | 安全, security, risk, protection, 风险 |
Matching Logic: Compare topic text against keyword lists to identify relevant dimensions.
工作流会将主题文本与预定义的头脑风暴维度进行匹配分析。
头脑风暴维度:
| 维度 | 关键词 |
|---|---|
| technical | 技术, technical, implementation, code, 实现, architecture |
| ux | 用户, user, experience, UX, UI, 体验, interaction |
| business | 业务, business, value, ROI, 价值, market |
| innovation | 创新, innovation, novel, creative, 新颖 |
| feasibility | 可行, feasible, practical, realistic, 实际 |
| scalability | 扩展, scale, growth, performance, 性能 |
| security | 安全, security, risk, protection, 风险 |
匹配逻辑:将主题文本与关键词列表对比,确定相关维度。
Step 1.2: Role Selection
步骤1.2:角色选择
Recommend roles based on topic keywords, then let user confirm or override.
Professional Roles (recommended based on topic keywords):
| Role | Perspective Agent 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:
- Auto mode: Select top 3 recommended professional roles based on keyword matching
- Manual mode: Present recommended roles + "Use simple perspectives" option
- Continue mode: Use roles from previous session
根据主题关键词推荐角色,再由用户确认或修改。
专业角色(根据主题关键词推荐):
| 角色 | 视角代理关注点 | 关键词 |
|---|---|---|
| system-architect | 架构、模式 | 架构, architecture, system, 系统, design pattern |
| product-manager | 业务价值、路线图 | 产品, product, feature, 功能, roadmap |
| ui-designer | 视觉设计、交互 | UI, 界面, interface, visual, 视觉 |
| ux-expert | 用户研究、可用性 | UX, 体验, experience, user, 用户 |
| data-architect | 数据建模、存储 | 数据, data, database, 存储, storage |
| test-strategist | 质量、测试 | 测试, test, quality, 质量, QA |
| subject-matter-expert | 领域知识 | 领域, domain, industry, 行业, expert |
基础视角(备选 - 始终可用):
| 视角 | 关注点 | 适用场景 |
|---|---|---|
| creative | 创新、跨领域 | 生成新颖创意 |
| pragmatic | 实现、可行性 | 验证创意的现实性 |
| systematic | 架构、结构化 | 整理解决方案 |
选择策略:
- 自动模式:根据关键词匹配结果,选择排名前3的专业角色
- 手动模式:展示推荐角色 + "使用基础视角" 选项
- 续会模式:沿用之前会话的角色
Step 1.3: Initial Scoping (New Session Only)
步骤1.3:初始范围设定(仅新会话)
For new brainstorm sessions, gather user preferences before exploration.
Brainstorm Mode (Single-select):
- 创意模式 (Creative mode - 15-20 minutes, 1 subagent)
- 平衡模式 (Balanced mode - 30-60 minutes, 3 parallel subagents)
- 深度模式 (Deep mode - 1-2+ hours, 3 parallel subagents + deep refinement)
Focus Areas (Multi-select):
- 技术方案 (Technical solutions)
- 用户体验 (User experience)
- 创新突破 (Innovation breakthroughs)
- 可行性评估 (Feasibility assessment)
Constraints (Multi-select):
- 现有架构 (Existing architecture constraints)
- 时间限制 (Time constraints)
- 资源限制 (Resource constraints)
- 无约束 (No constraints)
对于新的头脑风暴会话,在探索前收集用户偏好。
头脑风暴模式(单选):
- 创意模式 (Creative mode - 15-20分钟,1个子代理)
- 平衡模式 (Balanced mode - 30-60分钟,3个并行子代理)
- 深度模式 (Deep mode - 1-2+小时,3个并行子代理+深度优化)
聚焦领域(多选):
- 技术方案 (Technical solutions)
- 用户体验 (User experience)
- 创新突破 (Innovation breakthroughs)
- 可行性评估 (Feasibility assessment)
约束条件(多选):
- 现有架构 (Existing architecture constraints)
- 时间限制 (Time constraints)
- 资源限制 (Resource constraints)
- 无约束 (No constraints)
Step 1.4: Expand Seed into Exploration Vectors
步骤1.4:将初始创意拓展为探索方向
Generate key questions that guide the brainstorming exploration. Use a subagent for vector generation.
Exploration Vectors:
- Core question: What is the fundamental problem/opportunity?
- User perspective: Who benefits and how?
- Technical angle: What enables this technically?
- Alternative approaches: What other ways could this be solved?
- Challenges: What could go wrong or block success?
- Innovation angle: What would make this 10x better?
- Integration: How does this fit with existing systems/processes?
Subagent for Vector Generation:
javascript
const vectorAgent = spawn_agent({
message: `生成指导头脑风暴探索的关键问题,使用子代理生成探索方向。
探索方向:
- 核心问题:根本问题/机遇是什么?
- 用户视角:谁会受益?如何受益?
- 技术角度:技术上有哪些实现基础?
- 替代方案:还有哪些解决思路?
- 挑战分析:可能出现哪些问题或障碍?
- 创新维度:如何让方案效果提升10倍?
- 集成考量:如何与现有系统/流程集成?
生成探索方向的子代理:
javascript
const vectorAgent = spawn_agent({
message: `TASK ASSIGNMENT
TASK ASSIGNMENT
MANDATORY FIRST STEPS (Agent Execute)
MANDATORY FIRST STEPS (Agent Execute)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
Context
Context
Topic: ${idea_or_topic}
User focus areas: ${userFocusAreas.join(', ')}
Constraints: ${constraints.join(', ')}
Topic: ${idea_or_topic}
User focus areas: ${userFocusAreas.join(', ')}
Constraints: ${constraints.join(', ')}
Task
Task
Generate 5-7 exploration vectors (questions/directions) to expand this idea:
- Core question: What is the fundamental problem/opportunity?
- User perspective: Who benefits and how?
- Technical angle: What enables this technically?
- Alternative approaches: What other ways could this be solved?
- Challenges: What could go wrong or block success?
- Innovation angle: What would make this 10x better?
- Integration: How does this fit with existing systems/processes?
Generate 5-7 exploration vectors (questions/directions) to expand this idea:
- Core question: What is the fundamental problem/opportunity?
- User perspective: Who benefits and how?
- Technical angle: What enables this technically?
- Alternative approaches: What other ways could this be solved?
- Challenges: What could go wrong or block success?
- Innovation angle: What would make this 10x better?
- Integration: How does this fit with existing systems/processes?
Deliverables
Deliverables
Return structured exploration vectors for multi-perspective analysis.
`
})
const result = wait({ ids: [vectorAgent], timeout_ms: 120000 })
close_agent({ id: vectorAgent })
**Purpose**: These vectors guide each perspective subagent's analysis and ensure comprehensive exploration.Return structured exploration vectors for multi-perspective analysis.
`
})
const result = wait({ ids: [vectorAgent], timeout_ms: 120000 })
close_agent({ id: vectorAgent })
**目的**:这些探索方向将指导每个视角子代理的分析,确保探索的全面性。Step 1.5: Initialize brainstorm.md
步骤1.5:初始化brainstorm.md
Create the main brainstorm document with session metadata and expansion content.
brainstorm.md Structure:
- Header: Session ID, topic, start time, brainstorm mode, dimensions
- Initial Context: Focus areas, depth level, constraints
- Roles: Selected roles (professional or simple perspectives)
- Seed Expansion: Original idea + exploration vectors
- Thought Evolution Timeline: Round-by-round findings
- Current Ideas: To be populated after exploration
Success Criteria:
- Session folder created successfully
- brainstorm.md initialized with all metadata
- 1-3 roles selected (professional or simple perspectives)
- Brainstorm mode and dimensions identified
- Exploration vectors generated
- User preferences captured
创建包含会话元数据和拓展内容的主头脑风暴文档。
brainstorm.md结构:
- 头部:会话ID、主题、开始时间、头脑风暴模式、维度
- 初始上下文:聚焦领域、深度级别、约束条件
- 角色:选中的角色(专业角色或基础视角)
- 初始创意拓展:原始创意 + 探索方向
- 思维演进时间线:各轮次的发现
- 当前创意:探索后填充的创意列表
成功标准:
- 会话文件夹创建成功
- brainstorm.md已初始化所有元数据
- 已选择1-3个角色(专业或基础视角)
- 已确定头脑风暴模式和维度
- 已生成探索方向
- 已收集用户偏好
Phase 2: Divergent Exploration
阶段2:发散探索
Objective: Gather codebase context and execute parallel multi-perspective analysis via subagents to generate diverse viewpoints.
Execution Model: Parallel subagent execution - spawn 3 perspective agents simultaneously, batch wait for all results, then aggregate.
Key API Pattern:
spawn_agent × 3 → wait({ ids: [...] }) → aggregate → close_agent × 3目标:收集代码库上下文,通过子代理执行多视角并行分析,生成多样化观点。
执行模型:并行子代理执行 - 同时启动3个视角代理,批量等待所有结果,再进行汇总。
核心API模式:
spawn_agent × 3 → wait({ ids: [...] }) → aggregate → close_agent × 3Step 2.1: Codebase Context Gathering
步骤2.1:代码库上下文收集
Use built-in tools to understand the codebase structure before spawning perspective agents.
Context Gathering Activities:
- Get project structure - Execute
ccw tool exec get_modules_by_depth '{}' - Search for related code - Use Grep/Glob to find files matching topic keywords
- Read project tech context - Load if available
{projectRoot}/.workflow/project-tech.json - Analyze patterns - Identify common code patterns and architecture decisions
exploration-codebase.json Structure:
- : Files related to the topic with relevance indicators
relevant_files[] - : Common code patterns and architectural styles
existing_patterns[] - : Project-level constraints
architecture_constraints[] - : Key integration patterns between modules
integration_points[] - : Timestamp and context information
_metadata
在启动视角代理前,使用内置工具了解代码库结构。
上下文收集活动:
- 获取项目结构 - 执行
ccw tool exec get_modules_by_depth '{}' - 搜索相关代码 - 使用Grep/Glob查找匹配主题关键词的文件
- 读取项目技术上下文 - 如果存在,加载
{projectRoot}/.workflow/project-tech.json - 分析模式 - 识别常见代码模式和架构决策
exploration-codebase.json结构:
- : 与主题相关的文件及相关性标识
relevant_files[] - : 常见代码模式和架构风格
existing_patterns[] - : 项目级约束
architecture_constraints[] - : 模块间的关键集成模式
integration_points[] - : 时间戳和上下文信息
_metadata
Step 2.2: Parallel Multi-Perspective Analysis
步骤2.2:多视角并行分析
⚠️ IMPORTANT: Role files are NOT read by main process. Pass path in message, agent reads itself.
Spawn 3 perspective agents in parallel: Creative + Pragmatic + Systematic.
Perspective Definitions:
| Perspective | Role File | Focus |
|---|---|---|
| Creative | | Innovation, cross-domain inspiration, challenging assumptions |
| Pragmatic | | Implementation feasibility, effort estimates, blockers |
| Systematic | | Problem decomposition, patterns, scalability |
Parallel Subagent Execution:
javascript
// Build shared context from codebase exploration
const explorationContext = `
CODEBASE CONTEXT:
- Key files: ${explorationResults.relevant_files.slice(0,5).map(f => f.path).join(', ')}
- Existing patterns: ${explorationResults.existing_patterns.slice(0,3).join(', ')}
- Architecture constraints: ${explorationResults.architecture_constraints.slice(0,3).join(', ')}`
// Define perspectives
const perspectives = [
{
name: 'creative',
focus: 'Innovation and novelty',
tasks: [
'Think beyond obvious solutions - what would be surprising/delightful?',
'Explore cross-domain inspiration',
'Challenge assumptions - what if the opposite were true?',
'Generate moonshot ideas alongside practical ones'
]
},
{
name: 'pragmatic',
focus: 'Implementation reality',
tasks: [
'Evaluate technical feasibility of core concept',
'Identify existing patterns/libraries that could help',
'Estimate implementation complexity',
'Highlight potential technical blockers'
]
},
{
name: 'systematic',
focus: 'Architecture thinking',
tasks: [
'Decompose the problem into sub-problems',
'Identify architectural patterns that apply',
'Map dependencies and interactions',
'Consider scalability implications'
]
}
]
// Parallel spawn - all agents start immediately
const agentIds = perspectives.map(perspective => {
return spawn_agent({
message: `⚠️ 重要提示:角色文件不由主进程读取,而是在消息中传递路径,由代理自行读取。
并行启动3个视角代理:创意型+务实型+系统型。
视角定义:
| 视角 | 角色文件 | 关注点 |
|---|---|---|
| Creative | | 创新、跨领域灵感、挑战假设 |
| Pragmatic | | 实现可行性、工作量估算、潜在障碍 |
| Systematic | | 问题分解、模式、可扩展性 |
并行子代理执行:
javascript
// Build shared context from codebase exploration
const explorationContext = `
CODEBASE CONTEXT:
- Key files: ${explorationResults.relevant_files.slice(0,5).map(f => f.path).join(', ')}
- Existing patterns: ${explorationResults.existing_patterns.slice(0,3).join(', ')}
- Architecture constraints: ${explorationResults.architecture_constraints.slice(0,3).join(', ')}`
// Define perspectives
const perspectives = [
{
name: 'creative',
focus: 'Innovation and novelty',
tasks: [
'Think beyond obvious solutions - what would be surprising/delightful?',
'Explore cross-domain inspiration',
'Challenge assumptions - what if the opposite were true?',
'Generate moonshot ideas alongside practical ones'
]
},
{
name: 'pragmatic',
focus: 'Implementation reality',
tasks: [
'Evaluate technical feasibility of core concept',
'Identify existing patterns/libraries that could help',
'Estimate implementation complexity',
'Highlight potential technical blockers'
]
},
{
name: 'systematic',
focus: 'Architecture thinking',
tasks: [
'Decompose the problem into sub-problems',
'Identify architectural patterns that apply',
'Map dependencies and interactions',
'Consider scalability implications'
]
}
]
// Parallel spawn - all agents start immediately
const agentIds = perspectives.map(perspective => {
return spawn_agent({
message: `TASK ASSIGNMENT
TASK ASSIGNMENT
MANDATORY FIRST STEPS (Agent Execute)
MANDATORY FIRST STEPS (Agent Execute)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: ${projectRoot}/.workflow/project-tech.json
- Read: ${projectRoot}/.workflow/project-guidelines.json
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: ${projectRoot}/.workflow/project-tech.json
- Read: ${projectRoot}/.workflow/project-guidelines.json
Brainstorm Context
Brainstorm Context
Topic: ${idea_or_topic}
Perspective: ${perspective.name} - ${perspective.focus}
Session: ${sessionFolder}
${explorationContext}
Topic: ${idea_or_topic}
Perspective: ${perspective.name} - ${perspective.focus}
Session: ${sessionFolder}
${explorationContext}
${perspective.name.toUpperCase()} Perspective Tasks
${perspective.name.toUpperCase()} Perspective Tasks
${perspective.tasks.map(t => ).join('\n')}
• ${t}${perspective.tasks.map(t => ).join('\n')}
• ${t}Deliverables
Deliverables
Write findings to: ${sessionFolder}/perspectives/${perspective.name}.json
Schema: {
perspective: "${perspective.name}",
ideas: [{ title, description, novelty, feasibility, rationale }],
key_findings: [],
challenged_assumptions: [],
open_questions: [],
_metadata: { perspective, timestamp }
}
Write findings to: ${sessionFolder}/perspectives/${perspective.name}.json
Schema: {
perspective: "${perspective.name}",
ideas: [{ title, description, novelty, feasibility, rationale }],
key_findings: [],
challenged_assumptions: [],
open_questions: [],
_metadata: { perspective, timestamp }
}
Success Criteria
Success Criteria
- Role definition read
- 3-5 ideas generated with ratings
- Key findings documented
- JSON output follows schema ` }) })
// Batch wait - TRUE PARALLELISM (key Codex advantage)
const results = wait({
ids: agentIds,
timeout_ms: 600000 // 10 minutes for all
})
// Handle timeout
if (results.timed_out) {
// Some agents may still be running
// Option: continue waiting or use completed results
}
// Collect results from all perspectives
const completedFindings = {}
agentIds.forEach((agentId, index) => {
const perspective = perspectives[index]
if (results.status[agentId].completed) {
completedFindings[perspective.name] = results.status[agentId].completed
}
})
// Batch cleanup
agentIds.forEach(id => close_agent({ id }))
undefined- Role definition read
- 3-5 ideas generated with ratings
- Key findings documented
- JSON output follows schema ` }) })
// Batch wait - TRUE PARALLELISM (key Codex advantage)
const results = wait({
ids: agentIds,
timeout_ms: 600000 // 10 minutes for all
})
// Handle timeout
if (results.timed_out) {
// Some agents may still be running
// Option: continue waiting or use completed results
}
// Collect results from all perspectives
const completedFindings = {}
agentIds.forEach((agentId, index) => {
const perspective = perspectives[index]
if (results.status[agentId].completed) {
completedFindings[perspective.name] = results.status[agentId].completed
}
})
// Batch cleanup
agentIds.forEach(id => close_agent({ id }))
undefinedStep 2.3: Aggregate Multi-Perspective Findings
步骤2.3:汇总多视角分析结果
Consolidate results from all three parallel perspective agents.
perspectives.json Structure:
- : Reference to brainstorm session
session_id - : Completion time
timestamp - : Original idea/topic
topic - : Creative perspective findings (ideas with novelty ratings)
creative - : Pragmatic perspective findings (approaches with effort ratings)
pragmatic - : Systematic perspective findings (architectural options)
systematic - : {convergent_themes, conflicting_views, unique_contributions}
synthesis - : Merged ideas from all perspectives
aggregated_ideas[] - : Main insights across all perspectives
key_findings[]
Aggregation Activities:
- Extract ideas and findings from each perspective's output
- Identify themes all perspectives agree on (convergent)
- Note conflicting views and tradeoffs
- Extract unique contributions from each perspective
- Merge and deduplicate similar ideas
javascript
const synthesis = {
session_id: sessionId,
timestamp: new Date().toISOString(),
topic: idea_or_topic,
// Individual perspective findings
creative: completedFindings.creative || {},
pragmatic: completedFindings.pragmatic || {},
systematic: completedFindings.systematic || {},
// Cross-perspective synthesis
synthesis: {
convergent_themes: extractConvergentThemes(completedFindings),
conflicting_views: extractConflicts(completedFindings),
unique_contributions: extractUniqueInsights(completedFindings)
},
// Aggregated for refinement
aggregated_ideas: mergeAllIdeas(completedFindings),
key_findings: mergeKeyFindings(completedFindings)
}整合三个并行视角代理的结果。
perspectives.json结构:
- : 关联头脑风暴会话
session_id - : 完成时间
timestamp - : 原始创意/主题
topic - : 创意视角的分析结果(带新颖度评分的创意)
creative - : 务实视角的分析结果(带工作量评分的方案)
pragmatic - : 系统视角的分析结果(架构选项)
systematic - : {convergent_themes, conflicting_views, unique_contributions}
synthesis - : 所有视角的创意合并结果
aggregated_ideas[] - : 所有视角的核心洞察
key_findings[]
汇总活动:
- 从每个视角的输出中提取创意和发现
- 识别所有视角达成共识的主题(收敛点)
- 记录冲突观点和权衡点
- 提取每个视角的独特贡献
- 合并并去重相似创意
javascript
const synthesis = {
session_id: sessionId,
timestamp: new Date().toISOString(),
topic: idea_or_topic,
// Individual perspective findings
creative: completedFindings.creative || {},
pragmatic: completedFindings.pragmatic || {},
systematic: completedFindings.systematic || {},
// Cross-perspective synthesis
synthesis: {
convergent_themes: extractConvergentThemes(completedFindings),
conflicting_views: extractConflicts(completedFindings),
unique_contributions: extractUniqueInsights(completedFindings)
},
// Aggregated for refinement
aggregated_ideas: mergeAllIdeas(completedFindings),
key_findings: mergeKeyFindings(completedFindings)
}Step 2.4: Update brainstorm.md
步骤2.4:更新brainstorm.md
Append exploration results to the brainstorm timeline.
Round 2 Sections (Multi-Perspective Exploration):
- Creative Perspective: Novel ideas with novelty/impact ratings
- Pragmatic Perspective: Practical approaches with effort/risk ratings
- Systematic Perspective: Architectural options with tradeoff analysis
- Perspective Synthesis: Convergent themes, conflicts, unique contributions
Documentation Standards:
- Include evidence from codebase exploration
- Organize findings by perspective
- Highlight areas of agreement and disagreement
- Note key assumptions and reasoning
Success Criteria:
- All 3 subagents spawned and completed (or timeout handled)
- created with comprehensive context
exploration-codebase.json - created for each perspective
perspectives/*.json - created with aggregated findings and synthesis
perspectives.json - updated with Round 2 results
brainstorm.md - All agents closed properly
- Ready for interactive refinement phase
将探索结果追加到头脑风暴时间线中。
第2轮内容(多视角探索):
- 创意视角:带新颖度/影响力评分的新颖创意
- 务实视角:带工作量/风险评分的实用方案
- 系统视角:带权衡分析的架构选项
- 视角综合:共识主题、冲突点、独特贡献
文档标准:
- 包含代码库探索的相关证据
- 按视角组织发现内容
- 突出共识与分歧点
- 记录关键假设和推理过程
成功标准:
- 3个子代理均已启动并完成(或已处理超时情况)
- 已创建,包含全面上下文
exploration-codebase.json - 每个视角的已创建
perspectives/*.json - 已创建,包含汇总结果和综合分析
perspectives.json - 已更新第2轮结果
brainstorm.md - 所有代理已正确关闭
- 已准备好进入交互式优化阶段
Phase 3: Interactive Refinement
阶段3:交互式优化
Objective: Iteratively refine ideas through multi-round user-guided exploration cycles with deep dives, challenge testing, and idea merging.
Max Rounds: 6 refinement rounds (can exit earlier if user indicates completion)
Execution Model: Use for deep interaction within same agent context, or spawn new agent for significantly different exploration angles.
send_input目标:通过多轮用户引导的探索循环,迭代优化创意,包括深度挖掘、挑战验证和创意合并。
最大轮次:6轮优化(若用户表示完成可提前退出)
执行模型:使用在同一代理上下文内进行深度交互,或为完全不同的探索角度启动新代理。
send_inputStep 3.1: Present Findings & Gather User Direction
步骤3.1:展示结果并收集用户方向
Display current ideas and perspectives to the user.
Presentation Content:
- Top ideas from each perspective with ratings
- Convergent themes and areas of agreement
- Conflicting views and tradeoffs
- Open questions for further exploration
User Feedback Options (Single-select):
| Option | Purpose | Next Action |
|---|---|---|
| 深入探索 | Explore selected ideas in detail | |
| 继续发散 | Generate more ideas | Spawn new agent with different angles |
| 挑战验证 | Test ideas critically | Spawn challenge agent (devil's advocate) |
| 合并综合 | Combine multiple ideas | Spawn merge agent to synthesize |
| 准备收敛 | Begin convergence | Exit refinement loop for synthesis |
向用户展示当前创意和视角分析结果。
展示内容:
- 每个视角的顶级创意及评分
- 共识主题和达成一致的领域
- 冲突观点和权衡点
- 待进一步探索的开放问题
用户反馈选项(单选):
| 选项 | 用途 | 后续操作 |
|---|---|---|
| 深入探索 | 详细探索选中的创意 | 向活跃代理发送 |
| 继续发散 | 生成更多创意 | 启动不同角度的新代理 |
| 挑战验证 | 批判性测试创意 | 启动挑战代理(唱反调角色) |
| 合并综合 | 整合多个创意 | 启动合并代理进行综合 |
| 准备收敛 | 开始收敛阶段 | 退出优化循环进入综合阶段 |
Step 3.2: Deep Dive on Selected Ideas (via send_input or new agent)
步骤3.2:深入探索选中的创意(通过send_input或新代理)
When user selects "deep dive", provide comprehensive analysis.
Option A: send_input to Existing Agent (preferred if agent still active)
javascript
// Continue with existing agent context
send_input({
id: perspectiveAgent, // Reuse agent from Phase 2 if not closed
message: `当用户选择“深入探索”时,提供全面分析。
选项A:向现有代理发送send_input(若代理仍活跃,优先选择)
javascript
// Continue with existing agent context
send_input({
id: perspectiveAgent, // 若未关闭,复用阶段2的代理
message: `CONTINUATION: Deep Dive Analysis
CONTINUATION: Deep Dive Analysis
Based on your initial exploration, the user wants deeper investigation on these ideas:
${selectedIdeas.map((idea, i) => ).join('\n')}
${i+1}. ${idea.title}Based on your initial exploration, the user wants deeper investigation on these ideas:
${selectedIdeas.map((idea, i) => ).join('\n')}
${i+1}. ${idea.title}Deep Dive Tasks
Deep Dive Tasks
• Elaborate each concept in detail
• Identify implementation requirements and dependencies
• Analyze potential challenges and propose mitigations
• Suggest proof-of-concept approach
• Define success metrics
• Elaborate each concept in detail
• Identify implementation requirements and dependencies
• Analyze potential challenges and propose mitigations
• Suggest proof-of-concept approach
• Define success metrics
Deliverables
Deliverables
Write to: ${sessionFolder}/ideas/{idea-slug}.md for each selected idea
Write to: ${sessionFolder}/ideas/{idea-slug}.md for each selected idea
Success Criteria
Success Criteria
- Each idea has detailed breakdown
- Technical requirements documented
- Risk analysis with mitigations ` })
const deepDiveResult = wait({ ids: [perspectiveAgent], timeout_ms: 600000 })
**Option B: Spawn New Deep-Dive Agent** (if prior agents closed)
```javascript
const deepDiveAgent = spawn_agent({
message: `- Each idea has detailed breakdown
- Technical requirements documented
- Risk analysis with mitigations ` })
const deepDiveResult = wait({ ids: [perspectiveAgent], timeout_ms: 600000 })
**选项B:启动新的深度挖掘代理**(若之前的代理已关闭)
```javascript
const deepDiveAgent = spawn_agent({
message: `TASK ASSIGNMENT
TASK ASSIGNMENT
MANDATORY FIRST STEPS (Agent Execute)
MANDATORY FIRST STEPS (Agent Execute)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: ${sessionFolder}/perspectives.json (prior findings)
- Read: ${projectRoot}/.workflow/project-tech.json
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: ${sessionFolder}/perspectives.json (prior findings)
- Read: ${projectRoot}/.workflow/project-tech.json
Deep Dive Context
Deep Dive Context
Topic: ${idea_or_topic}
Selected Ideas: ${selectedIdeas.map(i => i.title).join(', ')}
Topic: ${idea_or_topic}
Selected Ideas: ${selectedIdeas.map(i => i.title).join(', ')}
Deep Dive Tasks
Deep Dive Tasks
${selectedIdeas.map(idea => `
${selectedIdeas.map(idea => `
${idea.title}
${idea.title}
• Elaborate the core concept in detail
• Identify implementation requirements
• List potential challenges and mitigations
• Suggest proof-of-concept approach
• Define success metrics
`).join('\n')}
• Elaborate the core concept in detail
• Identify implementation requirements
• List potential challenges and mitigations
• Suggest proof-of-concept approach
• Define success metrics
`).join('\n')}
Deliverables
Deliverables
Write: ${sessionFolder}/ideas/{idea-slug}.md for each idea
Include for each:
- Detailed concept description
- Technical requirements list
- Risk/challenge matrix
- MVP definition
- Success criteria ` })
const result = wait({ ids: [deepDiveAgent], timeout_ms: 600000 })
close_agent({ id: deepDiveAgent })
undefinedWrite: ${sessionFolder}/ideas/{idea-slug}.md for each idea
Include for each:
- Detailed concept description
- Technical requirements list
- Risk/challenge matrix
- MVP definition
- Success criteria ` })
const result = wait({ ids: [deepDiveAgent], timeout_ms: 600000 })
close_agent({ id: deepDiveAgent })
undefinedStep 3.3: Devil's Advocate Challenge (spawn new agent)
步骤3.3:唱反调挑战(启动新代理)
When user selects "challenge", spawn a dedicated challenge agent.
javascript
const challengeAgent = spawn_agent({
message: `当用户选择“挑战”时,启动专门的挑战代理。
javascript
const challengeAgent = spawn_agent({
message: `TASK ASSIGNMENT
TASK ASSIGNMENT
MANDATORY FIRST STEPS (Agent Execute)
MANDATORY FIRST STEPS (Agent Execute)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: ${sessionFolder}/perspectives.json (ideas to challenge)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: ${sessionFolder}/perspectives.json (ideas to challenge)
Challenge Context
Challenge Context
Topic: ${idea_or_topic}
Ideas to Challenge:
${selectedIdeas.map((idea, i) => ).join('\n')}
${i+1}. ${idea.title}: ${idea.description}Topic: ${idea_or_topic}
Ideas to Challenge:
${selectedIdeas.map((idea, i) => ).join('\n')}
${i+1}. ${idea.title}: ${idea.description}Devil's Advocate Tasks
Devil's Advocate Tasks
• For each idea, identify 3 strongest objections
• Challenge core assumptions
• Identify scenarios where this fails
• Consider competitive/alternative solutions
• Assess whether this solves the right problem
• Rate survivability after challenge (1-5)
• For each idea, identify 3 strongest objections
• Challenge core assumptions
• Identify scenarios where this fails
• Consider competitive/alternative solutions
• Assess whether this solves the right problem
• Rate survivability after challenge (1-5)
Deliverables
Deliverables
Return structured challenge results:
{
challenges: [{
idea: "...",
objections: [],
challenged_assumptions: [],
failure_scenarios: [],
alternatives: [],
survivability_rating: 1-5,
strengthened_version: "..."
}]
}
Return structured challenge results:
{
challenges: [{
idea: "...",
objections: [],
challenged_assumptions: [],
failure_scenarios: [],
alternatives: [],
survivability_rating: 1-5,
strengthened_version: "..."
}]
}
Success Criteria
Success Criteria
- 3+ objections per idea
- Assumptions explicitly challenged
- Survivability ratings assigned ` })
const result = wait({ ids: [challengeAgent], timeout_ms: 300000 })
close_agent({ id: challengeAgent })
undefined- 3+ objections per idea
- Assumptions explicitly challenged
- Survivability ratings assigned ` })
const result = wait({ ids: [challengeAgent], timeout_ms: 300000 })
close_agent({ id: challengeAgent })
undefinedStep 3.4: Merge Multiple Ideas (spawn merge agent)
步骤3.4:合并多个创意(启动新代理)
When user selects "merge", synthesize complementary ideas.
javascript
const mergeAgent = spawn_agent({
message: `当用户选择“合并”时,整合互补创意。
javascript
const mergeAgent = spawn_agent({
message: `TASK ASSIGNMENT
TASK ASSIGNMENT
MANDATORY FIRST STEPS (Agent Execute)
MANDATORY FIRST STEPS (Agent Execute)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: ${sessionFolder}/perspectives.json (source ideas)
- Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
- Read: ${sessionFolder}/perspectives.json (source ideas)
Merge Context
Merge Context
Topic: ${idea_or_topic}
Ideas to Merge:
${selectedIdeas.map((idea, i) => ).join('\n')}
${i+1}. ${idea.title} (${idea.source_perspective}) ${idea.description} Strengths: ${idea.strengths?.join(', ') || 'N/A'}Topic: ${idea_or_topic}
Ideas to Merge:
${selectedIdeas.map((idea, i) => ).join('\n')}
${i+1}. ${idea.title} (${idea.source_perspective}) ${idea.description} Strengths: ${idea.strengths?.join(', ') || 'N/A'}Merge Tasks
Merge Tasks
• Identify complementary elements
• Resolve contradictions
• Create unified concept
• Preserve key strengths from each
• Describe the merged solution
• Assess viability of merged idea
• Identify complementary elements
• Resolve contradictions
• Create unified concept
• Preserve key strengths from each
• Describe the merged solution
• Assess viability of merged idea
Deliverables
Deliverables
Write to: ${sessionFolder}/ideas/merged-idea-{n}.md
Include:
- Merged concept description
- Elements taken from each source idea
- Contradictions resolved (or noted as tradeoffs)
- New combined strengths
- Implementation considerations
Write to: ${sessionFolder}/ideas/merged-idea-{n}.md
Include:
- Merged concept description
- Elements taken from each source idea
- Contradictions resolved (or noted as tradeoffs)
- New combined strengths
- Implementation considerations
Success Criteria
Success Criteria
- Coherent merged concept
- Source attributions clear
- Contradictions addressed ` })
const result = wait({ ids: [mergeAgent], timeout_ms: 300000 })
close_agent({ id: mergeAgent })
undefined- Coherent merged concept
- Source attributions clear
- Contradictions addressed ` })
const result = wait({ ids: [mergeAgent], timeout_ms: 300000 })
close_agent({ id: mergeAgent })
undefinedStep 3.5: Document Each Round
步骤3.5:记录每一轮优化
Update brainstorm.md with results from each refinement round.
Round N Sections (Rounds 3-6):
| Section | Content |
|---|---|
| User Direction | Action taken and ideas selected |
| Findings | New findings and clarifications |
| Idea Updates | Changes to idea scores and status |
| Insights | Key learnings and realizations |
| Next Directions | Suggested follow-up investigations |
Documentation Standards:
- Clear timestamps and action taken
- Evidence-based findings with code references
- Updated idea rankings and status changes
- Explicit tracking of assumption changes
- Organized by exploration vector
Success Criteria:
- User feedback processed for each round
- updated with all refinement rounds
brainstorm.md - Ideas in folder for selected deep-dives
ideas/ - All spawned agents closed properly
- Exit condition reached (user selects converge or max rounds)
将每一轮优化的结果更新到brainstorm.md中。
第N轮内容(第3-6轮):
| 章节 | 内容 |
|---|---|
| 用户方向 | 执行的操作和选中的创意 |
| 发现结果 | 新的发现和澄清内容 |
| 创意更新 | 创意评分和状态的变化 |
| 关键洞察 | 重要的学习和认知 |
| 后续方向 | 建议的后续探索方向 |
文档标准:
- 清晰的时间戳和执行操作
- 基于证据的发现,包含代码引用
- 更新后的创意排名和状态变化
- 明确记录假设的变化
- 按探索方向组织内容
成功标准:
- 每一轮的用户反馈已处理
- 已更新所有优化轮次的内容
brainstorm.md - 选中的深度挖掘创意已存入文件夹
ideas/ - 所有启动的代理已正确关闭
- 已达到退出条件(用户选择收敛或达到最大轮次)
Phase 4: Convergence & Crystallization
阶段4:收敛与固化
Objective: Synthesize final ideas, generate conclusions and recommendations, and offer next steps.
目标:综合最终创意,生成结论和建议,提供后续步骤。
Step 4.1: Consolidate Insights
步骤4.1:整合洞察
Extract and synthesize all findings from refinement rounds into final conclusions.
Consolidation Activities:
- Review all refinement rounds and accumulated findings
- Rank ideas by score, feasibility, and impact
- Identify top 5 viable ideas
- Extract key learnings and insights
- Generate recommendations with rationale
synthesis.json Structure:
- : Session identifier
session_id - : Original idea/topic
topic - : Completion timestamp
completed - : Number of refinement rounds
total_rounds - : Top 5 ranked ideas with scores and next steps
top_ideas[] - : Ideas parked for future consideration
parked_ideas[] - : Key learnings from brainstorming process
key_insights[] - : Primary recommendation and alternatives
recommendations - : Suggested next steps (implementation, research, validation)
follow_up[]
Idea Format:
- : Clear, descriptive title
title - : Complete concept description
description - : Which perspective(s) contributed
source_perspective - : Final viability score (1-10)
score - : Novelty/innovation rating (1-5)
novelty - : Implementation feasibility (1-5)
feasibility - : Main advantages and benefits
key_strengths - : Key challenges and limitations
main_challenges - : Recommended actions to pursue
next_steps
从所有优化轮次中提取并综合发现,形成最终结论。
整合活动:
- 回顾所有优化轮次和累积的发现
- 按评分、可行性和影响力对创意排名
- 确定前5个可行创意
- 提取关键学习和洞察
- 生成带推理过程的建议方案
synthesis.json结构:
- : 会话标识符
session_id - : 原始创意/主题
topic - : 完成时间戳
completed - : 优化轮次数量
total_rounds - : 排名前5的创意,带评分和后续步骤
top_ideas[] - : 暂存的创意,供未来考虑
parked_ideas[] - : 头脑风暴过程中的关键学习
key_insights[] - : 主要建议方案和备选方案
recommendations - : 建议的后续步骤(实现、研究、验证)
follow_up[]
创意格式:
- : 清晰、描述性的标题
title - : 完整的创意描述
description - : 贡献该创意的视角
source_perspective - : 最终可行性评分(1-10)
score - : 新颖性/创新性评分(1-5)
novelty - : 实现可行性评分(1-5)
feasibility - : 主要优势和价值
key_strengths - : 关键挑战和限制
main_challenges - : 建议的推进动作
next_steps
Step 4.2: Final brainstorm.md Update
步骤4.2:最终更新brainstorm.md
Append conclusions section and finalize the thinking document.
Synthesis & Conclusions Section:
- Executive Summary: High-level overview of brainstorming results
- Top Ideas: Ranked list with descriptions and strengths/challenges
- Primary Recommendation: Best path forward with clear rationale
- Alternative Approaches: Other viable options with tradeoff analysis
- Parked Ideas: Future considerations with potential triggers
- Key Insights: Important learnings from the process
Session Statistics:
- Total refinement rounds completed
- Ideas generated and evaluated
- Ideas survived challenges
- Perspectives used (creative, pragmatic, systematic)
- Artifacts generated
追加结论章节,完成思维文档的整理。
综合与结论章节:
- 执行摘要:头脑风暴结果的高层概述
- 顶级创意:排名列表,包含描述、优势和挑战
- 主要建议:最优推进路径及清晰的推理过程
- 备选方案:其他可行选项及权衡分析
- 暂存创意:未来考虑的创意及潜在触发条件
- 关键洞察:过程中的重要学习
会话统计:
- 完成的优化轮次总数
- 生成和评估的创意数量
- 经挑战后保留的创意数量
- 使用的视角(创意、务实、系统)
- 生成的产物数量
Step 4.3: Post-Completion Options
步骤4.3:完成后选项
Offer user follow-up actions based on brainstorming results.
Available Options:
| Option | Purpose | Action |
|---|---|---|
| 创建实施计划 | Plan implementation of top idea | Launch |
| 创建Issue | Track top ideas for later | Launch |
| 深入分析 | Analyze top idea in detail | Launch |
| 导出分享 | Generate shareable report | Create formatted report document |
| 完成 | No further action | End workflow |
Success Criteria:
- created with complete synthesis
synthesis.json - finalized with all conclusions
brainstorm.md - User offered meaningful next step options
- Session complete and all artifacts available
根据头脑风暴结果为用户提供后续操作选项。
可用选项:
| 选项 | 用途 | 操作 |
|---|---|---|
| 创建实施计划 | 为顶级创意制定实施计划 | 启动 |
| 创建Issue | 跟踪顶级创意供后续处理 | 启动 |
| 深入分析 | 详细分析顶级创意 | 启动 |
| 导出分享 | 生成可分享的报告 | 创建格式化的报告文档 |
| 完成 | 无进一步操作 | 结束工作流 |
成功标准:
- 已创建,包含完整的综合分析
synthesis.json - 已最终定稿,包含所有结论
brainstorm.md - 已为用户提供有意义的后续步骤选项
- 会话完成,所有产物均可访问
Configuration
配置
Brainstorm Dimensions Reference
头脑风暴维度参考
Dimensions guide brainstorming scope and focus:
| Dimension | Keywords | Best For |
|---|---|---|
| technical | 技术, technical, implementation, code | Implementation approaches |
| ux | 用户, user, experience, UI | User-facing design ideas |
| business | 业务, business, value | Business model innovations |
| innovation | 创新, innovation, novel | Breakthrough ideas |
| feasibility | 可行, feasible, practical | Realistic approaches |
| scalability | 扩展, scale, growth | Large-scale solutions |
| security | 安全, security, risk | Security considerations |
维度用于指导头脑风暴的范围和焦点:
| 维度 | 关键词 | 适用场景 |
|---|---|---|
| technical | 技术, technical, implementation, code | 实现方案探索 |
| ux | 用户, user, experience, UI | 面向用户的设计创意 |
| business | 业务, business, value | 商业模式创新 |
| innovation | 创新, innovation, novel | 突破性创意 |
| feasibility | 可行, feasible, practical | 现实可行的方案 |
| scalability | 扩展, scale, growth | 大规模解决方案 |
| security | 安全, security, risk | 安全考量 |
Brainstorm Modes
头脑风暴模式
| Mode | Duration | Intensity | Subagents |
|---|---|---|---|
| Creative | 15-20 min | High novelty | 1 agent, short timeout |
| Balanced | 30-60 min | Mixed | 3 parallel agents |
| Deep | 1-2+ hours | Comprehensive | 3 parallel agents + deep refinement |
| 模式 | 时长 | 强度 | 子代理数量 |
|---|---|---|---|
| Creative | 15-20分钟 | 高新颖性 | 1个代理,短超时 |
| Balanced | 30-60分钟 | 混合 | 3个并行代理 |
| Deep | 1-2+小时 | 全面深入 | 3个并行代理+深度优化 |
Collaboration Patterns
协作模式
| Pattern | Usage | Description |
|---|---|---|
| Parallel Divergence | New topic | All perspectives explore simultaneously via parallel subagents |
| Sequential Deep-Dive | Promising idea | |
| Debate Mode | Controversial approach | Spawn opposing agents to argue for/against |
| Synthesis Mode | Ready to decide | Spawn synthesis agent combining insights from all perspectives |
| 模式 | 用途 | 描述 |
|---|---|---|
| Parallel Divergence | 新主题 | 所有视角通过并行子代理同时探索 |
| Sequential Deep-Dive | 有潜力的创意 | 向一个代理发送 |
| Debate Mode | 有争议的方案 | 启动对立代理进行正反方辩论 |
| Synthesis Mode | 准备决策 | 启动综合代理整合所有视角的洞察 |
Context Overflow Protection
上下文溢出保护
Per-Agent Limits:
- Main analysis output: < 3000 words
- Sub-document (if any): < 2000 words each
- Maximum sub-documents: 5 per perspective
Synthesis Protection:
- If total analysis > 100KB, synthesis reads only main analysis files (not sub-documents)
- Large ideas automatically split into separate idea documents in ideas/ folder
Recovery Steps:
- Check agent outputs for truncation or overflow
- Reduce scope: fewer perspectives or simpler topic
- Use structured brainstorm mode for more focused output
- Split complex topics into multiple sessions
单代理限制:
- 主要分析输出:< 3000字
- 子文档(若有):每个< 2000字
- 最大子文档数量:每个视角5个
综合保护:
- 若总分析内容>100KB,综合阶段仅读取主要分析文件(不包含子文档)
- 大型创意会自动拆分到ideas/文件夹中的独立创意文档
恢复步骤:
- 检查代理输出是否被截断或溢出
- 缩小范围:减少视角数量或简化主题
- 使用结构化头脑风暴模式以获得更聚焦的输出
- 将复杂主题拆分为多个会话
Error Handling & Recovery
错误处理与恢复
| Situation | Action | Recovery |
|---|---|---|
| Subagent timeout | Check | Reduce scope, use 2 perspectives instead of 3 |
| Agent closed prematurely | Cannot recover closed agent | Spawn new agent with prior context from perspectives.json |
| Parallel agent partial failure | Some perspectives complete, some fail | Use completed results, note gaps in synthesis |
| send_input to closed agent | Error: agent not found | Spawn new agent with prior findings as context |
| No good ideas | Reframe problem or adjust constraints | Try new exploration angles |
| User disengaged | Summarize progress and offer break | Save state, keep agents alive for resume |
| Perspectives conflict | Present as tradeoff options | Let user select preferred direction |
| Max rounds reached | Force synthesis phase | Highlight unresolved questions |
| Session folder conflict | Append timestamp suffix | Create unique folder |
| 场景 | 操作 | 恢复方案 |
|---|---|---|
| 子代理超时 | 检查 | 缩小范围,用2个视角代替3个 |
| 代理提前关闭 | 无法恢复已关闭的代理 | 以perspectives.json中的之前上下文启动新代理 |
| 并行代理部分失败 | 部分视角完成,部分失败 | 使用已完成的结果,在综合阶段记录缺口 |
| 向已关闭的代理发送send_input | 错误:代理未找到 | 以之前的发现为上下文启动新代理 |
| 未生成优质创意 | 重新构建问题或调整约束 | 尝试新的探索角度 |
| 用户未参与 | 总结进度并提供暂停选项 | 保存状态,保持代理活跃以便恢复 |
| 视角冲突 | 作为权衡选项呈现 | 让用户选择偏好方向 |
| 达到最大轮次 | 强制进入综合阶段 | 突出未解决的问题 |
| 会话文件夹冲突 | 追加时间戳后缀 | 创建唯一文件夹 |
Codex-Specific Error Patterns
Codex专属错误模式
javascript
// Safe parallel execution with error handling
try {
const agentIds = perspectives.map(p => spawn_agent({ message: buildPrompt(p) }))
const results = wait({ ids: agentIds, timeout_ms: 600000 })
if (results.timed_out) {
// Handle partial completion
const completed = agentIds.filter(id => results.status[id].completed)
const pending = agentIds.filter(id => !results.status[id].completed)
// Option 1: Continue waiting for pending
// const moreResults = wait({ ids: pending, timeout_ms: 300000 })
// Option 2: Use partial results
// processPartialResults(completed, results)
}
// Process all results
processResults(agentIds, results)
} finally {
// ALWAYS cleanup, even on errors
agentIds.forEach(id => {
try { close_agent({ id }) } catch (e) { /* ignore */ }
})
}javascript
// Safe parallel execution with error handling
try {
const agentIds = perspectives.map(p => spawn_agent({ message: buildPrompt(p) }))
const results = wait({ ids: agentIds, timeout_ms: 600000 })
if (results.timed_out) {
// Handle partial completion
const completed = agentIds.filter(id => results.status[id].completed)
const pending = agentIds.filter(id => !results.status[id].completed)
// Option 1: Continue waiting for pending
// const moreResults = wait({ ids: pending, timeout_ms: 300000 })
// Option 2: Use partial results
// processPartialResults(completed, results)
}
// Process all results
processResults(agentIds, results)
} finally {
// ALWAYS cleanup, even on errors
agentIds.forEach(id => {
try { close_agent({ id }) } catch (e) { /* ignore */ }
})
}Iteration Patterns
迭代模式
First Brainstorm Session (Parallel Mode)
首次头脑风暴会话(并行模式)
User initiates: TOPIC="idea or topic"
├─ No session exists → New session mode
├─ Parse topic and identify dimensions
├─ Scope with user (focus, depth, mode)
├─ Create brainstorm.md
├─ Expand seed into vectors
├─ Gather codebase context
│
├─ Execute parallel perspective exploration:
│ ├─ spawn_agent × 3 (Creative + Pragmatic + Systematic)
│ ├─ wait({ ids: [...] }) ← TRUE PARALLELISM
│ └─ close_agent × 3
│
├─ Aggregate findings with synthesis
└─ Enter multi-round refinement loopUser initiates: TOPIC="idea or topic"
├─ No session exists → New session mode
├─ Parse topic and identify dimensions
├─ Scope with user (focus, depth, mode)
├─ Create brainstorm.md
├─ Expand seed into vectors
├─ Gather codebase context
│
├─ Execute parallel perspective exploration:
│ ├─ spawn_agent × 3 (Creative + Pragmatic + Systematic)
│ ├─ wait({ ids: [...] }) ← TRUE PARALLELISM
│ └─ close_agent × 3
│
├─ Aggregate findings with synthesis
└─ Enter multi-round refinement loopContinue Existing Session
续会模式
User resumes: TOPIC="same topic"
├─ Session exists → Continue mode
├─ Load previous brainstorm.md
├─ Load perspectives.json
└─ Resume from last refinement roundUser resumes: TOPIC="same topic"
├─ Session exists → Continue mode
├─ Load previous brainstorm.md
├─ Load perspectives.json
└─ Resume from last refinement roundRefinement Loop (Rounds 3-6)
优化循环(第3-6轮)
Each round:
├─ Present current findings and top ideas
├─ Gather user feedback (deep dive/diverge/challenge/merge/converge)
├─ Process response:
│ ├─ Deep Dive → send_input to active agent OR spawn deep-dive agent
│ ├─ Diverge → spawn new agent with different angles
│ ├─ Challenge → spawn challenge agent (devil's advocate)
│ ├─ Merge → spawn merge agent to synthesize
│ └─ Converge → Exit loop for synthesis
├─ wait({ ids: [...] }) for result
├─ Update brainstorm.md
└─ Repeat until user selects converge or max rounds reachedEach round:
├─ Present current findings and top ideas
├─ Gather user feedback (deep dive/diverge/challenge/merge/converge)
├─ Process response:
│ ├─ Deep Dive → send_input to active agent OR spawn deep-dive agent
│ ├─ Diverge → spawn new agent with different angles
│ ├─ Challenge → spawn challenge agent (devil's advocate)
│ ├─ Merge → spawn merge agent to synthesize
│ └─ Converge → Exit loop for synthesis
├─ wait({ ids: [...] }) for result
├─ Update brainstorm.md
└─ Repeat until user selects converge or max rounds reachedAgent Lifecycle Management
代理生命周期管理
Subagent lifecycle:
├─ spawn_agent({ message }) → Create with role path + task
├─ wait({ ids, timeout_ms }) → Get results (ONLY way to get output)
├─ send_input({ id, message }) → Continue interaction (if not closed)
└─ close_agent({ id }) → Cleanup (MUST do, cannot recover)
Key rules:
├─ NEVER close before you're done with an agent
├─ ALWAYS use wait() to get results, NOT close_agent()
├─ Batch wait for parallel agents: wait({ ids: [a, b, c] })
└─ Consider keeping agents alive for send_input during refinementSubagent lifecycle:
├─ spawn_agent({ message }) → Create with role path + task
├─ wait({ ids, timeout_ms }) → Get results (ONLY way to get output)
├─ send_input({ id, message }) → Continue interaction (if not closed)
└─ close_agent({ id }) → Cleanup (MUST do, cannot recover)
Key rules:
├─ NEVER close before you're done with an agent
├─ ALWAYS use wait() to get results, NOT close_agent()
├─ Batch wait for parallel agents: wait({ ids: [a, b, c] })
└─ Consider keeping agents alive for send_input during refinementCompletion Flow
完成流程
Final synthesis:
├─ Consolidate all findings into top ideas
├─ Generate synthesis.json
├─ Update brainstorm.md with final conclusions
├─ close_agent for any remaining active agents
├─ Offer follow-up options
└─ Archive session artifactsFinal synthesis:
├─ Consolidate all findings into top ideas
├─ Generate synthesis.json
├─ Update brainstorm.md with final conclusions
├─ close_agent for any remaining active agents
├─ Offer follow-up options
└─ Archive session artifactsBest Practices
最佳实践
Before Starting Brainstorm
头脑风暴开始前
- Clear Topic Definition: Detailed topics lead to better dimension identification
- User Context: Understanding preferences helps guide brainstorming intensity
- Scope Understanding: Being clear about time/scope expectations sets correct exploration level
- 清晰的主题定义:详细的主题能更好地识别维度
- 用户上下文:了解用户偏好有助于指导头脑风暴的强度
- 范围认知:明确时间/范围预期,设置合适的探索深度
During Brainstorming
头脑风暴过程中
- Review Perspectives: Check all three perspectives before refinement rounds
- Document Assumptions: Track what you think is true for correction later
- Use Continue Mode: Resume sessions to build on previous exploration
- Embrace Conflicts: Perspective conflicts often reveal important tradeoffs
- Iterate Thoughtfully: Each refinement round should meaningfully advance ideas
- 查看所有视角:在优化轮次前检查三个视角的结果
- 记录假设:跟踪你认为正确的假设,以便后续修正
- 使用续会模式:恢复之前的会话以基于已有探索继续推进
- 接受冲突:视角冲突通常能揭示重要的权衡点
- 有意义地迭代:每一轮优化都应切实推进创意发展
Codex Subagent Best Practices
Codex子代理最佳实践
- Role Path, Not Content: Pass path in message, let agent read itself
~/.codex/agents/*.md - Parallel for Perspectives: Use batch spawn + wait for 3 perspective agents
- Delay close_agent for Refinement: Keep perspective agents alive for reuse
send_input - Batch wait: Use for parallel agents, not sequential waits
wait({ ids: [a, b, c] }) - Handle Timeouts: Check and decide: continue waiting or use partial results
results.timed_out - Explicit Cleanup: Always when done, even on errors (use try/finally pattern)
close_agent - send_input vs spawn: Prefer for same-context deep-dive,
send_inputfor new exploration anglesspawn
- 传递角色路径而非内容:在消息中传递路径,让代理自行读取
~/.codex/agents/*.md - 视角分析用并行模式:批量启动+等待3个视角代理
- 优化阶段延迟close_agent:保持视角代理活跃以便复用进行
send_input - 批量等待:对并行代理使用,而非顺序等待
wait({ ids: [a, b, c] }) - 处理超时:检查并决定:继续等待或使用部分结果
results.timed_out - 显式清理:完成后始终调用,即使出错(使用try/finally模式)
close_agent - send_input vs spawn:同一上下文的深度挖掘优先用,新探索角度用
send_inputspawn
Documentation Practices
文档实践
- Evidence-Based: Every idea should reference codebase patterns or feasibility analysis
- Perspective Diversity: Capture viewpoints from all three perspectives
- Timeline Clarity: Use clear timestamps for traceability
- Evolution Tracking: Document how ideas changed and evolved
- Action Items: Generate specific, implementable recommendations
- Synthesis Quality: Ensure convergent/conflicting themes are clearly documented
Now execute the brainstorm-with-file workflow for topic: $TOPIC
- 基于证据:每个创意都应引用代码库模式或可行性分析
- 视角多样性:捕捉所有三个视角的观点
- 时间线清晰:使用明确的时间戳以便追溯
- 跟踪演进:记录创意如何变化和发展
- 生成可执行的行动项:生成具体、可实现的建议
- 高质量综合:确保共识/冲突主题记录清晰
现在为主题执行带文件支持的头脑风暴工作流:$TOPIC