speccrew 0.7.16 → 0.7.18

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.
@@ -0,0 +1,379 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="pm-phase6-verify-confirm" status="pending">
3
+
4
+ <!-- ========== Input Parameters ========== -->
5
+ <block type="input" id="I1" desc="Phase 6 Verification Input">
6
+ <field name="iteration_path" required="true" type="string" desc="Path to iteration directory"/>
7
+ <field name="complexity" required="true" type="string" desc="simple or complex"/>
8
+ <field name="prd_output" required="true" type="object" desc="PRD generation output with file paths"/>
9
+ <field name="dispatch_plan" required="false" type="object" desc="Dispatch plan for complex path"/>
10
+ <field name="update_progress_script" required="true" type="string" desc="Path to update-progress.js"/>
11
+ <field name="language" required="false" type="string" desc="User language"/>
12
+ </block>
13
+
14
+ <!-- ========== Phase 6 Mandatory Rules ========== -->
15
+ <block type="rule" id="P6-R0" level="mandatory" desc="Phase 6 Structure Rules">
16
+ <field name="text">Phase 6 MUST execute in order: 6.1 (Verification) → 6.2 (User Review) → 6.3 (Finalize)</field>
17
+ <field name="text">Gate 6.1→6.2: Automatic after checklist passes</field>
18
+ <field name="text">Gate 6.2→6.3: REQUIRES EXPLICIT USER CONFIRMATION - no auto-proceed</field>
19
+ <field name="text">DO NOT update checkpoints before user confirmation</field>
20
+ <field name="text">DO NOT update WORKFLOW-PROGRESS.json to completed before user confirmation</field>
21
+ <field name="text">DO NOT assume user silence means confirmation</field>
22
+ </block>
23
+
24
+ <!-- ========== Step 6.1: File Integrity Verification ========== -->
25
+ <sequence name="Step 6.1: File Integrity Verification">
26
+
27
+ <!-- 6.1.1: Verify Master PRD -->
28
+ <block type="task" id="P6-1-B1" action="validate-file" status="pending" desc="Verify Master PRD exists and size > 1KB">
29
+ <field name="path" value="${prd_output.master_prd_path}"/>
30
+ <field name="min_size" value="1024"/>
31
+ <field name="output" var="master_prd_valid"/>
32
+ <!-- HTML Comment: Check Master PRD file existence and minimum size threshold -->
33
+ </block>
34
+
35
+ <!-- 6.1.2: Verify Sub-PRD Files (Complex Path) -->
36
+ <block type="gateway" id="P6-1-G1" mode="exclusive" desc="Check complexity for Sub-PRD verification">
37
+ <branch test="${complexity} == 'complex'" name="Complex Path - Verify Sub-PRDs">
38
+
39
+ <block type="task" id="P6-1-B2" action="read-json" status="pending" desc="Read dispatch plan for module count">
40
+ <field name="path" value="${prd_output.dispatch_plan_path}"/>
41
+ <field name="output" var="dispatch_plan_data"/>
42
+ <!-- HTML Comment: Load dispatch plan to get expected module count -->
43
+ </block>
44
+
45
+ <block type="task" id="P6-1-B3" action="glob-files" status="pending" desc="Scan all Sub-PRD files">
46
+ <field name="pattern" value="${iteration_path}/01.product-requirement/*-sub-*.md"/>
47
+ <field name="output" var="sub_prd_files"/>
48
+ <!-- HTML Comment: Find all Sub-PRD files matching pattern -->
49
+ </block>
50
+
51
+ <block type="task" id="P6-1-B4" action="compare-counts" status="pending" desc="Verify Sub-PRD count matches dispatch plan">
52
+ <field name="expected_count" value="${dispatch_plan_data.module_count}"/>
53
+ <field name="actual_count" value="${sub_prd_files.length}"/>
54
+ <field name="output" var="sub_prd_count_match"/>
55
+ <!-- HTML Comment: Ensure no modules were skipped during dispatch -->
56
+ </block>
57
+
58
+ <block type="task" id="P6-1-B5" action="validate-files" status="pending" desc="Verify each Sub-PRD exists">
59
+ <field name="files" value="${sub_prd_files}"/>
60
+ <field name="output" var="sub_prd_validation"/>
61
+ <!-- HTML Comment: Confirm each Sub-PRD file exists and is readable -->
62
+ </block>
63
+
64
+ </branch>
65
+ <branch test="${complexity} == 'simple'" name="Simple Path - Skip Sub-PRD Check">
66
+ <block type="set-variable" id="P6-1-V1" name="sub_prd_count_match" value="true"/>
67
+ <block type="set-variable" id="P6-1-V2" name="sub_prd_validation" value="{passed: true}"/>
68
+ </branch>
69
+ </block>
70
+
71
+ <!-- 6.1.3: Verify Clarification Summary -->
72
+ <block type="task" id="P6-1-B6" action="validate-file" status="pending" desc="Verify .clarification-summary.md exists">
73
+ <field name="path" value="${iteration_path}/01.product-requirement/.clarification-summary.md"/>
74
+ <field name="min_size" value="100"/>
75
+ <field name="output" var="clarification_summary_valid"/>
76
+ <!-- HTML Comment: Ensure clarification output exists for traceability -->
77
+ </block>
78
+
79
+ <!-- 6.1.4: Verify Module Design (Complex Path) -->
80
+ <block type="gateway" id="P6-1-G2" mode="exclusive" desc="Check if module design required">
81
+ <branch test="${complexity} == 'complex'" name="Complex Path - Verify Module Design">
82
+ <block type="task" id="P6-1-B7" action="validate-file" status="pending" desc="Verify .module-design.md exists">
83
+ <field name="path" value="${iteration_path}/01.product-requirement/.module-design.md"/>
84
+ <field name="min_size" value="512"/>
85
+ <field name="output" var="module_design_valid"/>
86
+ <!-- HTML Comment: Module design is required for complex path traceability -->
87
+ </block>
88
+ </branch>
89
+ <branch test="${complexity} == 'simple'" name="Simple Path - Skip Module Design">
90
+ <block type="set-variable" id="P6-1-V3" name="module_design_valid" value="true"/>
91
+ </branch>
92
+ </block>
93
+
94
+ <!-- 6.1.5: Gateway - Report Missing Items -->
95
+ <block type="gateway" id="P6-1-G3" mode="exclusive" desc="Check file verification results">
96
+ <branch test="${master_prd_valid} == false OR ${sub_prd_count_match} == false OR ${clarification_summary_valid} == false" name="File Verification Failed">
97
+ <block type="event" id="P6-1-E1" action="log" desc="Report missing items">
98
+ <field name="template">file-verification-failed</field>
99
+ <field name="data">
100
+ master_prd_valid: ${master_prd_valid}
101
+ sub_prd_count_match: ${sub_prd_count_match}
102
+ clarification_summary_valid: ${clarification_summary_valid}
103
+ module_design_valid: ${module_design_valid}
104
+ </field>
105
+ <!-- HTML Comment: Report all missing files before proceeding -->
106
+ </block>
107
+ <block type="output" id="P6-1-O1" desc="Return failure">
108
+ <field name="status" value="failed"/>
109
+ <field name="reason" value="file_verification_failed"/>
110
+ <field name="missing_items" value="${verification_missing_items}"/>
111
+ </block>
112
+ </branch>
113
+ <branch default="true" name="File Verification Passed">
114
+ <block type="event" id="P6-1-E2" action="log" desc="Log verification success">
115
+ <field name="message">✅ File integrity verification passed</field>
116
+ </block>
117
+ </branch>
118
+ </block>
119
+ </sequence>
120
+
121
+ <!-- ========== Step 6.2: Feature List Completeness Verification ========== -->
122
+ <sequence name="Step 6.2: Feature List Completeness Verification">
123
+
124
+ <!-- 6.2.1: Read Master PRD Feature List -->
125
+ <block type="task" id="P6-2-B1" action="read-section" status="pending" desc="Read Master PRD feature list">
126
+ <field name="path" value="${prd_output.master_prd_path}"/>
127
+ <field name="section" value="3.4"/>
128
+ <field name="output" var="master_feature_list"/>
129
+ <!-- HTML Comment: Extract feature breakdown section from Master PRD -->
130
+ </block>
131
+
132
+ <!-- 6.2.2: Scan Sub-PRD Features (Complex Path) -->
133
+ <block type="gateway" id="P6-2-G1" mode="exclusive" desc="Check complexity for feature scan">
134
+ <branch test="${complexity} == 'complex'" name="Complex Path - Scan Sub-PRDs">
135
+
136
+ <block type="task" id="P6-2-B2" action="scan-features" status="pending" desc="Scan all Sub-PRD features">
137
+ <field name="files" value="${sub_prd_files}"/>
138
+ <field name="output" var="sub_prd_features"/>
139
+ <!-- HTML Comment: Collect all features from Sub-PRD Section 3.4 -->
140
+ </block>
141
+
142
+ <!-- 6.2.3: Compare Features -->
143
+ <block type="task" id="P6-2-B3" action="compare-features" status="pending" desc="Compare features for completeness">
144
+ <field name="master_features" value="${master_feature_list}"/>
145
+ <field name="sub_features" value="${sub_prd_features}"/>
146
+ <field name="output" var="feature_comparison"/>
147
+ <!-- HTML Comment: Verify no missing or duplicate features -->
148
+ </block>
149
+
150
+ </branch>
151
+ <branch test="${complexity} == 'simple'" name="Simple Path - Skip Feature Comparison">
152
+ <block type="set-variable" id="P6-2-V1" name="feature_comparison" value="{complete: true, missing: [], duplicates: []}"/>
153
+ </branch>
154
+ </block>
155
+
156
+ <!-- 6.2.4: Gateway - Report Feature Discrepancies -->
157
+ <block type="gateway" id="P6-2-G2" mode="exclusive" desc="Check feature completeness">
158
+ <branch test="${feature_comparison.complete} == false" name="Feature Incomplete">
159
+ <block type="event" id="P6-2-E1" action="log" desc="Report feature discrepancies">
160
+ <field name="template">feature-discrepancy</field>
161
+ <field name="data" value="${feature_comparison}"/>
162
+ <!-- HTML Comment: Report missing or duplicate features -->
163
+ </block>
164
+ <block type="event" id="P6-2-E2" action="confirm" desc="Ask user to proceed or regenerate">
165
+ <field name="prompt">Feature list incomplete. Missing: ${feature_comparison.missing}. Duplicates: ${feature_comparison.duplicates}. Proceed anyway, Regenerate affected PRD, or Abort?</field>
166
+ </block>
167
+ </branch>
168
+ <branch default="true" name="Feature Complete">
169
+ <block type="event" id="P6-2-E3" action="log" desc="Log feature verification success">
170
+ <field name="message">✅ Feature list completeness verified</field>
171
+ </block>
172
+ </branch>
173
+ </block>
174
+
175
+ <!-- Aggregate verification result -->
176
+ <block type="task" id="P6-2-B4" action="aggregate-result" status="pending" desc="Aggregate all verification results">
177
+ <field name="output" var="verification_result"/>
178
+ <field name="data">
179
+ file_integrity: passed
180
+ feature_completeness: passed
181
+ master_prd_path: ${prd_output.master_prd_path}
182
+ sub_prd_count: ${sub_prd_files.length}
183
+ total_features: ${feature_comparison.total_count}
184
+ </field>
185
+ </block>
186
+ </sequence>
187
+
188
+ <!-- ========== Step 6.3: User Review (MANDATORY) ========== -->
189
+ <sequence name="Step 6.3: User Review">
190
+
191
+ <!-- MANDATORY Rule: No auto-confirmation -->
192
+ <block type="rule" id="P6-3-R1" level="mandatory" desc="User Confirmation MANDATORY">
193
+ <field name="text">🛑 FORBIDDEN: DO NOT mark user confirmation yourself</field>
194
+ <field name="text">🛑 FORBIDDEN: DO NOT proceed without explicit user "确认" or "OK"</field>
195
+ <field name="text">🛑 FORBIDDEN: DO NOT assume user silence means confirmation</field>
196
+ <field name="text">🛑 FORBIDDEN: DO NOT auto-proceed to Phase 6.4</field>
197
+ </block>
198
+
199
+ <!-- Present Verification Summary -->
200
+ <block type="task" id="P6-3-B1" action="prepare-summary" status="pending" desc="Prepare verification summary for user">
201
+ <field name="output" var="review_summary"/>
202
+ <field name="data">
203
+ verification_result: ${verification_result}
204
+ prd_files: ${prd_output.all_prd_files}
205
+ sub_prd_files: ${sub_prd_files}
206
+ total_size: ${prd_output.total_size}
207
+ </field>
208
+ <!-- HTML Comment: Prepare comprehensive summary for user review -->
209
+ </block>
210
+
211
+ <!-- MANDATORY User Confirmation Event -->
212
+ <block type="checkpoint" id="P6-3-CP1" name="user_review" desc="User review gate - MANDATORY">
213
+ <field name="required" value="true"/>
214
+ </block>
215
+
216
+ <block type="event" id="P6-3-E1" action="user-confirm" desc="Present summary and await user confirmation">
217
+ <field name="prompt">
218
+ 📋 PRD Documents Ready for Review
219
+
220
+ Generated Files:
221
+ ├── Master PRD: ${prd_output.master_prd_path} (${prd_output.master_prd_size} KB)
222
+ ├── Sub-PRD Files: ${sub_prd_files.length} files
223
+ └── Total Size: ${prd_output.total_size} KB
224
+
225
+ Verification Results:
226
+ ├── File existence: ✅ All files present
227
+ ├── Size validation: ✅ All files valid
228
+ ├── Feature Breakdown: ✅ All sections present
229
+ └── Content Boundary: ✅ No violations detected
230
+
231
+ Document Status: 📝 Draft (pending your confirmation)
232
+
233
+ 🛑 AWAITING USER CONFIRMATION
234
+
235
+ 请审查以上PRD文档。确认无误后我将更新状态为 Confirmed。是否确认?
236
+
237
+ 您可以回复:
238
+ - "确认" 或 "OK" → 进入 Step 6.4 完成最终状态更新
239
+ - "需要修改" + 具体内容 → 返回相应阶段重新生成
240
+ - "取消" → 终止当前工作流
241
+
242
+ **I will NOT proceed until you explicitly confirm.**
243
+ </field>
244
+ <field name="template">prd-review-summary</field>
245
+ <field name="data" value="${review_summary}"/>
246
+ <!-- HTML Comment: MANDATORY - Must wait for explicit user confirmation -->
247
+ </block>
248
+
249
+ <!-- Gateway: Handle User Response -->
250
+ <block type="gateway" id="P6-3-G1" mode="exclusive" desc="Process user response">
251
+ <branch test="${user_response} == 'confirm'" name="User Confirmed">
252
+ <block type="set-variable" id="P6-3-V1" name="user_confirmed" value="true"/>
253
+ <block type="event" id="P6-3-E2" action="log" desc="Log user confirmation">
254
+ <field name="message">✅ User confirmed - proceeding to finalization</field>
255
+ </block>
256
+ </branch>
257
+ <branch test="${user_response} == 'modify'" name="User Requests Modification">
258
+ <block type="event" id="P6-3-E3" action="log" desc="Log modification request">
259
+ <field name="message">📝 User requested modifications: ${modification_details}</field>
260
+ </block>
261
+ <block type="output" id="P6-3-O1" desc="Return modification request">
262
+ <field name="status" value="modification_required"/>
263
+ <field name="modification_details" value="${modification_details}"/>
264
+ <field name="suggested_phase" value="${suggested_return_phase}"/>
265
+ </block>
266
+ </branch>
267
+ <branch test="${user_response} == 'cancel'" name="User Cancelled">
268
+ <block type="output" id="P6-3-O2" desc="Return cancelled">
269
+ <field name="status" value="cancelled"/>
270
+ <field name="reason" value="user_cancelled"/>
271
+ </block>
272
+ </branch>
273
+ </block>
274
+ </sequence>
275
+
276
+ <!-- ========== Step 6.4: Finalization ========== -->
277
+ <sequence name="Step 6.4: Finalization">
278
+
279
+ <!-- Prerequisite Check -->
280
+ <block type="rule" id="P6-4-R1" level="mandatory" desc="Phase 6.4 Prerequisite">
281
+ <field name="text">⚠️ Phase 6.4 can ONLY execute AFTER user has explicitly confirmed in Step 6.3</field>
282
+ <field name="text">IF user has NOT confirmed → DO NOT execute any step below</field>
283
+ <field name="text">IF you are unsure whether user confirmed → DO NOT execute any step below</field>
284
+ </block>
285
+
286
+ <block type="gateway" id="P6-4-G0" mode="exclusive" desc="Verify user confirmation">
287
+ <branch test="${user_confirmed} != true" name="No User Confirmation">
288
+ <block type="event" id="P6-4-E0" action="log" desc="Block execution">
289
+ <field name="message">🛑 BLOCKED: User has not explicitly confirmed. Return to Step 6.3.</field>
290
+ </block>
291
+ <block type="goto" id="P6-4-GOTO1" target="P6-3-E1"/>
292
+ </branch>
293
+ <branch default="true" name="User Confirmed - Proceed"/>
294
+ </block>
295
+
296
+ <!-- 6.4.1: Update verification_checklist checkpoint -->
297
+ <block type="task" id="P6-4-B1" action="run-script" status="pending" desc="Update verification_checklist checkpoint">
298
+ <field name="command">node ${update_progress_script} write-checkpoint --file ${iteration_path}/01.product-requirement/.checkpoints.json --stage 01_prd --checkpoint verification_checklist --passed true</field>
299
+ <!-- HTML Comment: Mark verification checklist as passed via script -->
300
+ </block>
301
+
302
+ <!-- 6.4.2: Update prd_review checkpoint -->
303
+ <block type="task" id="P6-4-B2" action="run-script" status="pending" desc="Update prd_review checkpoint">
304
+ <field name="command">node ${update_progress_script} write-checkpoint --file ${iteration_path}/01.product-requirement/.checkpoints.json --stage 01_prd --checkpoint prd_review --passed true</field>
305
+ <!-- HTML Comment: Mark PRD review as passed via script -->
306
+ </block>
307
+
308
+ <!-- 6.4.3: Update WORKFLOW-PROGRESS.json to completed -->
309
+ <block type="task" id="P6-4-B3" action="run-script" status="pending" desc="Update workflow status to completed">
310
+ <field name="command">node ${update_progress_script} update-workflow --file ${iteration_path}/WORKFLOW-PROGRESS.json --stage 01_prd --status completed</field>
311
+ <!-- HTML Comment: Set workflow stage to completed via script -->
312
+ </block>
313
+
314
+ <!-- 6.4.4: Update WORKFLOW-PROGRESS.json to confirmed -->
315
+ <block type="task" id="P6-4-B4" action="run-script" status="pending" desc="Update workflow status to confirmed">
316
+ <field name="command">node ${update_progress_script} update-workflow --file ${iteration_path}/WORKFLOW-PROGRESS.json --stage 01_prd --status confirmed</field>
317
+ <!-- HTML Comment: Set workflow stage to confirmed via script -->
318
+ </block>
319
+
320
+ <!-- 6.4.5: Update PRD document status -->
321
+ <block type="task" id="P6-4-B5" action="update-status" status="pending" desc="Update PRD document status to Confirmed">
322
+ <field name="files" value="${prd_output.all_prd_files}"/>
323
+ <field name="from" value="📝 Draft"/>
324
+ <field name="to" value="✅ Confirmed"/>
325
+ <!-- HTML Comment: Change document status marker in all PRD files -->
326
+ </block>
327
+
328
+ <!-- 6.4.6: Cleanup intermediate files -->
329
+ <block type="task" id="P6-4-B6" action="run-script" status="pending" desc="Cleanup intermediate files">
330
+ <field name="command">Remove-Item ${iteration_path}/01.product-requirement/.checkpoints.json -ErrorAction SilentlyContinue; Remove-Item ${iteration_path}/01.product-requirement/.prd-generation-report.md -ErrorAction SilentlyContinue; Remove-Item ${iteration_path}/01.product-requirement/.prd-completion-report.md -ErrorAction SilentlyContinue; Remove-Item ${iteration_path}/01.product-requirement/.sub-prd-dispatch-plan.json -ErrorAction SilentlyContinue</field>
331
+ <!-- HTML Comment: Delete intermediate process files, keep PRD documents and clarification files -->
332
+ </block>
333
+
334
+ <!-- Files to KEEP (documented for reference):
335
+ - Master PRD and all Sub-PRD documents (*-prd.md, *-sub-*.md)
336
+ - .clarification-summary.md
337
+ - .module-design.md (complex path)
338
+ - .prd-feature-list.json (for Feature Design phase)
339
+ -->
340
+
341
+ <!-- 6.4.7: Output completion report -->
342
+ <block type="event" id="P6-4-E1" action="log" desc="Output final completion report">
343
+ <field name="message">
344
+ ✅ PRD Stage Complete
345
+
346
+ All documents confirmed:
347
+ ├── Master PRD: ✅ Confirmed
348
+ ├── Sub-PRD Files: ${sub_prd_files.length} confirmed
349
+ └── Feature Count: ${feature_comparison.total_count}
350
+
351
+ Files Kept:
352
+ ├── Master PRD: ${prd_output.master_prd_path}
353
+ ├── Sub-PRDs: ${sub_prd_files.length} files in 01.product-requirement/
354
+ ├── Clarification Summary: .clarification-summary.md
355
+ └── Feature List: .prd-feature-list.json
356
+
357
+ Intermediate files cleaned up.
358
+
359
+ Next Steps:
360
+ When you are ready to proceed with Feature Design, start a new conversation
361
+ and invoke the Feature Designer Agent (speccrew-feature-designer).
362
+
363
+ DO NOT proceed to Feature Design in this conversation.
364
+ </field>
365
+ <field name="template">prd-completion</field>
366
+ </block>
367
+ </sequence>
368
+
369
+ <!-- ========== Output ========== -->
370
+ <block type="output" id="O1" desc="Phase 6 Verification & Confirmation Result">
371
+ <field name="verification_result" from="${verification_result}" type="object" desc="File and feature verification results"/>
372
+ <field name="user_confirmed" from="${user_confirmed}" type="boolean" desc="Whether user explicitly confirmed"/>
373
+ <field name="deliverables_summary" from="${review_summary}" type="object" desc="Summary of all delivered documents"/>
374
+ <field name="status" value="success" type="string" desc="Workflow execution status"/>
375
+ <field name="prd_files" from="${prd_output.all_prd_files}" type="array" desc="All PRD file paths"/>
376
+ <field name="feature_list_path" from="${iteration_path}/01.product-requirement/.prd-feature-list.json" type="string" desc="Feature list file for downstream phases"/>
377
+ </block>
378
+
379
+ </workflow>
@@ -85,3 +85,12 @@ Applies ISA-95 Stage 1 (Domain Description) for clarification:
85
85
  - Use chat for complex requirements
