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.
@@ -14,6 +14,13 @@
14
14
  <!-- ============================================================
15
15
  Global Constraints
16
16
  ============================================================ -->
17
+ <block type="rule" id="R-MULTIROUND" level="mandatory" desc="Multi-round clarification is MANDATORY">
18
+ <field name="text">MANDATORY: Clarification MUST execute multiple rounds until ALL 4 sufficiency checks pass.</field>
19
+ <field name="text">DO NOT terminate after a single round. Each round generates .clarification-questions-round-{N}.md</field>
20
+ <field name="text">After user answers, perform sufficiency check. If any check fails, generate next round questions.</field>
21
+ <field name="text">Maximum 5 rounds allowed. If max reached, proceed with warning.</field>
22
+ </block>
23
+
17
24
  <block type="rule" id="R1" level="mandatory" desc="Execution constraints">
18
25
  <field name="text">Always perform at least 1 clarification round</field>
19
26
  <field name="text">Use file-based for complex mode or 4+ questions</field>
@@ -69,7 +76,14 @@
69
76
  </branch>
70
77
  </block>
71
78
 
72
- <!-- Step 4: Execute Clarification -->
79
+ <!-- Step 4: Initialize Loop Variables -->
80
+ <block type="task" id="B6-init" action="set-var" desc="Initialize loop control variables">
81
+ <field name="sufficiency_checks_passed" value="false"/>
82
+ <field name="round_number" value="1"/>
83
+ <field name="max_rounds" value="5"/>
84
+ </block>
85
+
86
+ <!-- Step 5: Execute Clarification -->
73
87
  <block type="gateway" id="G2" mode="exclusive" desc="Execute clarification based on mode">
74
88
  <branch test="${complexity} == 'simple'" name="Simple Mode Clarification">
75
89
  <block type="task" id="B6" action="analyze" desc="Simple mode: 1-3 key questions">
@@ -84,19 +98,28 @@
84
98
  </branch>
85
99
  <branch test="${complexity} == 'complex'" name="Complex Mode Clarification">
86
100
  <!-- Clarification Loop -->
87
- <block type="loop" id="L1" condition="sufficiency_checks_passed == false" desc="Clarification rounds until sufficiency">
88
- <block type="task" id="B7" action="generate" desc="Create clarification questions file">
89
- <field name="output_path" value="${iteration_path}/01.product-requirement/.clarification-questions-round-{round}.md"/>
90
- <field name="sections">
91
- - Business Background & Goals
92
- - Target Users & Scenarios
93
- - System Scope & Boundaries
101
+ <block type="loop" id="L1" condition="sufficiency_checks_passed == false AND round_number <= max_rounds" desc="Clarification rounds until sufficiency">
102
+ <!-- Load Question Template -->
103
+ <block type="task" id="B7-load-template" action="read-file" desc="Load clarification questions template">
104
+ <field name="path" value="${skill_path}/templates/CLARIFICATION-QUESTIONS-TEMPLATE.md"/>
105
+ <field name="output" var="questions_template"/>
106
+ </block>
107
+
108
+ <block type="task" id="B7" action="generate" desc="Create clarification questions file from template">
109
+ <field name="template" value="${questions_template}"/>
110
+ <field name="output_path" value="${iteration_path}/01.product-requirement/.clarification-questions-round-${round_number}.md"/>
111
+ <field name="vars">
112
+ - round_number: ${round_number}
113
+ - iteration_name: ${iteration_name}
114
+ - date: ${current_date}
115
+ - complexity_level: ${complexity}
116
+ - requirement_summary: ${requirement_summary}
94
117
  </field>
95
118
  <field name="output" var="questions_file"/>
96
119
  </block>
97
120
 
98
- <block type="event" id="E1" action="confirm" title="Clarification Round {round}" type="wait" desc="Wait for user to answer questions">
99
- <field name="message">Round {round} questions written. Please fill answers and notify me.</field>
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>
100
123
  </block>
101
124
 
102
125
  <block type="task" id="B8" action="read-file" desc="Read answered questions">
@@ -106,6 +129,7 @@
106
129
 
107
130
  <!-- Sufficiency Check -->
108
131
  <block type="task" id="B9" action="analyze" desc="Perform sufficiency check">
132
+ <field name="input" value="${answered_questions}"/>
109
133
  <field name="checks">
110
134
  1. Scope boundaries are clear - Explicit in/out scope defined
111
135
  2. Key business rules are documented - At least 1 rule identified
@@ -114,24 +138,46 @@
114
138
  </field>
115
139
  <field name="output" var="sufficiency_result"/>
116
140
  </block>
141
+
142
+ <!-- Update sufficiency variable based on check result -->
143
+ <block type="task" id="B9-update" action="set-var" desc="Update sufficiency check status">
144
+ <field name="sufficiency_checks_passed" value="${sufficiency_result.all_passed}"/>
145
+ <field name="checks_passed_count" value="${sufficiency_result.passed_count}"/>
146
+ </block>
147
+
148
+ <!-- Increment round number for next iteration -->
149
+ <block type="task" id="B9-increment" action="set-var" desc="Increment round counter">
150
+ <field name="round_number" value="${round_number + 1}"/>
151
+ </block>
117
152
  </block>
118
153
  </branch>
119
154
  </block>
120
155
 
