speccrew 0.7.15 → 0.7.17

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.
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <workflow id="pm-orchestration-main" status="pending">
2
+ <workflow name="speccrew-product-manager-orchestration" version="2.0">
3
3
 
4
4
  <!-- ========== Input Parameters ========== -->
5
5
  <block type="input" id="I1" desc="PM Orchestration Input">
@@ -9,526 +9,227 @@
9
9
  <field name="language" required="false" type="string" desc="User language (auto-detected)"/>
10
10
  </block>
11
11
 
12
- <!-- ========== Phase 0: Workflow Progress Management ========== -->
13
- <sequence name="Phase 0: Workflow Progress Management">
14
-
15
- <!-- Phase 0.5: IDE Detection -->
16
- <block type="task" id="P0-B1" action="detect-ide" status="pending" desc="Detect current IDE environment">
17
- <field name="output" var="ide_type"/>
18
- <field name="output" var="ide_skills_dir"/>
19
- </block>
20
-
21
- <!-- Phase 0.6: Path Initialization -->
22
- <block type="task" id="P0-B2" action="compute-paths" status="pending" desc="Compute all workflow paths">
23
- <field name="workspace_root" value="${workspace_root}"/>
24
- <field name="source_path" value="${source_path}"/>
25
- <field name="output" var="sync_state_bizs_dir"/>
26
- <field name="output" var="iterations_dir"/>
27
- <field name="output" var="update_progress_script"/>
28
- <field name="output" var="configs_dir"/>
29
- </block>
30
-
31
- <!-- Phase 0.1: Create or Locate Iteration Directory -->
32
- <block type="gateway" id="P0-G1" mode="exclusive" desc="Check for active iteration">
33
- <branch test="exists(${iterations_dir}/*/WORKFLOW-PROGRESS.json with 01_prd.status=in_progress)" name="Has Active Iteration">
34
- <block type="task" id="P0-B3" action="read-file" status="pending" desc="Read active iteration progress">
35
- <field name="path" value="${iterations_dir}/${active_iter}/WORKFLOW-PROGRESS.json"/>
36
- <field name="output" var="workflow_progress"/>
37
- </block>
38
- </branch>
39
- <branch default="true" name="Create New Iteration">
40
- <block type="task" id="P0-B4" action="run-script" status="pending" desc="Create new iteration directory">
41
- <field name="command">mkdir -p ${iterations_dir}/${iteration_name}/00.docs ${iterations_dir}/${iteration_name}/01.product-requirement</field>
42
- </block>
43
- <block type="task" id="P0-B5" action="run-script" status="pending" desc="Initialize WORKFLOW-PROGRESS.json">
44
- <field name="command">node ${update_progress_script} update-workflow --file ${iterations_dir}/${iteration_name}/WORKFLOW-PROGRESS.json --stage 01_prd --status in_progress</field>
45
- </block>
46
- </branch>
47
- </block>
48
-
49
- <!-- Phase 0.2: Check Resume State -->
50
- <block type="gateway" id="P0-G2" mode="exclusive" desc="Check resume state from checkpoint">
51
- <branch test="exists(${iteration_path}/01.product-requirement/.checkpoints.json)" name="Has Checkpoint">
52
- <block type="task" id="P0-B6" action="run-script" status="pending" desc="Read checkpoints">
53
- <field name="command">node ${update_progress_script} read --file ${iteration_path}/01.product-requirement/.checkpoints.json --checkpoints</field>
54
- <field name="output" var="checkpoints"/>
55
- </block>
56
- <block type="event" id="P0-E1" action="log" desc="Display resume summary">
57
- <field name="template">resume-summary</field>
58
- <field name="data" value="${checkpoints}"/>
59
- </block>
60
- </branch>
61
- <branch default="true" name="No Checkpoint - Fresh Start"/>
62
- </block>
63
- </sequence>
64
-
65
- <!-- ========== Phase 1: Knowledge Base Availability Check ========== -->
66
- <sequence name="Phase 1: Knowledge Base Availability Check">
67
-
68
- <block type="rule" id="P1-R1" level="mandatory" desc="Phase 1 Mandatory Constraints">
69
- <field name="text">DO NOT manually search directories or construct status reports yourself - MUST dispatch Worker with speccrew-pm-knowledge-detector skill</field>
70
- <field name="text">DO NOT create features-*.json files manually - ALL features files MUST be generated by scripts via Worker</field>
71
- <field name="text">DO NOT execute knowledge-base scripts via Bash - ALL script execution MUST happen inside Worker Agents</field>
72
- </block>
73
-
74
- <!-- Phase 1.1: Detect Knowledge Base Status -->
75
- <block type="task" id="P1-B1" action="dispatch-to-worker" status="pending" desc="Dispatch knowledge detector worker">
76
- <field name="agent">speccrew-task-worker</field>
77
- <field name="skill">speccrew-pm-knowledge-detector</field>
78
- <field name="context">
79
- workspace_path: ${workspace_root}
80
- sync_state_bizs_dir: ${sync_state_bizs_dir}
81
- configs_dir: ${configs_dir}
82
- </field>
83
- <field name="output" var="knowledge_status"/>
84
- </block>
85
-
86
- <!-- Phase 1.2: Branch on Knowledge Status -->
87
- <block type="gateway" id="P1-G1" mode="exclusive" desc="Route based on knowledge status">
88
-
89
- <!-- Path A: Full Knowledge -->
90
- <branch test="${knowledge_status.status} == 'full'" name="Full Knowledge">
91
- <block type="task" id="P1-B2" action="dispatch-to-worker" status="pending" desc="Read system-overview.md summary">
92
- <field name="agent">speccrew-task-worker</field>
93
- <field name="skill">speccrew-pm-system-summary-reader</field>
94
- <field name="context">
95
- system_overview_path: ${knowledge_status.system_overview_path}
96
- </field>
97
- <field name="output" var="system_context"/>
98
- </block>
99
- </branch>
100
-
101
- <!-- Path B: Lite Knowledge -->
102
- <branch test="${knowledge_status.status} == 'lite'" name="Lite Knowledge">
103
- <block type="task" id="P1-B3" action="dispatch-to-worker" status="pending" desc="Dispatch module matcher worker">
104
- <field name="agent">speccrew-task-worker</field>
105
- <field name="skill">speccrew-pm-module-matcher</field>
106
- <field name="context">
107
- sync_state_bizs_dir: ${sync_state_bizs_dir}
108
- requirement_text: ${user_requirement}
109
- language: ${language}
110
- </field>
111
- <field name="output" var="matched_modules"/>
112
- </block>
113
- <block type="event" id="P1-E1" action="confirm" desc="Ask user to confirm module initialization">
114
- <field name="prompt">Based on your requirement, the following modules appear to be related. Would you like to initialize detailed knowledge for these modules?</field>
115
- <field name="data" value="${matched_modules}"/>
116
- </block>
117
- </branch>
118
-
119
- <!-- Path C: No Knowledge -->
120
- <branch test="${knowledge_status.status} == 'none'" name="No Knowledge">
121
- <block type="rule" id="P1-R2" level="mandatory" desc="Path C Mandatory Rules">
122
- <field name="text">DO NOT skip to Phase 2 without running feature inventory - this is AUTOMATIC</field>
123
- <field name="text">DO NOT ask user whether to run feature inventory - automatic initialization is MANDATORY</field>
124
- <field name="text">DO NOT run module-initializer here - deep init is scoped by requirement in Path B</field>
125
- </block>
126
-
127
- <block type="event" id="P1-E2" action="log" desc="Inform user about initialization">
128
- <field name="message">No business knowledge base detected. Scanning project structure to discover available modules...</field>
129
- </block>
130
-
131
- <block type="task" id="P1-B4" action="dispatch-to-worker" status="pending" desc="Generate feature inventory">
132
- <field name="agent">speccrew-task-worker</field>
133
- <field name="skill">speccrew-knowledge-bizs-init-features</field>
134
- <field name="context">
135
- workspace_path: ${workspace_root}
136
- language: ${language}
137
- sync_state_bizs_dir: ${sync_state_bizs_dir}
138
- configs_dir: ${configs_dir}
139
- ide_skills_dir: ${ide_skills_dir}
140
- </field>
141
- </block>
142
-
143
- <!-- After init-features, re-run detector and proceed to Path B -->
144
- <block type="task" id="P1-B5" action="dispatch-to-worker" status="pending" desc="Re-run knowledge detector">
145
- <field name="agent">speccrew-task-worker</field>
146
- <field name="skill">speccrew-pm-knowledge-detector</field>
147
- <field name="context">
148
- workspace_path: ${workspace_root}
149
- sync_state_bizs_dir: ${sync_state_bizs_dir}
150
- configs_dir: ${configs_dir}
151
- </field>
152
- <field name="output" var="knowledge_status"/>
153
- </block>
154
- </branch>
155
- </block>
156
-
157
- <!-- Phase 1.3: Store Knowledge Context -->
158
- <block type="task" id="P1-B6" action="set-context" status="pending" desc="Store knowledge context for subsequent phases">
159
- <field name="knowledge_status" value="${knowledge_status.status}"/>
160
- <field name="system_context" value="${system_context}"/>
161
- <field name="matched_modules" value="${matched_modules}"/>
162
- </block>
163
- </sequence>
12
+ <!-- ========== Phase 0: Initialize Workflow ========== -->
13
+ <block type="task" id="P0" action="dispatch-to-worker" desc="Phase 0: Initialize workflow">
14
+ <field name="worker">speccrew-task-worker</field>
15
+ <field name="skill">speccrew-pm-phase0-init</field>
16
+ <field name="context">{
17
+ "workspace_root": "${workspace_root}",
18
+ "source_path": "${source_path}",
19
+ "user_requirement": "${user_requirement}",
20
+ "language": "${language}"
21
+ }</field>
22
+ <field name="output" var="phase0_result"/>
23
+ </block>
164
24
 