86
86
  - Manually write JSON files
87
87
  - Auto-proceed to Phase 4 (PRD generation) without PM Agent's user confirmation gate
88
+ - Auto-pass sufficiency checks without actual user answers
89
+ - Write checkpoints in this Skill — checkpoints are managed by orchestration layer
90
+
91
+ ### MANDATORY: User Answer Verification Rule
92
+
93
+ - Worker MUST NOT auto-pass sufficiency checks without actual user answers
94
+ - Each clarification round MUST wait for user to fill in answers before proceeding
95
+ - Checkpoint writing is FORBIDDEN in this Skill — checkpoints are managed by the orchestration layer
96
+ - The sufficiency check result is ONLY valid when based on real user-provided answers
@@ -118,8 +118,15 @@
118
118
  <field name="output" var="questions_file"/>
119
119
  </block>
120
120
 
121
- <block type="event" id="E1" action="confirm" title="Clarification Round ${round_number}" type="wait" desc="Wait for user to answer questions">
122
- <field name="message">Round ${round_number} questions written. Please fill answers and notify me.</field>
121
+ <!-- MANDATORY: Wait for user to answer clarification questions -->
122
+ <block type="event" id="E-ROUND-CONFIRM" action="user-confirm" desc="Wait for user to answer clarification questions">
123
+ <field name="prompt">📋 第 ${round_number} 轮澄清问题已生成: ${questions_file}
124
+
125
+ 请:
126
+ 1. 查看澄清问题文件
127
+ 2. 在文件中填写您的答案
128
+ 3. 填写完成后确认继续</field>
129
+ <field name="skippable" value="false"/>
123
130
  </block>