121
- <!-- Step 5: Generate .clarification-summary.md -->
122
- <block type="task" id="B10" action="generate" desc="Generate clarification summary">
156
+ <!-- Step 6: Generate .clarification-summary.md -->
157
+ <block type="task" id="B10-load-template" action="read-file" desc="Load summary template">
158
+ <field name="path" value="${skill_path}/templates/CLARIFICATION-SUMMARY-TEMPLATE.md"/>
159
+ <field name="output" var="summary_template"/>
160
+ </block>
161
+
162
+ <block type="task" id="B10" action="generate" desc="Generate clarification summary from template">
163
+ <field name="template" value="${summary_template}"/>
123
164
  <field name="output_path" value="${iteration_path}/01.product-requirement/.clarification-summary.md"/>
124
- <field name="sections">
125
- - Complexity level and rationale
126
- - Key decisions table
127
- - Clarification Q&A (all rounds)
128
- - Sufficiency checks results
129
- - Notes
165
+ <field name="vars">
166
+ - iteration_name: ${iteration_name}
167
+ - total_rounds: ${round_number - 1}
168
+ - date: ${current_date}
169
+ - sufficiency_result: ${sufficiency_result.all_passed ? 'PASSED' : 'PARTIAL'}
170
+ - checks_passed: ${sufficiency_result.passed_count}
171
+ - requirement_overview: ${requirement_summary}
172
+ - business_complexity: ${complexity}
173
+ - technical_complexity: ${complexity}
174
+ - integration_complexity: ${complexity}
175
+ - overall_complexity: ${complexity}
130
176
  </field>
131
177
  <field name="output" var="summary_path"/>
132
178
  </block>
133
179
 
134
- <!-- Step 6: Initialize .checkpoints.json -->
180
+ <!-- Step 7: Initialize .checkpoints.json -->
135
181
  <block type="task" id="B11" action="run-script" desc="Initialize checkpoints via script">
136
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>
137
183
  <field name="output" var="checkpoint_result"/>
@@ -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,20 +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
- > **Step 3**: Execute ALL blocks sequentially without pausing (only stop at explicit `<event action="confirm">` blocks)
28
+ > **CRITICAL DISPATCH RULE:**
29
+ > - PM Agent (Team Leader) MUST NOT execute Skills directly
30
+ > - ALL Skill executions MUST go through `dispatch-to-worker` action
31
+ > - Worker Agent (`speccrew-task-worker`) receives the Skill name and context, then executes the Skill
32
+ >
33
+ > **Step 3**: Execute ALL blocks sequentially without pausing (only stop at explicit `<event action="user-confirm">` blocks)
34
+
35
+ # Product Manager Orchestration (v2.0)
36
+
37
+ 纯路由层编排技能,负责:
38
+
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 的强制性用户确认门禁
43
+
44
+ ## Architecture: Pure Routing Layer
45
+
46
+ 本 Skill 是**纯路由层**,所有业务逻辑由独立的 Phase Skill 执行:
29
47
 
30
- # Product Manager Orchestration
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` | 验证清单、用户审核、最终确认 |
31
59
 
32
- Product Manager 的核心编排技能,负责:
60
+ ## User Confirmation Gates (MANDATORY)
33
61
 
34
- 1. **Pipeline Progress Management** - 创建/定位迭代目录,管理工作流进度
35
- 2. **Knowledge Base Detection** - 检测知识库状态并按需初始化
36
- 3. **Complexity Assessment** - 评估需求复杂度,决定简单/复杂路径
37
- 4. **Requirement Clarification** - 调用澄清技能,收集需求细节
38
- 5. **PRD Generation Orchestration** - 协调 PRD 生成(简单路径直接调用,复杂路径分发 Worker)
39
- 6. **Verification & Confirmation** - 验证 PRD 完整性,等待用户确认
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 | 验证确认 |
40
102
 
41
103
  ## Invocation Method
42
104
 
@@ -88,22 +150,24 @@ This skill MUST execute tasks continuously without unnecessary interruptions.
88
150
 
89
151
  ### When to Pause (ONLY these cases)
90
152
 
91
- 1. CHECKPOINT gates defined in workflow (user confirmation required by design)
153
+ 1. **User Confirmation Gates** `action="user-confirm"` blocks (Phase 3, Phase 4a)
92
154
  2. Ambiguous requirements that genuinely need clarification
93
155
  3. Unrecoverable errors that prevent further progress
94
156
  4. Security-sensitive operations (e.g., deleting existing files)
95
157
 
96
- ### Orchestrator Principle
158
+ ### Orchestrator Principle (v2.0)
97
159
 
98
- This agent is an **orchestrator/dispatcher**. Key constraints:
160
+ This agent is a **pure router/dispatcher**. Key constraints:
99
161
 
100
162
  | Phase | Skill | ORCHESTRATOR Rule |
101
163
  |-------|-------|-------------------|
102
- | Phase 3 | `speccrew-pm-requirement-clarify` | DO NOT clarify requirements yourself Skill handles all clarification rounds |
103
- | Phase 4a | `speccrew-pm-requirement-model` | DO NOT perform ISA-95 analysis or module decomposition yourself |
104
- | Phase 4b | `speccrew-pm-requirement-analysis` | DO NOT generate Master PRD or Dispatch Plan yourself |
105
- | Phase 5 | `speccrew-pm-sub-prd-generate` (via workers) | DO NOT generate Sub-PRD content yourself |
106
- | 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 |
166
+
167
+ **UNIVERSAL DISPATCH RULE:**
168
+ - PM Agent NEVER invokes Skills directly via `action="run-skill"`
169
+ - ALL Skill invocations use `action="dispatch-to-worker"` with `speccrew-task-worker`
170
+ - Worker Agent receives the Skill name in context and executes it
107
171
 
108
172
  **UNIVERSAL ABORT RULE:**
109
173
  - IF ANY skill fails → STOP and report to user