claude-code-workflow 6.0.5 → 6.1.0
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.
- package/.claude/agents/action-planning-agent.md +1 -1
- package/.claude/agents/cli-execution-agent.md +269 -269
- package/.claude/agents/cli-explore-agent.md +182 -182
- package/.claude/agents/context-search-agent.md +582 -582
- package/.claude/agents/memory-bridge.md +93 -93
- package/.claude/commands/cli/cli-init.md +1 -1
- package/.claude/commands/memory/docs-full-cli.md +471 -471
- package/.claude/commands/memory/docs-related-cli.md +386 -386
- package/.claude/commands/memory/docs.md +615 -615
- package/.claude/commands/memory/load.md +1 -1
- package/.claude/commands/memory/update-full.md +332 -332
- package/.claude/commands/memory/update-related.md +5 -5
- package/.claude/commands/workflow/init.md +1 -1
- package/.claude/commands/workflow/lite-fix.md +621 -621
- package/.claude/commands/workflow/lite-plan.md +592 -592
- package/.claude/commands/workflow/tools/context-gather.md +434 -434
- package/.claude/commands/workflow/ui-design/generate.md +504 -504
- package/.claude/commands/workflow/ui-design/import-from-code.md +537 -537
- package/.claude/scripts/classify-folders.sh +4 -0
- package/.claude/scripts/convert_tokens_to_css.sh +4 -0
- package/.claude/scripts/detect_changed_modules.sh +5 -1
- package/.claude/scripts/discover-design-files.sh +87 -83
- package/.claude/scripts/generate_module_docs.sh +717 -713
- package/.claude/scripts/get_modules_by_depth.sh +5 -1
- package/.claude/scripts/ui-generate-preview.sh +4 -0
- package/.claude/scripts/ui-instantiate-prototypes.sh +4 -0
- package/.claude/scripts/update_module_claude.sh +4 -0
- package/.claude/skills/command-guide/index/all-commands.json +1 -12
- package/.claude/skills/command-guide/index/by-category.json +1 -12
- package/.claude/skills/command-guide/index/by-use-case.json +1 -12
- package/.claude/skills/command-guide/index/essential-commands.json +1 -12
- package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +127 -71
- package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +269 -269
- package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +182 -182
- package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +18 -38
- package/.claude/skills/command-guide/reference/agents/context-search-agent.md +582 -577
- package/.claude/skills/command-guide/reference/agents/memory-bridge.md +93 -93
- package/.claude/skills/command-guide/reference/commands/cli/cli-init.md +1 -1
- package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -471
- package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -386
- package/.claude/skills/command-guide/reference/commands/memory/docs.md +615 -610
- package/.claude/skills/command-guide/reference/commands/memory/load.md +1 -1
- package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -332
- package/.claude/skills/command-guide/reference/commands/memory/update-related.md +5 -5
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/artifacts.md +299 -451
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +14 -37
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/synthesis.md +252 -350
- package/.claude/skills/command-guide/reference/commands/workflow/init.md +2 -2
- package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +52 -0
- package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +621 -602
- package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +46 -36
- package/.claude/skills/command-guide/reference/commands/workflow/review-fix.md +18 -58
- package/.claude/skills/command-guide/reference/commands/workflow/review-module-cycle.md +22 -52
- package/.claude/skills/command-guide/reference/commands/workflow/review-session-cycle.md +19 -48
- package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +25 -5
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +7 -7
- package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -434
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +151 -11
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +4 -4
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/generate.md +504 -504
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +537 -537
- package/.claude/workflows/context-search-strategy.md +77 -77
- package/.claude/workflows/tool-strategy.md +90 -71
- package/.claude/workflows/workflow-architecture.md +1 -1
- package/ccw/src/cli.js +7 -0
- package/ccw/src/commands/tool.js +181 -0
- package/ccw/src/core/dashboard-generator.js +18 -3
- package/ccw/src/core/lite-scanner.js +35 -11
- package/ccw/src/core/server.js +531 -46
- package/ccw/src/templates/dashboard-css/01-base.css +161 -0
- package/ccw/src/templates/dashboard-css/02-session.css +726 -0
- package/ccw/src/templates/dashboard-css/03-tasks.css +512 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +843 -0
- package/ccw/src/templates/dashboard-css/05-context.css +2206 -0
- package/ccw/src/templates/dashboard-css/06-cards.css +1570 -0
- package/ccw/src/templates/dashboard-css/07-managers.css +936 -0
- package/ccw/src/templates/dashboard-css/08-review.css +1266 -0
- package/ccw/src/templates/dashboard-css/09-explorer.css +1397 -0
- package/ccw/src/templates/dashboard-js/components/global-notifications.js +219 -0
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +10 -0
- package/ccw/src/templates/dashboard-js/components/mcp-manager.js +11 -1
- package/ccw/src/templates/dashboard-js/components/navigation.js +11 -5
- package/ccw/src/templates/dashboard-js/components/tabs-context.js +20 -20
- package/ccw/src/templates/dashboard-js/components/tabs-other.js +11 -11
- package/ccw/src/templates/dashboard-js/components/theme.js +29 -1
- package/ccw/src/templates/dashboard-js/main.js +4 -0
- package/ccw/src/templates/dashboard-js/state.js +5 -0
- package/ccw/src/templates/dashboard-js/views/explorer.js +852 -0
- package/ccw/src/templates/dashboard-js/views/home.js +13 -9
- package/ccw/src/templates/dashboard-js/views/hook-manager.js +8 -5
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +21 -16
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +90 -19
- package/ccw/src/templates/dashboard-js/views/project-overview.js +15 -11
- package/ccw/src/templates/dashboard-js/views/review-session.js +3 -3
- package/ccw/src/templates/dashboard-js/views/session-detail.js +38 -28
- package/ccw/src/templates/dashboard.html +129 -28
- package/ccw/src/tools/classify-folders.js +204 -0
- package/ccw/src/tools/convert-tokens-to-css.js +250 -0
- package/ccw/src/tools/detect-changed-modules.js +288 -0
- package/ccw/src/tools/discover-design-files.js +134 -0
- package/ccw/src/tools/edit-file.js +266 -0
- package/ccw/src/tools/generate-module-docs.js +416 -0
- package/ccw/src/tools/get-modules-by-depth.js +308 -0
- package/ccw/src/tools/index.js +176 -0
- package/ccw/src/tools/ui-generate-preview.js +327 -0
- package/ccw/src/tools/ui-instantiate-prototypes.js +301 -0
- package/ccw/src/tools/update-module-claude.js +380 -0
- package/package.json +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/status.md +0 -352
- package/ccw/src/core/server.js.bak +0 -385
- package/ccw/src/core/server_original.bak +0 -385
- package/ccw/src/templates/dashboard.css +0 -8187
- package/ccw/src/templates/dashboard_tailwind.html +0 -42
- package/ccw/src/templates/dashboard_test.html +0 -37
- package/ccw/src/templates/tailwind-base.css +0 -212
|
@@ -2,325 +2,318 @@
|
|
|
2
2
|
name: synthesis
|
|
3
3
|
description: Clarify and refine role analyses through intelligent Q&A and targeted updates with synthesis agent
|
|
4
4
|
argument-hint: "[optional: --session session-id]"
|
|
5
|
-
allowed-tools: Task(conceptual-planning-agent), TodoWrite(*), Read(*), Write(*), Edit(*), Glob(*)
|
|
5
|
+
allowed-tools: Task(conceptual-planning-agent), TodoWrite(*), Read(*), Write(*), Edit(*), Glob(*), AskUserQuestion(*)
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Six-phase workflow to eliminate ambiguities and enhance conceptual depth in role analyses:
|
|
11
11
|
|
|
12
|
-
**Phase 1-2
|
|
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 update → Completion report
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
**Phase 4 (Main Flow)**: User selects enhancements → User answers clarifications → Build update plan
|
|
17
|
-
|
|
18
|
-
**Phase 5 (Parallel Update Agents)**: Each agent updates ONE role document → Parallel execution
|
|
19
|
-
|
|
20
|
-
**Phase 6 (Main Flow)**: Metadata update → Completion report
|
|
21
|
-
|
|
22
|
-
**Key Features**:
|
|
23
|
-
- Multi-agent architecture (analysis agent + parallel update agents)
|
|
24
|
-
- Clear separation: Agent analysis vs Main flow interaction
|
|
25
|
-
- Parallel document updates (one agent per role)
|
|
26
|
-
- User intent alignment validation
|
|
18
|
+
All user interactions use AskUserQuestion tool (max 4 questions per call, multi-round).
|
|
27
19
|
|
|
28
20
|
**Document Flow**:
|
|
29
21
|
- Input: `[role]/analysis*.md`, `guidance-specification.md`, session metadata
|
|
30
22
|
- Output: Updated `[role]/analysis*.md` with Enhancements + Clarifications sections
|
|
31
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
|
+
|
|
32
74
|
## Task Tracking
|
|
33
75
|
|
|
34
76
|
```json
|
|
35
77
|
[
|
|
36
|
-
{"content": "Detect session and validate analyses", "status": "
|
|
78
|
+
{"content": "Detect session and validate analyses", "status": "pending", "activeForm": "Detecting session"},
|
|
37
79
|
{"content": "Discover role analysis file paths", "status": "pending", "activeForm": "Discovering paths"},
|
|
38
|
-
{"content": "Execute analysis agent (cross-role analysis)", "status": "pending", "activeForm": "Executing analysis
|
|
39
|
-
{"content": "Present enhancements
|
|
40
|
-
{"content": "
|
|
41
|
-
{"content": "
|
|
42
|
-
{"content": "
|
|
43
|
-
{"content": "Update session metadata and generate report", "status": "pending", "activeForm": "Finalizing session"}
|
|
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"}
|
|
44
85
|
]
|
|
45
86
|
```
|
|
46
87
|
|
|
88
|
+
---
|
|
89
|
+
|
|
47
90
|
## Execution Phases
|
|
48
91
|
|
|
49
92
|
### Phase 1: Discovery & Validation
|
|
50
93
|
|
|
51
|
-
1. **Detect Session**: Use `--session` parameter or find `.workflow/active/WFS-*`
|
|
94
|
+
1. **Detect Session**: Use `--session` parameter or find `.workflow/active/WFS-*`
|
|
52
95
|
2. **Validate Files**:
|
|
53
96
|
- `guidance-specification.md` (optional, warn if missing)
|
|
54
97
|
- `*/analysis*.md` (required, error if empty)
|
|
55
|
-
3. **Load User Intent**: Extract from `workflow-session.json`
|
|
98
|
+
3. **Load User Intent**: Extract from `workflow-session.json`
|
|
56
99
|
|
|
57
100
|
### Phase 2: Role Discovery & Path Preparation
|
|
58
101
|
|
|
59
102
|
**Main flow prepares file paths for Agent**:
|
|
60
103
|
|
|
61
104
|
1. **Discover Analysis Files**:
|
|
62
|
-
- Glob
|
|
63
|
-
- Supports: analysis.md
|
|
64
|
-
- Validate: At least one file exists (error if empty)
|
|
105
|
+
- Glob: `.workflow/active/WFS-{session}/.brainstorming/*/analysis*.md`
|
|
106
|
+
- Supports: analysis.md + analysis-{slug}.md (max 5)
|
|
65
107
|
|
|
66
108
|
2. **Extract Role Information**:
|
|
67
|
-
- `role_analysis_paths`: Relative paths
|
|
68
|
-
- `participating_roles`: Role names
|
|
69
|
-
|
|
70
|
-
3. **Pass to Agent** (Phase 3):
|
|
71
|
-
- `session_id`
|
|
72
|
-
- `brainstorm_dir`: .workflow/active/WFS-{session}/.brainstorming/
|
|
73
|
-
- `role_analysis_paths`: ["product-manager/analysis.md", "system-architect/analysis-1.md", ...]
|
|
74
|
-
- `participating_roles`: ["product-manager", "system-architect", ...]
|
|
109
|
+
- `role_analysis_paths`: Relative paths
|
|
110
|
+
- `participating_roles`: Role names from directories
|
|
75
111
|
|
|
76
|
-
**
|
|
112
|
+
3. **Pass to Agent**: session_id, brainstorm_dir, role_analysis_paths, participating_roles
|
|
77
113
|
|
|
78
114
|
### Phase 3A: Analysis & Enhancement Agent
|
|
79
115
|
|
|
80
|
-
**
|
|
116
|
+
**Agent executes cross-role analysis**:
|
|
81
117
|
|
|
82
|
-
```
|
|
83
|
-
Task(conceptual-planning-agent
|
|
118
|
+
```javascript
|
|
119
|
+
Task(conceptual-planning-agent, `
|
|
84
120
|
## Agent Mission
|
|
85
|
-
Analyze role documents, identify conflicts/gaps,
|
|
86
|
-
|
|
87
|
-
## Input
|
|
88
|
-
- brainstorm_dir: {brainstorm_dir}
|
|
89
|
-
- role_analysis_paths: {role_analysis_paths}
|
|
90
|
-
- participating_roles: {participating_roles}
|
|
91
|
-
|
|
92
|
-
##
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- Action: Load original user intent as primary reference
|
|
100
|
-
- Command: Read({brainstorm_dir}/../workflow-session.json)
|
|
101
|
-
- Output: original_user_intent (from project/description field)
|
|
102
|
-
|
|
103
|
-
2. **load_role_analyses**
|
|
104
|
-
- Action: Load all role analysis documents
|
|
105
|
-
- Command: For each path in role_analysis_paths: Read({brainstorm_dir}/{path})
|
|
106
|
-
- Output: role_analyses_content_map = {role_name: content}
|
|
107
|
-
|
|
108
|
-
3. **cross_role_analysis**
|
|
109
|
-
- Action: Identify consensus themes, conflicts, gaps, underspecified areas
|
|
110
|
-
- Output: consensus_themes, conflicting_views, gaps_list, ambiguities
|
|
111
|
-
|
|
112
|
-
4. **generate_recommendations**
|
|
113
|
-
- Action: Convert cross-role analysis findings into structured enhancement recommendations
|
|
114
|
-
- Format: EP-001, EP-002, ... (sequential numbering)
|
|
115
|
-
- Fields: id, title, affected_roles, category, current_state, enhancement, rationale, priority
|
|
116
|
-
- Taxonomy: Map to 9 categories (User Intent, Requirements, Architecture, UX, Feasibility, Risk, Process, Decisions, Terminology)
|
|
117
|
-
- Output: enhancement_recommendations (JSON array)
|
|
118
|
-
|
|
119
|
-
### Output to Main Flow
|
|
120
|
-
Return JSON array:
|
|
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
|
|
121
135
|
[
|
|
122
136
|
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
...
|
|
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
|
+
}
|
|
133
146
|
]
|
|
134
|
-
|
|
135
|
-
"
|
|
147
|
+
`)
|
|
136
148
|
```
|
|
137
149
|
|
|
138
|
-
### Phase 4:
|
|
150
|
+
### Phase 4: User Interaction
|
|
139
151
|
|
|
140
|
-
**
|
|
152
|
+
**All interactions via AskUserQuestion (Chinese questions)**
|
|
141
153
|
|
|
142
|
-
|
|
154
|
+
#### Step 1: Enhancement Selection
|
|
143
155
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
```javascript
|
|
157
|
+
// If enhancements > 4, split into multiple rounds
|
|
158
|
+
const enhancements = [...]; // from Phase 3A
|
|
159
|
+
const BATCH_SIZE = 4;
|
|
147
160
|
|
|
148
|
-
|
|
161
|
+
for (let i = 0; i < enhancements.length; i += BATCH_SIZE) {
|
|
162
|
+
const batch = enhancements.slice(i, i + BATCH_SIZE);
|
|
149
163
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
+
})
|
|
153
175
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
说明:明确用户需求优先级和验收标准
|
|
176
|
+
// Store selections before next round
|
|
177
|
+
}
|
|
157
178
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
说明:统一异常处理和降级方案
|
|
179
|
+
// User can also skip: provide "跳过" option
|
|
180
|
+
```
|
|
161
181
|
|
|
162
|
-
|
|
163
|
-
|
|
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
|
+
}
|
|
164
210
|
```
|
|
165
211
|
|
|
166
|
-
|
|
167
|
-
- ✅ **ALL questions in Chinese (所有问题必须用中文)**
|
|
168
|
-
- Use 9-category taxonomy scan results
|
|
169
|
-
- Prioritize most critical questions (no hard limit)
|
|
170
|
-
- Each with 2-4 options + descriptions
|
|
212
|
+
### Question Guidelines
|
|
171
213
|
|
|
172
|
-
|
|
173
|
-
```markdown
|
|
174
|
-
===== Clarification 问题 (第 1/2 轮) =====
|
|
175
|
-
|
|
176
|
-
【问题1 - 用户意图】MVP 阶段的核心目标是什么?
|
|
177
|
-
a) 快速验证市场需求
|
|
178
|
-
说明:最小功能集,快速上线获取反馈
|
|
179
|
-
b) 建立技术壁垒
|
|
180
|
-
说明:完善架构,为长期发展打基础
|
|
181
|
-
c) 实现功能完整性
|
|
182
|
-
说明:覆盖所有规划功能,延迟上线
|
|
183
|
-
|
|
184
|
-
【问题2 - 架构决策】技术栈选择的优先考虑因素?
|
|
185
|
-
a) 团队熟悉度
|
|
186
|
-
说明:使用现有技术栈,降低学习成本
|
|
187
|
-
b) 技术先进性
|
|
188
|
-
说明:采用新技术,提升竞争力
|
|
189
|
-
c) 生态成熟度
|
|
190
|
-
说明:选择成熟方案,保证稳定性
|
|
191
|
-
|
|
192
|
-
...(最多10个问题)
|
|
193
|
-
|
|
194
|
-
请回答 (格式: 1a 2b 3c...):
|
|
195
|
-
```
|
|
214
|
+
**Target**: 开发者(理解技术但需要从用户需求出发)
|
|
196
215
|
|
|
197
|
-
|
|
216
|
+
**Question Structure**: `[跨角色分析发现] + [需要澄清的决策点]`
|
|
217
|
+
**Option Structure**: `标签:[具体方案] + 说明:[业务影响] + [技术权衡]`
|
|
198
218
|
|
|
199
|
-
|
|
200
|
-
|
|
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
|
|
201
249
|
update_plan = {
|
|
202
250
|
"role1": {
|
|
203
|
-
"enhancements": [EP-001, EP-003],
|
|
251
|
+
"enhancements": ["EP-001", "EP-003"],
|
|
204
252
|
"clarifications": [
|
|
205
|
-
{"question": "...", "answer": "...", "category": "..."}
|
|
206
|
-
...
|
|
253
|
+
{"question": "...", "answer": "...", "category": "..."}
|
|
207
254
|
]
|
|
208
255
|
},
|
|
209
256
|
"role2": {
|
|
210
|
-
"enhancements": [EP-002],
|
|
257
|
+
"enhancements": ["EP-002"],
|
|
211
258
|
"clarifications": [...]
|
|
212
|
-
}
|
|
213
|
-
...
|
|
259
|
+
}
|
|
214
260
|
}
|
|
215
261
|
```
|
|
216
262
|
|
|
217
263
|
### Phase 5: Parallel Document Update Agents
|
|
218
264
|
|
|
219
|
-
**
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
# Execute in parallel using single message with multiple Task calls
|
|
265
|
+
**Execute in parallel** (one agent per role):
|
|
223
266
|
|
|
224
|
-
|
|
267
|
+
```javascript
|
|
268
|
+
// Single message with multiple Task calls for parallelism
|
|
269
|
+
Task(conceptual-planning-agent, `
|
|
225
270
|
## Agent Mission
|
|
226
|
-
Apply
|
|
227
|
-
|
|
228
|
-
##
|
|
229
|
-
-
|
|
230
|
-
-
|
|
231
|
-
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
### Flow Control Steps
|
|
244
|
-
**AGENT RESPONSIBILITY**: Execute these update steps sequentially:
|
|
245
|
-
|
|
246
|
-
1. **load_current_analysis**
|
|
247
|
-
- Action: Load existing role analysis document
|
|
248
|
-
- Command: Read({brainstorm_dir}/{role1}/analysis.md)
|
|
249
|
-
- Output: current_analysis_content
|
|
250
|
-
|
|
251
|
-
2. **add_clarifications_section**
|
|
252
|
-
- Action: Insert Clarifications section with Q&A
|
|
253
|
-
- Format: \"## Clarifications\\n### Session {date}\\n- **Q**: {question} (Category: {category})\\n **A**: {answer}\"
|
|
254
|
-
- Output: analysis_with_clarifications
|
|
255
|
-
|
|
256
|
-
3. **apply_enhancements**
|
|
257
|
-
- Action: Integrate EP-001, EP-003 into relevant sections
|
|
258
|
-
- Strategy: Locate section by category (Architecture → Architecture section, UX → User Experience section)
|
|
259
|
-
- Output: analysis_with_enhancements
|
|
260
|
-
|
|
261
|
-
4. **resolve_contradictions**
|
|
262
|
-
- Action: Remove conflicts between original content and clarifications/enhancements
|
|
263
|
-
- Output: contradiction_free_analysis
|
|
264
|
-
|
|
265
|
-
5. **enforce_terminology_consistency**
|
|
266
|
-
- Action: Align all terminology with user-confirmed choices from clarifications
|
|
267
|
-
- Output: terminology_consistent_analysis
|
|
268
|
-
|
|
269
|
-
6. **validate_user_intent_alignment**
|
|
270
|
-
- Action: Verify all updates support original_user_intent
|
|
271
|
-
- Output: validated_analysis
|
|
272
|
-
|
|
273
|
-
7. **write_updated_file**
|
|
274
|
-
- Action: Save final analysis document
|
|
275
|
-
- Command: Write({brainstorm_dir}/{role1}/analysis.md, validated_analysis)
|
|
276
|
-
- Output: File update confirmation
|
|
277
|
-
|
|
278
|
-
### Output
|
|
279
|
-
Updated {role1}/analysis.md with Clarifications section + enhanced content
|
|
280
|
-
")
|
|
281
|
-
|
|
282
|
-
Task(conceptual-planning-agent): "
|
|
283
|
-
## Agent Mission
|
|
284
|
-
Apply user-confirmed enhancements and clarifications to {role2} analysis document
|
|
285
|
-
|
|
286
|
-
## Agent Intent
|
|
287
|
-
- **Goal**: Integrate synthesis results into role-specific analysis
|
|
288
|
-
- **Scope**: Update ONLY {role2}/analysis.md (isolated, no cross-role dependencies)
|
|
289
|
-
- **Constraints**: Preserve original insights, add refinements without deletion
|
|
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_terminology → Align terminology
|
|
286
|
+
6. validate_intent → Verify alignment with user intent
|
|
287
|
+
7. write_updated_file → Save changes
|
|
290
288
|
|
|
291
|
-
##
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
- clarifications: [{question, answer, category}, ...] (user-confirmed answers)
|
|
296
|
-
- original_user_intent: {from session metadata}
|
|
289
|
+
## Output
|
|
290
|
+
Updated ${role}/analysis.md
|
|
291
|
+
`)
|
|
292
|
+
```
|
|
297
293
|
|
|
298
|
-
|
|
299
|
-
|
|
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
|
|
300
298
|
|
|
301
|
-
###
|
|
302
|
-
**AGENT RESPONSIBILITY**: Execute same 7 update steps as {role1} agent (load → clarifications → enhancements → contradictions → terminology → validation → write)
|
|
299
|
+
### Phase 6: Finalization
|
|
303
300
|
|
|
304
|
-
|
|
305
|
-
Updated {role2}/analysis.md with Clarifications section + enhanced content
|
|
306
|
-
")
|
|
301
|
+
#### Step 1: Update Context Package
|
|
307
302
|
|
|
308
|
-
|
|
309
|
-
|
|
303
|
+
```javascript
|
|
304
|
+
// Sync updated analyses to context-package.json
|
|
305
|
+
const context_pkg = Read(".workflow/active/WFS-{session}/.process/context-package.json")
|
|
310
306
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
-
|
|
314
|
-
|
|
315
|
-
- **Dependencies**: Zero cross-agent dependencies (full parallelism)
|
|
316
|
-
- **Validation**: All updates must align with original_user_intent
|
|
307
|
+
// Update guidance-specification if exists
|
|
308
|
+
// Update synthesis-specification if exists
|
|
309
|
+
// Re-read all role analysis files
|
|
310
|
+
// Update metadata timestamps
|
|
317
311
|
|
|
318
|
-
|
|
312
|
+
Write(context_pkg_path, JSON.stringify(context_pkg))
|
|
313
|
+
```
|
|
319
314
|
|
|
320
|
-
|
|
315
|
+
#### Step 2: Update Session Metadata
|
|
321
316
|
|
|
322
|
-
1. Wait for all parallel agents to complete
|
|
323
|
-
2. Update workflow-session.json:
|
|
324
317
|
```json
|
|
325
318
|
{
|
|
326
319
|
"phases": {
|
|
@@ -330,15 +323,13 @@ Updated {role2}/analysis.md with Clarifications section + enhanced content
|
|
|
330
323
|
"completed_at": "timestamp",
|
|
331
324
|
"participating_roles": [...],
|
|
332
325
|
"clarification_results": {
|
|
333
|
-
"enhancements_applied": ["EP-001", "EP-002"
|
|
326
|
+
"enhancements_applied": ["EP-001", "EP-002"],
|
|
334
327
|
"questions_asked": 3,
|
|
335
|
-
"categories_clarified": ["Architecture", "UX"
|
|
336
|
-
"roles_updated": ["role1", "role2"
|
|
337
|
-
"outstanding_items": []
|
|
328
|
+
"categories_clarified": ["Architecture", "UX"],
|
|
329
|
+
"roles_updated": ["role1", "role2"]
|
|
338
330
|
},
|
|
339
331
|
"quality_metrics": {
|
|
340
332
|
"user_intent_alignment": "validated",
|
|
341
|
-
"requirement_coverage": "comprehensive",
|
|
342
333
|
"ambiguity_resolution": "complete",
|
|
343
334
|
"terminology_consistency": "enforced"
|
|
344
335
|
}
|
|
@@ -347,7 +338,8 @@ Updated {role2}/analysis.md with Clarifications section + enhanced content
|
|
|
347
338
|
}
|
|
348
339
|
```
|
|
349
340
|
|
|
350
|
-
|
|
341
|
+
#### Step 3: Completion Report
|
|
342
|
+
|
|
351
343
|
```markdown
|
|
352
344
|
## ✅ Clarification Complete
|
|
353
345
|
|
|
@@ -359,9 +351,11 @@ Updated {role2}/analysis.md with Clarifications section + enhanced content
|
|
|
359
351
|
✅ PROCEED: `/workflow:plan --session WFS-{session-id}`
|
|
360
352
|
```
|
|
361
353
|
|
|
354
|
+
---
|
|
355
|
+
|
|
362
356
|
## Output
|
|
363
357
|
|
|
364
|
-
**Location**: `.workflow/active/WFS-{session}/.brainstorming/[role]/analysis*.md`
|
|
358
|
+
**Location**: `.workflow/active/WFS-{session}/.brainstorming/[role]/analysis*.md`
|
|
365
359
|
|
|
366
360
|
**Updated Structure**:
|
|
367
361
|
```markdown
|
|
@@ -381,116 +375,24 @@ Updated {role2}/analysis.md with Clarifications section + enhanced content
|
|
|
381
375
|
- Ambiguities resolved, placeholders removed
|
|
382
376
|
- Consistent terminology
|
|
383
377
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
**Purpose**: Sync updated role analyses to context-package.json to avoid stale cache
|
|
387
|
-
|
|
388
|
-
**Operations**:
|
|
389
|
-
```bash
|
|
390
|
-
context_pkg_path = ".workflow/active/WFS-{session}/.process/context-package.json"
|
|
391
|
-
|
|
392
|
-
# 1. Read existing package
|
|
393
|
-
context_pkg = Read(context_pkg_path)
|
|
394
|
-
|
|
395
|
-
# 2. Re-read brainstorm artifacts (now with synthesis enhancements)
|
|
396
|
-
brainstorm_dir = ".workflow/active/WFS-{session}/.brainstorming"
|
|
397
|
-
|
|
398
|
-
# 2.1 Update guidance-specification if exists
|
|
399
|
-
IF exists({brainstorm_dir}/guidance-specification.md):
|
|
400
|
-
context_pkg.brainstorm_artifacts.guidance_specification.content = Read({brainstorm_dir}/guidance-specification.md)
|
|
401
|
-
context_pkg.brainstorm_artifacts.guidance_specification.updated_at = NOW()
|
|
402
|
-
|
|
403
|
-
# 2.2 Update synthesis-specification if exists
|
|
404
|
-
IF exists({brainstorm_dir}/synthesis-specification.md):
|
|
405
|
-
IF context_pkg.brainstorm_artifacts.synthesis_output:
|
|
406
|
-
context_pkg.brainstorm_artifacts.synthesis_output.content = Read({brainstorm_dir}/synthesis-specification.md)
|
|
407
|
-
context_pkg.brainstorm_artifacts.synthesis_output.updated_at = NOW()
|
|
408
|
-
|
|
409
|
-
# 2.3 Re-read all role analysis files
|
|
410
|
-
role_analysis_files = Glob({brainstorm_dir}/*/analysis*.md)
|
|
411
|
-
context_pkg.brainstorm_artifacts.role_analyses = []
|
|
412
|
-
|
|
413
|
-
FOR file IN role_analysis_files:
|
|
414
|
-
role_name = extract_role_from_path(file) # e.g., "ui-designer"
|
|
415
|
-
relative_path = file.replace({brainstorm_dir}/, "")
|
|
416
|
-
|
|
417
|
-
context_pkg.brainstorm_artifacts.role_analyses.push({
|
|
418
|
-
"role": role_name,
|
|
419
|
-
"files": [{
|
|
420
|
-
"path": relative_path,
|
|
421
|
-
"type": "primary",
|
|
422
|
-
"content": Read(file),
|
|
423
|
-
"updated_at": NOW()
|
|
424
|
-
}]
|
|
425
|
-
})
|
|
426
|
-
|
|
427
|
-
# 3. Update metadata
|
|
428
|
-
context_pkg.metadata.updated_at = NOW()
|
|
429
|
-
context_pkg.metadata.synthesis_timestamp = NOW()
|
|
430
|
-
|
|
431
|
-
# 4. Write back
|
|
432
|
-
Write(context_pkg_path, JSON.stringify(context_pkg, indent=2))
|
|
433
|
-
|
|
434
|
-
REPORT: "✅ Updated context-package.json with synthesis results"
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
**TodoWrite Update**:
|
|
438
|
-
```json
|
|
439
|
-
{"content": "Update context package with synthesis results", "status": "completed", "activeForm": "Updating context package"}
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
## Session Metadata
|
|
443
|
-
|
|
444
|
-
Update `workflow-session.json`:
|
|
445
|
-
|
|
446
|
-
```json
|
|
447
|
-
{
|
|
448
|
-
"phases": {
|
|
449
|
-
"BRAINSTORM": {
|
|
450
|
-
"status": "clarification_completed",
|
|
451
|
-
"clarification_completed": true,
|
|
452
|
-
"completed_at": "timestamp",
|
|
453
|
-
"participating_roles": ["product-manager", "system-architect", ...],
|
|
454
|
-
"clarification_results": {
|
|
455
|
-
"questions_asked": 3,
|
|
456
|
-
"categories_clarified": ["Architecture & Design", ...],
|
|
457
|
-
"roles_updated": ["system-architect", "ui-designer", ...],
|
|
458
|
-
"outstanding_items": []
|
|
459
|
-
},
|
|
460
|
-
"quality_metrics": {
|
|
461
|
-
"user_intent_alignment": "validated",
|
|
462
|
-
"requirement_coverage": "comprehensive",
|
|
463
|
-
"ambiguity_resolution": "complete",
|
|
464
|
-
"terminology_consistency": "enforced",
|
|
465
|
-
"decision_transparency": "documented"
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
```
|
|
378
|
+
---
|
|
471
379
|
|
|
472
380
|
## Quality Checklist
|
|
473
381
|
|
|
474
382
|
**Content**:
|
|
475
|
-
- All role analyses loaded/analyzed
|
|
476
|
-
- Cross-role analysis (consensus, conflicts, gaps)
|
|
477
|
-
- 9-category ambiguity scan
|
|
478
|
-
- Questions prioritized
|
|
479
|
-
- Clarifications documented
|
|
383
|
+
- ✅ All role analyses loaded/analyzed
|
|
384
|
+
- ✅ Cross-role analysis (consensus, conflicts, gaps)
|
|
385
|
+
- ✅ 9-category ambiguity scan
|
|
386
|
+
- ✅ Questions prioritized
|
|
480
387
|
|
|
481
388
|
**Analysis**:
|
|
482
|
-
- User intent validated
|
|
483
|
-
- Cross-role synthesis complete
|
|
484
|
-
- Ambiguities resolved
|
|
485
|
-
-
|
|
486
|
-
- Terminology consistent
|
|
487
|
-
- Contradictions removed
|
|
389
|
+
- ✅ User intent validated
|
|
390
|
+
- ✅ Cross-role synthesis complete
|
|
391
|
+
- ✅ Ambiguities resolved
|
|
392
|
+
- ✅ Terminology consistent
|
|
488
393
|
|
|
489
394
|
**Documents**:
|
|
490
|
-
- Clarifications section formatted
|
|
491
|
-
- Sections reflect answers
|
|
492
|
-
- No placeholders (TODO/TBD)
|
|
493
|
-
- Valid Markdown
|
|
494
|
-
- Cross-references maintained
|
|
495
|
-
|
|
496
|
-
|
|
395
|
+
- ✅ Clarifications section formatted
|
|
396
|
+
- ✅ Sections reflect answers
|
|
397
|
+
- ✅ No placeholders (TODO/TBD)
|
|
398
|
+
- ✅ Valid Markdown
|