124
131
 
125
132
  <block type="task" id="B8" action="read-file" desc="Read answered questions">
@@ -127,10 +134,18 @@
127
134
  <field name="output" var="answered_questions"/>
128
135
  </block>
129
136
 
137
+ <!-- MANDATORY: User answers are required for sufficiency check -->
138
+ <block type="rule" id="R-ANSWER-REQUIRED" level="mandatory" desc="User answers are required for sufficiency check">
139
+ <field name="text">MANDATORY: Sufficiency check can ONLY pass when the user has actually provided answers to the clarification questions.</field>
140
+ <field name="text">If the clarification questions file still contains only the original template without user answers, ALL checks MUST fail.</field>
141
+ <field name="text">Worker MUST NOT self-evaluate and auto-pass the sufficiency check without real user input.</field>
142
+ </block>
143
+
130
144
  <!-- Sufficiency Check -->
131
145
  <block type="task" id="B9" action="analyze" desc="Perform sufficiency check">
132
146
  <field name="input" value="${answered_questions}"/>
133
147
  <field name="checks">
148
+ 0. User has actually provided answers - The answered_questions content contains real user responses, not just the original template
134
149
  1. Scope boundaries are clear - Explicit in/out scope defined
135
150
  2. Key business rules are documented - At least 1 rule identified