165
- <!-- ========== Phase 2: Complexity Assessment & Skill Routing ========== -->
166
- <sequence name="Phase 2: Complexity Assessment & Skill Routing">
167
-
168
- <!-- Phase 2.0: Knowledge Initialization Verification -->
169
- <block type="rule" id="P2-R1" level="mandatory" desc="Phase 2.0 Mandatory Verification">
170
- <field name="text">THIS STEP IS MANDATORY AND CANNOT BE SKIPPED - MUST execute verification before complexity assessment</field>
171
- </block>
172
-
173
- <block type="task" id="P2-B1" action="run-script" status="pending" desc="Check DISPATCH-PROGRESS.json">
174
- <field name="command">node ${update_progress_script} read --file ${workspace_root}/knowledges/bizs/DISPATCH-PROGRESS.json --summary</field>
175
- <field name="output" var="dispatch_progress"/>
176
- </block>
25
+ <!-- ========== Phase 0 Resume Router ========== -->
26
+ <block type="gateway" id="P0-RESUME" mode="exclusive" desc="Route based on resume target">
27
+ <branch test="${phase0_result.resume_target} == 'PHASE_1_KNOWLEDGE_CHECK'" goto="P1"/>
28
+ <branch test="${phase0_result.resume_target} == 'PHASE_3_USER_CONFIRMATION'" goto="P3-CONFIRM"/>
29
+ <branch test="${phase0_result.resume_target} == 'PHASE_4_PRD_SIMPLE'" goto="P4-SIMPLE"/>
30
+ <branch test="${phase0_result.resume_target} == 'PHASE_4A_MODEL'" goto="P4A"/>
31
+ <branch test="${phase0_result.resume_target} == 'PHASE_4A_CONFIRMATION'" goto="P4A-CONFIRM"/>
32
+ <branch test="${phase0_result.resume_target} == 'PHASE_4B_PRD_GENERATION'" goto="P4B"/>
33
+ <branch test="${phase0_result.resume_target} == 'PHASE_5_SUBPRD_DISPATCH'" goto="P5"/>
34
+ <branch test="${phase0_result.resume_target} == 'PHASE_6_VERIFICATION'" goto="P6"/>
35
+ <branch default="true" name="Fresh Start" goto="P1"/>
36
+ </block>
177
37
 
