claude-code-workflow 6.3.42 → 6.3.44

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 (87) hide show
  1. package/.claude/agents/tdd-developer.md +530 -0
  2. package/.claude/commands/issue/discover-by-prompt.md +5 -1
  3. package/.claude/commands/issue/discover.md +472 -468
  4. package/.claude/commands/issue/execute.md +580 -581
  5. package/.claude/commands/issue/new.md +417 -413
  6. package/.claude/commands/issue/plan.md +11 -13
  7. package/.claude/commands/issue/queue.md +445 -441
  8. package/.claude/commands/task/breakdown.md +207 -203
  9. package/.claude/commands/task/replan.md +440 -436
  10. package/.claude/commands/workflow/action-plan-verify.md +485 -447
  11. package/.claude/commands/workflow/brainstorm/artifacts.md +457 -453
  12. package/.claude/commands/workflow/brainstorm/auto-parallel.md +5 -1
  13. package/.claude/commands/workflow/brainstorm/synthesis.md +402 -398
  14. package/.claude/commands/workflow/clean.md +67 -35
  15. package/.claude/commands/workflow/debug-with-file.md +670 -666
  16. package/.claude/commands/workflow/debug.md +331 -327
  17. package/.claude/commands/workflow/develop-with-file.md +5 -1
  18. package/.claude/commands/workflow/execute.md +546 -498
  19. package/.claude/commands/workflow/lite-execute.md +44 -26
  20. package/.claude/commands/workflow/lite-fix.md +780 -730
  21. package/.claude/commands/workflow/lite-lite-lite.md +5 -1
  22. package/.claude/commands/workflow/lite-plan.md +87 -39
  23. package/.claude/commands/workflow/multi-cli-plan.md +572 -568
  24. package/.claude/commands/workflow/plan-verify.md +527 -0
  25. package/.claude/commands/workflow/plan.md +555 -551
  26. package/.claude/commands/workflow/replan.md +572 -515
  27. package/.claude/commands/workflow/review-fix.md +608 -610
  28. package/.claude/commands/workflow/session/complete.md +37 -14
  29. package/.claude/commands/workflow/session/solidify.md +303 -299
  30. package/.claude/commands/workflow/tdd-plan.md +630 -597
  31. package/.claude/commands/workflow/tdd-verify.md +391 -206
  32. package/.claude/commands/workflow/tools/conflict-resolution.md +24 -12
  33. package/.claude/commands/workflow/tools/task-generate-agent.md +583 -563
  34. package/.claude/commands/workflow/tools/task-generate-tdd.md +749 -517
  35. package/.claude/commands/workflow/ui-design/animation-extract.md +1154 -1150
  36. package/.claude/commands/workflow/ui-design/layout-extract.md +792 -788
  37. package/.claude/commands/workflow/ui-design/style-extract.md +777 -773
  38. package/.claude/skills/ccw/command.json +4 -4
  39. package/.claude/skills/ccw-coordinator/README.md +45 -0
  40. package/.claude/skills/ccw-coordinator/SKILL.md +320 -0
  41. package/.claude/skills/ccw-coordinator/phases/actions/action-abort.md +9 -0
  42. package/.claude/skills/ccw-coordinator/phases/actions/action-command-build.md +40 -0
  43. package/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md +124 -0
  44. package/.claude/skills/ccw-coordinator/phases/actions/action-command-selection.md +48 -0
  45. package/.claude/skills/ccw-coordinator/phases/actions/action-complete.md +25 -0
  46. package/.claude/skills/ccw-coordinator/phases/actions/action-init.md +26 -0
  47. package/.claude/skills/ccw-coordinator/phases/orchestrator.md +59 -0
  48. package/.claude/skills/ccw-coordinator/phases/state-schema.md +66 -0
  49. package/.claude/skills/ccw-coordinator/skill-config.json +66 -0
  50. package/.claude/skills/ccw-coordinator/specs/command-library.md +169 -0
  51. package/.claude/skills/ccw-coordinator/specs/specs.md +362 -0
  52. package/.claude/skills/ccw-coordinator/tools/README.md +95 -0
  53. package/.claude/skills/ccw-coordinator/tools/chain-validate.cjs +320 -0
  54. package/.claude/skills/ccw-coordinator/tools/command-registry.cjs +255 -0
  55. package/.claude/skills/ccw-help/command.json +5 -5
  56. package/.claude/skills/ccw-help/scripts/analyze_commands.py +337 -337
  57. package/.claude/workflows/cli-templates/prompts/workflow-impl-plan-template.txt +1 -1
  58. package/.codex/skills/parallel-dev-cycle/README.md +19 -16
  59. package/.codex/skills/parallel-dev-cycle/phases/agents/code-developer.md +90 -5
  60. package/.codex/skills/parallel-dev-cycle/phases/agents/requirements-analyst.md +89 -4
  61. package/.codex/skills/parallel-dev-cycle/phases/orchestrator.md +696 -696
  62. package/.codex/skills/parallel-dev-cycle/phases/state-schema.md +436 -436
  63. package/.codex/skills/parallel-dev-cycle/skill.md +194 -0
  64. package/.codex/skills/parallel-dev-cycle/specs/communication-optimization.md +423 -423
  65. package/.codex/skills/parallel-dev-cycle/specs/coordination-protocol.md +31 -16
  66. package/.codex/skills/parallel-dev-cycle/specs/versioning-strategy.md +74 -73
  67. package/ccw/dist/commands/issue.d.ts +4 -0
  68. package/ccw/dist/commands/issue.d.ts.map +1 -1
  69. package/ccw/dist/commands/issue.js +73 -6
  70. package/ccw/dist/commands/issue.js.map +1 -1
  71. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  72. package/ccw/dist/core/routes/cli-routes.js +32 -28
  73. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  74. package/ccw/dist/tools/claude-cli-tools.d.ts +10 -0
  75. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  76. package/ccw/dist/tools/claude-cli-tools.js +45 -0
  77. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  78. package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
  79. package/ccw/dist/tools/codex-lens.js +38 -11
  80. package/ccw/dist/tools/codex-lens.js.map +1 -1
  81. package/ccw/src/commands/issue.ts +84 -6
  82. package/ccw/src/core/routes/cli-routes.ts +30 -25
  83. package/ccw/src/templates/dashboard-js/views/help.js +1 -1
  84. package/ccw/src/tools/claude-cli-tools.ts +50 -0
  85. package/ccw/src/tools/codex-lens.ts +40 -11
  86. package/package.json +1 -1
  87. package/.codex/skills/parallel-dev-cycle/SKILL.md +0 -513