136
151
  3. Priority/phasing decisions are made - Phase 1 scope is clear
@@ -177,12 +192,6 @@
177
192
  <field name="output" var="summary_path"/>
178
193
  </block>
179
194
 
180
- <!-- Step 7: Initialize .checkpoints.json -->
181
- <block type="task" id="B11" action="run-script" desc="Initialize checkpoints via script">
182
- <field name="command">node "${workspace_path}/scripts/update-progress.js" write-checkpoint --file "${iteration_path}/01.product-requirement/.checkpoints.json" --checkpoint requirement_clarification --passed true</field>
183
- <field name="output" var="checkpoint_result"/>
184
- </block>
185
-
186
195
  <!-- Checkpoint: Clarification complete -->
187
196
  <block type="checkpoint" id="CP1" name="clarification-complete" desc="Verify clarification completed">
188
197
  <field name="file" value="${summary_path}"/>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: speccrew-product-manager-orchestration
3
- version: 1.0.0
4
- description: Product Manager 的核心编排技能,负责需求澄清、复杂度评估、PRD 生成协调与验证。处理简单需求(单 PRD)和复杂需求(Master-Sub PRD)两种工作流路径。
3
+ version: 2.0.0
4
+ description: Product Manager 核心编排技能(纯路由层 v2.0),负责工作流恢复路由和各 Phase Skill 的 dispatch-to-worker 调度。所有业务逻辑由独立的 Phase Skill 执行。
5
5
  tools: Read, Write, Glob, Grep, Bash, Agent