178
- <block type="gateway" id="P2-G1" mode="exclusive" desc="Verify knowledge initialization complete">
179
- <branch test="${dispatch_progress.counts.pending} > 0" name="Knowledge Incomplete">
180
- <block type="event" id="P2-E1" action="log" desc="Report incomplete initialization">
181
- <field name="message">Knowledge initialization is INCOMPLETE. Returning to Path B Step 3 to complete pending tasks.</field>
182
- </block>
183
- <!-- Return to Phase 1 Path B Step 3 -->
184
- <block type="goto" id="P2-GOTO1" target="P1-B3"/>
185
- </branch>
186
- <branch default="true" name="Knowledge Complete - Proceed"/>
187
- </block>
38
+ <!-- ========== Phase 1: Knowledge Base Check ========== -->
39
+ <block type="task" id="P1" action="dispatch-to-worker" desc="Phase 1: Knowledge base check">
40
+ <field name="worker">speccrew-task-worker</field>
41
+ <field name="skill">speccrew-pm-phase1-knowledge-check</field>
42
+ <field name="context">{
43
+ "workspace_path": "${phase0_result.workspace_path}",
44
+ "sync_state_bizs_dir": "${phase0_result.sync_state_bizs_dir}",
45
+ "configs_dir": "${phase0_result.configs_dir}",
46
+ "ide_skills_dir": "${phase0_result.ide_skills_dir}",
47
+ "user_requirement": "${user_requirement}",
48
+ "language": "${language}"
49
+ }</field>
50
+ <field name="output" var="phase1_result"/>
51
+ </block>
188
52
 
189
- <!-- Phase 2.1-2.2: Complexity Indicators & Decision -->
190
- <block type="task" id="P2-B2" action="assess-complexity" status="pending" desc="Assess requirement complexity">
191
- <field name="user_requirement" value="${user_requirement}"/>
192
- <field name="knowledge_status" value="${knowledge_status}"/>
193
- <field name="output" var="complexity"/>
194
- <field name="output" var="module_count"/>
195
- <field name="output" var="feature_count"/>
196
- </block>
53
+ <!-- ========== Phase 2: Complexity Assessment ========== -->
54
+ <block type="task" id="P2" action="dispatch-to-worker" desc="Phase 2: Complexity assessment">
55
+ <field name="worker">speccrew-task-worker</field>
56
+ <field name="skill">speccrew-pm-phase2-complexity-assess</field>
57
+ <field name="context">{
58
+ "workspace_path": "${phase0_result.workspace_path}",
59
+ "iteration_path": "${phase0_result.iteration_path}",
60
+ "update_progress_script": "${phase0_result.update_progress_script}",
61
+ "user_requirement": "${user_requirement}",
62
+ "knowledge_status": "${phase1_result.knowledge_status}",
63
+ "system_context": "${phase1_result.system_context}",
64
+ "language": "${language}"
65
+ }</field>
66
+ <field name="output" var="phase2_result"/>
67
+ </block>
197
68
 
198
- <!-- Phase 2.3: Skill Routing -->
199
- <block type="gateway" id="P2-G2" mode="exclusive" desc="Route based on complexity">
200
- <branch test="${complexity} == 'simple'" name="Simple Requirement">
201
- <block type="event" id="P2-E2" action="log" desc="Log simple path selection">
202
- <field name="message">Assessment: SIMPLE requirement (${module_count} modules, ${feature_count} features) → Single PRD workflow</field>
203
- </block>
204
- <block type="set-variable" id="P2-V1" name="prd_skill" value="speccrew-pm-requirement-simple"/>
205
- </branch>
206
- <branch test="${complexity} == 'complex'" name="Complex Requirement">
207
- <block type="event" id="P2-E3" action="log" desc="Log complex path selection">
208
- <field name="message">Assessment: COMPLEX requirement (${module_count} modules, ${feature_count} features) → Master-Sub PRD workflow</field>
209
- </block>
210
- <block type="set-variable" id="P2-V2" name="prd_skill" value="speccrew-pm-requirement-analysis"/>
211
- </branch>
212
- </block>
213
- </sequence>
69
+ <!-- ========== Phase 2 Router: Simple vs Complex ========== -->
70
+ <block type="gateway" id="P2-ROUTE" mode="exclusive" desc="Route based on complexity">
71
+ <branch test="${phase2_result.route} == 'speccrew-pm-requirement-simple'" name="Simple Requirement" goto="P4-SIMPLE"/>
72
+ <branch test="${phase2_result.route} == 'full-pipeline'" name="Complex Requirement" goto="P3"/>
73
+ </block>
214
74
 
215
75
  <!-- ========== Phase 3: Requirement Clarification ========== -->
