claude-code-workflow 7.2.29 → 7.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
  2. package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
  3. package/.claude/agents/action-planning-agent.md +7 -4
  4. package/.claude/agents/cli-explore-agent.md +77 -63
  5. package/.claude/agents/cli-lite-planning-agent.md +11 -10
  6. package/.claude/agents/issue-plan-agent.md +421 -426
  7. package/.claude/commands/workflow/spec/setup.md +1 -1
  8. package/.claude/skills/ccw-chain/SKILL.md +119 -0
  9. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
  10. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
  11. package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
  12. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
  13. package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
  14. package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
  15. package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
  16. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
  17. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
  18. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
  19. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
  20. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
  21. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
  22. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
  23. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
  24. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
  25. package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
  26. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
  27. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
  28. package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
  29. package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
  30. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
  31. package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
  32. package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
  33. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
  34. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
  35. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
  36. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
  37. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
  38. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
  39. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
  40. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
  41. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
  42. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
  43. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
  44. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
  45. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
  46. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
  47. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
  48. package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
  49. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
  50. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
  51. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
  52. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
  53. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
  54. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
  55. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
  56. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
  57. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
  58. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
  59. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
  60. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
  61. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
  62. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
  63. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
  64. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
  65. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
  66. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
  67. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
  68. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
  69. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
  70. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
  71. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
  72. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
  73. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
  74. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
  75. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
  76. package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
  77. package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
  78. package/.claude/skills/chain-loader/SKILL.md +78 -0
  79. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
  80. package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
  81. package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
  82. package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
  83. package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
  84. package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
  85. package/.claude/skills/review-cycle/phases/review-module.md +764 -764
  86. package/.claude/skills/review-cycle/phases/review-session.md +775 -775
  87. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
  88. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
  89. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
  90. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
  91. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
  92. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
  93. package/README.md +14 -0
  94. package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
  95. package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
  96. package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
  97. package/ccw/dist/tools/chain-loader.d.ts +10 -0
  98. package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
  99. package/ccw/dist/tools/chain-loader.js +642 -0
  100. package/ccw/dist/tools/chain-loader.js.map +1 -0
  101. package/ccw/dist/tools/index.d.ts.map +1 -1
  102. package/ccw/dist/tools/index.js +2 -0
  103. package/ccw/dist/tools/index.js.map +1 -1
  104. package/ccw/dist/tools/json-builder.js +20 -0
  105. package/ccw/dist/tools/json-builder.js.map +1 -1
  106. package/ccw/dist/types/chain-types.d.ts +72 -0
  107. package/ccw/dist/types/chain-types.d.ts.map +1 -0
  108. package/ccw/dist/types/chain-types.js +5 -0
  109. package/ccw/dist/types/chain-types.js.map +1 -0
  110. package/ccw/scripts/prepublish-clean.mjs +0 -1
  111. package/package.json +1 -3
  112. package/ccw-litellm/README.md +0 -180
  113. package/ccw-litellm/pyproject.toml +0 -35
  114. package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
  115. package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
  116. package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
  117. package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
  118. package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
  119. package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
  120. package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
  121. package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
  122. package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
  123. package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
  124. package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