6
6
  ---
7
7
 
@@ -23,41 +23,82 @@ tools: Read, Write, Glob, Grep, Bash, Agent
23
23
  > - `action="dispatch-to-worker"` → Create **Task** via **Task tool** for `speccrew-task-worker`
24
24
  > - `action="read-file"` → Read via **Read tool**
25
25
  > - `action="log"` → Output message directly
26
- > - `action="confirm"` → Present to user and wait for response
26
+ > - `action="user-confirm"` → Present to user and wait for EXPLICIT confirmation (NON-SKIPPABLE)
27
27
  >
28
28
  > **CRITICAL DISPATCH RULE:**
29
29
  > - PM Agent (Team Leader) MUST NOT execute Skills directly
30
30
  > - ALL Skill executions MUST go through `dispatch-to-worker` action
31
31
  > - Worker Agent (`speccrew-task-worker`) receives the Skill name and context, then executes the Skill
32
32
  >
33
- > **Step 3**: Execute ALL blocks sequentially without pausing (only stop at explicit `<event action="confirm">` blocks)
33
+ > **Step 3**: Execute ALL blocks sequentially without pausing (only stop at explicit `<event action="user-confirm">` blocks)
34
34
 
35
- # Product Manager Orchestration
35
+ # Product Manager Orchestration (v2.0)
36
36
 