216
- <sequence name="Phase 3: Requirement Clarification">
217
-
218
- <block type="rule" id="P3-R1" level="mandatory" desc="Phase 3 Mandatory Constraints">
219
- <field name="text">DO NOT perform requirement clarification yourself - MUST use speccrew-pm-requirement-clarify skill</field>
220
- <field name="text">DO NOT proceed to PRD generation without .clarification-summary.md</field>
221
- <field name="text">IF clarification skill fails: ABORT - do NOT generate clarification yourself</field>
222
- </block>
223
-
224
- <!-- Phase 3.1-3.2: Prepare Parameters & Invoke Skill -->
225
- <block type="task" id="P3-B1" action="run-skill" status="pending" desc="Invoke clarification skill">
226
- <field name="skill">speccrew-pm-requirement-clarify</field>
227
- <field name="context">
228
- requirement_file: ${user_requirement}
229
- iteration_path: ${iteration_path}
230
- complexity_hint: ${complexity}
231
- knowledge_status: ${knowledge_status.status}
232
- </field>
233
- <field name="output" var="clarification_result"/>
234
- </block>
235
-
236
- <!-- Phase 3.4: Validate Output -->
237
- <block type="task" id="P3-B2" action="validate-file" status="pending" desc="Validate clarification output">
238
- <field name="path" value="${iteration_path}/01.product-requirement/.clarification-summary.md"/>
239
- <field name="min_size" value="500"/>
240
- <field name="output" var="clarification_valid"/>
241
- </block>
242
-
243
- <block type="gateway" id="P3-G1" mode="exclusive" desc="Check validation result">
244
- <branch test="${clarification_valid} == false" name="Validation Failed">
245
- <block type="event" id="P3-E1" action="confirm" desc="Ask user for retry or abort">
246
- <field name="prompt">Phase 3 FAILED: Requirement Clarification Skill failed. Retry with additional context or Abort?</field>
247
- </block>
248
- </branch>
249
- <branch default="true" name="Validation Passed"/>
250
- </block>
251
-
252
- <!-- Phase 3.7: User Confirmation Gate -->
253
- <block type="checkpoint" id="P3-CP1" name="requirement_clarification" desc="User confirmation gate">
254
- <field name="required" value="true"/>
255
- </block>
256
-
257
- <block type="event" id="P3-E2" action="confirm" desc="Present clarification results for user confirmation">
258
- <field name="prompt">📋 Requirement Clarification Complete. Please review and confirm before proceeding to PRD generation.</field>
259
- <field name="template">clarification-summary</field>
260
- <field name="data" value="${clarification_result}"/>
261
- </block>
262
-
263
- <block type="task" id="P3-B3" action="run-script" status="pending" desc="Update confirmation checkpoint">
264
- <field name="command">node ${update_progress_script} write-checkpoint --file ${iteration_path}/01.product-requirement/.checkpoints.json --stage 01_prd --checkpoint requirement_clarification_confirmed --passed true</field>
265
- </block>
266
- </sequence>
267
-
268
- <!-- ========== Phase 4: Invoke PRD Skill ========== -->
269
- <sequence name="Phase 4: Invoke PRD Skill">
270
-
271
- <block type="rule" id="P4-R1" level="mandatory" desc="Phase 4 Orchestrator Principle">
272
- <field name="text">You are the ORCHESTRATOR, NOT the WRITER</field>
273
- <field name="text">Phase 4a (Model): DO NOT do ISA-95 analysis yourself - Skill does it</field>
274
- <field name="text">Phase 4b (Generate): DO NOT generate Master PRD yourself - Skill generates it</field>
275
- <field name="text">If ANY Skill fails: STOP and report error to user. DO NOT generate content as fallback.</field>
276
- </block>
277
-
278
- <block type="gateway" id="P4-G1" mode="exclusive" desc="Route to simple or complex path">
279
-
280
- <!-- Path A: Simple Requirements -->
281
- <branch test="${complexity} == 'simple'" name="Simple Path">
282
- <block type="task" id="P4-B1" action="run-skill" status="pending" desc="Invoke simple PRD skill">
283
- <field name="skill">speccrew-pm-requirement-simple</field>
284
- <field name="context">
285
- iteration_path: ${iteration_path}
286
- clarification_file: ${iteration_path}/01.product-requirement/.clarification-summary.md
287
- </field>
288
- <field name="output" var="prd_output"/>
289
- </block>
290
-
291
- <block type="task" id="P4-B2" action="validate-file" status="pending" desc="Validate single PRD">
292
- <field name="path" value="${prd_output.prd_path}"/>
293
- <field name="min_size" value="2048"/>
294
- <field name="output" var="prd_valid"/>
295
- </block>
296
-
297
- <!-- Skip Phase 5 for simple path -->
298
- <block type="set-variable" id="P4-V1" name="skip_phase_5" value="true"/>
299
- </branch>
76
+ <block type="task" id="P3" action="dispatch-to-worker" desc="Phase 3: Requirement clarification">
77
+ <field name="worker">speccrew-task-worker</field>
78
+ <field name="skill">speccrew-pm-requirement-clarify</field>
79
+ <field name="context">{
80
+ "workspace_path": "${phase0_result.workspace_path}",
81
+ "iteration_path": "${phase0_result.iteration_path}",
82
+ "user_requirement": "${user_requirement}",
83
+ "complexity": "${phase2_result.complexity}",
84
+ "knowledge_status": "${phase1_result.knowledge_status}",
85
+ "language": "${language}"
86
+ }</field>
87
+ <field name="output" var="phase3_result"/>
88
+ </block>
300
89
 