@@ -0,0 +1,482 @@
1
+ ---
2
+ name: brainstorm-with-file
3
+ description: Interactive brainstorming with multi-CLI collaboration, idea expansion, and documented thought evolution
4
+ argument-hint: "[-y|--yes] [-c|--continue] [-m|--mode creative|structured] \"idea or topic\""
5
+ allowed-tools: TodoWrite(*), Agent(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*)
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-confirm decisions, use recommended roles, balanced exploration mode.
11
+
12
+ # Workflow Brainstorm Command
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ # Basic usage
18
+ /workflow:brainstorm-with-file "如何重新设计用户通知系统"
19
+
20
+ # With options
21
+ /workflow:brainstorm-with-file --continue "通知系统" # Continue existing
22
+ /workflow:brainstorm-with-file -y -m creative "创新的AI辅助功能" # Creative auto mode
23
+ /workflow:brainstorm-with-file -m structured "优化缓存策略" # Goal-oriented mode
24
+ ```
25
+
26
+ **Context Source**: cli-explore-agent + Multi-CLI perspectives (Gemini/Codex/Claude or Professional Roles)
27
+ **Output Directory**: `.workflow/.brainstorm/{session-id}/`
28
+ **Core Innovation**: Diverge-Converge cycles with documented thought evolution
29
+
30
+ ## Output Artifacts
31
+
32
+ | Phase | Artifact | Description |
33
+ |-------|----------|-------------|
34
+ | 1 | `brainstorm.md` | Complete thought evolution timeline (initialized) |
35
+ | 1 | Session variables | Dimensions, roles, exploration vectors |
36
+ | 2 | `exploration-codebase.json` | Codebase context from cli-explore-agent |
37
+ | 2 | `perspectives.json` | Multi-CLI perspective findings (creative/pragmatic/systematic) |
38
+ | 2 | Updated `brainstorm.md` | Round 2 multi-perspective exploration |
39
+ | 3 | `ideas/{idea-slug}.md` | Deep-dive analysis for selected ideas |
40
+ | 3 | Updated `brainstorm.md` | Round 3-6 refinement cycles |
41
+ | 4 | `synthesis.json` | Final synthesis with top ideas, recommendations |
42
+ | 4 | Final `brainstorm.md` | Complete thought evolution with conclusions |
43
+
44
+ ## Output Structure
45
+
46
+ ```
47
+ .workflow/.brainstorm/BS-{slug}-{date}/
48
+ ├── brainstorm.md # ⭐ Complete thought evolution timeline
49
+ ├── exploration-codebase.json # Phase 2: Codebase context
50
+ ├── perspectives.json # Phase 2: Multi-CLI findings
51
+ ├── synthesis.json # Phase 4: Final synthesis
52
+ └── ideas/ # Phase 3: Individual idea deep-dives
53
+ ├── idea-1.md
54
+ ├── idea-2.md
55
+ └── merged-idea-1.md
56
+ ```
57
+
58
+ ```
59
+ ┌─────────────────────────────────────────────────────────────────────────┐
60
+ │ INTERACTIVE BRAINSTORMING WORKFLOW │
61
+ ├─────────────────────────────────────────────────────────────────────────┤
62
+ │ │
63
+ │ Phase 1: Seed Understanding │
64
+ │ ├─ Parse initial idea/topic │
65
+ │ ├─ Identify dimensions (technical, UX, business, etc.) │
66
+ │ ├─ Select roles (professional or simple perspectives) │
67
+ │ ├─ Initial scoping questions │
68
+ │ ├─ Expand into exploration vectors │
69
+ │ └─ Initialize brainstorm.md │
70
+ │ │
71
+ │ Phase 2: Divergent Exploration │
72
+ │ ├─ cli-explore-agent: Codebase context (FIRST) │
73
+ │ ├─ Multi-CLI Perspectives (AFTER exploration) │
74
+ │ │ ├─ Creative (Gemini): Innovation, cross-domain │
75
+ │ │ ├─ Pragmatic (Codex): Implementation, feasibility │
76
+ │ │ └─ Systematic (Claude): Architecture, structure │
77
+ │ └─ Aggregate diverse viewpoints │
78
+ │ │
79
+ │ Phase 3: Interactive Refinement (Multi-Round) │
80
+ │ ├─ Present multi-perspective findings │
81
+ │ ├─ User selects promising directions │
82
+ │ ├─ Actions: Deep dive | Generate more | Challenge | Merge │
83
+ │ ├─ Update brainstorm.md with evolution │
84
+ │ └─ Repeat diverge-converge cycles (max 6 rounds) │
85
+ │ │
86
+ │ Phase 4: Convergence & Crystallization │
87
+ │ ├─ Synthesize best ideas │
88
+ │ ├─ Resolve conflicts between perspectives │
89
+ │ ├─ Generate actionable conclusions │
90
+ │ ├─ Offer next steps (plan/issue/analyze/export) │
91
+ │ └─ Final brainstorm.md update │
92
+ │ │
93
+ └─────────────────────────────────────────────────────────────────────────┘
94
+ ```
95
+
96
+ ## Implementation
97
+
98
+ ### Session Initialization
99
+
100
+ 1. Extract idea/topic from `$ARGUMENTS`
101
+ 2. Generate session ID: `BS-{slug}-{date}` (slug: lowercase, alphanumeric + Chinese, max 40 chars; date: YYYY-MM-DD UTC+8)
102
+ 3. Define session folder: `.workflow/.brainstorm/{session-id}`
103
+ 4. Parse command options:
104
+ - `-c` or `--continue` for session continuation
105
+ - `-m` or `--mode` for brainstorm mode (creative/structured/balanced)
106
+ - `-y` or `--yes` for auto-approval mode
107
+ 5. Auto-detect mode: If session folder + brainstorm.md exist → continue mode
108
+ 6. Create directory structure: `{session-folder}/ideas/`
109
+
110
+ 7. **Create Progress Tracking** (TodoWrite — MANDATORY):
111
+ ```
112
+ TodoWrite([
113
+ { id: "phase-1", title: "Phase 1: Seed Understanding", status: "in_progress" },
114
+ { id: "phase-2", title: "Phase 2: Divergent Exploration", status: "pending" },
115
+ { id: "phase-3", title: "Phase 3: Interactive Refinement", status: "pending" },
116
+ { id: "phase-4", title: "Phase 4: Convergence & Crystallization", status: "pending" },
117
+ { id: "next-step", title: "GATE: Post-Completion Next Step", status: "pending" }
118
+ ])
119
+ ```
120
+ - Update status to `"in_progress"` when entering each phase, `"completed"` when done
121
+ - **`next-step` is a terminal gate** — workflow is NOT complete until this todo is `"completed"`
122
+
123
+ **Session Variables**: `sessionId`, `sessionFolder`, `brainstormMode` (creative|structured|balanced), `autoMode` (boolean), `mode` (new|continue)
124
+
125
+ ### Phase 1: Seed Understanding
126
+
127
+ 1. **Parse Seed & Identify Dimensions**
128
+ - Match topic keywords against Brainstorm Dimensions table
129
+ - Default dimensions based on brainstormMode if no match
130
+
131
+ 2. **Role Selection**
132
+ - Recommend roles based on topic keywords (see Role Selection tables)
133
+ - **Professional roles**: system-architect, product-manager, ui-designer, ux-expert, data-architect, test-strategist, subject-matter-expert, product-owner, scrum-master
134
+ - **Simple perspectives** (fallback): creative/pragmatic/systematic
135
+ - **Auto mode**: Select top 3 recommended professional roles
136
+ - **Manual mode**: AskUserQuestion with recommended roles + "Use simple perspectives" option
137
+
138
+ 3. **Initial Scoping Questions** (if new session + not auto mode)
139
+ - **Direction**: Multi-select from directions generated by detected dimensions
140
+ - **Depth**: Single-select from quick/balanced/deep (15-20min / 30-60min / 1-2hr)
141
+ - **Constraints**: Multi-select from existing architecture, time, resources, or no constraints
142
+
143
+ 4. **Expand Seed into Exploration Vectors**
144
+
145
+ ```javascript
146
+ Bash({
147
+ command: `ccw cli -p "
148
+ Given the initial idea: '${idea_or_topic}'
149
+ User focus areas: ${userFocusAreas.join(', ')}
150
+ Constraints: ${constraints.join(', ')}
151
+
152
+ Generate 5-7 exploration vectors (questions/directions) to expand this idea:
153
+ 1. Core question: What is the fundamental problem/opportunity?
154
+ 2. User perspective: Who benefits and how?
155
+ 3. Technical angle: What enables this technically?
156
+ 4. Alternative approaches: What other ways could this be solved?
157
+ 5. Challenges: What could go wrong or block success?
158
+ 6. Innovation angle: What would make this 10x better?
159
+ 7. Integration: How does this fit with existing systems/processes?
160
+
161
+ Output as structured exploration vectors for multi-perspective analysis.
162
+ " --tool gemini --mode analysis --model gemini-2.5-flash`,
163
+ run_in_background: false
164
+ })
165
+ ```
166
+
167
+ 5. **Initialize brainstorm.md** with session metadata, initial context (user focus, depth, constraints), seed expansion (original idea + exploration vectors), empty thought evolution timeline sections
168
+
169
+ **TodoWrite**: Update `phase-1` → `"completed"`, `phase-2` → `"in_progress"`
170
+
171
+ ### Phase 2: Divergent Exploration
172
+
173
+ 1. **Primary Codebase Exploration via cli-explore-agent** (⚠️ FIRST)
174
+
175
+ ```javascript
176
+ Agent({
177
+ subagent_type: "cli-explore-agent",
178
+ run_in_background: false,
179
+ description: `Explore codebase for brainstorm: ${topicSlug}`,
180
+ prompt: `
181
+ ## Brainstorm Context
182
+ Topic: ${idea_or_topic}
183
+ Dimensions: ${dimensions.join(', ')}
184
+ Mode: ${brainstormMode}
185
+ Session: ${sessionFolder}
186
+
187
+ ## MANDATORY FIRST STEPS
188
+ 1. Run: ccw tool exec get_modules_by_depth '{}'
189
+ 2. Search for code related to topic keywords
190
+ 3. Read: .workflow/project-tech.json (if exists)
191
+
192
+ ## Exploration Focus
193
+ - Identify existing implementations related to the topic
194
+ - Find patterns that could inspire solutions
195
+ - Map current architecture constraints
196
+ - Locate integration points
197
+
198
+ ## Output
199
+ Write findings to: ${sessionFolder}/exploration-codebase.json
200
+
201
+ Schema:
202
+ {
203
+ "relevant_files": [{"path": "...", "relevance": "high|medium|low", "rationale": "..."}],
204
+ "existing_patterns": [],
205
+ "architecture_constraints": [],
206
+ "integration_points": [],
207
+ "inspiration_sources": [],
208
+ "_metadata": { "exploration_type": "brainstorm-codebase", "timestamp": "..." }
209
+ }
210
+ `
211
+ })
212
+ ```
213
+
214
+ 2. **Multi-CLI Perspective Analysis** (⚠️ AFTER exploration)
215
+
216
+ Build shared context from exploration results:
217
+
218
+ ```javascript
219
+ const explorationContext = `
220
+ PRIOR EXPLORATION CONTEXT (from cli-explore-agent):
221
+ - Key files: ${explorationResults.relevant_files.slice(0,5).map(f => f.path).join(', ')}
222
+ - Existing patterns: ${explorationResults.existing_patterns.slice(0,3).join(', ')}
223
+ - Architecture constraints: ${explorationResults.architecture_constraints.slice(0,3).join(', ')}
224
+ - Integration points: ${explorationResults.integration_points.slice(0,3).join(', ')}`
225
+ ```
226
+
227
+ Launch 3 parallel CLI calls (`run_in_background: true` each), one per perspective:
228
+
229
+ | Perspective | Tool | PURPOSE | Key TASK bullets | EXPECTED | CONSTRAINTS |
230
+ |-------------|------|---------|-----------------|----------|-------------|
231
+ | Creative | gemini | Generate innovative ideas | Challenge assumptions, cross-domain inspiration, moonshot + practical ideas | 5+ creative ideas with novelty/impact ratings | structured mode: keep feasible |
232
+ | Pragmatic | codex | Implementation reality | Evaluate feasibility, estimate complexity, identify blockers, incremental approach | 3-5 practical approaches with effort/risk ratings | Current tech stack |
233
+ | Systematic | claude | Architectural thinking | Decompose problems, identify patterns, map dependencies, scalability | Problem decomposition, 2-3 approaches with tradeoffs | Existing architecture |
234
+
235
+ ```javascript
236
+ // Each perspective uses this prompt structure (launch all 3 in parallel):
237
+ Bash({
238
+ command: `ccw cli -p "
239
+ PURPOSE: ${perspective} brainstorming for '${idea_or_topic}' - ${purposeFocus}
240
+ Success: ${expected}
241
+
242
+ ${explorationContext}
243
+
244
+ TASK:
245
+ • Build on explored ${contextType} - how to ${actionVerb}?
246
+ ${perspectiveSpecificBullets}
247
+
248
+ MODE: analysis
249
+ CONTEXT: @**/* | Topic: ${idea_or_topic}
250
+ EXPECTED: ${expected}
251
+ CONSTRAINTS: ${constraints}
252
+ " --tool ${tool} --mode analysis`,
253
+ run_in_background: true
254
+ })
255
+ // ⚠️ STOP POINT: Wait for hook callback to receive all results before continuing
256
+ ```
257
+
258
+ 3. **Aggregate Multi-Perspective Findings**
259
+ - Convergent themes (all agree), conflicting views (need resolution), unique contributions
260
+ - Write to perspectives.json
261
+
262
+ 4. **Update brainstorm.md** with Round 2 multi-perspective exploration and synthesis
263
+
264
+ ### Phase 3: Interactive Refinement
265
+
266
+ **Guideline**: Delegate complex tasks to agents (cli-explore-agent, code-developer, universal-executor) or CLI calls. Avoid direct analysis/execution in main process.
267
+
268
+ 1. **Present Current State**: Extract top ideas from perspectives.json with title, source, description, novelty/feasibility ratings
269
+
270
+ 2. **Gather User Direction** (AskUserQuestion)
271
+ - **Q1**: Which ideas to explore (multi-select from top ideas)
272
+ - **Q2**: Next step (single-select):
273
+ - **深入探索**: Deep dive on selected ideas
274
+ - **继续发散**: Generate more ideas
275
+ - **挑战验证**: Devil's advocate challenge
276
+ - **合并综合**: Merge multiple ideas
277
+ - **准备收敛**: Begin convergence (exit loop)
278
+
279
+ 3. **Execute User-Selected Action**
280
+
281
+ | Action | Tool | Output | Key Tasks |
282
+ |--------|------|--------|-----------|
283
+ | Deep Dive | Gemini CLI | ideas/{slug}.md | Elaborate concept, requirements, challenges, POC approach, metrics, dependencies |
284
+ | Generate More | Selected CLI | Updated perspectives.json | New angles from unexplored vectors |
285
+ | Challenge | Codex CLI | Challenge results | 3 objections per idea, challenge assumptions, failure scenarios, survivability (1-5) |
286
+ | Merge | Gemini CLI | ideas/merged-{slug}.md | Complementary elements, resolve contradictions, unified concept |
287
+
288
+ **Deep Dive CLI Call**:
289
+ ```javascript
290
+ Bash({
291
+ command: `ccw cli -p "
292
+ PURPOSE: Deep dive analysis on idea '${idea.title}'
293
+ Success: Comprehensive understanding with actionable next steps
294
+
295
+ TASK:
296
+ • Elaborate the core concept in detail
297
+ • Identify implementation requirements
298
+ • List potential challenges and mitigations
299
+ • Suggest proof-of-concept approach
300
+ • Define success metrics
301
+ • Map related/dependent features
302
+
303
+ MODE: analysis
304
+ CONTEXT: @**/*
305
+ Original idea: ${idea.description}
306
+ Source perspective: ${idea.source}
307
+
308
+ EXPECTED: Detailed concept, technical requirements, risk matrix, MVP definition, success criteria, recommendation (pursue/pivot/park)
309
+ CONSTRAINTS: Focus on actionability
310
+ " --tool gemini --mode analysis`,
311
+ run_in_background: false
312
+ })
313
+ ```
314
+
315
+ **Devil's Advocate CLI Call**:
316
+ ```javascript
317
+ Bash({
318
+ command: `ccw cli -p "
319
+ PURPOSE: Devil's advocate - rigorously challenge these brainstorm ideas
320
+ Success: Uncover hidden weaknesses and strengthen viable ideas
321
+
322
+ IDEAS TO CHALLENGE:
323
+ ${ideas.map((idea, i) => `${i+1}. ${idea.title}: ${idea.brief}`).join('\n')}
324
+
325
+ TASK:
326
+ • For each idea, identify 3 strongest objections
327
+ • Challenge core assumptions
328
+ • Identify scenarios where this fails
329
+ • Consider competitive/alternative solutions
330
+ • Rate survivability after challenge (1-5)
331
+
332
+ MODE: analysis
333
+ EXPECTED: Per-idea challenge report, critical weaknesses, survivability ratings, modified/strengthened versions
334
+ CONSTRAINTS: Be genuinely critical, not just contrarian
335
+ " --tool codex --mode analysis`,
336
+ run_in_background: false
337
+ })
338
+ ```
339
+
340
+ **Merge Ideas CLI Call**:
341
+ ```javascript
342
+ Bash({
343
+ command: `ccw cli -p "
344
+ PURPOSE: Synthesize multiple ideas into unified concept
345
+ Success: Coherent merged idea that captures best elements
346
+
347
+ IDEAS TO MERGE:
348
+ ${selectedIdeas.map((idea, i) => `
349
+ ${i+1}. ${idea.title} (${idea.source})
350
+ ${idea.description}
351
+ Strengths: ${idea.strengths.join(', ')}
352
+ `).join('\n')}
353
+
354
+ TASK:
355
+ • Identify complementary elements
356
+ • Resolve contradictions
357
+ • Create unified concept preserving key strengths
358
+ • Assess viability of merged idea
359
+
360
+ MODE: analysis
361
+ EXPECTED: Merged concept, elements from each source, contradictions resolved, implementation considerations
362
+ CONSTRAINTS: Don't force incompatible ideas together
363
+ " --tool gemini --mode analysis`,
364
+ run_in_background: false
365
+ })
366
+ ```
367
+
368
+ 4. **Update brainstorm.md** with Round N findings
369
+ 5. **Repeat or Converge**: Continue loop (max 6 rounds) or exit to Phase 4
370
+
371
+ **TodoWrite**: Update `phase-2` → `"completed"` (after first round enters Phase 3), `phase-3` → `"in_progress"`
372
+ **TodoWrite** (on exit loop): Update `phase-3` → `"completed"`, `phase-4` → `"in_progress"`
373
+
374
+ ### Phase 4: Convergence & Crystallization
375
+
376
+ 1. **Generate Final Synthesis** → Write to synthesis.json
377
+ - **Top ideas**: Filter active, sort by score, top 5 with title, description, source_perspective, score, novelty, feasibility, strengths, challenges, next_steps
378
+ - **Parked ideas**: With reason and future trigger
379
+ - **Key insights**: Process discoveries, challenged assumptions, unexpected connections
380
+ - **Recommendations**: Primary, alternatives, not recommended
381
+ - **Follow-up**: Implementation/research/validation summaries
382
+
383
+ **synthesis.json Schema**: `session_id`, `topic`, `completed` (timestamp), `total_rounds`, `top_ideas[]`, `parked_ideas[]`, `key_insights[]`, `recommendations` (primary/alternatives/not_recommended), `follow_up[]`
384
+
385
+ 2. **Final brainstorm.md Update**: Executive summary, top ideas ranked, primary recommendation with rationale, alternative approaches, parked ideas, key insights, session statistics (rounds, ideas generated/survived, duration)
386
+
387
+ 3. **MANDATORY GATE: Next Step Selection** — workflow MUST NOT end without executing this step.
388
+
389
+ **TodoWrite**: Update `phase-4` → `"completed"`, `next-step` → `"in_progress"`
390
+
391
+ > **CRITICAL**: This AskUserQuestion is a **terminal gate**. The workflow is INCOMPLETE if this question is not asked. After displaying synthesis (step 2), you MUST immediately proceed here.
392
+
393
+ Call AskUserQuestion (single-select, header: "Next Step"):
394
+ - **创建实施计划** (Recommended if top idea has high feasibility): "基于最佳创意启动 workflow-plan 制定实施计划"
395
+ - **创建Issue**: "将 Top 3 创意转化为 issue 进行跟踪管理"
396
+ - **深入分析**: "对最佳创意启动 analyze-with-file 深入技术分析"
397
+ - **完成**: "头脑风暴已足够,无需进一步操作"
398
+
399
+ **Handle user selection**:
400
+
401
+ **"创建实施计划"** → MUST invoke Skill tool:
402
+ 1. Build `taskDescription` from top idea in synthesis.json (title + description + next_steps)
403
+ 2. Assemble context: `## Prior Brainstorm ({sessionId})` + summary + top idea details + key insights (up to 5)
404
+ 3. **Invoke Skill tool immediately**:
405
+ ```javascript
406
+ Skill({ skill: "workflow-plan", args: `${taskDescription}\n\n${contextLines}` })
407
+ ```
408
+ If Skill invocation is omitted, the workflow is BROKEN.
409
+ 4. After Skill invocation, brainstorm-with-file is complete
410
+
411
+ **"创建Issue"** → Convert top ideas to issues:
412
+ 1. For each idea in synthesis.top_ideas (top 3):
413
+ - Build issue JSON: `{title: idea.title, context: idea.description + '\n' + idea.next_steps.join('\n'), priority: idea.score >= 8 ? 2 : 3, source: 'brainstorm', labels: dimensions}`
414
+ - Create via: `Skill({ skill: "issue:from-brainstorm", args: "${sessionFolder}/synthesis.json" })`
415
+ 2. Display created issue IDs
416
+
417
+ **"深入分析"** → Launch analysis on top idea:
418
+ 1. Build analysis topic from top idea title + description
419
+ 2. **Invoke Skill tool immediately**:
420
+ ```javascript
421
+ Skill({ skill: "workflow:analyze-with-file", args: `${topIdea.title}: ${topIdea.description}` })
422
+ ```
423
+
424
+ **"完成"** → No further action needed.
425
+
426
+ **TodoWrite**: Update `next-step` → `"completed"` after user selection is handled
427
+
428
+ ## Configuration
429
+
430
+ ### Brainstorm Dimensions
431
+
432
+ | Dimension | Keywords |
433
+ |-----------|----------|
434
+ | technical | 技术, technical, implementation, code, 实现, architecture |
435
+ | ux | 用户, user, experience, UX, UI, 体验, interaction |
436
+ | business | 业务, business, value, ROI, 价值, market |
437
+ | innovation | 创新, innovation, novel, creative, 新颖 |
438
+ | feasibility | 可行, feasible, practical, realistic, 实际 |
439
+ | scalability | 扩展, scale, growth, performance, 性能 |
440
+ | security | 安全, security, risk, protection, 风险 |
441
+
442
+ ### Role Selection
443
+
444
+ **Professional Roles**:
445
+
446
+ | Role | CLI Tool | Focus Area | Keywords |
447
+ |------|----------|------------|----------|
448
+ | system-architect | Claude | Architecture, patterns | 架构, architecture, system, 系统, design pattern |
449
+ | product-manager | Gemini | Business value, roadmap | 产品, product, feature, 功能, roadmap |
450
+ | ui-designer | Gemini | Visual design, interaction | UI, 界面, interface, visual, 视觉 |
451
+ | ux-expert | Codex | User research, usability | UX, 体验, experience, user, 用户 |
452
+ | data-architect | Claude | Data modeling, storage | 数据, data, database, 存储, storage |
453
+ | test-strategist | Codex | Quality, testing | 测试, test, quality, 质量, QA |
454
+ | subject-matter-expert | Gemini | Domain knowledge | 领域, domain, industry, 行业, expert |
455
+ | product-owner | Codex | Priority, scope | 优先, priority, scope, 范围, backlog |
456
+ | scrum-master | Gemini | Process, collaboration | 敏捷, agile, scrum, sprint, 迭代 |
457
+
458
+ **Simple Perspectives** (fallback):
459
+
460
+ | Perspective | CLI Tool | Focus |
461
+ |-------------|----------|-------|
462
+ | creative | Gemini | Innovation, cross-domain |
463
+ | pragmatic | Codex | Implementation, feasibility |
464
+ | systematic | Claude | Architecture, structure |
465
+
466
+ **Selection Strategy**: Auto mode → top 3 professional roles | Manual mode → recommended roles + "Use simple perspectives" option | Continue mode → roles from previous session
467
+
468
+ ## Error Handling
469
+
470
+ | Error | Resolution |
471
+ |-------|------------|
472
+ | cli-explore-agent fails | Continue with empty exploration context |
473
+ | CLI timeout | Retry with shorter prompt, or skip perspective |
474
+ | No good ideas | Reframe problem, adjust constraints, try new angles |
475
+ | User disengaged | Summarize progress, offer break point with resume |
476
+ | Perspectives conflict | Present as tradeoff, let user decide |
477
+ | Max rounds reached | Force synthesis, highlight unresolved questions |
478
+ | All ideas fail challenge | Return to divergent phase with new constraints |
479
+
480
+ ---
481
+
482
+ **Now execute brainstorm-with-file for**: $ARGUMENTS