37
- Product Manager 的核心编排技能,负责:
37
+ 纯路由层编排技能,负责:
38
38
 
39
- 1. **Pipeline Progress Management** - 创建/定位迭代目录,管理工作流进度
40
- 2. **Knowledge Base Detection** - 检测知识库状态并按需初始化
41
- 3. **Complexity Assessment** - 评估需求复杂度,决定简单/复杂路径
42
- 4. **Requirement Clarification** - 分发 Worker 执行澄清技能,收集需求细节
43
- 5. **PRD Generation Orchestration** - 协调 PRD 生成(所有 Skill 通过 Worker 分发执行)
44
- 6. **Verification & Confirmation** - 验证 PRD 完整性,等待用户确认
39
+ 1. **Workflow Initialization** - Phase 0 初始化并返回恢复目标
40
+ 2. **Resume Routing** - 根据 `resume_target` 跳转到正确的 Phase
41
+ 3. **Phase Dispatch** - 每个 Phase 只有一个 `dispatch-to-worker` 调用
42
+ 4. **User Confirmation Gates** - Phase 3 和 Phase 4a 的强制性用户确认门禁
45
43
 
46
- **DISPATCH-TO-WORKER ARCHITECTURE:**
44
+ ## Architecture: Pure Routing Layer
47
45
 