301
- <!-- Path B: Complex Requirements -->
302
- <branch test="${complexity} == 'complex'" name="Complex Path">
303
-
304
- <!-- Phase 4a: Module Modeling -->
305
- <block type="task" id="P4-B3" action="run-skill" status="pending" desc="Invoke requirement modeling skill">
306
- <field name="skill">speccrew-pm-requirement-model</field>
307
- <field name="context">
308
- iteration_path: ${iteration_path}
309
- clarification_file: ${iteration_path}/01.product-requirement/.clarification-summary.md
310
- </field>
311
- <field name="output" var="model_output"/>
312
- </block>
90
+ <!-- R-CONFIRM: Mandatory User Confirmation Rule for Phase 3 -->
91
+ <block type="rule" id="R-CONFIRM-P3" level="mandatory" desc="User confirmation is MANDATORY and CANNOT be skipped">
92
+ <field name="text">MANDATORY: After Phase 3 (Requirement Clarification) completes, you MUST wait for EXPLICIT user confirmation before proceeding.</field>
93
+ <field name="text">DO NOT mark checkpoint as passed by yourself. DO NOT skip user confirmation for ANY reason.</field>
94
+ <field name="text">Even if the user provided complete requirements, they MUST explicitly confirm the clarification results.</field>
95
+ <field name="text">The checkpoint write-checkpoint command MUST ONLY be executed AFTER the user explicitly confirms.</field>
96
+ </block>
313
97
 
314
- <block type="task" id="P4-B4" action="validate-file" status="pending" desc="Validate module design">
315
- <field name="path" value="${iteration_path}/01.product-requirement/.module-design.md"/>
316
- <field name="min_size" value="1024"/>
317
- <field name="output" var="model_valid"/>
318
- </block>
98
+ <!-- Phase 3 Checkpoint -->
99
+ <block type="checkpoint" id="P3-CP1" name="requirement_clarification" desc="User confirmation gate for Phase 3">
100
+ <field name="required" value="true"/>
101
+ </block>
319
102
 
320
- <block type="gateway" id="P4-G2" mode="exclusive" desc="Check model validation">
321
- <branch test="${model_valid} == false" name="Model Failed">
322
- <block type="event" id="P4-E1" action="confirm" desc="Ask user for retry or abort">
323
- <field name="prompt">Phase 4a FAILED: Modeling skill failed. Retry with additional context or Abort?</field>
324
- </block>
325
- </branch>
326
- <branch default="true" name="Model Passed"/>
327
- </block>
103
+ <!-- Phase 3 User Confirmation Event -->
104
+ <block type="event" id="P3-CONFIRM" action="user-confirm" desc="Present clarification results for user confirmation">
105
+ <field name="prompt">📋 Phase 3: Requirement Clarification Complete. Please review the clarification summary and confirm before proceeding to PRD generation.</field>
106
+ <field name="template">clarification-summary</field>
107
+ <field name="data" value="${phase3_result}"/>
108
+ <field name="skippable" value="false"/>
109
+ </block>
328
110
 
329
- <!-- Phase 4b: Master PRD Generation -->
330
- <block type="task" id="P4-B5" action="run-skill" status="pending" desc="Invoke requirement analysis skill">
331
- <field name="skill">speccrew-pm-requirement-analysis</field>
332
- <field name="context">
333
- iteration_path: ${iteration_path}
334
- clarification_file: ${iteration_path}/01.product-requirement/.clarification-summary.md
335
- module_design_file: ${iteration_path}/01.product-requirement/.module-design.md
336
- </field>
337
- <field name="output" var="prd_output"/>
338
- </block>
111
+ <!-- Phase 3 Checkpoint Write -->
112
+ <block type="task" id="P3-CHK-WRITE" action="run-script" desc="Update Phase 3 confirmation checkpoint">
113
+ <field name="command">node ${phase0_result.update_progress_script} write-checkpoint --file ${phase0_result.iteration_path}/01.product-requirement/.checkpoints.json --stage 01_prd --checkpoint requirement_clarification_confirmed --passed true</field>
114
+ </block>
339
115
 
340
- <block type="task" id="P4-B6" action="validate-file" status="pending" desc="Validate Master PRD">
341
- <field name="path" value="${prd_output.master_prd_path}"/>
342
- <field name="min_size" value="2048"/>
343
- <field name="output" var="prd_valid"/>
344
- </block>
116
+ <!-- ========== Phase 4 Simple: Single PRD Generation ========== -->
117
+ <block type="task" id="P4-SIMPLE" action="dispatch-to-worker" desc="Phase 4 Simple: Generate single PRD">
118
+ <field name="worker">speccrew-task-worker</field>
119
+ <field name="skill">speccrew-pm-requirement-simple</field>
120
+ <field name="context">{
121
+ "workspace_path": "${phase0_result.workspace_path}",
122
+ "iteration_path": "${phase0_result.iteration_path}",
123
+ "clarification_file": "${phase0_result.iteration_path}/01.product-requirement/.clarification-summary.md",
124
+ "knowledge_status": "${phase1_result.knowledge_status}",
125
+ "language": "${language}"
126
+ }</field>
127
+ <field name="output" var="phase4_result"/>
128
+ </block>
345
129
 
