claude-code-workflow 7.2.29 → 7.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
  2. package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
  3. package/.claude/agents/action-planning-agent.md +7 -4
  4. package/.claude/agents/cli-explore-agent.md +77 -63
  5. package/.claude/agents/cli-lite-planning-agent.md +11 -10
  6. package/.claude/agents/issue-plan-agent.md +421 -426
  7. package/.claude/commands/workflow/spec/setup.md +1 -1
  8. package/.claude/skills/ccw-chain/SKILL.md +119 -0
  9. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
  10. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
  11. package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
  12. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
  13. package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
  14. package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
  15. package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
  16. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
  17. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
  18. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
  19. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
  20. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
  21. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
  22. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
  23. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
  24. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
  25. package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
  26. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
  27. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
  28. package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
  29. package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
  30. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
  31. package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
  32. package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
  33. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
  34. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
  35. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
  36. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
  37. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
  38. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
  39. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
  40. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
  41. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
  42. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
  43. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
  44. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
  45. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
  46. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
  47. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
  48. package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
  49. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
  50. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
  51. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
  52. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
  53. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
  54. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
  55. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
  56. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
  57. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
  58. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
  59. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
  60. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
  61. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
  62. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
  63. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
  64. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
  65. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
  66. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
  67. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
  68. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
  69. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
  70. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
  71. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
  72. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
  73. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
  74. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
  75. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
  76. package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
  77. package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
  78. package/.claude/skills/chain-loader/SKILL.md +78 -0
  79. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
  80. package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
  81. package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
  82. package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
  83. package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
  84. package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
  85. package/.claude/skills/review-cycle/phases/review-module.md +764 -764
  86. package/.claude/skills/review-cycle/phases/review-session.md +775 -775
  87. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
  88. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
  89. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
  90. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
  91. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
  92. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
  93. package/README.md +14 -0
  94. package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
  95. package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
  96. package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
  97. package/ccw/dist/tools/chain-loader.d.ts +10 -0
  98. package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
  99. package/ccw/dist/tools/chain-loader.js +642 -0
  100. package/ccw/dist/tools/chain-loader.js.map +1 -0
  101. package/ccw/dist/tools/index.d.ts.map +1 -1
  102. package/ccw/dist/tools/index.js +2 -0
  103. package/ccw/dist/tools/index.js.map +1 -1
  104. package/ccw/dist/tools/json-builder.js +20 -0
  105. package/ccw/dist/tools/json-builder.js.map +1 -1
  106. package/ccw/dist/types/chain-types.d.ts +72 -0
  107. package/ccw/dist/types/chain-types.d.ts.map +1 -0
  108. package/ccw/dist/types/chain-types.js +5 -0
  109. package/ccw/dist/types/chain-types.js.map +1 -0
  110. package/ccw/scripts/prepublish-clean.mjs +0 -1
  111. package/package.json +1 -3
  112. package/ccw-litellm/README.md +0 -180
  113. package/ccw-litellm/pyproject.toml +0 -35
  114. package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
  115. package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
  116. package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
  117. package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
  118. package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
  119. package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
  120. package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
  121. package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
  122. package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
  123. package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
  124. package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
