关于 brainstorm-with-file
brainstorm-with-file 是 Codex 的头脑风暴工作流,会在会话文档中记录想法演变,并引导多视角探索、可选网页研究、迭代完善和结构化交接。
主要功能
- 01在 brainstorm.md 中记录想法演变
- 02创意、务实和系统化视角
- 03可选网页研究
- 04迭代完善与综合想法
- 05支持续接会话和自动确认
适用场景
- 01从多个视角探索产品或技术想法
- 02续接并完善已记录的头脑风暴
- 03为主题研究相关模式和灵感
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ catlog22/ claude-code-workflow --skill brainstorm-with-file安装后在 Claude Code 中输入/brainstorm-with-file确认已加载。
详细介绍
Codex 借助文件进行头脑风暴的提示词
概览
采用记录思路演进过程的交互式头脑风暴工作流。通过提问、行内多视角分析、外部研究和迭代优化,扩展初始想法。
核心工作流:种子想法 → 扩展 → 多视角探索 → 研究 → 优化 → 凝练 → 下一步
主要功能:
- brainstorm.md:完整的思路演进时间线
- 多视角分析:创意型 + 务实型 + 系统型(串行、行内)
- 外部研究:通过
web.run搜索网页,寻找灵感、模式和最佳实践 - 想法扩展:通过循序渐进的提问和探索来扩展想法
- 发散-收敛循环:先生成选项,再聚焦最佳路径
- 进度跟踪:使用
functions.update_plan实时查看各阶段进度 - 结构化交接:通过终端关卡进行执行规划、创建 issue 或完成流程
自动模式
使用 --yes 或 -y 时:自动确认探索决策,使用推荐视角,并跳过交互式范围界定。
快速开始
# Basic usage
/codex:brainstorm-with-file TOPIC="How to improve developer onboarding experience"
# With perspective selection
/codex:brainstorm-with-file TOPIC="New caching strategy" --perspectives=creative,pragmatic,systematic
# Continue existing session
/codex:brainstorm-with-file TOPIC="caching strategy" --continue
# Auto mode (skip confirmations)
/codex:brainstorm-with-file -y TOPIC="Plugin architecture ideas"
目标主题
$TOPIC
配置
| 标志 | 默认值 | 描述 |
|---|---|---|
-y, --yes | false | 自动确认所有决策 |
--continue | false | 继续现有会话 |
--perspectives | creative,pragmatic,systematic | 以逗号分隔的视角列表 |
--max-ideas | 15 | 跟踪想法的最大数量 |
会话 ID 格式:BS-{YYYY-MM-DD}-{slug}
- slug:小写字母、数字和 CJK 字符,最多 40 个字符
- 日期:YYYY-MM-DD(UTC+8)
- 自动检测是否继续:会话文件夹中存在 brainstorm.md → 继续模式
头脑风暴流程
Step 0: Session Setup
├─ Parse topic, flags (--perspectives, --continue, -y)
├─ Generate session ID: BS-{date}-{slug}
├─ Create session folder (or detect existing → continue mode)
└─ functions.update_plan (5 phases: Seed → Explore → Refine → Converge → GATE)
Step 1: Seed Understanding
├─ Parse topic, identify brainstorm dimensions
├─ Role/perspective selection with user (or auto)
├─ Initial scoping via functions.request_user_input (mode, focus, constraints)
├─ Expand seed into exploration vectors
└─ Initialize brainstorm.md
Step 2: Divergent Exploration (Inline, No Agents)
├─ Detect codebase → search relevant modules, patterns
│ ├─ Run `ccw spec load --category exploration` (if spec system available)
│ └─ Use Grep, Glob, Read, mcp__ace-tool__search_context
├─ Multi-perspective analysis (serial, inline)
│ ├─ Creative perspective: innovation, cross-domain, challenge assumptions
│ ├─ Pragmatic perspective: feasibility, effort, blockers
│ └─ Systematic perspective: decomposition, patterns, scalability
├─ External research via web.run (optional — patterns, best practices, inspiration)
├─ Aggregate findings → perspectives.json + research.json
├─ Update brainstorm.md with Round 1
└─ Initial Idea Coverage Check
Step 3: Interactive Refinement (Multi-Round, max 6)
├─ Present current ideas and perspectives (Cumulative Context)
├─ Record findings to brainstorm.md BEFORE updating Current Ideas
├─ Gather user feedback via functions.request_user_input
├─ Process response:
│ ├─ Deep Dive → deeper inline analysis on selected ideas
│ ├─ Diverge → new inline analysis with different angles
│ ├─ Challenge → devil's advocate inline analysis
│ ├─ Merge → synthesize complementary ideas inline
│ ├─ 外部研究 → web.run for external inspiration/validation
│ └─ Converge → exit loop for synthesis
├─ Update brainstorm.md with round details
└─ Repeat until user selects converge or max rounds
Step 4: Convergence & Crystallization
├─ Consolidate all insights → synthesis.json
├─ Update brainstorm.md with final synthesis
├─ Batch top-idea review via functions.request_user_input
└─ MANDATORY Terminal Gate: 执行任务 / 产出Issue / 完成
├─ Execute Task → handoff-spec.json with implementation scope
├─ Create Issue → display issue creation command
└─ Done → end workflow
输出产物
阶段 1:理解种子想法
| 产物 | 用途 |
|---|---|
brainstorm.md | 初始化文件,包含会话元数据、种子想法扩展和探索方向 |
| 会话变量 | 主题 slug、头脑风暴模式、维度、探索方向 |
阶段 2:发散探索
| 产物 | 用途 |
|---|---|
exploration-codebase.json | 代码库上下文:相关文件、模式、架构约束 |
perspectives/*.json | 各视角的独立输出(创意型、务实型、系统型) |
perspectives.json | 汇总发现及综合分析(收敛或冲突的主题) |
更新后的 brainstorm.md | 第 1 轮:探索结果和多视角分析 |
阶段 3:交互式优化
| 产物 | 用途 |
|---|---|
ideas/{idea-slug}.md | 对选定想法进行深入分析 |
ideas/merged-idea-{n}.md | 合并后的想法文档 |
更新后的 brainstorm.md | 第 2–6 轮:用户反馈、想法选择和优化循环 |
阶段 4:收敛与凝练
| 产物 | 用途 |
|---|---|
synthesis.json | 最终综合结果:优先想法、建议和见解 |
最终版 brainstorm.md | 包含结论的完整思路演进过程 |
记录协议
重要:头脑风暴期间,出现以下情况时,必须立即记录到 brainstorm.md:
| 触发条件 | 记录内容 | 目标章节 |
|---|---|---|
| 生成想法 | 想法内容、来源视角、新颖度/可行性评分 | #### Ideas Generated |
| 视角转变 | 旧框架 → 新框架、触发原因 | #### Decision Log |
| 用户反馈 | 用户的原始输入、选中或拒绝了哪些想法 | #### User Input |
| 挑战假设 | 原始假设 → 挑战结果、是否经得起考验 | #### Challenged Assumptions |
| 合并想法 | 源想法、合并后的概念、保留或舍弃的内容 | #### Decision Log |
| 调整范围 | 调整前后的范围、触发原因 | #### Decision Log |
决策记录格式
> **Decision**: [Description of the decision]
> - **Context**: [What triggered this decision]
> - **Options considered**: [Alternatives evaluated]
> - **Chosen**: [Selected approach] — **Reason**: [Rationale]
> - **Rejected**: [Why other options were discarded]
> - **Impact**: [Effect on brainstorming direction]
叙述性综合格式
每轮更新后追加:
### Round N: Narrative Synthesis
**Starting point**: Based on previous round's [conclusions/questions], this round explored [starting point].
**Key progress**: [New ideas/findings] [confirmed/refuted/expanded] previous understanding of [topic area].
**Decision impact**: User selected [feedback type], directing brainstorming toward [adjusted/deepened/maintained].
**Current state**: After this round, top ideas are [updated idea rankings].
**Open directions**: [remaining exploration angles for next round]
实现细节
阶段 0:会话初始化
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
// Parse flags
const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
const continueMode = $ARGUMENTS.includes('--continue')
const perspectivesMatch = $ARGUMENTS.match(/--perspectives[=\s]([\w,]+)/)
const selectedPerspectiveNames = perspectivesMatch
? perspectivesMatch[1].split(',')
: ['creative', 'pragmatic', 'systematic']
// Extract topic
const topic = $ARGUMENTS.replace(/--yes|-y|--continue|--perspectives[=\s][\w,]+|--max-ideas[=\s]\d+|TOPIC=/g, '').replace(/^["']|["']$/g, '').trim()
// Determine project root
const projectRoot = functions.exec_command('git rev-parse --show-toplevel 2>/dev/null || pwd').trim()
const slug = topic.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').substring(0, 40)
const dateStr = getUtc8ISOString().substring(0, 10)
const sessionId = `BS-${dateStr}-${slug}`
const sessionFolder = `${projectRoot}/.workflow/.brainstorm/${sessionId}`
// Auto-detect continue: session folder + brainstorm.md exists → continue mode
// If continue → load brainstorm.md + perspectives, resume from last round
functions.exec_command(`mkdir -p ${sessionFolder}`)
// Initialize progress tracking (MANDATORY)
functions.update_plan([
{ id: "phase-1", title: "Phase 1: Seed Understanding", status: "in_progress" },
{ id: "phase-2", title: "Phase 2: Divergent Exploration", status: "pending" },
{ id: "phase-3", title: "Phase 3: Interactive Refinement", status: "pending" },
{ id: "phase-4", title: "Phase 4: Convergence & Crystallization", status: "pending" },
{ id: "next-step", title: "GATE: Post-Completion Next Step", status: "pending" }
])
阶段 1:初步理解
目标:解析初始构想,确定探索方向和范围偏好,并初始化头脑风暴文档。
步骤 1.1:解析初步构想并确定维度
将主题关键词与头脑风暴维度进行匹配(参见维度参考):
// Match topic text against keyword lists from Dimensions Reference
// If multiple dimensions match, include all
// If none match, default to "technical" and "innovation"
const dimensions = identifyDimensions(topic, BRAINSTORM_DIMENSIONS)
步骤 1.2:角色选择
根据主题关键词推荐角色,然后让用户确认或调整。
专业角色(根据主题关键词推荐):
| 角色 | 视角重点 | 关键词 |
|---|---|---|
| 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 个专业角色
- 手动模式:展示推荐角色以及“使用简单视角”选项
- 继续模式:使用上一会话中的角色
步骤 1.3:初步确定范围(仅限新会话)
对于新的头脑风暴会话,在开始探索前收集用户偏好(自动模式或继续模式下跳过):
if (!autoYes && !continueMode) {
// Single batch: Mode + Focus + Constraints (max 4 questions per call)
const scoping = functions.request_user_input({
questions: [
{
header: "Mode", // max 12 chars
question: "Select brainstorming intensity:",
multiSelect: false,
options: [
{ label: "Balanced (Recommended)", description: "Moderate, 3 perspectives" },
{ label: "Creative", description: "Fast, high novelty, 1 perspective" },
{ label: "Deep", description: "Comprehensive, 3 perspectives + deep refinement" }
]
},
{
header: "Focus",
question: "Select brainstorming focus areas:",
multiSelect: true,
options: generateFocusOptions(dimensions) // Dynamic based on dimensions
},
{
header: "Constraints",
question: "Any constraints to consider?",
multiSelect: true,
options: [
{ label: "Existing Arch", description: "Must fit current system" },
{ label: "Time Limited", description: "Short implementation timeline" },
{ label: "Resource Limited", description: "Limited team/budget" },
{ label: "No Constraints", description: "Blue-sky thinking" }
]
}
]
})
}
步骤 1.4:将初步构想扩展为探索方向
生成引导头脑风暴探索的关键问题。此步骤直接完成,不委派给 Agent。
探索方向:
- 核心问题:根本问题或机遇是什么?
- 用户视角:谁会受益,以及如何受益?
- 技术角度:需要哪些技术条件才能实现?
- 替代方案:还可以用哪些方式解决?
- 挑战:可能出现哪些问题,或有哪些因素会阻碍成功?
- 创新角度:如何让它好 10 倍?
- 集成:它如何融入现有系统/流程?
结合用户的关注领域和约束条件,直接分析主题并生成 5-7 个探索方向。
步骤 1.5:初始化 brainstorm.md
const brainstormMd = `# Brainstorm Session
**Session ID**: ${sessionId}
**Topic**: ${topic}
**Started**: ${getUtc8ISOString()}
**Dimensions**: ${dimensions.join(', ')}
**Mode**: ${brainstormMode}
## Table of Contents
- [Session Context](#session-context)
- [Current Ideas](#current-ideas)
- [Thought Evolution Timeline](#thought-evolution-timeline)
## Current Ideas
> To be populated after exploration.
## Session Context
- Focus areas: ${focusAreas.join(', ')}
- Perspectives: ${selectedPerspectiveNames.join(', ')}
- Constraints: ${constraints.join(', ')}
- Mode: ${brainstormMode}
## Exploration Vectors
${explorationVectors.map((v, i) => `${i+1}. ${v}`).join('\n')}
## Initial Decisions
> Record why these perspectives and focus areas were selected.
---
## Thought Evolution Timeline
> Rounds will be appended below as brainstorming progresses.
---
## Decision Trail
> Consolidated critical decisions across all rounds (populated in Phase 4).
`
Write(`${sessionFolder}/brainstorm.md`, brainstormMd)
成功标准:
- 已创建会话文件夹并初始化 brainstorm.md
- 已确定头脑风暴维度并记录用户偏好
- 已记录初始决策:视角选择理由、排除的选项及理由
- 已生成探索方向
- 已选择 1-3 个视角
阶段 2:发散探索
目标:收集代码库背景信息,并执行多视角分析以生成多样化观点。所有探索均直接完成,不委派给 Agent。
步骤 2.1:检测并探索代码库
const hasCodebase = functions.exec_command(`
test -f package.json && echo "nodejs" ||
test -f go.mod && echo "golang" ||
test -f Cargo.toml && echo "rust" ||
test -f pyproject.toml && echo "python" ||
test -f pom.xml && echo "java" ||
test -d src && echo "generic" ||
echo "none"
`).trim()
if (hasCodebase !== 'none') {
// 1. Read project metadata (if exists)
// - Run `ccw spec load --category exploration` (load project specs)
// - Run `ccw spec load --category debug` (known issues and root-cause notes)
// - .workflow/specs/*.md (project conventions)
// 2. Search codebase for relevant content
// Use: Grep, Glob, Read, or mcp__ace-tool__search_context
// Focus on: modules/components, patterns/structure, integration points, config/dependencies
// 3. Write findings
Write(`${sessionFolder}/exploration-codebase.json`, JSON.stringify({
project_type: hasCodebase,
relevant_files: [...], // [{path, relevance, summary}]
existing_patterns: [...], // [{pattern, files, description}]
architecture_constraints: [...], // Constraints found
integration_points: [...], // [{location, description}]
key_findings: [...], // Main insights from code search
_metadata: { timestamp: getUtc8ISOString(), exploration_scope: '...' }
}, null, 2))
}
步骤 2.2:多视角分析(串行,直接完成)
从每个选定的视角进行分析。所有分析均由 AI 直接完成,不使用 Agent。
视角定义:
| 视角 | 重点 | 任务 |
|---|---|---|
| Creative | 创新、跨领域 | 跳出显而易见的思路,探索跨领域灵感,质疑假设,提出宏大愿景 |
| Pragmatic | 实际实现 | 评估可行性,识别现有模式/库,估算复杂度,指出阻碍因素 |
| Systematic | 架构思维 | 分解问题,识别架构模式,梳理依赖关系,考虑可扩展性 |
串行执行——依次分析每个视角:
const perspectives = ['creative', 'pragmatic', 'systematic']
perspectives.forEach(perspective => {
// Analyze inline using exploration-codebase.json as context
// Generate ideas from this perspective's focus
Write(`${sessionFolder}/perspectives/${perspective}.json`, JSON.stringify({
perspective: perspective,
ideas: [ // 3-5 ideas per perspective
{ title: '...', description: '...', novelty: 1-5, feasibility: 1-5, rationale: '...' }
],
key_findings: [...],
challenged_assumptions: [...],
open_questions: [...],
_metadata: { perspective, timestamp: getUtc8ISOString() }
}, null, 2))
})
Step 2.3:汇总多视角发现
// Update progress
functions.update_plan([{ id: "phase-2", title: "Phase 2: Divergent Exploration", status: "in_progress" }])
const synthesis = {
session_id: sessionId,
timestamp: getUtc8ISOString(),
topic,
// Individual perspective findings
creative: readJson(`${sessionFolder}/perspectives/creative.json`),
pragmatic: readJson(`${sessionFolder}/perspectives/pragmatic.json`),
systematic: readJson(`${sessionFolder}/perspectives/systematic.json`),
// Cross-perspective synthesis
synthesis: {
convergent_themes: [...], // What all perspectives agree on
conflicting_views: [...], // Where perspectives differ
unique_contributions: [...] // Insights unique to specific perspectives
},
// Aggregated for refinement
aggregated_ideas: [...], // Merged and deduplicated ideas from all perspectives
key_findings: [...] // Main insights across all perspectives
}
Write(`${sessionFolder}/perspectives.json`, JSON.stringify(synthesis, null, 2))
Step 2.3b:外部研究(可选)
搜索外部灵感、行业最佳实践和先例,以丰富头脑风暴的背景信息。
// Triggered when: topic involves established patterns, industry trends, or competitive landscape
const researchQueries = generateResearchQueries(topic, dimensions)
researchQueries.forEach(query => {
const results = web.run({ search_query: query })
// Extract: patterns, inspiration, best practices, case studies
})
// Write research findings
Write(`${sessionFolder}/research.json`, JSON.stringify({
queries: researchQueries,
findings: [...], // [{source, insight, relevance_to_topic}]
inspiration: [...], // Cross-domain ideas from external sources
best_practices: [...],
_metadata: { timestamp: getUtc8ISOString() }
}, null, 2))
// Merge research findings into perspectives.json synthesis
// Update convergent_themes and unique_contributions with external evidence
Step 2.4:更新 brainstorm.md
使用轮次文档模式将探索结果追加为第 1 轮。
第 1 轮章节(多视角探索):
- 创意视角:新颖的想法及其新颖度/影响力评分
- 务实视角:实用的方法及其工作量/风险评分
- 系统视角:架构选项及权衡分析
- 视角综合:趋同主题、冲突和独特贡献
Step 2.5:初始想法覆盖检查
// Check exploration vectors against Round 1 findings
appendToBrainstorm(`
#### Initial Idea Coverage Check (Post-Exploration)
${explorationVectors.map((vector, i) => {
const status = assessCoverage(vector, explorationFindings)
return `- ${status.icon} Vector ${i+1}: ${vector} — ${status.detail}`
}).join('\n')}
> Next rounds will focus on uncovered and in-progress vectors.
`)
成功标准:
- 已创建包含代码库上下文的 exploration-codebase.json(如果代码库存在)
- 已为每个视角创建 perspectives/*.json
- 已创建包含汇总发现和综合分析的 perspectives.json
- 已使用第 1 轮结果更新 brainstorm.md
- 已完成初始想法覆盖检查
- 已记录包含证据和评分的关键发现
阶段 3:交互式完善
目标:通过多轮、由用户引导的探索循环迭代完善想法。最大轮数:6。所有分析均直接在对话中完成。
自动模式行为(--yes):
- 平衡/深度模式:自动运行 2 轮(对排名前 2 的想法进行 1 轮深入探讨,对排名前 3 的想法进行 1 轮质疑),然后自动收敛
- 创意模式:自动运行 1 轮(1 次发散),然后自动收敛
- 跳过用户方向提示;根据想法评分自动选择
累积上下文规则:每轮分析 MUST 将所有先前发现作为上下文。绝不孤立分析——始终以以下内容为基础:
- 前几轮的想法和评分
- 用户在所有前几轮中的反馈
- 研究发现(如有)
- 受到质疑的假设及其结果
记录后再继续规则:更新当前想法或呈现下一次交互之前,MUST 先将本轮发现写入 brainstorm.md。
Step 3.1:呈现发现并征求用户指示
当前理解摘要(第 2 轮及之后,在呈现新发现之前):
- 用 1–2 句话概述最佳想法和上一轮的方向
- 示例:“目前的最佳想法:[idea1]、[idea2]。上一轮进行了[深入探讨/质疑/合并]。以下是最新发现:”
// Update progress
functions.update_plan([{ id: "phase-3", title: "Phase 3: Interactive Refinement", status: "in_progress" }])
if (!autoYes) {
// Dynamic options based on round context
const baseOptions = [
{ label: "Deep Dive", description: "Explore selected ideas in detail" },
{ label: "Diverge More", description: "Generate more ideas from different angles" },
{ label: "Challenge", description: "Devil's advocate — test ideas critically" },
{ label: "Merge Ideas", description: "Combine complementary ideas" }
]
// Add research option if not yet done or if new angles emerged
if (!researchDone || newAnglesEmerged) {
baseOptions.push({ label: "外部研究", description: "Search for external inspiration and best practices" })
}
// Always include converge as final option
baseOptions.push({ label: "Ready to Converge", description: "Sufficient ideas, proceed to synthesis" })
const feedback = functions.request_user_input({
questions: [{
header: "Direction", // max 12 chars
question: `Brainstorm round ${round}: What would you like to do next?`,
multiSelect: false,
options: baseOptions.slice(0, 4) // max 4 options per schema
}]
})
}
Step 3.2:处理用户回复
记录检查点:无论选择哪个选项,都 MUST 记录到 brainstorm.md:
- 用户的原始选择和表达
- 对头脑风暴方向的影响
- 如果方向发生变化,记录完整的决策记录
| 回复 | 操作 |
|---|---|
| 深入探讨 | 询问要探索哪些想法。在对话中进行分析:阐述概念、确定需求/依赖项、分析挑战、建议 PoC 方法、定义成功指标。写入 ideas/{idea-slug}.md。 |
| 进一步发散 | 从不同角度在对话中进行分析:替代性表述、跨领域灵感、假设情景、放宽约束。生成新想法。 |
| 质疑 | 在对话中进行魔鬼代言式分析:为每个想法提出 3 个最有力的反对意见、质疑假设、分析失败情景和竞争性替代方案,并给出可行性评分(1–5)。 |
| 合并想法 | 询问要合并哪些想法。在对话中进行综合:找出互补元素、解决矛盾、创建统一概念、保留优势。写入 ideas/merged-idea-{n}.md。 |
| 外部研究 | 执行 web.run 并使用针对主题的查询。搜索:行业模式、竞争性解决方案、最佳实践、学术研究。将发现合并到当前轮次中。更新 research.json。 |
| 准备收敛 | 记录结束的原因。退出循环 → 阶段 4。 |
Step 3.3:深入探讨所选想法
用户选择“深入探讨”时,提供全面的对话内分析:
// For each selected idea, analyze inline
selectedIdeas.forEach(idea => {
const deepDive = {
title: idea.title,
detailed_description: '...', // Elaborated concept
technical_requirements: [...], // Implementation needs
dependencies: [...], // What this depends on
challenges: [ // Risk/challenge matrix
{ challenge: '...', severity: 'high|medium|low', mitigation: '...' }
],
poc_approach: '...', // Proof-of-concept suggestion
success_metrics: [...], // How to measure success
source_perspectives: [...] // Which perspectives contributed
}
Write(`${sessionFolder}/ideas/${ideaSlug}.md`, formatIdeaMarkdown(deepDive))
})
Step 3.4:魔鬼代言式质疑
用户选择“质疑”时,进行对话内批判性分析:
selectedIdeas.forEach(idea => {
const challenge = {
idea: idea.title,
objections: [...], // 3+ strongest objections
challenged_assumptions: [...], // Core assumptions tested
failure_scenarios: [...], // When/how this fails
alternatives: [...], // Competitive/alternative solutions
survivability_rating: 1-5, // How well idea survives challenge
strengthened_version: '...' // Improved version post-challenge
}
// Record in brainstorm.md
})
步骤 3.5:合并多个想法
当用户选择“合并”时,直接综合:
const merged = {
title: '...', // New merged concept name
description: '...', // Unified concept description
source_ideas: [...], // Which ideas were merged
elements_from_each: [...], // What was taken from each source
contradictions_resolved: [...], // How conflicts were handled
combined_strengths: [...], // New combined advantages
implementation_considerations: '...'
}
Write(`${sessionFolder}/ideas/merged-idea-${n}.md`, formatMergedIdeaMarkdown(merged))
步骤 3.6:记录每一轮
使用每轮文档记录模式更新 brainstorm.md。
追加到思路演进时间线:用户指引、决策日志、生成/更新的想法、分析结果、受到质疑的假设、待处理事项、叙事综合。
替换(而非追加):
| 部分 | 更新规则 |
|---|---|
## Current Ideas | 用最新的想法排名列表覆盖 |
## Table of Contents | 更新链接,纳入新的第 N 轮部分 |
成功标准:
- 每一轮的用户反馈都已处理
- brainstorm.md 已更新,包含所有完善轮次
ideas/文件夹中包含所选深入探讨主题的想法- 已达到退出条件(用户选择收敛或达到最大轮数)
阶段 4:收敛与提炼
目标:综合最终想法,生成结论和建议,并提出后续步骤。
步骤 4.1:整合见解
const synthesis = {
session_id: sessionId,
topic,
completed: getUtc8ISOString(),
total_rounds: roundCount,
top_ideas: [ // Top 5 ranked ideas
{
title: '...', description: '...',
source_perspective: '...',
score: 1-10, // Final viability score
novelty: 1-5, // Innovation rating
feasibility: 1-5, // Implementation feasibility
key_strengths: [...],
main_challenges: [...],
next_steps: [...],
review_status: 'accepted|modified|rejected|pending'
}
],
parked_ideas: [...], // Ideas for future consideration
key_insights: [...], // Key learnings from brainstorming
recommendations: {
primary: '...', // Best path forward
alternatives: [...] // Other viable options
},
follow_up: [ // Suggested next steps
{ type: 'implement|research|validate', summary: '...' }
],
decision_trail: [ // Consolidated from all phases
{ round: 1, decision: '...', context: '...', chosen: '...', reason: '...', impact: '...' }
]
}
Write(`${sessionFolder}/synthesis.json`, JSON.stringify(synthesis, null, 2))
步骤 4.2:最终更新 brainstorm.md
综合与结论:
- 执行摘要:头脑风暴结果的高层概述
- 首要想法:按排名列出想法,并说明其描述、优势和挑战
- 主要建议:明确说明理由的最佳后续路径
- 替代方案:其他可行方案及其权衡分析
- 暂缓的想法:未来可考虑的想法及其潜在触发条件
- 关键见解:流程中获得的重要经验
当前想法(最终版):
| 子部分 | 内容 |
|---|---|
| 首要想法 | 按评分排名,并列出优势/挑战 |
| 想法演进 | 首要想法在各轮中的发展过程 |
| 关键见解 | 供未来参考的宝贵经验 |
决策轨迹:
| 子部分 | 内容 |
|---|---|
| 关键决策 | 对结果产生重大影响的决策 |
| 方向变更 | 范围/重点调整的时间线及理由 |
| 已做出的权衡 | 关键权衡,以及选择某些路径的原因 |
会话统计:总轮数、生成的想法数、经受住质疑的想法数、采用的视角数、生成的产物数。
步骤 4.3:交互式首要想法评审(自动模式下跳过)
批量评审首要想法(每次调用最多 4 个问题,因此应据此对首要想法分组):
// Update progress
functions.update_plan([{ id: "phase-4", title: "Phase 4: Convergence & Crystallization", status: "in_progress" }])
if (!autoYes) {
// Batch review: up to 4 ideas per functions.request_user_input call
const batchSize = 4
for (let batch = 0; batch < rankedIdeas.length; batch += batchSize) {
const batchIdeas = rankedIdeas.slice(batch, batch + batchSize)
const review = functions.request_user_input({
questions: batchIdeas.map((idea, i) => ({
header: `Idea #${batch + i + 1}`, // max 12 chars
question: `"${idea.title}" (score: ${idea.score}). Your decision:`,
multiSelect: false,
options: [
{ label: "Accept", description: "Keep in final recommendations" },
{ label: "Modify", description: "Adjust scope or priority" },
{ label: "Reject", description: "Remove from recommendations" },
{ label: "Accept Rest", description: "Accept all remaining ideas" }
]
}))
})
// Process: Accept → "accepted" | Modify → gather text → "modified" | Reject → "rejected"
// Accept Rest → mark all remaining as "accepted", break outer loop
// Record review decisions to brainstorm.md Decision Log + update synthesis.json
}
}
评审摘要(追加到 brainstorm.md):
### Top Idea Review Summary
| # | Idea | Score | Novelty | Feasibility | Review Status | Notes |
|---|------|-------|---------|-------------|---------------|-------|
| 1 | [title] | 8 | 4 | 3 | Accepted | |
| 2 | [title] | 7 | 5 | 2 | Modified | [notes] |
| 3 | [title] | 6 | 3 | 4 | Rejected | [reason] |
步骤 4.4:强制终止关卡(完成后的下一步)
重要:必须执行此关卡。工作流不得在未调用此 functions.request_user_input 的情况下结束。
// Update progress — mark phase 4 complete, activate terminal gate
functions.update_plan([
{ id: "phase-4", title: "Phase 4: Convergence & Crystallization", status: "completed" },
{ id: "next-step", title: "GATE: Post-Completion Next Step", status: "in_progress" }
])
const nextStep = functions.request_user_input({
questions: [{
header: "Next Step", // max 12 chars
question: "Brainstorming complete. What would you like to do next?",
multiSelect: false,
options: [
{ label: "Execute Task", description: "Build implementation scope and handoff spec from top ideas" },
{ label: "Create Issue", description: "Convert top ideas into trackable issues" },
{ label: "Done", description: "End workflow, all artifacts saved" }
]
}]
})
// Handle next step
if (nextStep === "Execute Task") {
// Build implementation scope from accepted ideas
// Step A: Identify scope items from top ideas
// Step B: Generate handoff-spec.json with implementation details
// Step C: Write handoff-spec.json to session folder
Write(`${sessionFolder}/handoff-spec.json`, JSON.stringify({
session_id: sessionId,
topic,
scope_items: acceptedIdeas.map(idea => ({
title: idea.title,
description: idea.description,
implementation_approach: idea.next_steps,
priority: idea.score >= 8 ? 'high' : idea.score >= 5 ? 'medium' : 'low',
estimated_complexity: idea.feasibility <= 2 ? 'high' : idea.feasibility <= 4 ? 'medium' : 'low'
})),
recommended_workflow: 'workflow-lite-plan or workflow-plan',
_metadata: { generated: getUtc8ISOString(), source_session: sessionId }
}, null, 2))
// Display: "Handoff spec created. Run /workflow-lite-plan to execute."
} else if (nextStep === "Create Issue") {
// Display command for user to run manually
// "/issue:from-brainstorm ${sessionFolder}" or "/issue:new ..."
}
// Mark terminal gate complete
functions.update_plan([
{ id: "next-step", title: "GATE: Post-Completion Next Step", status: "completed" }
])
成功标准:
- 已创建包含完整综合内容的 synthesis.json
- brainstorm.md 已完成最终整理,包含所有结论
- 已执行终止关卡,并记录用户选择的下一步
- 如果选择“执行任务”:已创建包含实施范围的 handoff-spec.json
- 会话已完成,所有产物均可用
模板
每轮文档记录模式
brainstorm.md 中的每一轮均遵循以下结构:
### Round N - [DeepDive|Diverge|Challenge|Merge] (timestamp)
#### User Input
What the user indicated they wanted to focus on
#### Decision Log
#### Ideas Generated
New ideas from this round with ratings
#### Analysis Results
Detailed findings from this round's analysis
- Finding 1 (evidence: file:line or rationale)
- Finding 2 (evidence: file:line or rationale)
#### Challenged Assumptions
- ~~Previous assumption~~ → New understanding
- Reason: Why the assumption was wrong
#### Open Items
Remaining questions or exploration directions
#### Narrative Synthesis
brainstorm.md 演进摘要
- 标题:会话 ID、主题、开始时间、维度、模式
- 会话背景:重点领域、视角、限制条件
- 探索方向:指导探索的关键问题
- 初始决策:选择这些视角和重点领域的原因
- 思路演进时间线:逐轮记录发现
- 第 1 轮:探索结果 + 决策日志 + 叙事综合
- 第 2-N 轮:当前想法摘要 + 用户反馈 + 方向调整 + 新想法 + 决策日志 + 叙事综合
- 决策轨迹:汇总所有轮次中的关键决策
- 综合与结论:摘要、首要想法、建议
- 当前想法(最终版):整合后的排名想法
- 会话统计:已完成轮数、生成的想法数、产出的工件数
参考
输出结构
{projectRoot}/.workflow/.brainstorm/BS-{date}-{slug}/
├── 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 findings with synthesis
├── research.json # Phase 2/3: External research findings (if web.run used)
├── synthesis.json # Phase 4: Final synthesis
├── handoff-spec.json # Phase 4: Implementation scope (if "Execute Task" selected)
└── ideas/ # Phase 3: Individual idea deep-dives
├── idea-1.md
├── idea-2.md
└── merged-idea-1.md
| 文件 | 阶段 | 说明 |
|---|---|---|
brainstorm.md | 1-4 | 会话元数据 → 思考演进 → 结论 |
exploration-codebase.json | 2 | 代码库上下文:相关文件、模式、约束 |
perspectives/*.json | 2 | 各视角的创意生成结果 |
perspectives.json | 2 | 汇总发现及跨视角综合分析 |
research.json | 2-3 | 外部研究:模式、最佳实践、灵感 |
ideas/*.md | 3 | 单个创意的深入分析及合并后的创意 |
synthesis.json | 4 | 最终综合:重点创意、建议、见解 |
handoff-spec.json | 4 | 实施范围和交接内容(如果选择「执行任务」) |
头脑风暴维度
| 维度 | 关键词 | 说明 |
|---|---|---|
| 技术 | 技术, technical, implementation, code, 实现, architecture | 实施方案 |
| 用户体验 | 用户, user, experience, UX, UI, 体验, interaction | 面向用户的设计创意 |
| 业务 | 业务, business, value, ROI, 价值, market | 商业模式创新 |
| 创新 | 创新, innovation, novel, creative, 新颖 | 突破性创意 |
| 可行性 | 可行, feasible, practical, realistic, 实际 | 现实可行的方案 |
| 可扩展性 | 扩展, scale, growth, performance, 性能 | 大规模解决方案 |
| 安全 | 安全, security, risk, protection, 风险 | 安全考量 |
头脑风暴视角
| 视角 | 重点 | 最适合 |
|---|---|---|
| 创意型 | 创新、跨领域启发、挑战假设 | 生成新颖且出人意料的创意 |
| 务实型 | 实施可行性、工作量估算、阻碍因素 | 对创意进行现实检验 |
| 系统型 | 问题分解、模式、可扩展性、架构 | 组织并构建解决方案 |
头脑风暴模式
| 模式 | 强度 | 视角 | 说明 |
|---|---|---|---|
| 创意型 | 高新颖度 | 1 个视角 | 快速聚焦新颖创意 |
| 平衡型 | 混合 | 3 个视角 | 适度、均衡地探索(默认) |
| 深度型 | 全面 | 3 个视角 + 深入细化 | 通过多轮调查进行全面探索 |
协作模式
| 模式 | 用途 | 说明 |
|---|---|---|
| 并行发散 | 新主题 | 依次探索所有视角,确保全面覆盖 |
| 顺序深入探讨 | 有前景的创意 | 由一个视角展开阐述,其他视角进行批评 |
| 辩论模式 | 有争议的方案 | 进行支持与反对的内联分析 |
| 综合模式 | 准备做出决策 | 通过内联综合整合所有视角的见解 |
上下文溢出防护
各视角的限制:
- 主分析输出:< 3000 字
- 子文档(如有):每份 < 2000 字
- 子文档上限:每个视角 5 份
综合分析防护:
- 如果分析总量 > 100KB,综合分析只读取主分析文件(不读取子文档)
- 较大的创意会自动拆分为
ideas/文件夹中的独立创意文档
恢复步骤:
- 检查输出是否被截断或溢出
- 缩小范围:减少视角数量或简化主题
- 使用结构化头脑风暴模式,获得更聚焦的输出
- 将复杂主题拆分为多个会话
错误处理
| 情况 | 操作 | 恢复方式 |
|---|---|---|
| 未检测到代码库 | 按正常流程进行,纯主题头脑风暴 | 无需 exploration-codebase.json,直接继续 |
| 代码库搜索失败 | 继续利用现有上下文 | 在 brainstorm.md 中注明限制 |
| 网络调研失败 | 在没有外部发现的情况下继续 | 在 brainstorm.md 中注明,依靠内联分析 |
| 调研结果与想法冲突 | 将其作为相互竞争的证据呈现 | 由用户决定要探索哪个方向 |
| 没有好的想法 | 重新定义问题或调整约束 | 尝试新的探索角度 |
| 不同视角存在冲突 | 将其作为权衡选项呈现 | 由用户选择偏好的方向 |
| 达到最大轮数(6) | 强制进入综合阶段 | 突出尚未解决的问题 |
| 会话文件夹冲突 | 添加时间戳后缀 | 创建唯一文件夹 |
| 用户超时 | 保存状态并显示恢复命令 | 使用 --continue 恢复 |
最佳实践
核心原则
- 不修改代码:此技能严格遵循只读原则。它会生成分析和创意文档,但绝不会修改源代码。
- 立即记录决策:使用决策记录格式,在决策发生时及时记录
- 基于证据:引用代码库模式的想法应包含文件:行号证据
- 接纳冲突:不同视角之间的冲突往往能揭示重要的权衡
开始之前
- 明确主题定义:详细的主题有助于更好地识别维度
- 了解用户背景:了解偏好有助于调整头脑风暴的力度
- 了解范围:明确时间和范围预期,以便设定恰当的探索深度
头脑风暴期间
- 审视不同视角:开始迭代完善之前,先检查所有视角的结果
- 记录假设:跟踪你认为属实的内容,以便之后进行修正
- 使用继续模式:恢复会话,以便在之前的探索基础上继续
- 审慎迭代:每一轮完善都应切实推进想法
- 跟踪想法演变:记录想法在各轮中如何变化
文档编写实践
- 确保时间线清晰:使用清晰的时间戳以便追溯
- 跟踪演变过程:记录想法如何发展和变化
- 综合多种视角:记录趋同或冲突的主题
- 行动项:生成具体、可实施的建议
适用场景
在以下情况使用 brainstorm-with-file:
- 为某个主题提出新想法和解决方案
- 需要从多个视角探索可能性
- 希望记录思路演变过程,展示想法如何发展
- 在着手实施之前探索创造性解决方案
- 需要通过发散—收敛循环来完善想法
以下情况可考虑其他方案:
- 分析现有代码/架构 → 使用
analyze-with-file - 需要诊断具体错误 → 使用
debug-with-file - 根据需求进行复杂规划 → 使用
collaborative-plan-with-file - 准备开始实施 → 使用
lite-plan
现在开始针对以下主题进行头脑风暴:$TOPIC
重要:此技能仅用于头脑风暴。它会生成分析、不同视角和综合文档,但绝不会执行代码、修改源文件或自动启动其他技能。所有后续操作都需要用户手动运行建议的命令。