346
- <block type="gateway" id="P4-G3" mode="exclusive" desc="Check PRD validation">
347
- <branch test="${prd_valid} == false" name="PRD Failed">
348
- <block type="event" id="P4-E2" action="confirm" desc="Ask user for retry or abort">
349
- <field name="prompt">Phase 4b FAILED: PRD generation skill failed. Retry with additional context or Abort?</field>
350
- </block>
351
- </branch>
352
- <branch default="true" name="PRD Passed">
353
- <block type="set-variable" id="P4-V2" name="skip_phase_5" value="false"/>
354
- </branch>
355
- </block>
356
- </branch>
357
- </block>
358
- </sequence>
130
+ <!-- Skip Phase 5 for simple path -->
131
+ <block type="set-variable" id="P4-SIMPLE-SKIP" name="skip_phase_5" value="true"/>
132
+
133
+ <!-- Phase 4 Simple goto Phase 6 -->
134
+ <block type="goto" id="P4-SIMPLE-GOTO" target="P6"/>
135
+
136
+ <!-- ========== Phase 4a: Requirement Modeling (Complex Path) ========== -->
137
+ <block type="task" id="P4A" action="dispatch-to-worker" desc="Phase 4a: ISA-95 Requirement modeling">
138
+ <field name="worker">speccrew-task-worker</field>
139
+ <field name="skill">speccrew-pm-requirement-model</field>
140
+ <field name="context">{
141
+ "workspace_path": "${phase0_result.workspace_path}",
142
+ "iteration_path": "${phase0_result.iteration_path}",
143
+ "clarification_file": "${phase0_result.iteration_path}/01.product-requirement/.clarification-summary.md",
144
+ "language": "${language}"
145
+ }</field>
146
+ <field name="output" var="phase4a_result"/>
147
+ </block>
359
148
 
360
- <!-- ========== Phase 5: Sub-PRD Worker Dispatch (Complex Only) ========== -->
361
- <sequence name="Phase 5: Sub-PRD Worker Dispatch">
362
-
363
- <block type="gateway" id="P5-G1" mode="exclusive" desc="Check if Phase 5 needed">
364
- <branch test="${skip_phase_5} == true" name="Skip Phase 5">
365
- <block type="event" id="P5-E1" action="log" desc="Skip Sub-PRD dispatch for simple path">
366
- <field name="message">Simple requirement - skipping Sub-PRD dispatch phase</field>
367
- </block>
368
- </branch>
369
- <branch default="true" name="Execute Phase 5">
370
-
371
- <block type="rule" id="P5-R1" level="mandatory" desc="Phase 5 Worker Enforcement">
372
- <field name="text">ONE Worker per Module - NO EXCEPTIONS</field>
373
- <field name="text">DO NOT generate Sub-PRDs yourself - dispatch speccrew-task-worker</field>
374
- <field name="text">DO NOT invoke speccrew-pm-sub-prd-generate skill directly - ONLY via Worker</field>
375
- <field name="text">Dispatch in batches of 5, wait for each batch to complete</field>
376
- </block>
149
+ <!-- R-CONFIRM: Mandatory User Confirmation Rule for Phase 4a -->
150
+ <block type="rule" id="R-CONFIRM-P4A" level="mandatory" desc="User confirmation is MANDATORY and CANNOT be skipped">
151
+ <field name="text">MANDATORY: After Phase 4a (Requirement Modeling) completes, you MUST wait for EXPLICIT user confirmation before proceeding.</field>
152
+ <field name="text">DO NOT mark checkpoint as passed by yourself. DO NOT skip user confirmation for ANY reason.</field>
153
+ <field name="text">Even if the module design appears complete, the user MUST explicitly confirm before PRD generation.</field>
154
+ <field name="text">The checkpoint write-checkpoint command MUST ONLY be executed AFTER the user explicitly confirms.</field>
155
+ </block>
377
156
 
378
- <!-- Phase 5.1: Read Dispatch Plan -->
379
- <block type="task" id="P5-B1" action="read-json" status="pending" desc="Read dispatch plan from PRD output">
380
- <field name="path" value="${prd_output.dispatch_plan_path}"/>
381
- <field name="output" var="dispatch_plan"/>
382
- </block>
157
+ <!-- Phase 4a Checkpoint -->
158
+ <block type="checkpoint" id="P4A-CP1" name="requirement_modeling" desc="User confirmation gate for Phase 4a">
159
+ <field name="required" value="true"/>
160
+ </block>
383
161
 
384
- <!-- Phase 5.2: Initialize Dispatch Progress -->
385
- <block type="task" id="P5-B2" action="run-script" status="pending" desc="Initialize DISPATCH-PROGRESS.json">
386
- <field name="command">node ${update_progress_script} init --file ${iteration_path}/01.product-requirement/DISPATCH-PROGRESS.json --stage sub_prd_dispatch --tasks-file ${iteration_path}/01.product-requirement/.tasks-temp.json</field>
387
- </block>
162
+ <!-- Phase 4a User Confirmation Event -->
163
+ <block type="event" id="P4A-CONFIRM" action="user-confirm" desc="Present module design for user confirmation">
164
+ <field name="prompt">📋 Phase 4a: ISA-95 Module Design Complete. Please review .module-design.md before proceeding to PRD generation.</field>
165
+ <field name="template">module-design-summary</field>
166
+ <field name="data" value="${phase4a_result}"/>
167
+ <field name="skippable" value="false"/>
168
+ </block>
388
169
 
389
- <!-- Phase 5.3: Dispatch Workers in Batches -->
390
- <block type="loop" id="P5-L1" mode="batch" batch_size="5" desc="Dispatch workers for each module">
391
- <field name="items" value="${dispatch_plan.modules}"/>
392
-
393
- <block type="task" id="P5-B3" action="dispatch-to-worker" status="pending" desc="Dispatch Sub-PRD worker">
394
- <field name="agent">speccrew-task-worker</field>
395
- <field name="skill">speccrew-pm-sub-prd-generate</field>
396
- <field name="context">
397
- module_id: ${item.module_id}
398
- module_name: ${item.module_name}
399
- module_key: ${item.module_key}
400
- module_scope: ${item.module_scope}
401
- module_entities: ${item.module_entities}
402
- module_user_stories: ${item.module_user_stories}
403
- module_requirements: ${item.module_requirements}
404
- module_features: ${item.module_features}
405
- module_dependencies: ${item.module_dependencies}
406
- master_prd_path: ${prd_output.master_prd_path}
407
- clarification_file: ${iteration_path}/01.product-requirement/.clarification-summary.md
408
- module_design_file: ${iteration_path}/01.product-requirement/.module-design.md
409
- feature_name: ${dispatch_plan.feature_name}
410
- template_path: ${dispatch_plan.template_path}
411
- output_path: ${dispatch_plan.output_dir}/${dispatch_plan.feature_name}-sub-${item.module_key}.md
412
- language: ${language}
413
- </field>
414
- </block>
170
+ <!-- Phase 4a Checkpoint Write -->
171
+ <block type="task" id="P4A-CHK-WRITE" action="run-script" desc="Update Phase 4a confirmation checkpoint">
172
+ <field name="command">node ${phase0_result.update_progress_script} write-checkpoint --file ${phase0_result.iteration_path}/01.product-requirement/.checkpoints.json --stage 01_prd --checkpoint requirement_modeling_confirmed --passed true</field>
173
+ </block>
415
174
 
