claude-code-workflow 6.3.43 → 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 (77) 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 +5 -1
  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/ccw/dist/commands/issue.d.ts +4 -0
  59. package/ccw/dist/commands/issue.d.ts.map +1 -1
  60. package/ccw/dist/commands/issue.js +73 -6
  61. package/ccw/dist/commands/issue.js.map +1 -1
  62. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  63. package/ccw/dist/core/routes/cli-routes.js +32 -28
  64. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  65. package/ccw/dist/tools/claude-cli-tools.d.ts +10 -0
  66. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  67. package/ccw/dist/tools/claude-cli-tools.js +45 -0
  68. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  69. package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
  70. package/ccw/dist/tools/codex-lens.js +38 -11
  71. package/ccw/dist/tools/codex-lens.js.map +1 -1
  72. package/ccw/src/commands/issue.ts +84 -6
  73. package/ccw/src/core/routes/cli-routes.ts +30 -25
  74. package/ccw/src/templates/dashboard-js/views/help.js +1 -1
  75. package/ccw/src/tools/claude-cli-tools.ts +50 -0
  76. package/ccw/src/tools/codex-lens.ts +40 -11
  77. package/package.json +1 -1
@@ -1,453 +1,457 @@
1
- ---
2
- name: artifacts
3
- description: Interactive clarification generating confirmed guidance specification through role-based analysis and synthesis
4
- argument-hint: "topic or challenge description [--count N]"
5
- allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), AskUserQuestion(*)
6
- ---
7
-
8
- ## Overview
9
-
10
- Seven-phase workflow: **Context collection** **Topic analysis** **Role selection** → **Role questions** **Conflict resolution** → **Final check** → **Generate specification**
11
-
12
- All user interactions use AskUserQuestion tool (max 4 questions per call, multi-round).
13
-
14
- **Input**: `"GOAL: [objective] SCOPE: [boundaries] CONTEXT: [background]" [--count N]`
15
- **Output**: `.workflow/active/WFS-{topic}/.brainstorming/guidance-specification.md`
16
- **Core Principle**: Questions dynamically generated from project context + topic keywords, NOT generic templates
17
-
18
- **Parameters**:
19
- - `topic` (required): Topic or challenge description (structured format recommended)
20
- - `--count N` (optional): Number of roles to select (system recommends N+2 options, default: 3)
21
-
22
- ---
23
-
24
- ## Quick Reference
25
-
26
- ### Phase Summary
27
-
28
- | Phase | Goal | AskUserQuestion | Storage |
29
- |-------|------|-----------------|---------|
30
- | 0 | Context collection | - | context-package.json |
31
- | 1 | Topic analysis | 2-4 questions | intent_context |
32
- | 2 | Role selection | 1 multi-select | selected_roles |
33
- | 3 | Role questions | 3-4 per role | role_decisions[role] |
34
- | 4 | Conflict resolution | max 4 per round | cross_role_decisions |
35
- | 4.5 | Final check | progressive rounds | additional_decisions |
36
- | 5 | Generate spec | - | guidance-specification.md |
37
-
38
- ### AskUserQuestion Pattern
39
-
40
- ```javascript
41
- // Single-select (Phase 1, 3, 4)
42
- AskUserQuestion({
43
- questions: [
44
- {
45
- question: "{问题文本}",
46
- header: "{短标签}", // max 12 chars
47
- multiSelect: false,
48
- options: [
49
- { label: "{选项}", description: "{说明和影响}" },
50
- { label: "{选项}", description: "{说明和影响}" },
51
- { label: "{选项}", description: "{说明和影响}" }
52
- ]
53
- }
54
- // ... max 4 questions per call
55
- ]
56
- })
57
-
58
- // Multi-select (Phase 2)
59
- AskUserQuestion({
60
- questions: [{
61
- question: "请选择 {count} 个角色",
62
- header: "角色选择",
63
- multiSelect: true,
64
- options: [/* max 4 options per call */]
65
- }]
66
- })
67
- ```
68
-
69
- ### Multi-Round Execution
70
-
71
- ```javascript
72
- const BATCH_SIZE = 4;
73
- for (let i = 0; i < allQuestions.length; i += BATCH_SIZE) {
74
- const batch = allQuestions.slice(i, i + BATCH_SIZE);
75
- AskUserQuestion({ questions: batch });
76
- // Store responses before next round
77
- }
78
- ```
79
-
80
- ---
81
-
82
- ## Task Tracking
83
-
84
- **TodoWrite Rule**: EXTEND auto-parallel's task list (NOT replace/overwrite)
85
-
86
- **When called from auto-parallel**:
87
- - Find artifacts parent task → Mark "in_progress"
88
- - APPEND sub-tasks (Phase 0-5) Mark each as completes
89
- - When Phase 5 completes → Mark parent "completed"
90
- - PRESERVE all other auto-parallel tasks
91
-
92
- **Standalone Mode**:
93
- ```json
94
- [
95
- {"content": "Initialize session", "status": "pending", "activeForm": "Initializing"},
96
- {"content": "Phase 0: Context collection", "status": "pending", "activeForm": "Phase 0"},
97
- {"content": "Phase 1: Topic analysis (2-4 questions)", "status": "pending", "activeForm": "Phase 1"},
98
- {"content": "Phase 2: Role selection", "status": "pending", "activeForm": "Phase 2"},
99
- {"content": "Phase 3: Role questions (per role)", "status": "pending", "activeForm": "Phase 3"},
100
- {"content": "Phase 4: Conflict resolution", "status": "pending", "activeForm": "Phase 4"},
101
- {"content": "Phase 4.5: Final clarification", "status": "pending", "activeForm": "Phase 4.5"},
102
- {"content": "Phase 5: Generate specification", "status": "pending", "activeForm": "Phase 5"}
103
- ]
104
- ```
105
-
106
- ---
107
-
108
- ## Execution Phases
109
-
110
- ### Session Management
111
-
112
- - Check `.workflow/active/` for existing sessions
113
- - Multiple → Prompt selection | Single → Use it | None → Create `WFS-[topic-slug]`
114
- - Parse `--count N` parameter (default: 3)
115
- - Store decisions in `workflow-session.json`
116
-
117
- ### Phase 0: Context Collection
118
-
119
- **Goal**: Gather project context BEFORE user interaction
120
-
121
- **Steps**:
122
- 1. Check if `context-package.json` exists → Skip if valid
123
- 2. Invoke `context-search-agent` (BRAINSTORM MODE - lightweight)
124
- 3. Output: `.workflow/active/WFS-{session-id}/.process/context-package.json`
125
-
126
- **Graceful Degradation**: If agent fails, continue to Phase 1 without context
127
-
128
- ```javascript
129
- Task(
130
- subagent_type="context-search-agent",
131
- run_in_background=false,
132
- description="Gather project context for brainstorm",
133
- prompt=`
134
- Execute context-search-agent in BRAINSTORM MODE (Phase 1-2 only).
135
-
136
- Session: ${session_id}
137
- Task: ${task_description}
138
- Output: .workflow/${session_id}/.process/context-package.json
139
-
140
- Required fields: metadata, project_context, assets, dependencies, conflict_detection
141
- `
142
- )
143
- ```
144
-
145
- ### Phase 1: Topic Analysis
146
-
147
- **Goal**: Extract keywords/challenges enriched by Phase 0 context
148
-
149
- **Steps**:
150
- 1. Load Phase 0 context (tech_stack, modules, conflict_risk)
151
- 2. Deep topic analysis (entities, challenges, constraints, metrics)
152
- 3. Generate 2-4 context-aware probing questions
153
- 4. AskUserQuestion → Store to `session.intent_context`
154
-
155
- **Example**:
156
- ```javascript
157
- AskUserQuestion({
158
- questions: [
159
- {
160
- question: "实时协作平台的主要技术挑战?",
161
- header: "核心挑战",
162
- multiSelect: false,
163
- options: [
164
- { label: "实时数据同步", description: "100+用户同时在线,状态同步复杂度高" },
165
- { label: "可扩展性架构", description: "用户规模增长时的系统扩展能力" },
166
- { label: "冲突解决机制", description: "多用户同时编辑的冲突处理策略" }
167
- ]
168
- },
169
- {
170
- question: "MVP阶段最关注的指标?",
171
- header: "优先级",
172
- multiSelect: false,
173
- options: [
174
- { label: "功能完整性", description: "实现所有核心功能" },
175
- { label: "用户体验", description: "流畅的交互体验和响应速度" },
176
- { label: "系统稳定性", description: "高可用性和数据一致性" }
177
- ]
178
- }
179
- ]
180
- })
181
- ```
182
-
183
- **⚠️ CRITICAL**: Questions MUST reference topic keywords. Generic "Project type?" violates dynamic generation.
184
-
185
- ### Phase 2: Role Selection
186
-
187
- **Goal**: User selects roles from intelligent recommendations
188
-
189
- **Available Roles**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
190
-
191
- **Steps**:
192
- 1. Analyze Phase 1 keywords → Recommend count+2 roles with rationale
193
- 2. AskUserQuestion (multiSelect=true) Store to `session.selected_roles`
194
- 3. If count+2 > 4, split into multiple rounds
195
-
196
- **Example**:
197
- ```javascript
198
- AskUserQuestion({
199
- questions: [{
200
- question: "请选择 3 个角色参与头脑风暴分析",
201
- header: "角色选择",
202
- multiSelect: true,
203
- options: [
204
- { label: "system-architect", description: "实时同步架构设计和技术选型" },
205
- { label: "ui-designer", description: "协作界面用户体验和状态展示" },
206
- { label: "product-manager", description: "功能优先级和MVP范围决策" },
207
- { label: "data-architect", description: "数据同步模型和存储方案设计" }
208
- ]
209
- }]
210
- })
211
- ```
212
-
213
- **⚠️ CRITICAL**: User MUST interact. NEVER auto-select without confirmation.
214
-
215
- ### Phase 3: Role-Specific Questions
216
-
217
- **Goal**: Generate deep questions mapping role expertise to Phase 1 challenges
218
-
219
- **Algorithm**:
220
- 1. FOR each selected role:
221
- - Map Phase 1 challenges to role domain
222
- - Generate 3-4 questions (implementation depth, trade-offs, edge cases)
223
- - AskUserQuestion per role → Store to `session.role_decisions[role]`
224
- 2. Process roles sequentially (one at a time for clarity)
225
- 3. If role needs > 4 questions, split into multiple rounds
226
-
227
- **Example** (system-architect):
228
- ```javascript
229
- AskUserQuestion({
230
- questions: [
231
- {
232
- question: "100+ 用户实时状态同步方案?",
233
- header: "状态同步",
234
- multiSelect: false,
235
- options: [
236
- { label: "Event Sourcing", description: "完整事件历史,支持回溯,存储成本高" },
237
- { label: "集中式状态管理", description: "实现简单,单点瓶颈风险" },
238
- { label: "CRDT", description: "去中心化,自动合并,学习曲线陡" }
239
- ]
240
- },
241
- {
242
- question: "两个用户同时编辑冲突如何解决?",
243
- header: "冲突解决",
244
- multiSelect: false,
245
- options: [
246
- { label: "自动合并", description: "用户无感知,可能产生意外结果" },
247
- { label: "手动解决", description: "用户控制,增加交互复杂度" },
248
- { label: "版本控制", description: "保留历史,需要分支管理" }
249
- ]
250
- }
251
- ]
252
- })
253
- ```
254
-
255
- ### Phase 4: Conflict Resolution
256
-
257
- **Goal**: Resolve ACTUAL conflicts from Phase 3 answers
258
-
259
- **Algorithm**:
260
- 1. Analyze Phase 3 answers for conflicts:
261
- - Contradictory choices (e.g., "fast iteration" vs "complex Event Sourcing")
262
- - Missing integration (e.g., "Optimistic updates" but no conflict handling)
263
- - Implicit dependencies (e.g., "Live cursors" but no auth defined)
264
- 2. Generate clarification questions referencing SPECIFIC Phase 3 choices
265
- 3. AskUserQuestion (max 4 per call, multi-round) Store to `session.cross_role_decisions`
266
- 4. If NO conflicts: Skip Phase 4 (inform user: "未检测到跨角色冲突,跳过Phase 4")
267
-
268
- **Example**:
269
- ```javascript
270
- AskUserQuestion({
271
- questions: [{
272
- question: "CRDT 与 UI 回滚期望冲突,如何解决?\n背景:system-architect选择CRDT,ui-designer期望回滚UI",
273
- header: "架构冲突",
274
- multiSelect: false,
275
- options: [
276
- { label: "采用 CRDT", description: "保持去中心化,调整UI期望" },
277
- { label: "显示合并界面", description: "增加用户交互,展示冲突详情" },
278
- { label: "切换到 OT", description: "支持回滚,增加服务器复杂度" }
279
- ]
280
- }]
281
- })
282
- ```
283
-
284
- ### Phase 4.5: Final Clarification
285
-
286
- **Purpose**: Ensure no important points missed before generating specification
287
-
288
- **Steps**:
289
- 1. Ask initial check:
290
- ```javascript
291
- AskUserQuestion({
292
- questions: [{
293
- question: "在生成最终规范之前,是否有前面未澄清的重点需要补充?",
294
- header: "补充确认",
295
- multiSelect: false,
296
- options: [
297
- { label: "无需补充", description: "前面的讨论已经足够完整" },
298
- { label: "需要补充", description: "还有重要内容需要澄清" }
299
- ]
300
- }]
301
- })
302
- ```
303
- 2. If "需要补充":
304
- - Analyze user's additional points
305
- - Generate progressive questions (not role-bound, interconnected)
306
- - AskUserQuestion (max 4 per round) → Store to `session.additional_decisions`
307
- - Repeat until user confirms completion
308
- 3. If "无需补充": Proceed to Phase 5
309
-
310
- **Progressive Pattern**: Questions interconnected, each round informs next, continue until resolved.
311
-
312
- ### Phase 5: Generate Specification
313
-
314
- **Steps**:
315
- 1. Load all decisions: `intent_context` + `selected_roles` + `role_decisions` + `cross_role_decisions` + `additional_decisions`
316
- 2. Transform Q&A to declarative: Questions → Headers, Answers → CONFIRMED/SELECTED statements
317
- 3. Generate `guidance-specification.md`
318
- 4. Update `workflow-session.json` (metadata only)
319
- 5. Validate: No interrogative sentences, all decisions traceable
320
-
321
- ---
322
-
323
- ## Question Guidelines
324
-
325
- ### Core Principle
326
-
327
- **Target**: 开发者(理解技术但需要从用户需求出发)
328
-
329
- **Question Structure**: `[业务场景/需求前提] + [技术关注点]`
330
- **Option Structure**: `标签:[技术方案] + 说明:[业务影响] + [技术权衡]`
331
-
332
- ### Quality Rules
333
-
334
- **MUST Include**:
335
- - ✅ All questions in Chinese (用中文提问)
336
- - 业务场景作为问题前提
337
- - ✅ 技术选项的业务影响说明
338
- - ✅ 量化指标和约束条件
339
-
340
- **MUST Avoid**:
341
- - 纯技术选型无业务上下文
342
- - 过度抽象的用户体验问题
343
- - ❌ 脱离话题的通用架构问题
344
-
345
- ### Phase-Specific Requirements
346
-
347
- | Phase | Focus | Key Requirements |
348
- |-------|-------|------------------|
349
- | 1 | 意图理解 | Reference topic keywords, 用户场景、业务约束、优先级 |
350
- | 2 | 角色推荐 | Intelligent analysis (NOT keyword mapping), explain relevance |
351
- | 3 | 角色问题 | Reference Phase 1 keywords, concrete options with trade-offs |
352
- | 4 | 冲突解决 | Reference SPECIFIC Phase 3 choices, explain impact on both roles |
353
-
354
- ---
355
-
356
- ## Output & Governance
357
-
358
- ### Output Template
359
-
360
- **File**: `.workflow/active/WFS-{topic}/.brainstorming/guidance-specification.md`
361
-
362
- ```markdown
363
- # [Project] - Confirmed Guidance Specification
364
-
365
- **Metadata**: [timestamp, type, focus, roles]
366
-
367
- ## 1. Project Positioning & Goals
368
- **CONFIRMED Objectives**: [from topic + Phase 1]
369
- **CONFIRMED Success Criteria**: [from Phase 1 answers]
370
-
371
- ## 2-N. [Role] Decisions
372
- ### SELECTED Choices
373
- **[Question topic]**: [User's answer]
374
- - **Rationale**: [From option description]
375
- - **Impact**: [Implications]
376
-
377
- ### Cross-Role Considerations
378
- **[Conflict resolved]**: [Resolution from Phase 4]
379
- - **Affected Roles**: [Roles involved]
380
-
381
- ## Cross-Role Integration
382
- **CONFIRMED Integration Points**: [API/Data/Auth from multiple roles]
383
-
384
- ## Risks & Constraints
385
- **Identified Risks**: [From answers] → Mitigation: [Approach]
386
-
387
- ## Next Steps
388
- **⚠️ Automatic Continuation** (when called from auto-parallel):
389
- - auto-parallel assigns agents for role-specific analysis
390
- - Each selected role gets conceptual-planning-agent
391
- - Agents read this guidance-specification.md for context
392
-
393
- ## Appendix: Decision Tracking
394
- | Decision ID | Category | Question | Selected | Phase | Rationale |
395
- |-------------|----------|----------|----------|-------|-----------|
396
- | D-001 | Intent | [Q] | [A] | 1 | [Why] |
397
- | D-002 | Roles | [Selected] | [Roles] | 2 | [Why] |
398
- | D-003+ | [Role] | [Q] | [A] | 3 | [Why] |
399
- ```
400
-
401
- ### File Structure
402
-
403
- ```
404
- .workflow/active/WFS-[topic]/
405
- ├── workflow-session.json # Metadata ONLY
406
- ├── .process/
407
- │ └── context-package.json # Phase 0 output
408
- └── .brainstorming/
409
- └── guidance-specification.md # Full guidance content
410
- ```
411
-
412
- ### Session Metadata
413
-
414
- ```json
415
- {
416
- "session_id": "WFS-{topic-slug}",
417
- "type": "brainstorming",
418
- "topic": "{original user input}",
419
- "selected_roles": ["system-architect", "ui-designer", "product-manager"],
420
- "phase_completed": "artifacts",
421
- "timestamp": "2025-10-24T10:30:00Z",
422
- "count_parameter": 3
423
- }
424
- ```
425
-
426
- **⚠️ Rule**: Session JSON stores ONLY metadata. All guidance content goes to guidance-specification.md.
427
-
428
- ### Validation Checklist
429
-
430
- - No interrogative sentences (use CONFIRMED/SELECTED)
431
- - ✅ Every decision traceable to user answer
432
- - Cross-role conflicts resolved or documented
433
- - ✅ Next steps concrete and specific
434
- - ✅ No content duplication between .json and .md
435
-
436
- ### Update Mechanism
437
-
438
- ```
439
- IF guidance-specification.md EXISTS:
440
- Prompt: "Regenerate completely / Update sections / Cancel"
441
- ELSE:
442
- Run full Phase 0-5 flow
443
- ```
444
-
445
- ### Governance Rules
446
-
447
- - All decisions MUST use CONFIRMED/SELECTED (NO "?" in decision sections)
448
- - Every decision MUST trace to user answer
449
- - Conflicts MUST be resolved (not marked "TBD")
450
- - Next steps MUST be actionable
451
- - Topic preserved as authoritative reference
452
-
453
- **CRITICAL**: Guidance is single source of truth for downstream phases. Ambiguity violates governance.
1
+ ---
2
+ name: artifacts
3
+ description: Interactive clarification generating confirmed guidance specification through role-based analysis and synthesis
4
+ argument-hint: "[-y|--yes] topic or challenge description [--count N]"
5
+ allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), AskUserQuestion(*)
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-select recommended roles, skip all clarification questions, use default answers.
11
+
12
+ ## Overview
13
+
14
+ Seven-phase workflow: **Context collection** **Topic analysis** **Role selection** → **Role questions** → **Conflict resolution** → **Final check** → **Generate specification**
15
+
16
+ All user interactions use AskUserQuestion tool (max 4 questions per call, multi-round).
17
+
18
+ **Input**: `"GOAL: [objective] SCOPE: [boundaries] CONTEXT: [background]" [--count N]`
19
+ **Output**: `.workflow/active/WFS-{topic}/.brainstorming/guidance-specification.md`
20
+ **Core Principle**: Questions dynamically generated from project context + topic keywords, NOT generic templates
21
+
22
+ **Parameters**:
23
+ - `topic` (required): Topic or challenge description (structured format recommended)
24
+ - `--count N` (optional): Number of roles to select (system recommends N+2 options, default: 3)
25
+
26
+ ---
27
+
28
+ ## Quick Reference
29
+
30
+ ### Phase Summary
31
+
32
+ | Phase | Goal | AskUserQuestion | Storage |
33
+ |-------|------|-----------------|---------|
34
+ | 0 | Context collection | - | context-package.json |
35
+ | 1 | Topic analysis | 2-4 questions | intent_context |
36
+ | 2 | Role selection | 1 multi-select | selected_roles |
37
+ | 3 | Role questions | 3-4 per role | role_decisions[role] |
38
+ | 4 | Conflict resolution | max 4 per round | cross_role_decisions |
39
+ | 4.5 | Final check | progressive rounds | additional_decisions |
40
+ | 5 | Generate spec | - | guidance-specification.md |
41
+
42
+ ### AskUserQuestion Pattern
43
+
44
+ ```javascript
45
+ // Single-select (Phase 1, 3, 4)
46
+ AskUserQuestion({
47
+ questions: [
48
+ {
49
+ question: "{问题文本}",
50
+ header: "{短标签}", // max 12 chars
51
+ multiSelect: false,
52
+ options: [
53
+ { label: "{选项}", description: "{说明和影响}" },
54
+ { label: "{选项}", description: "{说明和影响}" },
55
+ { label: "{选项}", description: "{说明和影响}" }
56
+ ]
57
+ }
58
+ // ... max 4 questions per call
59
+ ]
60
+ })
61
+
62
+ // Multi-select (Phase 2)
63
+ AskUserQuestion({
64
+ questions: [{
65
+ question: "请选择 {count} 个角色",
66
+ header: "角色选择",
67
+ multiSelect: true,
68
+ options: [/* max 4 options per call */]
69
+ }]
70
+ })
71
+ ```
72
+
73
+ ### Multi-Round Execution
74
+
75
+ ```javascript
76
+ const BATCH_SIZE = 4;
77
+ for (let i = 0; i < allQuestions.length; i += BATCH_SIZE) {
78
+ const batch = allQuestions.slice(i, i + BATCH_SIZE);
79
+ AskUserQuestion({ questions: batch });
80
+ // Store responses before next round
81
+ }
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Task Tracking
87
+
88
+ **TodoWrite Rule**: EXTEND auto-parallel's task list (NOT replace/overwrite)
89
+
90
+ **When called from auto-parallel**:
91
+ - Find artifacts parent task → Mark "in_progress"
92
+ - APPEND sub-tasks (Phase 0-5) → Mark each as completes
93
+ - When Phase 5 completes → Mark parent "completed"
94
+ - PRESERVE all other auto-parallel tasks
95
+
96
+ **Standalone Mode**:
97
+ ```json
98
+ [
99
+ {"content": "Initialize session", "status": "pending", "activeForm": "Initializing"},
100
+ {"content": "Phase 0: Context collection", "status": "pending", "activeForm": "Phase 0"},
101
+ {"content": "Phase 1: Topic analysis (2-4 questions)", "status": "pending", "activeForm": "Phase 1"},
102
+ {"content": "Phase 2: Role selection", "status": "pending", "activeForm": "Phase 2"},
103
+ {"content": "Phase 3: Role questions (per role)", "status": "pending", "activeForm": "Phase 3"},
104
+ {"content": "Phase 4: Conflict resolution", "status": "pending", "activeForm": "Phase 4"},
105
+ {"content": "Phase 4.5: Final clarification", "status": "pending", "activeForm": "Phase 4.5"},
106
+ {"content": "Phase 5: Generate specification", "status": "pending", "activeForm": "Phase 5"}
107
+ ]
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Execution Phases
113
+
114
+ ### Session Management
115
+
116
+ - Check `.workflow/active/` for existing sessions
117
+ - Multiple Prompt selection | Single → Use it | None → Create `WFS-[topic-slug]`
118
+ - Parse `--count N` parameter (default: 3)
119
+ - Store decisions in `workflow-session.json`
120
+
121
+ ### Phase 0: Context Collection
122
+
123
+ **Goal**: Gather project context BEFORE user interaction
124
+
125
+ **Steps**:
126
+ 1. Check if `context-package.json` exists Skip if valid
127
+ 2. Invoke `context-search-agent` (BRAINSTORM MODE - lightweight)
128
+ 3. Output: `.workflow/active/WFS-{session-id}/.process/context-package.json`
129
+
130
+ **Graceful Degradation**: If agent fails, continue to Phase 1 without context
131
+
132
+ ```javascript
133
+ Task(
134
+ subagent_type="context-search-agent",
135
+ run_in_background=false,
136
+ description="Gather project context for brainstorm",
137
+ prompt=`
138
+ Execute context-search-agent in BRAINSTORM MODE (Phase 1-2 only).
139
+
140
+ Session: ${session_id}
141
+ Task: ${task_description}
142
+ Output: .workflow/${session_id}/.process/context-package.json
143
+
144
+ Required fields: metadata, project_context, assets, dependencies, conflict_detection
145
+ `
146
+ )
147
+ ```
148
+
149
+ ### Phase 1: Topic Analysis
150
+
151
+ **Goal**: Extract keywords/challenges enriched by Phase 0 context
152
+
153
+ **Steps**:
154
+ 1. Load Phase 0 context (tech_stack, modules, conflict_risk)
155
+ 2. Deep topic analysis (entities, challenges, constraints, metrics)
156
+ 3. Generate 2-4 context-aware probing questions
157
+ 4. AskUserQuestion → Store to `session.intent_context`
158
+
159
+ **Example**:
160
+ ```javascript
161
+ AskUserQuestion({
162
+ questions: [
163
+ {
164
+ question: "实时协作平台的主要技术挑战?",
165
+ header: "核心挑战",
166
+ multiSelect: false,
167
+ options: [
168
+ { label: "实时数据同步", description: "100+用户同时在线,状态同步复杂度高" },
169
+ { label: "可扩展性架构", description: "用户规模增长时的系统扩展能力" },
170
+ { label: "冲突解决机制", description: "多用户同时编辑的冲突处理策略" }
171
+ ]
172
+ },
173
+ {
174
+ question: "MVP阶段最关注的指标?",
175
+ header: "优先级",
176
+ multiSelect: false,
177
+ options: [
178
+ { label: "功能完整性", description: "实现所有核心功能" },
179
+ { label: "用户体验", description: "流畅的交互体验和响应速度" },
180
+ { label: "系统稳定性", description: "高可用性和数据一致性" }
181
+ ]
182
+ }
183
+ ]
184
+ })
185
+ ```
186
+
187
+ **⚠️ CRITICAL**: Questions MUST reference topic keywords. Generic "Project type?" violates dynamic generation.
188
+
189
+ ### Phase 2: Role Selection
190
+
191
+ **Goal**: User selects roles from intelligent recommendations
192
+
193
+ **Available Roles**: data-architect, product-manager, product-owner, scrum-master, subject-matter-expert, system-architect, test-strategist, ui-designer, ux-expert
194
+
195
+ **Steps**:
196
+ 1. Analyze Phase 1 keywords → Recommend count+2 roles with rationale
197
+ 2. AskUserQuestion (multiSelect=true) → Store to `session.selected_roles`
198
+ 3. If count+2 > 4, split into multiple rounds
199
+
200
+ **Example**:
201
+ ```javascript
202
+ AskUserQuestion({
203
+ questions: [{
204
+ question: "请选择 3 个角色参与头脑风暴分析",
205
+ header: "角色选择",
206
+ multiSelect: true,
207
+ options: [
208
+ { label: "system-architect", description: "实时同步架构设计和技术选型" },
209
+ { label: "ui-designer", description: "协作界面用户体验和状态展示" },
210
+ { label: "product-manager", description: "功能优先级和MVP范围决策" },
211
+ { label: "data-architect", description: "数据同步模型和存储方案设计" }
212
+ ]
213
+ }]
214
+ })
215
+ ```
216
+
217
+ **⚠️ CRITICAL**: User MUST interact. NEVER auto-select without confirmation.
218
+
219
+ ### Phase 3: Role-Specific Questions
220
+
221
+ **Goal**: Generate deep questions mapping role expertise to Phase 1 challenges
222
+
223
+ **Algorithm**:
224
+ 1. FOR each selected role:
225
+ - Map Phase 1 challenges to role domain
226
+ - Generate 3-4 questions (implementation depth, trade-offs, edge cases)
227
+ - AskUserQuestion per role → Store to `session.role_decisions[role]`
228
+ 2. Process roles sequentially (one at a time for clarity)
229
+ 3. If role needs > 4 questions, split into multiple rounds
230
+
231
+ **Example** (system-architect):
232
+ ```javascript
233
+ AskUserQuestion({
234
+ questions: [
235
+ {
236
+ question: "100+ 用户实时状态同步方案?",
237
+ header: "状态同步",
238
+ multiSelect: false,
239
+ options: [
240
+ { label: "Event Sourcing", description: "完整事件历史,支持回溯,存储成本高" },
241
+ { label: "集中式状态管理", description: "实现简单,单点瓶颈风险" },
242
+ { label: "CRDT", description: "去中心化,自动合并,学习曲线陡" }
243
+ ]
244
+ },
245
+ {
246
+ question: "两个用户同时编辑冲突如何解决?",
247
+ header: "冲突解决",
248
+ multiSelect: false,
249
+ options: [
250
+ { label: "自动合并", description: "用户无感知,可能产生意外结果" },
251
+ { label: "手动解决", description: "用户控制,增加交互复杂度" },
252
+ { label: "版本控制", description: "保留历史,需要分支管理" }
253
+ ]
254
+ }
255
+ ]
256
+ })
257
+ ```
258
+
259
+ ### Phase 4: Conflict Resolution
260
+
261
+ **Goal**: Resolve ACTUAL conflicts from Phase 3 answers
262
+
263
+ **Algorithm**:
264
+ 1. Analyze Phase 3 answers for conflicts:
265
+ - Contradictory choices (e.g., "fast iteration" vs "complex Event Sourcing")
266
+ - Missing integration (e.g., "Optimistic updates" but no conflict handling)
267
+ - Implicit dependencies (e.g., "Live cursors" but no auth defined)
268
+ 2. Generate clarification questions referencing SPECIFIC Phase 3 choices
269
+ 3. AskUserQuestion (max 4 per call, multi-round) → Store to `session.cross_role_decisions`
270
+ 4. If NO conflicts: Skip Phase 4 (inform user: "未检测到跨角色冲突,跳过Phase 4")
271
+
272
+ **Example**:
273
+ ```javascript
274
+ AskUserQuestion({
275
+ questions: [{
276
+ question: "CRDT UI 回滚期望冲突,如何解决?\n背景:system-architect选择CRDT,ui-designer期望回滚UI",
277
+ header: "架构冲突",
278
+ multiSelect: false,
279
+ options: [
280
+ { label: "采用 CRDT", description: "保持去中心化,调整UI期望" },
281
+ { label: "显示合并界面", description: "增加用户交互,展示冲突详情" },
282
+ { label: "切换到 OT", description: "支持回滚,增加服务器复杂度" }
283
+ ]
284
+ }]
285
+ })
286
+ ```
287
+
288
+ ### Phase 4.5: Final Clarification
289
+
290
+ **Purpose**: Ensure no important points missed before generating specification
291
+
292
+ **Steps**:
293
+ 1. Ask initial check:
294
+ ```javascript
295
+ AskUserQuestion({
296
+ questions: [{
297
+ question: "在生成最终规范之前,是否有前面未澄清的重点需要补充?",
298
+ header: "补充确认",
299
+ multiSelect: false,
300
+ options: [
301
+ { label: "无需补充", description: "前面的讨论已经足够完整" },
302
+ { label: "需要补充", description: "还有重要内容需要澄清" }
303
+ ]
304
+ }]
305
+ })
306
+ ```
307
+ 2. If "需要补充":
308
+ - Analyze user's additional points
309
+ - Generate progressive questions (not role-bound, interconnected)
310
+ - AskUserQuestion (max 4 per round) Store to `session.additional_decisions`
311
+ - Repeat until user confirms completion
312
+ 3. If "无需补充": Proceed to Phase 5
313
+
314
+ **Progressive Pattern**: Questions interconnected, each round informs next, continue until resolved.
315
+
316
+ ### Phase 5: Generate Specification
317
+
318
+ **Steps**:
319
+ 1. Load all decisions: `intent_context` + `selected_roles` + `role_decisions` + `cross_role_decisions` + `additional_decisions`
320
+ 2. Transform Q&A to declarative: Questions → Headers, Answers → CONFIRMED/SELECTED statements
321
+ 3. Generate `guidance-specification.md`
322
+ 4. Update `workflow-session.json` (metadata only)
323
+ 5. Validate: No interrogative sentences, all decisions traceable
324
+
325
+ ---
326
+
327
+ ## Question Guidelines
328
+
329
+ ### Core Principle
330
+
331
+ **Target**: 开发者(理解技术但需要从用户需求出发)
332
+
333
+ **Question Structure**: `[业务场景/需求前提] + [技术关注点]`
334
+ **Option Structure**: `标签:[技术方案] + 说明:[业务影响] + [技术权衡]`
335
+
336
+ ### Quality Rules
337
+
338
+ **MUST Include**:
339
+ - ✅ All questions in Chinese (用中文提问)
340
+ - ✅ 业务场景作为问题前提
341
+ - 技术选项的业务影响说明
342
+ - 量化指标和约束条件
343
+
344
+ **MUST Avoid**:
345
+ - ❌ 纯技术选型无业务上下文
346
+ - ❌ 过度抽象的用户体验问题
347
+ - 脱离话题的通用架构问题
348
+
349
+ ### Phase-Specific Requirements
350
+
351
+ | Phase | Focus | Key Requirements |
352
+ |-------|-------|------------------|
353
+ | 1 | 意图理解 | Reference topic keywords, 用户场景、业务约束、优先级 |
354
+ | 2 | 角色推荐 | Intelligent analysis (NOT keyword mapping), explain relevance |
355
+ | 3 | 角色问题 | Reference Phase 1 keywords, concrete options with trade-offs |
356
+ | 4 | 冲突解决 | Reference SPECIFIC Phase 3 choices, explain impact on both roles |
357
+
358
+ ---
359
+
360
+ ## Output & Governance
361
+
362
+ ### Output Template
363
+
364
+ **File**: `.workflow/active/WFS-{topic}/.brainstorming/guidance-specification.md`
365
+
366
+ ```markdown
367
+ # [Project] - Confirmed Guidance Specification
368
+
369
+ **Metadata**: [timestamp, type, focus, roles]
370
+
371
+ ## 1. Project Positioning & Goals
372
+ **CONFIRMED Objectives**: [from topic + Phase 1]
373
+ **CONFIRMED Success Criteria**: [from Phase 1 answers]
374
+
375
+ ## 2-N. [Role] Decisions
376
+ ### SELECTED Choices
377
+ **[Question topic]**: [User's answer]
378
+ - **Rationale**: [From option description]
379
+ - **Impact**: [Implications]
380
+
381
+ ### Cross-Role Considerations
382
+ **[Conflict resolved]**: [Resolution from Phase 4]
383
+ - **Affected Roles**: [Roles involved]
384
+
385
+ ## Cross-Role Integration
386
+ **CONFIRMED Integration Points**: [API/Data/Auth from multiple roles]
387
+
388
+ ## Risks & Constraints
389
+ **Identified Risks**: [From answers] Mitigation: [Approach]
390
+
391
+ ## Next Steps
392
+ **⚠️ Automatic Continuation** (when called from auto-parallel):
393
+ - auto-parallel assigns agents for role-specific analysis
394
+ - Each selected role gets conceptual-planning-agent
395
+ - Agents read this guidance-specification.md for context
396
+
397
+ ## Appendix: Decision Tracking
398
+ | Decision ID | Category | Question | Selected | Phase | Rationale |
399
+ |-------------|----------|----------|----------|-------|-----------|
400
+ | D-001 | Intent | [Q] | [A] | 1 | [Why] |
401
+ | D-002 | Roles | [Selected] | [Roles] | 2 | [Why] |
402
+ | D-003+ | [Role] | [Q] | [A] | 3 | [Why] |
403
+ ```
404
+
405
+ ### File Structure
406
+
407
+ ```
408
+ .workflow/active/WFS-[topic]/
409
+ ├── workflow-session.json # Metadata ONLY
410
+ ├── .process/
411
+ │ └── context-package.json # Phase 0 output
412
+ └── .brainstorming/
413
+ └── guidance-specification.md # Full guidance content
414
+ ```
415
+
416
+ ### Session Metadata
417
+
418
+ ```json
419
+ {
420
+ "session_id": "WFS-{topic-slug}",
421
+ "type": "brainstorming",
422
+ "topic": "{original user input}",
423
+ "selected_roles": ["system-architect", "ui-designer", "product-manager"],
424
+ "phase_completed": "artifacts",
425
+ "timestamp": "2025-10-24T10:30:00Z",
426
+ "count_parameter": 3
427
+ }
428
+ ```
429
+
430
+ **⚠️ Rule**: Session JSON stores ONLY metadata. All guidance content goes to guidance-specification.md.
431
+
432
+ ### Validation Checklist
433
+
434
+ - ✅ No interrogative sentences (use CONFIRMED/SELECTED)
435
+ - ✅ Every decision traceable to user answer
436
+ - Cross-role conflicts resolved or documented
437
+ - ✅ Next steps concrete and specific
438
+ - ✅ No content duplication between .json and .md
439
+
440
+ ### Update Mechanism
441
+
442
+ ```
443
+ IF guidance-specification.md EXISTS:
444
+ Prompt: "Regenerate completely / Update sections / Cancel"
445
+ ELSE:
446
+ Run full Phase 0-5 flow
447
+ ```
448
+
449
+ ### Governance Rules
450
+
451
+ - All decisions MUST use CONFIRMED/SELECTED (NO "?" in decision sections)
452
+ - Every decision MUST trace to user answer
453
+ - Conflicts MUST be resolved (not marked "TBD")
454
+ - Next steps MUST be actionable
455
+ - Topic preserved as authoritative reference
456
+
457
+ **CRITICAL**: Guidance is single source of truth for downstream phases. Ambiguity violates governance.