@@ -1,398 +1,402 @@
1
- ---
2
- name: synthesis
3
- description: Clarify and refine role analyses through intelligent Q&A and targeted updates with synthesis agent
4
- argument-hint: "[optional: --session session-id]"
5
- allowed-tools: Task(conceptual-planning-agent), TodoWrite(*), Read(*), Write(*), Edit(*), Glob(*), AskUserQuestion(*)
6
- ---
7
-
8
- ## Overview
9
-
10
- Six-phase workflow to eliminate ambiguities and enhance conceptual depth in role analyses:
11
-
12
- **Phase 1-2**: Session detection → File discovery → Path preparation
13
- **Phase 3A**: Cross-role analysis agent → Generate recommendations
14
- **Phase 4**: User selects enhancements User answers clarifications (via AskUserQuestion)
15
- **Phase 5**: Parallel update agents (one per role)
16
- **Phase 6**: Context package update Metadata updateCompletion report
17
-
18
- All user interactions use AskUserQuestion tool (max 4 questions per call, multi-round).
19
-
20
- **Document Flow**:
21
- - Input: `[role]/analysis*.md`, `guidance-specification.md`, session metadata
22
- - Output: Updated `[role]/analysis*.md` with Enhancements + Clarifications sections
23
-
24
- ---
25
-
26
- ## Quick Reference
27
-
28
- ### Phase Summary
29
-
30
- | Phase | Goal | Executor | Output |
31
- |-------|------|----------|--------|
32
- | 1 | Session detection | Main flow | session_id, brainstorm_dir |
33
- | 2 | File discovery | Main flow | role_analysis_paths |
34
- | 3A | Cross-role analysis | Agent | enhancement_recommendations |
35
- | 4 | User interaction | Main flow + AskUserQuestion | update_plan |
36
- | 5 | Document updates | Parallel agents | Updated analysis*.md |
37
- | 6 | Finalization | Main flow | context-package.json, report |
38
-
39
- ### AskUserQuestion Pattern
40
-
41
- ```javascript
42
- // Enhancement selection (multi-select)
43
- AskUserQuestion({
44
- questions: [{
45
- question: "请选择要应用的改进建议",
46
- header: "改进选择",
47
- multiSelect: true,
48
- options: [
49
- { label: "EP-001: API Contract", description: "添加详细的请求/响应 schema 定义" },
50
- { label: "EP-002: User Intent", description: "明确用户需求优先级和验收标准" }
51
- ]
52
- }]
53
- })
54
-
55
- // Clarification questions (single-select, multi-round)
56
- AskUserQuestion({
57
- questions: [
58
- {
59
- question: "MVP 阶段的核心目标是什么?",
60
- header: "用户意图",
61
- multiSelect: false,
62
- options: [
63
- { label: "快速验证", description: "最小功能集,快速上线获取反馈" },
64
- { label: "技术壁垒", description: "完善架构,为长期发展打基础" },
65
- { label: "功能完整", description: "覆盖所有规划功能,延迟上线" }
66
- ]
67
- }
68
- ]
69
- })
70
- ```
71
-
72
- ---
73
-
74
- ## Task Tracking
75
-
76
- ```json
77
- [
78
- {"content": "Detect session and validate analyses", "status": "pending", "activeForm": "Detecting session"},
79
- {"content": "Discover role analysis file paths", "status": "pending", "activeForm": "Discovering paths"},
80
- {"content": "Execute analysis agent (cross-role analysis)", "status": "pending", "activeForm": "Executing analysis"},
81
- {"content": "Present enhancements via AskUserQuestion", "status": "pending", "activeForm": "Selecting enhancements"},
82
- {"content": "Clarification questions via AskUserQuestion", "status": "pending", "activeForm": "Clarifying"},
83
- {"content": "Execute parallel update agents", "status": "pending", "activeForm": "Updating documents"},
84
- {"content": "Update context package and metadata", "status": "pending", "activeForm": "Finalizing"}
85
- ]
86
- ```
87
-
88
- ---
89
-
90
- ## Execution Phases
91
-
92
- ### Phase 1: Discovery & Validation
93
-
94
- 1. **Detect Session**: Use `--session` parameter or find `.workflow/active/WFS-*`
95
- 2. **Validate Files**:
96
- - `guidance-specification.md` (optional, warn if missing)
97
- - `*/analysis*.md` (required, error if empty)
98
- 3. **Load User Intent**: Extract from `workflow-session.json`
99
-
100
- ### Phase 2: Role Discovery & Path Preparation
101
-
102
- **Main flow prepares file paths for Agent**:
103
-
104
- 1. **Discover Analysis Files**:
105
- - Glob: `.workflow/active/WFS-{session}/.brainstorming/*/analysis*.md`
106
- - Supports: analysis.md + analysis-{slug}.md (max 5)
107
-
108
- 2. **Extract Role Information**:
109
- - `role_analysis_paths`: Relative paths
110
- - `participating_roles`: Role names from directories
111
-
112
- 3. **Pass to Agent**: session_id, brainstorm_dir, role_analysis_paths, participating_roles
113
-
114
- ### Phase 3A: Analysis & Enhancement Agent
115
-
116
- **Agent executes cross-role analysis**:
117
-
118
- ```javascript
119
- Task(conceptual-planning-agent, `
120
- ## Agent Mission
121
- Analyze role documents, identify conflicts/gaps, generate enhancement recommendations
122
-
123
- ## Input
124
- - brainstorm_dir: ${brainstorm_dir}
125
- - role_analysis_paths: ${role_analysis_paths}
126
- - participating_roles: ${participating_roles}
127
-
128
- ## Flow Control Steps
129
- 1. load_session_metadata → Read workflow-session.json
130
- 2. load_role_analyses → Read all analysis files
131
- 3. cross_role_analysis → Identify consensus, conflicts, gaps, ambiguities
132
- 4. generate_recommendations Format as EP-001, EP-002, ...
133
-
134
- ## Output Format
135
- [
136
- {
137
- "id": "EP-001",
138
- "title": "API Contract Specification",
139
- "affected_roles": ["system-architect", "api-designer"],
140
- "category": "Architecture",
141
- "current_state": "High-level API descriptions",
142
- "enhancement": "Add detailed contract definitions",
143
- "rationale": "Enables precise implementation",
144
- "priority": "High"
145
- }
146
- ]
147
- `)
148
- ```
149
-
150
- ### Phase 4: User Interaction
151
-
152
- **All interactions via AskUserQuestion (Chinese questions)**
153
-
154
- #### Step 1: Enhancement Selection
155
-
156
- ```javascript
157
- // If enhancements > 4, split into multiple rounds
158
- const enhancements = [...]; // from Phase 3A
159
- const BATCH_SIZE = 4;
160
-
161
- for (let i = 0; i < enhancements.length; i += BATCH_SIZE) {
162
- const batch = enhancements.slice(i, i + BATCH_SIZE);
163
-
164
- AskUserQuestion({
165
- questions: [{
166
- question: `请选择要应用的改进建议 (第${Math.floor(i/BATCH_SIZE)+1}轮)`,
167
- header: "改进选择",
168
- multiSelect: true,
169
- options: batch.map(ep => ({
170
- label: `${ep.id}: ${ep.title}`,
171
- description: `影响: ${ep.affected_roles.join(', ')} | ${ep.enhancement}`
172
- }))
173
- }]
174
- })
175
-
176
- // Store selections before next round
177
- }
178
-
179
- // User can also skip: provide "跳过" option
180
- ```
181
-
182
- #### Step 2: Clarification Questions
183
-
184
- ```javascript
185
- // Generate questions based on 9-category taxonomy scan
186
- // Categories: User Intent, Requirements, Architecture, UX, Feasibility, Risk, Process, Decisions, Terminology
187
-
188
- const clarifications = [...]; // from analysis
189
- const BATCH_SIZE = 4;
190
-
191
- for (let i = 0; i < clarifications.length; i += BATCH_SIZE) {
192
- const batch = clarifications.slice(i, i + BATCH_SIZE);
193
- const currentRound = Math.floor(i / BATCH_SIZE) + 1;
194
- const totalRounds = Math.ceil(clarifications.length / BATCH_SIZE);
195
-
196
- AskUserQuestion({
197
- questions: batch.map(q => ({
198
- question: q.question,
199
- header: q.category.substring(0, 12),
200
- multiSelect: false,
201
- options: q.options.map(opt => ({
202
- label: opt.label,
203
- description: opt.description
204
- }))
205
- }))
206
- })
207
-
208
- // Store answers before next round
209
- }
210
- ```
211
-
212
- ### Question Guidelines
213
-
214
- **Target**: 开发者(理解技术但需要从用户需求出发)
215
-
216
- **Question Structure**: `[跨角色分析发现] + [需要澄清的决策点]`
217
- **Option Structure**: `标签:[具体方案] + 说明:[业务影响] + [技术权衡]`
218
-
219
- **9-Category Taxonomy**:
220
-
221
- | Category | Focus | Example Question Pattern |
222
- |----------|-------|--------------------------|
223
- | User Intent | 用户目标 | "MVP阶段核心目标?" + 验证/壁垒/完整性 |
224
- | Requirements | 需求细化 | "功能优先级如何排序?" + 核心/增强/可选 |
225
- | Architecture | 架构决策 | "技术栈选择考量?" + 熟悉度/先进性/成熟度 |
226
- | UX | 用户体验 | "交互复杂度取舍?" + 简洁/丰富/渐进 |
227
- | Feasibility | 可行性 | "资源约束下的范围?" + 最小/标准/完整 |
228
- | Risk | 风险管理 | "风险容忍度?" + 保守/平衡/激进 |
229
- | Process | 流程规范 | "迭代节奏?" + 快速/稳定/灵活 |
230
- | Decisions | 决策确认 | "冲突解决方案?" + 方案A/方案B/折中 |
231
- | Terminology | 术语统一 | "统一使用哪个术语?" + 术语A/术语B |
232
-
233
- **Quality Rules**:
234
-
235
- **MUST Include**:
236
- - ✅ All questions in Chinese (用中文提问)
237
- - ✅ 基于跨角色分析的具体发现
238
- - ✅ 选项包含业务影响说明
239
- - ✅ 解决实际的模糊点或冲突
240
-
241
- **MUST Avoid**:
242
- - 与角色分析无关的通用问题
243
- - 重复已在 artifacts 阶段确认的内容
244
- - ❌ 过于细节的实现级问题
245
-
246
- #### Step 3: Build Update Plan
247
-
248
- ```javascript
249
- update_plan = {
250
- "role1": {
251
- "enhancements": ["EP-001", "EP-003"],
252
- "clarifications": [
253
- {"question": "...", "answer": "...", "category": "..."}
254
- ]
255
- },
256
- "role2": {
257
- "enhancements": ["EP-002"],
258
- "clarifications": [...]
259
- }
260
- }
261
- ```
262
-
263
- ### Phase 5: Parallel Document Update Agents
264
-
265
- **Execute in parallel** (one agent per role):
266
-
267
- ```javascript
268
- // Single message with multiple Task calls for parallelism
269
- Task(conceptual-planning-agent, `
270
- ## Agent Mission
271
- Apply enhancements and clarifications to ${role} analysis
272
-
273
- ## Input
274
- - role: ${role}
275
- - analysis_path: ${brainstorm_dir}/${role}/analysis.md
276
- - enhancements: ${role_enhancements}
277
- - clarifications: ${role_clarifications}
278
- - original_user_intent: ${intent}
279
-
280
- ## Flow Control Steps
281
- 1. load_current_analysis → Read analysis file
282
- 2. add_clarifications_section → Insert Q&A section
283
- 3. apply_enhancements → Integrate into relevant sections
284
- 4. resolve_contradictions Remove conflicts
285
- 5. enforce_terminologyAlign terminology
286
- 6. validate_intentVerify alignment with user intent
287
- 7. write_updated_fileSave changes
288
-
289
- ## Output
290
- Updated ${role}/analysis.md
291
- `)
292
- ```
293
-
294
- **Agent Characteristics**:
295
- - **Isolation**: Each agent updates exactly ONE role (parallel safe)
296
- - **Dependencies**: Zero cross-agent dependencies
297
- - **Validation**: All updates must align with original_user_intent
298
-
299
- ### Phase 6: Finalization
300
-
301
- #### Step 1: Update Context Package
302
-
303
- ```javascript
304
- // Sync updated analyses to context-package.json
305
- const context_pkg = Read(".workflow/active/WFS-{session}/.process/context-package.json")
306
-
307
- // Update guidance-specification if exists
308
- // Update synthesis-specification if exists
309
- // Re-read all role analysis files
310
- // Update metadata timestamps
311
-
312
- Write(context_pkg_path, JSON.stringify(context_pkg))
313
- ```
314
-
315
- #### Step 2: Update Session Metadata
316
-
317
- ```json
318
- {
319
- "phases": {
320
- "BRAINSTORM": {
321
- "status": "clarification_completed",
322
- "clarification_completed": true,
323
- "completed_at": "timestamp",
324
- "participating_roles": [...],
325
- "clarification_results": {
326
- "enhancements_applied": ["EP-001", "EP-002"],
327
- "questions_asked": 3,
328
- "categories_clarified": ["Architecture", "UX"],
329
- "roles_updated": ["role1", "role2"]
330
- },
331
- "quality_metrics": {
332
- "user_intent_alignment": "validated",
333
- "ambiguity_resolution": "complete",
334
- "terminology_consistency": "enforced"
335
- }
336
- }
337
- }
338
- }
339
- ```
340
-
341
- #### Step 3: Completion Report
342
-
343
- ```markdown
344
- ## ✅ Clarification Complete
345
-
346
- **Enhancements Applied**: EP-001, EP-002, EP-003
347
- **Questions Answered**: 3/5
348
- **Roles Updated**: role1, role2, role3
349
-
350
- ### Next Steps
351
- PROCEED: `/workflow:plan --session WFS-{session-id}`
352
- ```
353
-
354
- ---
355
-
356
- ## Output
357
-
358
- **Location**: `.workflow/active/WFS-{session}/.brainstorming/[role]/analysis*.md`
359
-
360
- **Updated Structure**:
361
- ```markdown
362
- ## Clarifications
363
- ### Session {date}
364
- - **Q**: {question} (Category: {category})
365
- **A**: {answer}
366
-
367
- ## {Existing Sections}
368
- {Refined content based on clarifications}
369
- ```
370
-
371
- **Changes**:
372
- - User intent validated/corrected
373
- - Requirements more specific/measurable
374
- - Architecture with rationale
375
- - Ambiguities resolved, placeholders removed
376
- - Consistent terminology
377
-
378
- ---
379
-
380
- ## Quality Checklist
381
-
382
- **Content**:
383
- - ✅ All role analyses loaded/analyzed
384
- - Cross-role analysis (consensus, conflicts, gaps)
385
- - ✅ 9-category ambiguity scan
386
- - ✅ Questions prioritized
387
-
388
- **Analysis**:
389
- - ✅ User intent validated
390
- - ✅ Cross-role synthesis complete
391
- - ✅ Ambiguities resolved
392
- - ✅ Terminology consistent
393
-
394
- **Documents**:
395
- - ✅ Clarifications section formatted
396
- - ✅ Sections reflect answers
397
- - ✅ No placeholders (TODO/TBD)
398
- - ✅ Valid Markdown
1
+ ---
2
+ name: synthesis
3
+ description: Clarify and refine role analyses through intelligent Q&A and targeted updates with synthesis agent
4
+ argument-hint: "[-y|--yes] [optional: --session session-id]"
5
+ allowed-tools: Task(conceptual-planning-agent), TodoWrite(*), Read(*), Write(*), Edit(*), Glob(*), AskUserQuestion(*)
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-select all enhancements, skip clarification questions, use default answers.
11
+
12
+ ## Overview
13
+
14
+ Six-phase workflow to eliminate ambiguities and enhance conceptual depth in role analyses:
15
+
16
+ **Phase 1-2**: Session detectionFile discoveryPath preparation
17
+ **Phase 3A**: Cross-role analysis agent → Generate recommendations
18
+ **Phase 4**: User selects enhancements User answers clarifications (via AskUserQuestion)
19
+ **Phase 5**: Parallel update agents (one per role)
20
+ **Phase 6**: Context package update → Metadata update → Completion report
21
+
22
+ All user interactions use AskUserQuestion tool (max 4 questions per call, multi-round).
23
+
24
+ **Document Flow**:
25
+ - Input: `[role]/analysis*.md`, `guidance-specification.md`, session metadata
26
+ - Output: Updated `[role]/analysis*.md` with Enhancements + Clarifications sections
27
+
28
+ ---
29
+
30
+ ## Quick Reference
31
+
32
+ ### Phase Summary
33
+
34
+ | Phase | Goal | Executor | Output |
35
+ |-------|------|----------|--------|
36
+ | 1 | Session detection | Main flow | session_id, brainstorm_dir |
37
+ | 2 | File discovery | Main flow | role_analysis_paths |
38
+ | 3A | Cross-role analysis | Agent | enhancement_recommendations |
39
+ | 4 | User interaction | Main flow + AskUserQuestion | update_plan |
40
+ | 5 | Document updates | Parallel agents | Updated analysis*.md |
41
+ | 6 | Finalization | Main flow | context-package.json, report |
42
+
43
+ ### AskUserQuestion Pattern
44
+
45
+ ```javascript
46
+ // Enhancement selection (multi-select)
47
+ AskUserQuestion({
48
+ questions: [{
49
+ question: "请选择要应用的改进建议",
50
+ header: "改进选择",
51
+ multiSelect: true,
52
+ options: [
53
+ { label: "EP-001: API Contract", description: "添加详细的请求/响应 schema 定义" },
54
+ { label: "EP-002: User Intent", description: "明确用户需求优先级和验收标准" }
55
+ ]
56
+ }]
57
+ })
58
+
59
+ // Clarification questions (single-select, multi-round)
60
+ AskUserQuestion({
61
+ questions: [
62
+ {
63
+ question: "MVP 阶段的核心目标是什么?",
64
+ header: "用户意图",
65
+ multiSelect: false,
66
+ options: [
67
+ { label: "快速验证", description: "最小功能集,快速上线获取反馈" },
68
+ { label: "技术壁垒", description: "完善架构,为长期发展打基础" },
69
+ { label: "功能完整", description: "覆盖所有规划功能,延迟上线" }
70
+ ]
71
+ }
72
+ ]
73
+ })
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Task Tracking
79
+
80
+ ```json
81
+ [
82
+ {"content": "Detect session and validate analyses", "status": "pending", "activeForm": "Detecting session"},
83
+ {"content": "Discover role analysis file paths", "status": "pending", "activeForm": "Discovering paths"},
84
+ {"content": "Execute analysis agent (cross-role analysis)", "status": "pending", "activeForm": "Executing analysis"},
85
+ {"content": "Present enhancements via AskUserQuestion", "status": "pending", "activeForm": "Selecting enhancements"},
86
+ {"content": "Clarification questions via AskUserQuestion", "status": "pending", "activeForm": "Clarifying"},
87
+ {"content": "Execute parallel update agents", "status": "pending", "activeForm": "Updating documents"},
88
+ {"content": "Update context package and metadata", "status": "pending", "activeForm": "Finalizing"}
89
+ ]
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Execution Phases
95
+
96
+ ### Phase 1: Discovery & Validation
97
+
98
+ 1. **Detect Session**: Use `--session` parameter or find `.workflow/active/WFS-*`
99
+ 2. **Validate Files**:
100
+ - `guidance-specification.md` (optional, warn if missing)
101
+ - `*/analysis*.md` (required, error if empty)
102
+ 3. **Load User Intent**: Extract from `workflow-session.json`
103
+
104
+ ### Phase 2: Role Discovery & Path Preparation
105
+
106
+ **Main flow prepares file paths for Agent**:
107
+
108
+ 1. **Discover Analysis Files**:
109
+ - Glob: `.workflow/active/WFS-{session}/.brainstorming/*/analysis*.md`
110
+ - Supports: analysis.md + analysis-{slug}.md (max 5)
111
+
112
+ 2. **Extract Role Information**:
113
+ - `role_analysis_paths`: Relative paths
114
+ - `participating_roles`: Role names from directories
115
+
116
+ 3. **Pass to Agent**: session_id, brainstorm_dir, role_analysis_paths, participating_roles
117
+
118
+ ### Phase 3A: Analysis & Enhancement Agent
119
+
120
+ **Agent executes cross-role analysis**:
121
+
122
+ ```javascript
123
+ Task(conceptual-planning-agent, `
124
+ ## Agent Mission
125
+ Analyze role documents, identify conflicts/gaps, generate enhancement recommendations
126
+
127
+ ## Input
128
+ - brainstorm_dir: ${brainstorm_dir}
129
+ - role_analysis_paths: ${role_analysis_paths}
130
+ - participating_roles: ${participating_roles}
131
+
132
+ ## Flow Control Steps
133
+ 1. load_session_metadata → Read workflow-session.json
134
+ 2. load_role_analyses → Read all analysis files
135
+ 3. cross_role_analysis → Identify consensus, conflicts, gaps, ambiguities
136
+ 4. generate_recommendations → Format as EP-001, EP-002, ...
137
+
138
+ ## Output Format
139
+ [
140
+ {
141
+ "id": "EP-001",
142
+ "title": "API Contract Specification",
143
+ "affected_roles": ["system-architect", "api-designer"],
144
+ "category": "Architecture",
145
+ "current_state": "High-level API descriptions",
146
+ "enhancement": "Add detailed contract definitions",
147
+ "rationale": "Enables precise implementation",
148
+ "priority": "High"
149
+ }
150
+ ]
151
+ `)
152
+ ```
153
+
154
+ ### Phase 4: User Interaction
155
+
156
+ **All interactions via AskUserQuestion (Chinese questions)**
157
+
158
+ #### Step 1: Enhancement Selection
159
+
160
+ ```javascript
161
+ // If enhancements > 4, split into multiple rounds
162
+ const enhancements = [...]; // from Phase 3A
163
+ const BATCH_SIZE = 4;
164
+
165
+ for (let i = 0; i < enhancements.length; i += BATCH_SIZE) {
166
+ const batch = enhancements.slice(i, i + BATCH_SIZE);
167
+
168
+ AskUserQuestion({
169
+ questions: [{
170
+ question: `请选择要应用的改进建议 (第${Math.floor(i/BATCH_SIZE)+1}轮)`,
171
+ header: "改进选择",
172
+ multiSelect: true,
173
+ options: batch.map(ep => ({
174
+ label: `${ep.id}: ${ep.title}`,
175
+ description: `影响: ${ep.affected_roles.join(', ')} | ${ep.enhancement}`
176
+ }))
177
+ }]
178
+ })
179
+
180
+ // Store selections before next round
181
+ }
182
+
183
+ // User can also skip: provide "跳过" option
184
+ ```
185
+
186
+ #### Step 2: Clarification Questions
187
+
188
+ ```javascript
189
+ // Generate questions based on 9-category taxonomy scan
190
+ // Categories: User Intent, Requirements, Architecture, UX, Feasibility, Risk, Process, Decisions, Terminology
191
+
192
+ const clarifications = [...]; // from analysis
193
+ const BATCH_SIZE = 4;
194
+
195
+ for (let i = 0; i < clarifications.length; i += BATCH_SIZE) {
196
+ const batch = clarifications.slice(i, i + BATCH_SIZE);
197
+ const currentRound = Math.floor(i / BATCH_SIZE) + 1;
198
+ const totalRounds = Math.ceil(clarifications.length / BATCH_SIZE);
199
+
200
+ AskUserQuestion({
201
+ questions: batch.map(q => ({
202
+ question: q.question,
203
+ header: q.category.substring(0, 12),
204
+ multiSelect: false,
205
+ options: q.options.map(opt => ({
206
+ label: opt.label,
207
+ description: opt.description
208
+ }))
209
+ }))
210
+ })
211
+
212
+ // Store answers before next round
213
+ }
214
+ ```
215
+
216
+ ### Question Guidelines
217
+
218
+ **Target**: 开发者(理解技术但需要从用户需求出发)
219
+
220
+ **Question Structure**: `[跨角色分析发现] + [需要澄清的决策点]`
221
+ **Option Structure**: `标签:[具体方案] + 说明:[业务影响] + [技术权衡]`
222
+
223
+ **9-Category Taxonomy**:
224
+
225
+ | Category | Focus | Example Question Pattern |
226
+ |----------|-------|--------------------------|
227
+ | User Intent | 用户目标 | "MVP阶段核心目标?" + 验证/壁垒/完整性 |
228
+ | Requirements | 需求细化 | "功能优先级如何排序?" + 核心/增强/可选 |
229
+ | Architecture | 架构决策 | "技术栈选择考量?" + 熟悉度/先进性/成熟度 |
230
+ | UX | 用户体验 | "交互复杂度取舍?" + 简洁/丰富/渐进 |
231
+ | Feasibility | 可行性 | "资源约束下的范围?" + 最小/标准/完整 |
232
+ | Risk | 风险管理 | "风险容忍度?" + 保守/平衡/激进 |
233
+ | Process | 流程规范 | "迭代节奏?" + 快速/稳定/灵活 |
234
+ | Decisions | 决策确认 | "冲突解决方案?" + 方案A/方案B/折中 |
235
+ | Terminology | 术语统一 | "统一使用哪个术语?" + 术语A/术语B |
236
+
237
+ **Quality Rules**:
238
+
239
+ **MUST Include**:
240
+ - ✅ All questions in Chinese (用中文提问)
241
+ - ✅ 基于跨角色分析的具体发现
242
+ - 选项包含业务影响说明
243
+ - 解决实际的模糊点或冲突
244
+
245
+ **MUST Avoid**:
246
+ - 与角色分析无关的通用问题
247
+ - ❌ 重复已在 artifacts 阶段确认的内容
248
+ - ❌ 过于细节的实现级问题
249
+
250
+ #### Step 3: Build Update Plan
251
+
252
+ ```javascript
253
+ update_plan = {
254
+ "role1": {
255
+ "enhancements": ["EP-001", "EP-003"],
256
+ "clarifications": [
257
+ {"question": "...", "answer": "...", "category": "..."}
258
+ ]
259
+ },
260
+ "role2": {
261
+ "enhancements": ["EP-002"],
262
+ "clarifications": [...]
263
+ }
264
+ }
265
+ ```
266
+
267
+ ### Phase 5: Parallel Document Update Agents
268
+
269
+ **Execute in parallel** (one agent per role):
270
+
271
+ ```javascript
272
+ // Single message with multiple Task calls for parallelism
273
+ Task(conceptual-planning-agent, `
274
+ ## Agent Mission
275
+ Apply enhancements and clarifications to ${role} analysis
276
+
277
+ ## Input
278
+ - role: ${role}
279
+ - analysis_path: ${brainstorm_dir}/${role}/analysis.md
280
+ - enhancements: ${role_enhancements}
281
+ - clarifications: ${role_clarifications}
282
+ - original_user_intent: ${intent}
283
+
284
+ ## Flow Control Steps
285
+ 1. load_current_analysisRead analysis file
286
+ 2. add_clarifications_sectionInsert Q&A section
287
+ 3. apply_enhancementsIntegrate into relevant sections
288
+ 4. resolve_contradictions → Remove conflicts
289
+ 5. enforce_terminology → Align terminology
290
+ 6. validate_intent → Verify alignment with user intent
291
+ 7. write_updated_file → Save changes
292
+
293
+ ## Output
294
+ Updated ${role}/analysis.md
295
+ `)
296
+ ```
297
+
298
+ **Agent Characteristics**:
299
+ - **Isolation**: Each agent updates exactly ONE role (parallel safe)
300
+ - **Dependencies**: Zero cross-agent dependencies
301
+ - **Validation**: All updates must align with original_user_intent
302
+
303
+ ### Phase 6: Finalization
304
+
305
+ #### Step 1: Update Context Package
306
+
307
+ ```javascript
308
+ // Sync updated analyses to context-package.json
309
+ const context_pkg = Read(".workflow/active/WFS-{session}/.process/context-package.json")
310
+
311
+ // Update guidance-specification if exists
312
+ // Update synthesis-specification if exists
313
+ // Re-read all role analysis files
314
+ // Update metadata timestamps
315
+
316
+ Write(context_pkg_path, JSON.stringify(context_pkg))
317
+ ```
318
+
319
+ #### Step 2: Update Session Metadata
320
+
321
+ ```json
322
+ {
323
+ "phases": {
324
+ "BRAINSTORM": {
325
+ "status": "clarification_completed",
326
+ "clarification_completed": true,
327
+ "completed_at": "timestamp",
328
+ "participating_roles": [...],
329
+ "clarification_results": {
330
+ "enhancements_applied": ["EP-001", "EP-002"],
331
+ "questions_asked": 3,
332
+ "categories_clarified": ["Architecture", "UX"],
333
+ "roles_updated": ["role1", "role2"]
334
+ },
335
+ "quality_metrics": {
336
+ "user_intent_alignment": "validated",
337
+ "ambiguity_resolution": "complete",
338
+ "terminology_consistency": "enforced"
339
+ }
340
+ }
341
+ }
342
+ }
343
+ ```
344
+
345
+ #### Step 3: Completion Report
346
+
347
+ ```markdown
348
+ ## Clarification Complete
349
+
350
+ **Enhancements Applied**: EP-001, EP-002, EP-003
351
+ **Questions Answered**: 3/5
352
+ **Roles Updated**: role1, role2, role3
353
+
354
+ ### Next Steps
355
+ ✅ PROCEED: `/workflow:plan --session WFS-{session-id}`
356
+ ```
357
+
358
+ ---
359
+
360
+ ## Output
361
+
362
+ **Location**: `.workflow/active/WFS-{session}/.brainstorming/[role]/analysis*.md`
363
+
364
+ **Updated Structure**:
365
+ ```markdown
366
+ ## Clarifications
367
+ ### Session {date}
368
+ - **Q**: {question} (Category: {category})
369
+ **A**: {answer}
370
+
371
+ ## {Existing Sections}
372
+ {Refined content based on clarifications}
373
+ ```
374
+
375
+ **Changes**:
376
+ - User intent validated/corrected
377
+ - Requirements more specific/measurable
378
+ - Architecture with rationale
379
+ - Ambiguities resolved, placeholders removed
380
+ - Consistent terminology
381
+
382
+ ---
383
+
384
+ ## Quality Checklist
385
+
386
+ **Content**:
387
+ - ✅ All role analyses loaded/analyzed
388
+ - ✅ Cross-role analysis (consensus, conflicts, gaps)
389
+ - ✅ 9-category ambiguity scan
390
+ - ✅ Questions prioritized
391
+
392
+ **Analysis**:
393
+ - ✅ User intent validated
394
+ - ✅ Cross-role synthesis complete
395
+ - ✅ Ambiguities resolved
396
+ - ✅ Terminology consistent
397
+
398
+ **Documents**:
399
+ - ✅ Clarifications section formatted
400
+ - ✅ Sections reflect answers
401
+ - ✅ No placeholders (TODO/TBD)
402
+ - ✅ Valid Markdown