48
- PM Agent 作为 Team Leader,不直接执行任何 Skill。所有 Skill 调用都通过 `dispatch-to-worker` 模式:
46
+ Skill 是**纯路由层**,所有业务逻辑由独立的 Phase Skill 执行:
49
47
 
50
- | Phase | Action | Skill | Worker |
51
- |-------|--------|-------|--------|
52
- | Phase 1 | `dispatch-to-worker` | `speccrew-pm-knowledge-detector` | `speccrew-task-worker` |
53
- | Phase 1 | `dispatch-to-worker` | `speccrew-pm-system-summary-reader` | `speccrew-task-worker` |
54
- | Phase 1 | `dispatch-to-worker` | `speccrew-pm-module-matcher` | `speccrew-task-worker` |
55
- | Phase 1 | `dispatch-to-worker` | `speccrew-knowledge-bizs-init-features` | `speccrew-task-worker` |
56
- | Phase 3 | `dispatch-to-worker` | `speccrew-pm-requirement-clarify` | `speccrew-task-worker` |
57
- | Phase 4a | `dispatch-to-worker` | `speccrew-pm-requirement-model` | `speccrew-task-worker` |
58
- | Phase 4b | `dispatch-to-worker` | `speccrew-pm-requirement-analysis` | `speccrew-task-worker` |
59
- | Phase 4 (Simple) | `dispatch-to-worker` | `speccrew-pm-requirement-simple` | `speccrew-task-worker` |
60
- | Phase 5 | `dispatch-to-worker` | `speccrew-pm-sub-prd-generate` | `speccrew-task-worker` |
48
+ | Phase | Block ID | Skill | Purpose |
49
+ |-------|----------|-------|---------|
50
+ | Phase 0 | P0 | `speccrew-pm-phase0-init` | 工作流初始化、迭代目录创建/定位、恢复状态检测 |
51
+ | Phase 1 | P1 | `speccrew-pm-phase1-knowledge-check` | 知识库状态检测、模块匹配、知识初始化 |
52
+ | Phase 2 | P2 | `speccrew-pm-phase2-complexity-assess` | 复杂度评估、简单/复杂路径决策 |
53
+ | Phase 3 | P3 | `speccrew-pm-requirement-clarify` | 需求澄清、问答收集 |
54
+ | Phase 4 Simple | P4-SIMPLE | `speccrew-pm-requirement-simple` | 简单需求:单 PRD 生成 |
55
+ | Phase 4a | P4A | `speccrew-pm-requirement-model` | 复杂需求:ISA-95 建模 |
56
+ | Phase 4b | P4B | `speccrew-pm-requirement-analysis` | 复杂需求:Master PRD 生成 |
57
+ | Phase 5 | P5 | `speccrew-pm-phase5-subprd-dispatch` | Sub-PRD Worker 分发 |
58
+ | Phase 6 | P6 | `speccrew-pm-phase6-verify-confirm` | 验证清单、用户审核、最终确认 |
59
+
60
+ ## User Confirmation Gates (MANDATORY)
61
+
62
+ Phase 3 和 Phase 4a 之后有**强制性用户确认门禁**:
63
+
64
+ ### R-CONFIRM Rule Block
65
+
66
+ ```xml
67
+ <block type="rule" id="R-CONFIRM" level="mandatory" desc="User confirmation is MANDATORY">
68
+ <field name="text">MANDATORY: After each phase completes, you MUST wait for EXPLICIT user confirmation.</field>
69
+ <field name="text">DO NOT mark checkpoint as passed by yourself. DO NOT skip user confirmation.</field>
70
+ <field name="text">The checkpoint write-checkpoint command MUST ONLY be executed AFTER user confirms.</field>
71
+ </block>
72
+ ```
73
+
74
+ ### user-confirm Event Block
75
+
76
+ ```xml
77
+ <block type="event" id="P3-CONFIRM" action="user-confirm" desc="User confirmation required">
78
+ <field name="prompt">📋 Phase Complete. Please review and confirm.</field>
79
+ <field name="skippable" value="false"/>
80
+ </block>
81
+ ```
82
+
83
+ **Key Points:**
84
+ - `action="user-confirm"` — 必须等待用户明确确认
85
+ - `skippable="false"` — 不可跳过
86
+ - checkpoint 写入**必须**在用户确认后执行
87
+
88
+ ## Resume Router
89
+
90
+ Phase 0 输出 `resume_target` 控制恢复跳转:
91
+
92
+ | resume_target | Target Block | Description |
93
+ |---------------|--------------|-------------|
94
+ | `PHASE_1_KNOWLEDGE_CHECK` | P1 | 从知识库检查开始 |
95
+ | `PHASE_3_USER_CONFIRMATION` | P3-CONFIRM | 恢复到 Phase 3 确认门禁 |
96
+ | `PHASE_4_PRD_SIMPLE` | P4-SIMPLE | 简单路径 PRD 生成 |
97
+ | `PHASE_4A_MODEL` | P4A | 复杂路径建模 |
98
+ | `PHASE_4A_CONFIRMATION` | P4A-CONFIRM | 恢复到 Phase 4a 确认门禁 |
99
+ | `PHASE_4B_PRD_GENERATION` | P4B | Master PRD 生成 |
100
+ | `PHASE_5_SUBPRD_DISPATCH` | P5 | Sub-PRD 分发 |
101
+ | `PHASE_6_VERIFICATION` | P6 | 验证确认 |
61
102
 