416
- <block type="task" id="P5-B4" action="run-script" status="pending" desc="Update worker progress">
417
- <field name="command">node ${update_progress_script} update-task --file ${iteration_path}/01.product-requirement/DISPATCH-PROGRESS.json --task-id ${item.module_key} --status ${worker_status}</field>
418
- </block>
419
- </block>
175
+ <!-- ========== Phase 4b: Master PRD Generation (Complex Path) ========== -->
176
+ <block type="task" id="P4B" action="dispatch-to-worker" desc="Phase 4b: Generate Master PRD">
177
+ <field name="worker">speccrew-task-worker</field>
178
+ <field name="skill">speccrew-pm-requirement-analysis</field>
179
+ <field name="context">{
180
+ "workspace_path": "${phase0_result.workspace_path}",
181
+ "iteration_path": "${phase0_result.iteration_path}",
182
+ "clarification_file": "${phase0_result.iteration_path}/01.product-requirement/.clarification-summary.md",
183
+ "module_design_file": "${phase0_result.iteration_path}/01.product-requirement/.module-design.md",
184
+ "language": "${language}"
185
+ }</field>
186
+ <field name="output" var="phase4b_result"/>
187
+ </block>
420
188
 
421
- <!-- Phase 5.4: Handle Failures & Retry -->
422
- <block type="task" id="P5-B5" action="run-script" status="pending" desc="Check for failed tasks">
423
- <field name="command">node ${update_progress_script} read --file ${iteration_path}/01.product-requirement/DISPATCH-PROGRESS.json</field>
424
- <field name="output" var="final_progress"/>
425
- </block>
189
+ <block type="set-variable" id="P4B-NOSKIP" name="skip_phase_5" value="false"/>
426
190
 
427
- <block type="gateway" id="P5-G2" mode="exclusive" desc="Check for failures">
428
- <branch test="${final_progress.failed_count} > 0" name="Has Failures">
429
- <block type="event" id="P5-E2" action="log" desc="Report failed modules">
430
- <field name="template">failed-modules</field>
431
- <field name="data" value="${final_progress.failed_tasks}"/>
432
- </block>
433
- <!-- Single retry for failed modules -->
434
- <block type="event" id="P5-E3" action="confirm" desc="Ask user for retry or skip">
435
- <field name="prompt">Some modules failed. Retry failed modules, Skip and continue, or Abort?</field>
436
- </block>
437
- </branch>
438
- <branch default="true" name="All Success"/>
439
- </block>
191
+ <!-- ========== Phase 5: Sub-PRD Dispatch (Complex Only) ========== -->
192
+ <block type="gateway" id="P5-GATE" mode="exclusive" desc="Check if Phase 5 needed">
193
+ <branch test="${skip_phase_5} == true" name="Skip Phase 5" goto="P6"/>
194
+ <branch default="true" name="Execute Phase 5" goto="P5"/>
195
+ </block>
440
196
 
441
- <!-- Phase 5.5: Collect Results & Verify -->
442
- <block type="task" id="P5-B6" action="run-script" status="pending" desc="Update checkpoint">
443
- <field name="command">node ${update_progress_script} write-checkpoint --file ${iteration_path}/01.product-requirement/.checkpoints.json --checkpoint sub_prd_dispatch --status passed</field>
444
- </block>
445
- </branch>
446
- </block>
447
- </sequence>
197
+ <block type="task" id="P5" action="dispatch-to-worker" desc="Phase 5: Sub-PRD dispatch">
198
+ <field name="worker">speccrew-task-worker</field>
199
+ <field name="skill">speccrew-pm-phase5-subprd-dispatch</field>
200
+ <field name="context">{
201
+ "workspace_path": "${phase0_result.workspace_path}",
202
+ "iteration_path": "${phase0_result.iteration_path}",
203
+ "update_progress_script": "${phase0_result.update_progress_script}",
204
+ "master_prd_path": "${phase4b_result.master_prd_path}",
205
+ "dispatch_plan_path": "${phase4b_result.dispatch_plan_path}",
206
+ "language": "${language}"
207
+ }</field>
208
+ <field name="output" var="phase5_result"/>
209
+ </block>
448
210
 
449
211
  <!-- ========== Phase 6: Verification & Confirmation ========== -->
