brainstorm-with-file

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Codex 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
    spawn_agent
    + batch
    wait({ ids: [...] })
  • Role loading via path (agent reads
    ~/.codex/agents/*.md
    itself)
  • Deep interaction with
    send_input
    for multi-round refinement within single agent
  • 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:
  1. Seed Understanding - Parse the initial idea and identify exploration vectors
  2. Divergent Exploration - Gather codebase context and execute parallel multi-perspective analysis
  3. Interactive Refinement - Multi-round idea selection, deep-dive, and refinement via send_input
  4. 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.
该工作流通过支持并行的多个阶段,实现创意的迭代探索与优化:
  1. 初始创意理解 - 解析初始创意,确定探索方向
  2. 发散探索 - 收集代码库上下文,执行多视角并行分析
  3. 交互式优化 - 通过send_input进行多轮创意选择、深度挖掘与优化
  4. 收敛与固化 - 综合最终创意,生成建议方案
核心创新点是思维演进记录,它能捕捉创意如何发展、视角有何差异,以及各阶段产生的洞察。

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.md

Output Artifacts

输出产物

Phase 1: Seed Understanding

阶段1:初始创意理解

ArtifactPurpose
brainstorm.md
Initialized with session metadata, seed expansion, and exploration vectors
Session variablesTopic slug, brainstorm mode, dimensions, exploration vectors
产物用途
brainstorm.md
初始化时包含会话元数据、初始创意拓展内容和探索方向
会话变量主题缩写、头脑风暴模式、维度、探索方向

Phase 2: Divergent Exploration

阶段2:发散探索

ArtifactPurpose
exploration-codebase.json
Codebase context: relevant files, patterns, architecture constraints
perspectives/*.json
Individual perspective outputs from parallel subagents
perspectives.json
Aggregated parallel findings with synthesis (convergent/conflicting themes)
Updated
brainstorm.md
Round 2: Exploration results and multi-perspective analysis
产物用途
exploration-codebase.json
代码库上下文:相关文件、模式、架构约束
perspectives/*.json
各并行子代理的独立视角输出
perspectives.json
并行分析结果汇总与综合(包含共识与冲突点)
更新后的
brainstorm.md
第2轮:探索结果与多视角分析内容

Phase 3: Interactive Refinement

阶段3:交互式优化

ArtifactPurpose
ideas/{idea-slug}.md
Deep-dive analysis for selected ideas
Updated
brainstorm.md
Round 3-6: User feedback, idea selections, refinement cycles
产物用途
ideas/{idea-slug}.md
选中创意的深度分析文档
更新后的
brainstorm.md
第3-6轮:用户反馈、创意选择、优化循环记录

Phase 4: Convergence & Crystallization

阶段4:收敛与固化

ArtifactPurpose
synthesis.json
Final synthesis: top ideas, recommendations, insights
Final
brainstorm.md
Complete thought evolution with conclusions

产物用途
synthesis.json
最终综合结果:最优创意、建议方案、关键洞察
最终版
brainstorm.md
包含结论的完整思维演进记录

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}
  • slug
    : Lowercase alphanumeric + Chinese characters, max 40 chars
  • date
    : YYYY-MM-DD format (UTC+8)
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:
  • creative
    : Emphasize novelty and innovation, relaxed constraints
  • structured
    : Balance creativity with feasibility, realistic scope
  • balanced
    : Default, moderate innovation with practical considerations

检测项目根目录,确保
.workflow/
产物位置正确:
bash
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
优先通过 git 获取仓库根目录;非 git 项目回退到
pwd
取当前绝对路径。 存储为
{projectRoot}
,后续所有
.workflow/
路径必须以此为前缀。
工作流会根据主题和当前日期(UTC+8)自动生成唯一的会话标识符和目录结构。
会话ID格式
BS-{slug}-{date}
  • slug
    :小写字母数字+中文,最多40个字符
  • date
    :YYYY-MM-DD格式(UTC+8)
会话目录
{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:
DimensionKeywords
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):
RolePerspective Agent FocusKeywords
system-architectArchitecture, patterns架构, architecture, system, 系统, design pattern
product-managerBusiness value, roadmap产品, product, feature, 功能, roadmap
ui-designerVisual design, interactionUI, 界面, interface, visual, 视觉
ux-expertUser research, usabilityUX, 体验, experience, user, 用户
data-architectData modeling, storage数据, data, database, 存储, storage
test-strategistQuality, testing测试, test, quality, 质量, QA
subject-matter-expertDomain knowledge领域, domain, industry, 行业, expert
Simple Perspectives (fallback - always available):
PerspectiveFocusBest For
creativeInnovation, cross-domainGenerating novel ideas
pragmaticImplementation, feasibilityReality-checking ideas
systematicArchitecture, structureOrganizing 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
根据主题关键词推荐角色,再由用户确认或修改。
专业角色(根据主题关键词推荐):
角色视角代理关注点关键词
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架构、结构化整理解决方案
选择策略:
  1. 自动模式:根据关键词匹配结果,选择排名前3的专业角色
  2. 手动模式:展示推荐角色 + "使用基础视角" 选项
  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:
  1. Core question: What is the fundamental problem/opportunity?
  2. User perspective: Who benefits and how?
  3. Technical angle: What enables this technically?
  4. Alternative approaches: What other ways could this be solved?
  5. Challenges: What could go wrong or block success?
  6. Innovation angle: What would make this 10x better?
  7. Integration: How does this fit with existing systems/processes?
Subagent for Vector Generation:
javascript
const vectorAgent = spawn_agent({
  message: `
生成指导头脑风暴探索的关键问题,使用子代理生成探索方向。
探索方向:
  1. 核心问题:根本问题/机遇是什么?
  2. 用户视角:谁会受益?如何受益?
  3. 技术角度:技术上有哪些实现基础?
  4. 替代方案:还有哪些解决思路?
  5. 挑战分析:可能出现哪些问题或障碍?
  6. 创新维度:如何让方案效果提升10倍?
  7. 集成考量:如何与现有系统/流程集成?
生成探索方向的子代理:
javascript
const vectorAgent = spawn_agent({
  message: `

TASK ASSIGNMENT

TASK ASSIGNMENT

MANDATORY FIRST STEPS (Agent Execute)

MANDATORY FIRST STEPS (Agent Execute)

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)

  1. 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:
  1. Core question: What is the fundamental problem/opportunity?
  2. User perspective: Who benefits and how?
  3. Technical angle: What enables this technically?
  4. Alternative approaches: What other ways could this be solved?
  5. Challenges: What could go wrong or block success?
  6. Innovation angle: What would make this 10x better?
  7. Integration: How does this fit with existing systems/processes?
Generate 5-7 exploration vectors (questions/directions) to expand this idea:
  1. Core question: What is the fundamental problem/opportunity?
  2. User perspective: Who benefits and how?
  3. Technical angle: What enables this technically?
  4. Alternative approaches: What other ways could this be solved?
  5. Challenges: What could go wrong or block success?
  6. Innovation angle: What would make this 10x better?
  7. 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 × 3

Step 2.1: Codebase Context Gathering

步骤2.1:代码库上下文收集

Use built-in tools to understand the codebase structure before spawning perspective agents.
Context Gathering Activities:
  1. Get project structure - Execute
    ccw tool exec get_modules_by_depth '{}'
  2. Search for related code - Use Grep/Glob to find files matching topic keywords
  3. Read project tech context - Load
    {projectRoot}/.workflow/project-tech.json
    if available
  4. Analyze patterns - Identify common code patterns and architecture decisions
exploration-codebase.json Structure:
  • relevant_files[]
    : Files related to the topic with relevance indicators
  • existing_patterns[]
    : Common code patterns and architectural styles
  • architecture_constraints[]
    : Project-level constraints
  • integration_points[]
    : Key integration patterns between modules
  • _metadata
    : Timestamp and context information
在启动视角代理前,使用内置工具了解代码库结构。
上下文收集活动:
  1. 获取项目结构 - 执行
    ccw tool exec get_modules_by_depth '{}'
  2. 搜索相关代码 - 使用Grep/Glob查找匹配主题关键词的文件
  3. 读取项目技术上下文 - 如果存在,加载
    {projectRoot}/.workflow/project-tech.json
  4. 分析模式 - 识别常见代码模式和架构决策
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:
PerspectiveRole FileFocus
Creative
~/.codex/agents/cli-explore-agent.md
Innovation, cross-domain inspiration, challenging assumptions
Pragmatic
~/.codex/agents/cli-explore-agent.md
Implementation feasibility, effort estimates, blockers
Systematic
~/.codex/agents/cli-explore-agent.md
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
~/.codex/agents/cli-explore-agent.md
创新、跨领域灵感、挑战假设
Pragmatic
~/.codex/agents/cli-explore-agent.md
实现可行性、工作量估算、潜在障碍
Systematic
~/.codex/agents/cli-explore-agent.md
问题分解、模式、可扩展性
并行子代理执行:
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)

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
  2. Read: ${projectRoot}/.workflow/project-tech.json
  3. Read: ${projectRoot}/.workflow/project-guidelines.json

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
  2. Read: ${projectRoot}/.workflow/project-tech.json
  3. 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 =>
• ${t}
).join('\n')}
${perspective.tasks.map(t =>
• ${t}
).join('\n')}

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 }))
undefined

Step 2.3: Aggregate Multi-Perspective Findings

步骤2.3:汇总多视角分析结果

Consolidate results from all three parallel perspective agents.
perspectives.json Structure:
  • session_id
    : Reference to brainstorm session
  • timestamp
    : Completion time
  • topic
    : Original idea/topic
  • creative
    : Creative perspective findings (ideas with novelty ratings)
  • pragmatic
    : Pragmatic perspective findings (approaches with effort ratings)
  • systematic
    : Systematic perspective findings (architectural options)
  • synthesis
    : {convergent_themes, conflicting_views, unique_contributions}
  • aggregated_ideas[]
    : Merged ideas from all perspectives
  • key_findings[]
    : Main insights across all perspectives
Aggregation Activities:
  1. Extract ideas and findings from each perspective's output
  2. Identify themes all perspectives agree on (convergent)
  3. Note conflicting views and tradeoffs
  4. Extract unique contributions from each perspective
  5. 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
    : 系统视角的分析结果(架构选项)
  • synthesis
    : {convergent_themes, conflicting_views, unique_contributions}
  • aggregated_ideas[]
    : 所有视角的创意合并结果
  • key_findings[]
    : 所有视角的核心洞察
汇总活动:
  1. 从每个视角的输出中提取创意和发现
  2. 识别所有视角达成共识的主题(收敛点)
  3. 记录冲突观点和权衡点
  4. 提取每个视角的独特贡献
  5. 合并并去重相似创意
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)
  • exploration-codebase.json
    created with comprehensive context
  • perspectives/*.json
    created for each perspective
  • perspectives.json
    created with aggregated findings and synthesis
  • brainstorm.md
    updated with Round 2 results
  • All agents closed properly
  • Ready for interactive refinement phase

将探索结果追加到头脑风暴时间线中。
第2轮内容(多视角探索):
  • 创意视角:带新颖度/影响力评分的新颖创意
  • 务实视角:带工作量/风险评分的实用方案
  • 系统视角:带权衡分析的架构选项
  • 视角综合:共识主题、冲突点、独特贡献
文档标准:
  • 包含代码库探索的相关证据
  • 按视角组织发现内容
  • 突出共识与分歧点
  • 记录关键假设和推理过程
成功标准:
  • 3个子代理均已启动并完成(或已处理超时情况)
  • exploration-codebase.json
    已创建,包含全面上下文
  • 每个视角的
    perspectives/*.json
    已创建
  • perspectives.json
    已创建,包含汇总结果和综合分析
  • brainstorm.md
    已更新第2轮结果
  • 所有代理已正确关闭
  • 已准备好进入交互式优化阶段

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
send_input
for deep interaction within same agent context, or spawn new agent for significantly different exploration angles.
目标:通过多轮用户引导的探索循环,迭代优化创意,包括深度挖掘、挑战验证和创意合并。
最大轮次:6轮优化(若用户表示完成可提前退出)
执行模型:使用
send_input
在同一代理上下文内进行深度交互,或为完全不同的探索角度启动新代理。

Step 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):
OptionPurposeNext Action
深入探索Explore selected ideas in detail
send_input
to active agent OR spawn deep-dive agent
继续发散Generate more ideasSpawn new agent with different angles
挑战验证Test ideas criticallySpawn challenge agent (devil's advocate)
合并综合Combine multiple ideasSpawn merge agent to synthesize
准备收敛Begin convergenceExit refinement loop for synthesis
向用户展示当前创意和视角分析结果。
展示内容:
  • 每个视角的顶级创意及评分
  • 共识主题和达成一致的领域
  • 冲突观点和权衡点
  • 待进一步探索的开放问题
用户反馈选项(单选):
选项用途后续操作
深入探索详细探索选中的创意向活跃代理发送
send_input
或启动深度挖掘代理
继续发散生成更多创意启动不同角度的新代理
挑战验证批判性测试创意启动挑战代理(唱反调角色)
合并综合整合多个创意启动合并代理进行综合
准备收敛开始收敛阶段退出优化循环进入综合阶段

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) =>
${i+1}. ${idea.title}
).join('\n')}
Based on your initial exploration, the user wants deeper investigation on these ideas: ${selectedIdeas.map((idea, i) =>
${i+1}. ${idea.title}
).join('\n')}

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)

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
  2. Read: ${sessionFolder}/perspectives.json (prior findings)
  3. Read: ${projectRoot}/.workflow/project-tech.json

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
  2. Read: ${sessionFolder}/perspectives.json (prior findings)
  3. 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 })
undefined
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 })
undefined

Step 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)

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
  2. Read: ${sessionFolder}/perspectives.json (ideas to challenge)

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
  2. Read: ${sessionFolder}/perspectives.json (ideas to challenge)

Challenge Context

Challenge Context

Topic: ${idea_or_topic} Ideas to Challenge: ${selectedIdeas.map((idea, i) =>
${i+1}. ${idea.title}: ${idea.description}
).join('\n')}
Topic: ${idea_or_topic} Ideas to Challenge: ${selectedIdeas.map((idea, i) =>
${i+1}. ${idea.title}: ${idea.description}
).join('\n')}

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 })
undefined

Step 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)

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
  2. Read: ${sessionFolder}/perspectives.json (source ideas)

  1. Read role definition: ~/.codex/agents/cli-explore-agent.md (MUST read first)
  2. Read: ${sessionFolder}/perspectives.json (source ideas)

Merge Context

Merge Context

Topic: ${idea_or_topic} Ideas to Merge: ${selectedIdeas.map((idea, i) =>
${i+1}. ${idea.title} (${idea.source_perspective})    ${idea.description}    Strengths: ${idea.strengths?.join(', ') || 'N/A'}
).join('\n')}
Topic: ${idea_or_topic} Ideas to Merge: ${selectedIdeas.map((idea, i) =>
${i+1}. ${idea.title} (${idea.source_perspective})    ${idea.description}    Strengths: ${idea.strengths?.join(', ') || 'N/A'}
).join('\n')}

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 })
undefined

Step 3.5: Document Each Round

步骤3.5:记录每一轮优化

Update brainstorm.md with results from each refinement round.
Round N Sections (Rounds 3-6):
SectionContent
User DirectionAction taken and ideas selected
FindingsNew findings and clarifications
Idea UpdatesChanges to idea scores and status
InsightsKey learnings and realizations
Next DirectionsSuggested 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
  • brainstorm.md
    updated with all refinement rounds
  • Ideas in
    ideas/
    folder for selected deep-dives
  • 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:
  1. Review all refinement rounds and accumulated findings
  2. Rank ideas by score, feasibility, and impact
  3. Identify top 5 viable ideas
  4. Extract key learnings and insights
  5. Generate recommendations with rationale
synthesis.json Structure:
  • session_id
    : Session identifier
  • topic
    : Original idea/topic
  • completed
    : Completion timestamp
  • total_rounds
    : Number of refinement rounds
  • top_ideas[]
    : Top 5 ranked ideas with scores and next steps
  • parked_ideas[]
    : Ideas parked for future consideration
  • key_insights[]
    : Key learnings from brainstorming process
  • recommendations
    : Primary recommendation and alternatives
  • follow_up[]
    : Suggested next steps (implementation, research, validation)
Idea Format:
  • title
    : Clear, descriptive title
  • description
    : Complete concept description
  • source_perspective
    : Which perspective(s) contributed
  • score
    : Final viability score (1-10)
  • novelty
    : Novelty/innovation rating (1-5)
  • feasibility
    : Implementation feasibility (1-5)
  • key_strengths
    : Main advantages and benefits
  • main_challenges
    : Key challenges and limitations
  • next_steps
    : Recommended actions to pursue
从所有优化轮次中提取并综合发现,形成最终结论。
整合活动:
  1. 回顾所有优化轮次和累积的发现
  2. 按评分、可行性和影响力对创意排名
  3. 确定前5个可行创意
  4. 提取关键学习和洞察
  5. 生成带推理过程的建议方案
synthesis.json结构:
  • session_id
    : 会话标识符
  • topic
    : 原始创意/主题
  • completed
    : 完成时间戳
  • total_rounds
    : 优化轮次数量
  • top_ideas[]
    : 排名前5的创意,带评分和后续步骤
  • parked_ideas[]
    : 暂存的创意,供未来考虑
  • key_insights[]
    : 头脑风暴过程中的关键学习
  • recommendations
    : 主要建议方案和备选方案
  • follow_up[]
    : 建议的后续步骤(实现、研究、验证)
创意格式:
  • title
    : 清晰、描述性的标题
  • description
    : 完整的创意描述
  • source_perspective
    : 贡献该创意的视角
  • score
    : 最终可行性评分(1-10)
  • novelty
    : 新颖性/创新性评分(1-5)
  • feasibility
    : 实现可行性评分(1-5)
  • 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:
OptionPurposeAction
创建实施计划Plan implementation of top ideaLaunch
workflow:lite-plan
创建IssueTrack top ideas for laterLaunch
issue:new
with ideas
深入分析Analyze top idea in detailLaunch
workflow:analyze-with-file
导出分享Generate shareable reportCreate formatted report document
完成No further actionEnd workflow
Success Criteria:
  • synthesis.json
    created with complete synthesis
  • brainstorm.md
    finalized with all conclusions
  • User offered meaningful next step options
  • Session complete and all artifacts available

根据头脑风暴结果为用户提供后续操作选项。
可用选项:
选项用途操作
创建实施计划为顶级创意制定实施计划启动
workflow:lite-plan
创建Issue跟踪顶级创意供后续处理启动
issue:new
并填入创意内容
深入分析详细分析顶级创意启动
workflow:analyze-with-file
导出分享生成可分享的报告创建格式化的报告文档
完成无进一步操作结束工作流
成功标准:
  • synthesis.json
    已创建,包含完整的综合分析
  • brainstorm.md
    已最终定稿,包含所有结论
  • 已为用户提供有意义的后续步骤选项
  • 会话完成,所有产物均可访问

Configuration

配置

Brainstorm Dimensions Reference

头脑风暴维度参考

Dimensions guide brainstorming scope and focus:
DimensionKeywordsBest For
technical技术, technical, implementation, codeImplementation approaches
ux用户, user, experience, UIUser-facing design ideas
business业务, business, valueBusiness model innovations
innovation创新, innovation, novelBreakthrough ideas
feasibility可行, feasible, practicalRealistic approaches
scalability扩展, scale, growthLarge-scale solutions
security安全, security, riskSecurity 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

头脑风暴模式

ModeDurationIntensitySubagents
Creative15-20 minHigh novelty1 agent, short timeout
Balanced30-60 minMixed3 parallel agents
Deep1-2+ hoursComprehensive3 parallel agents + deep refinement
模式时长强度子代理数量
Creative15-20分钟高新颖性1个代理,短超时
Balanced30-60分钟混合3个并行代理
Deep1-2+小时全面深入3个并行代理+深度优化

Collaboration Patterns

协作模式

PatternUsageDescription
Parallel DivergenceNew topicAll perspectives explore simultaneously via parallel subagents
Sequential Deep-DivePromising idea
send_input
to one agent for elaboration, others critique via new agents
Debate ModeControversial approachSpawn opposing agents to argue for/against
Synthesis ModeReady to decideSpawn synthesis agent combining insights from all perspectives
模式用途描述
Parallel Divergence新主题所有视角通过并行子代理同时探索
Sequential Deep-Dive有潜力的创意向一个代理发送
send_input
进行详细阐述,其他代理通过新代理进行批判
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:
  1. Check agent outputs for truncation or overflow
  2. Reduce scope: fewer perspectives or simpler topic
  3. Use structured brainstorm mode for more focused output
  4. Split complex topics into multiple sessions

单代理限制:
  • 主要分析输出:< 3000字
  • 子文档(若有):每个< 2000字
  • 最大子文档数量:每个视角5个
综合保护:
  • 若总分析内容>100KB,综合阶段仅读取主要分析文件(不包含子文档)
  • 大型创意会自动拆分到ideas/文件夹中的独立创意文档
恢复步骤:
  1. 检查代理输出是否被截断或溢出
  2. 缩小范围:减少视角数量或简化主题
  3. 使用结构化头脑风暴模式以获得更聚焦的输出
  4. 将复杂主题拆分为多个会话

Error Handling & Recovery

错误处理与恢复

SituationActionRecovery
Subagent timeoutCheck
results.timed_out
, continue
wait()
or use partial results
Reduce scope, use 2 perspectives instead of 3
Agent closed prematurelyCannot recover closed agentSpawn new agent with prior context from perspectives.json
Parallel agent partial failureSome perspectives complete, some failUse completed results, note gaps in synthesis
send_input to closed agentError: agent not foundSpawn new agent with prior findings as context
No good ideasReframe problem or adjust constraintsTry new exploration angles
User disengagedSummarize progress and offer breakSave state, keep agents alive for resume
Perspectives conflictPresent as tradeoff optionsLet user select preferred direction
Max rounds reachedForce synthesis phaseHighlight unresolved questions
Session folder conflictAppend timestamp suffixCreate unique folder
场景操作恢复方案
子代理超时检查
results.timed_out
,继续
wait()
或使用部分结果
缩小范围,用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 loop
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 loop

Continue Existing Session

续会模式

User resumes: TOPIC="same topic"
   ├─ Session exists → Continue mode
   ├─ Load previous brainstorm.md
   ├─ Load perspectives.json
   └─ Resume from last refinement round
User resumes: TOPIC="same topic"
   ├─ Session exists → Continue mode
   ├─ Load previous brainstorm.md
   ├─ Load perspectives.json
   └─ Resume from last refinement round

Refinement 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 reached
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 reached

Agent 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 refinement
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 refinement

Completion 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 artifacts

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 artifacts

Best Practices

最佳实践

Before Starting Brainstorm

头脑风暴开始前

  1. Clear Topic Definition: Detailed topics lead to better dimension identification
  2. User Context: Understanding preferences helps guide brainstorming intensity
  3. Scope Understanding: Being clear about time/scope expectations sets correct exploration level
  1. 清晰的主题定义:详细的主题能更好地识别维度
  2. 用户上下文:了解用户偏好有助于指导头脑风暴的强度
  3. 范围认知:明确时间/范围预期,设置合适的探索深度

During Brainstorming

头脑风暴过程中

  1. Review Perspectives: Check all three perspectives before refinement rounds
  2. Document Assumptions: Track what you think is true for correction later
  3. Use Continue Mode: Resume sessions to build on previous exploration
  4. Embrace Conflicts: Perspective conflicts often reveal important tradeoffs
  5. Iterate Thoughtfully: Each refinement round should meaningfully advance ideas
  1. 查看所有视角:在优化轮次前检查三个视角的结果
  2. 记录假设:跟踪你认为正确的假设,以便后续修正
  3. 使用续会模式:恢复之前的会话以基于已有探索继续推进
  4. 接受冲突:视角冲突通常能揭示重要的权衡点
  5. 有意义地迭代:每一轮优化都应切实推进创意发展

Codex Subagent Best Practices

Codex子代理最佳实践

  1. Role Path, Not Content: Pass
    ~/.codex/agents/*.md
    path in message, let agent read itself
  2. Parallel for Perspectives: Use batch spawn + wait for 3 perspective agents
  3. Delay close_agent for Refinement: Keep perspective agents alive for
    send_input
    reuse
  4. Batch wait: Use
    wait({ ids: [a, b, c] })
    for parallel agents, not sequential waits
  5. Handle Timeouts: Check
    results.timed_out
    and decide: continue waiting or use partial results
  6. Explicit Cleanup: Always
    close_agent
    when done, even on errors (use try/finally pattern)
  7. send_input vs spawn: Prefer
    send_input
    for same-context deep-dive,
    spawn
    for new exploration angles
  1. 传递角色路径而非内容:在消息中传递
    ~/.codex/agents/*.md
    路径,让代理自行读取
  2. 视角分析用并行模式:批量启动+等待3个视角代理
  3. 优化阶段延迟close_agent:保持视角代理活跃以便复用进行
    send_input
  4. 批量等待:对并行代理使用
    wait({ ids: [a, b, c] })
    ,而非顺序等待
  5. 处理超时:检查
    results.timed_out
    并决定:继续等待或使用部分结果
  6. 显式清理:完成后始终调用
    close_agent
    ,即使出错(使用try/finally模式)
  7. send_input vs spawn:同一上下文的深度挖掘优先用
    send_input
    ,新探索角度用
    spawn

Documentation Practices

文档实践

  1. Evidence-Based: Every idea should reference codebase patterns or feasibility analysis
  2. Perspective Diversity: Capture viewpoints from all three perspectives
  3. Timeline Clarity: Use clear timestamps for traceability
  4. Evolution Tracking: Document how ideas changed and evolved
  5. Action Items: Generate specific, implementable recommendations
  6. Synthesis Quality: Ensure convergent/conflicting themes are clearly documented

Now execute the brainstorm-with-file workflow for topic: $TOPIC
  1. 基于证据:每个创意都应引用代码库模式或可行性分析
  2. 视角多样性:捕捉所有三个视角的观点
  3. 时间线清晰:使用明确的时间戳以便追溯
  4. 跟踪演进:记录创意如何变化和发展
  5. 生成可执行的行动项:生成具体、可实现的建议
  6. 高质量综合:确保共识/冲突主题记录清晰

现在为主题执行带文件支持的头脑风暴工作流:$TOPIC