@@ -0,0 +1,827 @@
1
+ # Phase 4: Synthesis Integration
2
+
3
+ Six-phase workflow to eliminate ambiguities, generate per-feature specifications through cross-role analysis and user clarification, with conditional quality review.
4
+
5
+ ## Objective
6
+
7
+ - Discover and validate all role analysis files (read-only, never modify originals)
8
+ - Execute cross-role analysis to identify consensus, conflicts, and gaps
9
+ - Present enhancement recommendations and clarification questions to user
10
+ - Generate consolidated feature specifications as final synthesis artifact
11
+ - Conditional quality review based on task complexity
12
+ - Update context package and session metadata
13
+
14
+ ## Design Principles
15
+
16
+ 1. **原始角色产出不可变** — 角色分析文档是各角色的原始视角,综合阶段只读不写
17
+ 2. **Spec 作为最终信物** — 所有综合决策、冲突解决、用户澄清都体现在 spec 中,不倒灌回角色文档
18
+ 3. **单 Agent 顺序生成** — 一个 Spec Agent 加载一次上下文,顺序生成所有 spec,跨 feature 决策可传递复用
19
+ 4. **按需校验** — Review Agent 由 Spec Agent 根据复杂度自判断触发,非必须环节
20
+
21
+ ## Auto Mode
22
+
23
+ When `--yes` or `-y`: Auto-select all enhancements, skip clarification questions, use default answers.
24
+
25
+ ## Quick Reference
26
+
27
+ ### Phase Summary
28
+
29
+ | Phase | Goal | Executor | Output |
30
+ |-------|------|----------|--------|
31
+ | 1 | Session detection | Main flow | session_id, brainstorm_dir |
32
+ | 2 | File discovery | Main flow | role_analysis_paths |
33
+ | 3A | Cross-role analysis | Agent | enhancement_recommendations, feature_conflict_map |
34
+ | 4 | User interaction | Main flow + AskUserQuestion | spec_context |
35
+ | 5 | Spec generation + conditional review | Spec Agent → Review Agent | feature-specs/, feature-index.json, synthesis-changelog.md |
36
+ | 6 | Finalization | Main flow | context-package.json, report |
37
+
38
+ ### AskUserQuestion Pattern
39
+
40
+ ```javascript
41
+ // Enhancement selection (multi-select)
42
+ AskUserQuestion({
43
+ questions: [{
44
+ question: "请选择要应用的改进建议",
45
+ header: "改进选择",
46
+ multiSelect: true,
47
+ options: [
48
+ { label: "EP-001: API Contract", description: "添加详细的请求/响应 schema 定义" },
49
+ { label: "EP-002: User Intent", description: "明确用户需求优先级和验收标准" }
50
+ ]
51
+ }]
52
+ })
53
+
54
+ // Clarification questions (single-select, multi-round)
55
+ AskUserQuestion({
56
+ questions: [
57
+ {
58
+ question: "MVP 阶段的核心目标是什么?",
59
+ header: "用户意图",
60
+ multiSelect: false,
61
+ options: [
62
+ { label: "快速验证", description: "最小功能集,快速上线获取反馈" },
63
+ { label: "技术壁垒", description: "完善架构,为长期发展打基础" },
64
+ { label: "功能完整", description: "覆盖所有规划功能,延迟上线" }
65
+ ]
66
+ }
67
+ ]
68
+ })
69
+ ```
70
+
71
+ ## Task Tracking
72
+
73
+ ```json
74
+ [
75
+ {"content": "Detect session and validate analyses", "status": "pending", "activeForm": "Detecting session"},
76
+ {"content": "Discover role analysis file paths", "status": "pending", "activeForm": "Discovering paths"},
77
+ {"content": "Execute analysis agent (cross-role analysis + feature conflict map)", "status": "pending", "activeForm": "Executing analysis"},
78
+ {"content": "Present enhancements via AskUserQuestion", "status": "pending", "activeForm": "Selecting enhancements"},
79
+ {"content": "Clarification questions via AskUserQuestion", "status": "pending", "activeForm": "Clarifying"},
80
+ {"content": "Execute Spec Agent (generate specs + index + changelog)", "status": "pending", "activeForm": "Generating specs"},
81
+ {"content": "Conditional Review Agent", "status": "pending", "activeForm": "Reviewing specs"},
82
+ {"content": "Update context package and metadata", "status": "pending", "activeForm": "Finalizing"}
83
+ ]
84
+ ```
85
+
86
+ ## Execution
87
+
88
+ ### Phase 1: Discovery & Validation
89
+
90
+ 1. **Detect Session**: Use `--session` parameter or find `.workflow/active/WFS-*`
91
+ 2. **Validate Files**:
92
+ - `guidance-specification.md` (optional, warn if missing)
93
+ - `*/analysis*.md` (required, error if empty)
94
+ 3. **Load User Intent**: Extract from `workflow-session.json`
95
+ 4. **Detect Feature Mode**: Check if role analyses use feature-point organization
96
+ ```javascript
97
+ // Feature mode is active when:
98
+ // 1. guidance-specification.md contains Feature Decomposition table
99
+ // 2. Role directories contain analysis-F-{id}-*.md files
100
+ const has_feature_decomposition = guidanceSpecContent &&
101
+ guidanceSpecContent.includes('Feature Decomposition');
102
+ const has_feature_subdocs = Glob(`${brainstorm_dir}/*/analysis-F-*-*.md`).length > 0;
103
+ const feature_mode = has_feature_decomposition && has_feature_subdocs;
104
+
105
+ // Extract feature_list from guidance-spec if feature_mode
106
+ if (feature_mode) {
107
+ feature_list = extractFeatureDecompositionTable(guidanceSpecContent);
108
+ // feature_list: [{id, slug, description, roles, priority}, ...]
109
+ }
110
+ ```
111
+
112
+ ### Phase 2: Role Discovery & Path Preparation
113
+
114
+ **Main flow prepares file paths for Agent**:
115
+
116
+ 1. **Discover Analysis Files**:
117
+ - Glob: `.workflow/active/WFS-{session}/.brainstorming/*/analysis*.md`
118
+ - Supports: analysis.md + analysis-{slug}.md (max 5)
119
+
120
+ 2. **Extract Role Information**:
121
+ - `role_analysis_paths`: Relative paths
122
+ - `participating_roles`: Role names from directories
123
+
124
+ 3. **Pass to Agent**: session_id, brainstorm_dir, role_analysis_paths, participating_roles
125
+
126
+ ### Phase 3A: Analysis & Enhancement Agent
127
+
128
+ **Agent executes cross-role analysis**:
129
+
130
+ **Input Optimization (feature_mode)**: When feature_mode is active, only read `{role}/analysis.md` index files (NOT sub-documents like `analysis-F-{id}-*.md` or `analysis-cross-cutting.md`). This reduces input tokens from ~39K to ~4.5K while preserving the role perspective overview, feature point index, and cross-cutting summary needed for conflict detection.
131
+
132
+ **Input (fallback mode)**: When feature_mode is NOT active, read all `{role}/analysis*.md` files as before.
133
+
134
+ ```javascript
135
+ // Prepare input paths based on mode
136
+ const analysis_input_paths = feature_mode
137
+ ? participating_roles.map(r => `${brainstorm_dir}/${r}/analysis.md`) // Index files only (~4.5K total)
138
+ : role_analysis_paths; // All analysis files (fallback)
139
+
140
+ Task(conceptual-planning-agent, `
141
+ ## Agent Mission
142
+ Analyze role documents, identify conflicts/gaps, generate enhancement recommendations.
143
+ ${feature_mode ? 'Additionally, generate feature_conflict_map for per-feature consensus/conflicts across roles.' : ''}
144
+
145
+ ## Input
146
+ - brainstorm_dir: ${brainstorm_dir}
147
+ - analysis_input_paths: ${analysis_input_paths}
148
+ - participating_roles: ${participating_roles}
149
+ - feature_mode: ${feature_mode}
150
+ ${feature_mode ? `- guidance_spec_path: ${brainstorm_dir}/guidance-specification.md (read Feature Decomposition section only)` : ''}
151
+
152
+ ## Flow Control Steps
153
+ 1. load_session_metadata → Read workflow-session.json
154
+ 2. load_role_analyses → Read analysis files from analysis_input_paths
155
+ ${feature_mode ? '(INDEX files only - each ~500-800 words with role overview, feature index table, cross-cutting summary)' : '(All analysis files)'}
156
+ ${feature_mode ? `3. load_feature_decomposition → Read Feature Decomposition table from guidance-specification.md
157
+ 4. cross_role_analysis → Identify consensus, conflicts, gaps, ambiguities
158
+ 5. generate_feature_conflict_map → For each feature in Feature Decomposition, extract per-feature consensus/conflicts/cross-references from role index summaries
159
+ 6. generate_recommendations → Format as EP-001, EP-002, ...` : `3. cross_role_analysis → Identify consensus, conflicts, gaps, ambiguities
160
+ 4. generate_recommendations → Format as EP-001, EP-002, ...`}
161
+
162
+ ## Output Format
163
+
164
+ ### enhancement_recommendations (always)
165
+ [
166
+ {
167
+ "id": "EP-001",
168
+ "title": "API Contract Specification",
169
+ "affected_roles": ["system-architect", "api-designer"],
170
+ "category": "Architecture",
171
+ "current_state": "High-level API descriptions",
172
+ "enhancement": "Add detailed contract definitions",
173
+ "rationale": "Enables precise implementation",
174
+ "priority": "High"
175
+ }
176
+ ]
177
+
178
+ ${feature_mode ? `### feature_conflict_map (feature_mode only)
179
+ Bridge artifact from Phase 3A to Phase 5. One entry per feature from Feature Decomposition.
180
+
181
+ {
182
+ "F-001": {
183
+ "consensus": [
184
+ "All roles agree on real-time sync via WebSocket",
185
+ "Event-driven architecture preferred"
186
+ ],
187
+ "conflicts": [
188
+ {
189
+ "topic": "State management approach",
190
+ "views": {
191
+ "system-architect": "Server-authoritative with CRDT",
192
+ "ux-expert": "Optimistic local-first updates"
193
+ },
194
+ "resolution": "Hybrid: optimistic local with server reconciliation via CRDT because balances UX responsiveness with data consistency, tradeoff: increased client complexity",
195
+ "confidence": "[RESOLVED]",
196
+ "applies_when": "Online mode with collaborative editing"
197
+ }
198
+ ],
199
+ "cross_refs": [
200
+ "F-003 (offline-mode) depends on sync conflict resolution strategy"
201
+ ]
202
+ }
203
+ }
204
+
205
+ **feature_conflict_map Rules**:
206
+ - One entry per feature ID from guidance-specification.md Feature Decomposition
207
+ - consensus[]: Statements where 2+ roles explicitly agree
208
+ - conflicts[]: Disagreements with topic, per-role positions, and suggested resolution
209
+ - cross_refs[]: References to other features or cross-cutting docs
210
+ - If a feature has no conflicts, set conflicts to empty array
211
+ - Keep each entry concise: aim for 100-200 words per feature
212
+
213
+ **Resolution Quality Requirements**:
214
+ 1. **Actionable**: resolution must be directly executable. Bad: "需要权衡" → Good: "采用 JWT 无状态认证,RefreshToken 存 HttpOnly Cookie"
215
+ 2. **Justified**: Explain why. Format: "[方案] because [原因],tradeoff: [代价]"
216
+ 3. **Scoped**: If limited scope, mark "Applies when: [条件]"
217
+ 4. **Confidence**: [RESOLVED] | [SUGGESTED] | [UNRESOLVED]
218
+ ` : ''}
219
+ `)
220
+ ```
221
+
222
+ **Phase 3A Output Storage**:
223
+ ```javascript
224
+ // Store enhancement_recommendations for Phase 4
225
+ const enhancement_recommendations = agent_output.enhancement_recommendations;
226
+
227
+ // Store feature_conflict_map for Phase 5 Spec Agent (feature_mode only)
228
+ const feature_conflict_map = feature_mode ? agent_output.feature_conflict_map : null;
229
+ ```
230
+
231
+ ### Phase 4: User Interaction
232
+
233
+ **All interactions via AskUserQuestion (Chinese questions)**
234
+
235
+ #### Step 1: Enhancement Selection
236
+
237
+ ```javascript
238
+ // If enhancements > 4, split into multiple rounds
239
+ const enhancements = [...]; // from Phase 3A
240
+ const BATCH_SIZE = 4;
241
+
242
+ for (let i = 0; i < enhancements.length; i += BATCH_SIZE) {
243
+ const batch = enhancements.slice(i, i + BATCH_SIZE);
244
+
245
+ AskUserQuestion({
246
+ questions: [{
247
+ question: `请选择要应用的改进建议 (第${Math.floor(i/BATCH_SIZE)+1}轮)`,
248
+ header: "改进选择",
249
+ multiSelect: true,
250
+ options: batch.map(ep => ({
251
+ label: `${ep.id}: ${ep.title}`,
252
+ description: `影响: ${ep.affected_roles.join(', ')} | ${ep.enhancement}`
253
+ }))
254
+ }]
255
+ })
256
+
257
+ // Store selections before next round
258
+ }
259
+
260
+ // User can also skip: provide "跳过" option
261
+ ```
262
+
263
+ #### Step 2: Clarification Questions
264
+
265
+ ```javascript
266
+ // Generate questions based on 9-category taxonomy scan
267
+ // Categories: User Intent, Requirements, Architecture, UX, Feasibility, Risk, Process, Decisions, Terminology
268
+
269
+ const clarifications = [...]; // from analysis
270
+ const BATCH_SIZE = 4;
271
+
272
+ for (let i = 0; i < clarifications.length; i += BATCH_SIZE) {
273
+ const batch = clarifications.slice(i, i + BATCH_SIZE);
274
+ const currentRound = Math.floor(i / BATCH_SIZE) + 1;
275
+ const totalRounds = Math.ceil(clarifications.length / BATCH_SIZE);
276
+
277
+ AskUserQuestion({
278
+ questions: batch.map(q => ({
279
+ question: q.question,
280
+ header: q.category.substring(0, 12),
281
+ multiSelect: false,
282
+ options: q.options.map(opt => ({
283
+ label: opt.label,
284
+ description: opt.description
285
+ }))
286
+ }))
287
+ })
288
+
289
+ // Store answers before next round
290
+ }
291
+ ```
292
+
293
+ ### Question Guidelines
294
+
295
+ **Target**: 开发者(理解技术但需要从用户需求出发)
296
+
297
+ **Question Structure**: `[跨角色分析发现] + [需要澄清的决策点]`
298
+ **Option Structure**: `标签:[具体方案] + 说明:[业务影响] + [技术权衡]`
299
+
300
+ **9-Category Taxonomy**:
301
+
302
+ | Category | Focus | Example Question Pattern |
303
+ |----------|-------|--------------------------|
304
+ | User Intent | 用户目标 | "MVP阶段核心目标?" + 验证/壁垒/完整性 |
305
+ | Requirements | 需求细化 | "功能优先级如何排序?" + 核心/增强/可选 |
306
+ | Architecture | 架构决策 | "技术栈选择考量?" + 熟悉度/先进性/成熟度 |
307
+ | UX | 用户体验 | "交互复杂度取舍?" + 简洁/丰富/渐进 |
308
+ | Feasibility | 可行性 | "资源约束下的范围?" + 最小/标准/完整 |
309
+ | Risk | 风险管理 | "风险容忍度?" + 保守/平衡/激进 |
310
+ | Process | 流程规范 | "迭代节奏?" + 快速/稳定/灵活 |
311
+ | Decisions | 决策确认 | "冲突解决方案?" + 方案A/方案B/折中 |
312
+ | Terminology | 术语统一 | "统一使用哪个术语?" + 术语A/术语B |
313
+
314
+ **Quality Rules**:
315
+
316
+ **MUST Include**:
317
+ - All questions in Chinese (用中文提问)
318
+ - 基于跨角色分析的具体发现
319
+ - 选项包含业务影响说明
320
+ - 解决实际的模糊点或冲突
321
+
322
+ **MUST Avoid**:
323
+ - 与角色分析无关的通用问题
324
+ - 重复已在 artifacts 阶段确认的内容
325
+ - 过于细节的实现级问题
326
+
327
+ #### Step 3: Build Spec Context
328
+
329
+ ```javascript
330
+ // Unified context for Spec Agent (replaces per-role update_plan)
331
+ spec_context = {
332
+ selected_enhancements: selected_eps, // ["EP-001", "EP-002", ...]
333
+ enhancement_details: enhancements.filter(ep => selected_eps.includes(ep.id)),
334
+ clarification_answers: [
335
+ { question: "...", answer: "...", category: "..." }
336
+ ],
337
+ original_user_intent: intent
338
+ }
339
+ ```
340
+
341
+ ### Phase 5: Spec Generation & Conditional Review
342
+
343
+ **Single Spec Agent generates all outputs sequentially, then self-evaluates complexity to decide whether to trigger Review Agent.**
344
+
345
+ **Skip condition (feature_mode = false)**: Spec Agent generates a single `synthesis-specification.md` instead of per-feature specs. Feature-index.json is skipped. All other logic (changelog, review) still applies.
346
+
347
+ #### Step 1: Prepare Input
348
+
349
+ ```javascript
350
+ const feature_specs_dir = `${brainstorm_dir}/feature-specs`;
351
+ // Ensure directory exists (create if not) [feature_mode only]
352
+
353
+ // Build per-feature input bundles [feature_mode only]
354
+ const feature_bundles = feature_list.map(feature => {
355
+ const fid = feature.id;
356
+ const slug = feature.slug;
357
+
358
+ const role_analysis_files = participating_roles
359
+ .map(role => `${brainstorm_dir}/${role}/analysis-${fid}-${slug}.md`)
360
+ .filter(path => fileExists(path));
361
+
362
+ return {
363
+ feature_id: fid,
364
+ feature_slug: slug,
365
+ feature_name: feature.description,
366
+ feature_priority: feature.priority,
367
+ conflict_map_entry: feature_conflict_map[fid],
368
+ role_analysis_files: role_analysis_files,
369
+ contributing_roles: role_analysis_files.map(f => extractRoleName(f)),
370
+ output_path: `${feature_specs_dir}/${fid}-${slug}.md`
371
+ };
372
+ });
373
+ ```
374
+
375
+ #### Step 2: Execute Spec Agent
376
+
377
+ ```javascript
378
+ Task(conceptual-planning-agent, `
379
+ ## Agent Mission
380
+ Generate all feature specifications sequentially, produce feature-index.json and synthesis-changelog.md.
381
+ After generation, self-evaluate complexity and output complexity_score.
382
+
383
+ ## Input
384
+ - brainstorm_dir: ${brainstorm_dir}
385
+ - feature_mode: ${feature_mode}
386
+ - participating_roles: ${participating_roles}
387
+ ${feature_mode ? `- feature_bundles: ${JSON.stringify(feature_bundles)}
388
+ - feature_conflict_map: ${JSON.stringify(feature_conflict_map)}` : `- role_analysis_paths: ${role_analysis_paths}`}
389
+ - spec_context: ${JSON.stringify(spec_context)}
390
+ - guidance_spec_path: ${brainstorm_dir}/guidance-specification.md
391
+
392
+ ## Flow Control Steps
393
+
394
+ ### Step 1: Load Context (once)
395
+ 1. Read guidance-specification.md
396
+ 2. Read spec_context (enhancements + clarifications + user intent)
397
+ ${feature_mode
398
+ ? '3. Load feature_conflict_map into working memory'
399
+ : '3. Read all role analysis files'}
400
+
401
+ ### Step 2: Generate Specs
402
+ ${feature_mode ? `
403
+ For EACH feature in feature_bundles (sequentially):
404
+ a. Read role-specific analysis files for this feature
405
+ (Each file ~1500-2000 words, total ~6.5K words for 3-4 roles)
406
+ b. Apply conflict_map_entry to identify resolved/unresolved conflicts
407
+ c. Apply four-layer aggregation rules (see below)
408
+ d. Apply relevant enhancements from spec_context.enhancement_details
409
+ e. Incorporate relevant clarification answers from spec_context.clarification_answers
410
+ f. Generate feature spec using template (see below)
411
+ g. Write to feature_bundles[i].output_path
412
+
413
+ **Cross-feature context**: Decisions made in earlier features carry forward.
414
+ When a later feature references an earlier one, use the actual decision (not re-analyze).
415
+ ` : `
416
+ Generate a single synthesis-specification.md:
417
+ a. Read all role analysis files
418
+ b. Apply cross-role conflict resolution
419
+ c. Incorporate selected enhancements and clarification answers
420
+ d. Write consolidated synthesis to ${brainstorm_dir}/synthesis-specification.md
421
+ `}
422
+
423
+ ### Step 3: Generate feature-index.json [feature_mode only]
424
+
425
+ ${feature_mode ? `
426
+ Collect all generated spec paths and build structured index:
427
+
428
+ const feature_index = {
429
+ "version": "1.0",
430
+ "generated_at": new Date().toISOString(),
431
+ "session_id": "${session_id}",
432
+ "feature_mode": true,
433
+ "features": feature_bundles.map(fb => ({
434
+ "id": fb.feature_id,
435
+ "slug": fb.feature_slug,
436
+ "name": fb.feature_name,
437
+ "priority": fb.feature_priority,
438
+ "spec_path": "feature-specs/" + fb.feature_id + "-" + fb.feature_slug + ".md",
439
+ "contributing_roles": fb.contributing_roles,
440
+ "cross_cutting_refs": feature_conflict_map[fb.feature_id]
441
+ ? feature_conflict_map[fb.feature_id].cross_refs : []
442
+ })),
443
+ "cross_cutting_specs": participating_roles
444
+ .filter(role => fileExists(brainstorm_dir + "/" + role + "/analysis-cross-cutting.md"))
445
+ .map(role => role + "/analysis-cross-cutting.md")
446
+ };
447
+
448
+ Write feature-index.json to ${brainstorm_dir}/feature-index.json
449
+ ` : 'Skip this step.'}
450
+
451
+ ### Step 4: Generate synthesis-changelog.md
452
+
453
+ Record all synthesis decisions as audit trail:
454
+
455
+ Write to ${brainstorm_dir}/synthesis-changelog.md:
456
+
457
+ ---
458
+ # Synthesis Changelog
459
+
460
+ **Session**: ${session_id}
461
+ **Generated**: {timestamp}
462
+
463
+ ## Enhancements Applied
464
+ For each selected enhancement:
465
+ - **{EP-ID}**: {title} — {how it was incorporated into which spec(s)}
466
+
467
+ ## Clarifications Resolved
468
+ For each clarification answer:
469
+ - **{Category}**: {question} → {answer} — {impact on specs}
470
+
471
+ ## Conflicts Resolved
472
+ For each conflict in feature_conflict_map:
473
+ - **{Feature ID} / {topic}**: {resolution} [{confidence}]
474
+
475
+ ## Unresolved Items
476
+ List any [DECISION NEEDED] or [UNRESOLVED] items remaining in specs.
477
+ ---
478
+
479
+ ### Step 5: Self-Evaluate Complexity
480
+
481
+ Compute complexity_score based on generation results:
482
+
483
+ | Dimension | Low (0) | Medium (1) | High (2) |
484
+ |-----------|---------|------------|----------|
485
+ | Feature count | ≤2 | 3-4 | ≥5 |
486
+ | UNRESOLVED conflicts | 0 | 1-2 | ≥3 |
487
+ | Participating roles | ≤2 | 3-4 | ≥5 |
488
+ | Cross-feature dependencies | 0 | 1-2 | ≥3 |
489
+
490
+ Output complexity_score (0-8) at the end of agent response.
491
+
492
+ ## Output
493
+ - Feature specs: ${feature_mode ? 'feature-specs/F-{id}-{slug}.md' : 'synthesis-specification.md'}
494
+ ${feature_mode ? '- feature-index.json' : ''}
495
+ - synthesis-changelog.md
496
+ - complexity_score: {number}
497
+
498
+ ${feature_mode ? `
499
+ ## Four-Layer Aggregation Rules
500
+
501
+ ### Layer 1: Direct Reference
502
+ - Quote role analyses directly when consensus exists
503
+ - Format: "[Role] recommends: [direct quote]"
504
+ - Use for undisputed technical recommendations
505
+
506
+ ### Layer 2: Structured Extraction
507
+ - Extract and organize key information from each role into unified structure
508
+ - Merge complementary perspectives
509
+ - De-duplicate overlapping content across roles
510
+
511
+ ### Layer 3: Conflict Distillation
512
+ - **[RESOLVED]**: State the resolution directly as a design decision. Format: "**Decision**: [resolution]. **Rationale**: [from conflict.resolution]. **Trade-off**: [tradeoff]."
513
+ - **[SUGGESTED]**: Adopt the suggested resolution but mark source. Format: "**Recommended**: [resolution] (suggested by Phase 3A cross-role analysis). **Rationale**: [reason]. **Alternative**: [strongest competing view]."
514
+ - **[UNRESOLVED]**: Do NOT pick a side. Present all options neutrally. Format: "**[DECISION NEEDED]**: [topic]. **Options**: [role1: approach1] vs [role2: approach2]. **Evaluation**: [pros/cons of each]. **Impact if deferred**: [consequence]."
515
+ - **Unresolved escalation**: If 2+ [UNRESOLVED] conflicts, add warning at top of Section 2
516
+
517
+ ### Layer 4: Cross-Feature Annotation
518
+ - Add explicit dependency notes with feature IDs
519
+ - Document integration points with other features
520
+ - Note shared constraints or patterns
521
+ ` : ''}
522
+
523
+ ${feature_mode ? `
524
+ ## Feature Spec Template (7 Sections, target 1500-2500 words)
525
+
526
+ ---
527
+ # Feature Spec: {feature_id} - {feature_name}
528
+
529
+ **Priority**: {feature_priority}
530
+ **Contributing Roles**: [list of roles]
531
+ **Status**: Draft (from synthesis)
532
+
533
+ ## 1. Requirements Summary
534
+ [Consolidated requirements from all role perspectives using RFC 2119 keywords]
535
+ - Functional requirements (from product-manager, product-owner) - use MUST/SHOULD/MAY
536
+ - User experience requirements (from ux-expert, ui-designer) - use MUST/SHOULD/MAY
537
+ - Technical requirements (from system-architect, data-architect, api-designer) - use MUST/SHOULD/MAY
538
+ - Domain requirements (from subject-matter-expert) - use MUST/SHOULD/MAY
539
+
540
+ **Example**:
541
+ - The feature MUST support user authentication via email/password
542
+ - The UI SHOULD provide real-time feedback within 100ms
543
+ - The system MAY cache user preferences for offline access
544
+
545
+ ## 2. Design Decisions [CORE SECTION]
546
+ [Key architectural and design decisions with rationale - 40%+ of word count]
547
+ For each decision:
548
+ - **Decision**: [What was decided - MUST use RFC 2119 keywords]
549
+ - **Context**: [Why this decision was needed]
550
+ - **Options Considered**: [Alternatives from different roles]
551
+ - **Chosen Approach**: [Selected option with rationale using MUST/SHOULD/MAY]
552
+ - **Trade-offs**: [What we gain vs. what we sacrifice]
553
+ - **Source**: [Which role(s) drove this decision]
554
+
555
+ **RFC 2119 Examples**:
556
+ - "The system MUST authenticate users before granting access"
557
+ - "The feature SHOULD cache frequently accessed data for performance"
558
+ - "The component MAY support OAuth2 authentication as an optional enhancement"
559
+
560
+ ## 3. Interface Contract
561
+ [API endpoints, data models, component interfaces]
562
+ - External interfaces (API contracts from api-designer)
563
+ - Internal interfaces (component boundaries from system-architect)
564
+ - Data interfaces (schemas from data-architect)
565
+ - User interfaces (interaction patterns from ux-expert/ui-designer)
566
+
567
+ ## 4. Constraints & Risks
568
+ [Technical constraints, business risks, mitigation strategies]
569
+ - Performance constraints (from system-architect)
570
+ - Data constraints (from data-architect)
571
+ - UX constraints (from ux-expert)
572
+ - Business/domain constraints (from subject-matter-expert)
573
+ - Risk mitigation strategies (from scrum-master)
574
+
575
+ ## 5. Acceptance Criteria
576
+ [Testable criteria for feature completion]
577
+ - Functional acceptance (from product-owner user stories)
578
+ - Performance acceptance (from system-architect NFRs)
579
+ - UX acceptance (from ux-expert usability criteria)
580
+ - Data integrity acceptance (from data-architect)
581
+
582
+ ## 6. Detailed Analysis References
583
+ [Pointers back to role-specific analysis documents]
584
+ - @../{role}/analysis-{feature_id}-{feature_slug}.md for each contributing role
585
+ - @../guidance-specification.md#feature-decomposition
586
+
587
+ ## 7. Cross-Feature Dependencies
588
+ [Dependencies on and from other features]
589
+ - **Depends on**: [Feature IDs this feature requires]
590
+ - **Required by**: [Feature IDs that depend on this feature]
591
+ - **Shared patterns**: References to analysis-cross-cutting.md patterns
592
+ - **Integration points**: [Specific interfaces between features]
593
+ ---
594
+
595
+ ## Feature Spec Completion Criteria
596
+ - All 7 sections populated with aggregated content
597
+ - Section 2 (Design Decisions) is the most detailed section (40%+ of word count)
598
+ - All conflicts from conflict_map_entry addressed with resolutions
599
+ - Cross-feature dependencies explicitly documented
600
+ - Word count between 1500-2500
601
+ - No placeholder text except [DECISION NEEDED] for genuinely unresolved items
602
+ ` : ''}
603
+ `)
604
+ ```
605
+
606
+ #### Step 3: Conditional Review Agent
607
+
608
+ **Trigger**: `complexity_score >= 4` (from Spec Agent output)
609
+
610
+ **Skip**: If `complexity_score < 4`, proceed directly to Phase 6 Finalization.
611
+
612
+ ```javascript
613
+ if (complexity_score >= 4) {
614
+ Task(conceptual-planning-agent, `
615
+ ## Agent Mission
616
+ Review all generated feature specs for cross-feature consistency and quality.
617
+ Read ONLY the generated specs (not role analysis originals) to minimize context.
618
+
619
+ ## Input
620
+ - brainstorm_dir: ${brainstorm_dir}
621
+ - feature_mode: ${feature_mode}
622
+ ${feature_mode
623
+ ? `- feature_spec_files: ${Glob(brainstorm_dir + '/feature-specs/F-*-*.md')}
624
+ - feature_index_path: ${brainstorm_dir}/feature-index.json`
625
+ : `- synthesis_spec_path: ${brainstorm_dir}/synthesis-specification.md`}
626
+ - changelog_path: ${brainstorm_dir}/synthesis-changelog.md
627
+
628
+ ## Review Checklist
629
+
630
+ ### 1. Cross-Feature Consistency
631
+ - Terminology: same concept uses same term across all specs
632
+ - Decisions: no contradictory decisions between features
633
+ - Technology choices: consistent stack across features
634
+
635
+ ### 2. Conflict Resolution Completeness
636
+ - All [UNRESOLVED] items have [DECISION NEEDED] markers
637
+ - All [RESOLVED] items state clear decision + rationale
638
+ - No silent conflicts (same topic, different decisions in different specs)
639
+
640
+ ### 3. Dependency Bidirectionality
641
+ - If F-001 "Depends on" F-003 → F-003 must have "Required by" F-001
642
+ - Cross-refs in feature-index.json match spec Section 7
643
+
644
+ ### 4. Enhancement & Clarification Coverage
645
+ - All selected enhancements (from changelog) reflected in relevant specs
646
+ - All clarification answers (from changelog) incorporated
647
+
648
+ ## Action Protocol
649
+ - **Minor issues** (typo, missing cross-ref, terminology inconsistency):
650
+ Fix directly in the spec file. Log fix in review_fixes[].
651
+ - **Major issues** (contradictory decisions, missing section, unaddressed conflict):
652
+ Add [REVIEW-FLAG] annotation inline. Log in review_flags[].
653
+
654
+ ## Output Format
655
+ Append to synthesis-changelog.md:
656
+
657
+ ## Review Results
658
+ **Complexity Score**: {score}
659
+ **Specs Reviewed**: {count}
660
+ **Minor Fixes Applied**: {count}
661
+ **Major Flags Raised**: {count}
662
+
663
+ ### Fixes Applied
664
+ - {spec_file}: {description of fix}
665
+
666
+ ### Flags Raised
667
+ - {spec_file}: [REVIEW-FLAG] {description of issue}
668
+ `)
669
+ }
670
+ ```
671
+
672
+ **Review Agent Characteristics**:
673
+ - **Input**: Only generated specs + changelog (NOT role analysis originals)
674
+ - **Context budget**: ~10-15K words (much smaller than generation phase)
675
+ - **Write permission**: Can modify spec files for minor fixes; uses [REVIEW-FLAG] for major issues
676
+ - **Isolation**: Does not touch role analysis files or guidance-specification.md
677
+
678
+ ### Phase 6: Finalization
679
+
680
+ #### Step 1: Update Context Package
681
+
682
+ ```javascript
683
+ const context_pkg = Read(".workflow/active/WFS-{session}/.process/context-package.json")
684
+
685
+ // Update metadata timestamps
686
+ // Add spec paths
687
+
688
+ if (feature_mode) {
689
+ context_pkg.feature_index_path = `${brainstorm_dir}/feature-index.json`;
690
+ context_pkg.feature_specs_dir = `${brainstorm_dir}/feature-specs/`;
691
+ context_pkg.feature_mode = true;
692
+ } else {
693
+ context_pkg.synthesis_spec_path = `${brainstorm_dir}/synthesis-specification.md`;
694
+ }
695
+
696
+ context_pkg.changelog_path = `${brainstorm_dir}/synthesis-changelog.md`;
697
+
698
+ Write(context_pkg_path, JSON.stringify(context_pkg))
699
+ ```
700
+
701
+ #### Step 2: Update Session Metadata
702
+
703
+ ```json
704
+ {
705
+ "phases": {
706
+ "BRAINSTORM": {
707
+ "status": "synthesis_completed",
708
+ "completed_at": "timestamp",
709
+ "participating_roles": ["..."],
710
+ "synthesis_results": {
711
+ "enhancements_applied": ["EP-001", "EP-002"],
712
+ "questions_asked": 3,
713
+ "categories_clarified": ["Architecture", "UX"],
714
+ "complexity_score": 5,
715
+ "review_triggered": true,
716
+ "review_fixes": 2,
717
+ "review_flags": 0
718
+ },
719
+ "feature_spec_results": {
720
+ "feature_mode": true,
721
+ "features_generated": ["F-001", "F-002", "F-003"],
722
+ "feature_index_path": ".brainstorming/feature-index.json",
723
+ "feature_specs_dir": ".brainstorming/feature-specs/"
724
+ },
725
+ "quality_metrics": {
726
+ "user_intent_alignment": "validated",
727
+ "ambiguity_resolution": "complete",
728
+ "terminology_consistency": "enforced"
729
+ }
730
+ }
731
+ }
732
+ }
733
+ ```
734
+
735
+ **Note**: `feature_spec_results` only present when `feature_mode` is true.
736
+
737
+ #### Step 3: Completion Report
738
+
739
+ ```markdown
740
+ ## Synthesis Complete
741
+
742
+ **Session**: {sessionId}
743
+ **Enhancements Applied**: EP-001, EP-002, EP-003
744
+ **Questions Answered**: 3/5
745
+ **Complexity Score**: {score}/8
746
+
747
+ ### Review Status
748
+ {review_triggered ? "Review Agent executed: {fixes} fixes applied, {flags} flags raised" : "Skipped (complexity below threshold)"}
749
+
750
+ ### Feature Specs (feature_mode only)
751
+ **Feature Specs Generated**: F-001, F-002, F-003
752
+ **Feature Index**: .brainstorming/feature-index.json
753
+ **Spec Directory**: .brainstorming/feature-specs/
754
+ **Changelog**: .brainstorming/synthesis-changelog.md
755
+
756
+ ### Next Steps
757
+ PROCEED: `/workflow-plan --session {session-id}`
758
+ ```
759
+
760
+ ## Output
761
+
762
+ **Location (role analyses)**: `.workflow/active/WFS-{session}/.brainstorming/[role]/analysis*.md` (read-only, never modified by synthesis)
763
+ **Location (feature specs)**: `.workflow/active/WFS-{session}/.brainstorming/feature-specs/F-{id}-{slug}.md` [feature_mode]
764
+ **Location (synthesis spec)**: `.workflow/active/WFS-{session}/.brainstorming/synthesis-specification.md` [non-feature_mode]
765
+ **Location (feature index)**: `.workflow/active/WFS-{session}/.brainstorming/feature-index.json` [feature_mode]
766
+ **Location (changelog)**: `.workflow/active/WFS-{session}/.brainstorming/synthesis-changelog.md`
767
+
768
+ **Directory Structure** (feature_mode):
769
+ ```
770
+ .workflow/active/WFS-{session}/.brainstorming/
771
+ ├── guidance-specification.md # Phase 2 output (read-only)
772
+ ├── feature-index.json # Phase 5 Spec Agent output
773
+ ├── synthesis-changelog.md # Phase 5 Spec Agent output (+ Review appendix)
774
+ ├── feature-specs/ # Phase 5 Spec Agent output
775
+ │ ├── F-001-{slug}.md # Consolidated feature spec (1500-2500 words)
776
+ │ ├── F-002-{slug}.md
777
+ │ └── F-00N-{slug}.md
778
+ ├── {role-1}/ # Phase 3 output (IMMUTABLE)
779
+ │ ├── analysis.md # Role overview index
780
+ │ ├── analysis-cross-cutting.md
781
+ │ ├── analysis-F-001-{slug}.md # Per-feature detail
782
+ │ └── analysis-F-002-{slug}.md
783
+ └── {role-N}/
784
+ └── ...
785
+ ```
786
+
787
+ **Consumers**: `action-planning-agent` reads feature-index.json to generate task JSONs. `code-developer` loads individual feature specs as implementation context.
788
+
789
+ ## Quality Checklist
790
+
791
+ **Content**:
792
+ - All role analyses loaded/analyzed (read-only)
793
+ - Cross-role analysis (consensus, conflicts, gaps)
794
+ - 9-category ambiguity scan
795
+ - Questions prioritized
796
+
797
+ **Spec Generation**:
798
+ - Single Spec Agent generates all specs sequentially
799
+ - Cross-feature decisions carry forward (no re-analysis)
800
+ - All selected enhancements incorporated
801
+ - All clarification answers reflected
802
+ - synthesis-changelog.md records all decisions
803
+
804
+ **Feature Specs (feature_mode only)**:
805
+ - Phase 3A reads only analysis.md index files (not sub-documents), input token <= 5K words
806
+ - feature_conflict_map generated with consensus/conflicts/cross_refs per feature
807
+ - Feature spec template has 7 sections, Section 2 (Design Decisions) is core
808
+ - Four-layer aggregation rules applied
809
+ - Each feature spec is 1500-2500 words
810
+ - feature-index.json generated with features[] + cross_cutting_specs[]
811
+
812
+ **Review (conditional)**:
813
+ - complexity_score computed from 4 dimensions (0-8 scale)
814
+ - Review triggered when score >= 4
815
+ - Minor fixes applied directly, major issues flagged with [REVIEW-FLAG]
816
+ - Review results appended to synthesis-changelog.md
817
+
818
+ **Immutability**:
819
+ - Role analysis files NOT modified by synthesis
820
+ - guidance-specification.md NOT modified by synthesis
821
+ - Only spec files, index, and changelog are write targets
822
+
823
+ - **TodoWrite**: Mark Phase 4 completed, collapse all sub-tasks to summary
824
+
825
+ ## Next Phase
826
+
827
+ Return to orchestrator. Auto mode workflow is now complete. Report final summary to user.