62
103
  ## Invocation Method
63
104
 
@@ -109,23 +150,19 @@ This skill MUST execute tasks continuously without unnecessary interruptions.
109
150
 
110
151
  ### When to Pause (ONLY these cases)
111
152
 
112
- 1. CHECKPOINT gates defined in workflow (user confirmation required by design)
153
+ 1. **User Confirmation Gates** `action="user-confirm"` blocks (Phase 3, Phase 4a)
113
154
  2. Ambiguous requirements that genuinely need clarification
114
155
  3. Unrecoverable errors that prevent further progress
115
156
  4. Security-sensitive operations (e.g., deleting existing files)
116
157
 
117
- ### Orchestrator Principle
158
+ ### Orchestrator Principle (v2.0)
118
159
 
119
- This agent is an **orchestrator/dispatcher**. Key constraints:
160
+ This agent is a **pure router/dispatcher**. Key constraints:
120
161
 
121
162
  | Phase | Skill | ORCHESTRATOR Rule |
122
163
  |-------|-------|-------------------|
123
- | Phase 3 | `speccrew-pm-requirement-clarify` | DO NOT clarify requirements yourself Dispatch Worker to execute |
124
- | Phase 4a | `speccrew-pm-requirement-model` | DO NOT perform ISA-95 analysis yourself — Dispatch Worker to execute |
125
- | Phase 4a.5 | User Confirmation Gate | MUST stop for user confirmation after module design |
126
- | Phase 4b | `speccrew-pm-requirement-analysis` | DO NOT generate Master PRD yourself — Dispatch Worker to execute |
127
- | Phase 5 | `speccrew-pm-sub-prd-generate` | DO NOT generate Sub-PRD yourself — Dispatch Workers to execute |
128
- | Phase 6 | PM Agent verification | DO NOT modify PRD content — only verify and present |
164
+ | Phase 0 | `speccrew-pm-phase0-init` | Route to correct Phase based on resume_target |
165
+ | Phase 1-6 | All Phase Skills | DO NOT execute logic yourself — Dispatch Worker |
129
166
 
130
167
  **UNIVERSAL DISPATCH RULE:**
131
168
  - PM Agent NEVER invokes Skills directly via `action="run-skill"`