450
- <sequence name="Phase 6: Verification & Confirmation">
451
-
452
- <block type="rule" id="P6-R1" level="mandatory" desc="Phase 6 Structure Rules">
453
- <field name="text">Phase 6 MUST execute in order: 6.1 (Verification) → 6.2 (User Review) → 6.3 (Finalize)</field>
454
- <field name="text">Gate 6.1→6.2: Automatic after checklist passes</field>
455
- <field name="text">Gate 6.2→6.3: REQUIRES EXPLICIT USER CONFIRMATION - no auto-proceed</field>
456
- <field name="text">DO NOT update checkpoints (verification_checklist, prd_review) before user confirmation</field>
457
- <field name="text">DO NOT update WORKFLOW-PROGRESS.json to completed before user confirmation</field>
458
- </block>
459
-
460
- <!-- Phase 6.1: Verification Checklist -->
461
- <block type="task" id="P6-B1" action="verify-checklist" status="pending" desc="Run verification checklist">
462
- <field name="iteration_path" value="${iteration_path}"/>
463
- <field name="complexity" value="${complexity}"/>
464
- <field name="output" var="verification_result"/>
465
- </block>
466
-
467
- <block type="gateway" id="P6-G1" mode="exclusive" desc="Check verification result">
468
- <branch test="${verification_result.passed} == false" name="Verification Failed">
469
- <block type="event" id="P6-E1" action="confirm" desc="Report violations">
470
- <field name="prompt">Verification failed. Issues found: ${verification_result.issues}. Proceed anyway, Regenerate, or Abort?</field>
471
- </block>
472
- </branch>
473
- <branch default="true" name="Verification Passed"/>
474
- </block>
475
-
476
- <!-- Phase 6.2: Present for User Review (HARD STOP) -->
477
- <block type="checkpoint" id="P6-CP1" name="user_review" desc="User review gate">
478
- <field name="required" value="true"/>
479
- </block>
480
-
481
- <block type="event" id="P6-E2" action="confirm" desc="Present PRD documents for user review">
482
- <field name="prompt">📋 PRD Documents Ready for Review. Please review and confirm. Reply "确认" or "OK" to proceed.</field>
483
- <field name="template">prd-review-summary</field>
484
- <field name="data" value="${prd_output}"/>
485
- </block>
486
-
487
- <!-- Phase 6.3: Finalize (ONLY after user confirms) -->
488
- <block type="rule" id="P6-R2" level="mandatory" desc="Phase 6.3 Prerequisite">
489
- <field name="text">Phase 6.3 can ONLY execute AFTER user has explicitly confirmed in Phase 6.2</field>
490
- <field name="text">IF user has NOT confirmed → DO NOT execute any step below</field>
491
- </block>
492
-
493
- <block type="task" id="P6-B2" action="run-script" status="pending" desc="Update verification checkpoint">
494
- <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>
495
- </block>
496
-
497
- <block type="task" id="P6-B3" action="run-script" status="pending" desc="Update PRD review checkpoint">
498
- <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>
499
- </block>
500
-
501
- <block type="task" id="P6-B4" action="run-script" status="pending" desc="Update workflow status to completed">
502
- <field name="command">node ${update_progress_script} update-workflow --file ${iteration_path}/WORKFLOW-PROGRESS.json --stage 01_prd --status completed</field>
503
- </block>
504
-
505
- <block type="task" id="P6-B5" action="run-script" status="pending" desc="Update workflow status to confirmed">
506
- <field name="command">node ${update_progress_script} update-workflow --file ${iteration_path}/WORKFLOW-PROGRESS.json --stage 01_prd --status confirmed</field>
507
- </block>
508
-
509
- <block type="task" id="P6-B6" action="update-status" status="pending" desc="Update PRD document status">
510
- <field name="files" value="${prd_output.all_prd_files}"/>
511
- <field name="from" value="📝 Draft"/>
512
- <field name="to" value="✅ Confirmed"/>
513
- </block>
514
-
515
- <!-- Phase 6 Cleanup -->
516
- <block type="task" id="P6-B7" action="run-script" status="pending" desc="Cleanup intermediate files">
517
- <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/.sub-prd-dispatch-plan.json -ErrorAction SilentlyContinue</field>
518
- </block>
519
-
520
- <block type="event" id="P6-E3" action="log" desc="Output completion message">
521
- <field name="template">prd-completion</field>
522
- <field name="message">✅ PRD Stage Complete. All documents confirmed. Ready for Feature Design phase.</field>
523
- </block>
524
- </sequence>
212
+ <block type="task" id="P6" action="dispatch-to-worker" desc="Phase 6: Verify and confirm">
213
+ <field name="worker">speccrew-task-worker</field>
214
+ <field name="skill">speccrew-pm-phase6-verify-confirm</field>
215
+ <field name="context">{
216
+ "workspace_path": "${phase0_result.workspace_path}",
217
+ "iteration_path": "${phase0_result.iteration_path}",
218
+ "update_progress_script": "${phase0_result.update_progress_script}",
219
+ "complexity": "${phase2_result.complexity}",
220
+ "prd_output": "${phase4_result}",
221
+ "language": "${language}"
222
+ }</field>
223
+ <field name="output" var="phase6_result"/>
224
+ </block>
525
225
 
526
226
  <!-- ========== Output ========== -->
527
227
  <block type="output" id="O1" desc="PM Orchestration execution result">
528
- <field name="status" from="${execution.status}" type="string" desc="success / partial / failed"/>
529
- <field name="prd_files" from="${prd_output.all_prd_files}" type="array" desc="Generated PRD file list"/>
530
- <field name="feature_list" from="${iteration_path}/01.product-requirement/.prd-feature-list.json" type="string" desc="Feature list file path"/>
228
+ <field name="status" from="${phase6_result.status}" type="string" desc="success / partial / failed"/>
229
+ <field name="prd_files" from="${phase6_result.prd_files}" type="array" desc="Generated PRD file list"/>
230
+ <field name="feature_list" from="${phase6_result.feature_list}" type="string" desc="Feature list file path"/>
531
231
  <field name="workflow_stage" from="01_prd" type="string" desc="Current workflow stage"/>
532
232
  <field name="next_agent" value="speccrew-feature-designer" type="string" desc="Suggested next agent"/>
533
233
  </block>
234
+
534
235
  </workflow>