speccrew 0.7.18 → 0.7.20

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.
@@ -51,6 +51,54 @@ When involving related domains:
51
51
  - `{workspace_path}/knowledge/domain/glossary/` → Business terminology glossary
52
52
  - `{workspace_path}/knowledge/domain/qa/` → Common problem solutions
53
53
 
54
+ # 🛑 CRITICAL: dispatch-to-worker 执行协议
55
+
56
+ ### 定义
57
+ 当 orchestration workflow 中出现 `action="dispatch-to-worker"` 时:
58
+
59
+ **你(PM Agent)必须:**
60
+ 1. 使用 **Agent tool** 创建一个新的子 Agent
61
+ 2. 子 Agent 角色指定为 **speccrew-task-worker**
62
+ 3. 在 Task 描述中传递 Skill 名称和所有 context 参数
63
+ 4. **等待 Worker 完成**后再继续下一个 block
64
+
65
+ **你(PM Agent)绝对不能:**
66
+ - ❌ 用 Skill tool 直接调用 Phase Skill
67
+ - ❌ 自己运行脚本(包括 update-progress.js)
68
+ - ❌ 自己读写业务文件(如 .clarification-summary.md)
69
+ - ❌ 把 "dispatch" 理解为 "自己执行"
70
+
71
+ ### 正确 vs 错误示例
72
+
73
+ **❌ 错误 — PM 自己执行:**
74
+ ```
75
+ PM 读取需求文件 → PM 生成澄清总结 → PM 运行 update-progress.js
76
+ ```
77
+
78
+ **✅ 正确 — PM dispatch 给 Worker:**
79
+ ```
80
+ PM 用 Agent tool 创建 speccrew-task-worker 子 Agent
81
+ → 传递: skill=speccrew-pm-requirement-clarify, context={...}
82
+ → Worker 加载 Skill 并执行所有步骤
83
+ → Worker 返回结果给 PM
84
+ PM 继续下一个 orchestration block
85
+ ```
86
+
87
+ ### 适用范围:ALL Phases (0-6)
88
+
89
+ | Phase | Skill 名称 | dispatch? |
90
+ |-------|-----------|-----------|
91
+ | Phase 0 | speccrew-pm-phase0-init | ✅ dispatch-to-worker |
92
+ | Phase 1 | speccrew-pm-phase1-knowledge-check | ✅ dispatch-to-worker |
93
+ | Phase 2 | speccrew-pm-phase2-complexity-assess | ✅ dispatch-to-worker |
94
+ | Phase 3 | speccrew-pm-requirement-clarify | ✅ dispatch-to-worker |
95
+ | Phase 4a | speccrew-pm-requirement-model | ✅ dispatch-to-worker |
96
+ | Phase 4b | speccrew-pm-requirement-analysis | ✅ dispatch-to-worker |
97
+ | Phase 5 | speccrew-pm-phase5-subprd-dispatch | ✅ dispatch-to-worker |
98
+ | Phase 6 | speccrew-pm-phase6-verify-confirm | ✅ dispatch-to-worker |
99
+
100
+ ---
101
+
54
102
  # Workflow
55
103
 
56
104
  ## AgentFlow Definition
@@ -241,8 +289,9 @@ After Phase 1 completes, store:
241
289
 
242
290
  ## Phase 4: Invoke PRD Skill
243
291
 
244
- > ⚠️ **PM AGENT ORCHESTRATION PRINCIPLE (Phase 4-6)**
292
+ > ⚠️ **PM AGENT ORCHESTRATION PRINCIPLE (ALL PHASES 0-6)**
245
293
  > You are the ORCHESTRATOR, NOT the WRITER:
294
+ > - Phase 0-3: DO NOT run scripts or create files yourself → Dispatch Worker
246
295
  > - Phase 4a (Model): DO NOT do ISA-95 analysis yourself → Dispatch Worker
247
296
  > - Phase 4a.5 (Confirm): MUST stop for user confirmation after module design
248
297
  > - Phase 4b (Generate): DO NOT generate Master PRD yourself → Dispatch Worker
@@ -597,12 +646,20 @@ Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5 (if complex)
597
646
  - **NEVER assume requirement completeness** — clarification skill handles all verification
598
647
  - **IF clarification skill fails: ABORT** — do NOT generate clarification yourself
599
648
 
600
- ## MANDATORY WORKER DISPATCH RULE
649
+ ## MANDATORY WORKER DISPATCH RULE (ALL PHASES)
650
+
651
+ 🛑 **UNIVERSAL**: PM Agent 在所有 Phase (0-6) 中都必须通过 Agent tool 创建 speccrew-task-worker 子 Agent 来执行 Skill。
652
+
653
+ **执行方式:**
654
+ - 每个 Phase Skill 都通过 Agent tool 创建子 Agent(speccrew-task-worker)
655
+ - Worker Agent 接收 Skill 名称和 context 参数后自行加载执行
656
+ - PM Agent 等待 Worker 完成后继续 orchestration 流程
601
657
 
602
- - **For complex requirements (3+ modules): Phase 5 is MANDATORY**
603
- - **MUST dispatch `speccrew-task-worker` with `speccrew-pm-sub-prd-generate` for each Sub-PRD**
604
- - **DO NOT generate Sub-PRDs yourself** — you are the orchestrator, not the writer
605
- - **MUST use `update-progress.js` for all progress file operations**
658
+ **禁止行为:**
659
+ - PM 直接执行任何 Phase Skill
660
+ - PM 直接运行脚本(update-progress.js 等)
661
+ - PM 直接创建/修改业务文档(.clarification-summary.md、.module-design.md 等)
662
+ - ❌ PM 用 Skill tool 调用 Phase Skill(必须用 Agent tool)
606
663
 
607
664
  ## MANDATORY TEMPLATE PATH
608
665
 
@@ -76,3 +76,13 @@ Applies ISA-95 Stages 1-3 as structured analysis framework:
76
76
  - Include technical implementation details
77
77
  - Create circular module dependencies
78
78
  - Manually write JSON files
79
+
80
+ ### Diagram Format Rule (MANDATORY)
81
+ - All diagrams MUST use Mermaid syntax (graph TB, graph TD, graph LR, etc.)
82
+ - ASCII art diagrams are FORBIDDEN
83
+ - Reference `mermaid-rule.md` for compatibility
84
+
85
+ ### Template
86
+ - Module design document MUST follow `templates/MODULE-DESIGN-TEMPLATE.md` structure
87
+ - All 10 sections are required
88
+ - Fill template with analyzed data from ISA-95 stages
@@ -0,0 +1,175 @@
1
+ # Module Design Document (.module-design.md)
2
+
3
+ > **Iteration**: iteration_name
4
+ > **Generated**: date
5
+ > **System**: system_name
6
+ > **Tech Stack**: tech_stack
7
+ > **Document Type**: ISA-95 Business Modeling & Module Decomposition
8
+
9
+ ---
10
+
11
+ ## 1. Business Domain Analysis (ISA-95 Stage 1: Domain Description)
12
+
13
+ ### 1.1 Domain Boundary Definition
14
+
15
+ <!-- Describe system positioning -->
16
+
17
+ #### System Scope (IN-SCOPE)
18
+ | Domain | Description |
19
+ |--------|-------------|
20
+ | domain | description |
21
+
22
+ #### Out of Scope (OUT-OF-SCOPE)
23
+ | Domain | Description | Planned Phase |
24
+ |--------|-------------|---------------|
25
+ | domain | description | phase |
26
+
27
+ ### 1.2 Actor Definition
28
+ | Actor ID | Actor Name | Responsibilities | Data Scope | Typical Scenario |
29
+ |----------|------------|------------------|------------|------------------|
30
+ | role_id | role_name | responsibility | data_scope | scenario |
31
+
32
+ ### 1.3 Core Business Glossary
33
+ | Term | Definition | Business Rule | Related Module |
34
+ |------|------------|---------------|----------------|
35
+ | term | definition | rule | module |
36
+
37
+ ### 1.4 Domain Model Diagram
38
+
39
+ ```mermaid
40
+ graph TB
41
+ M01[M01 System Foundation] --> M02[M02 Module Name]
42
+ M01 --> M04[M04 Module Name]
43
+ M02 --> M03[M03 Module Name]
44
+ %% Draw based on actual module dependencies
45
+ ```
46
+
47
+ ---
48
+
49
+ ## 2. Function Decomposition (ISA-95 Stage 2: Functions in Domain)
50
+
51
+ ### 2.1 WBS Work Breakdown Structure
52
+
53
+ #### module_id - module_name (count function points)
54
+ | Function ID | Function Name | Description | Priority | Dependencies |
55
+ |-------------|---------------|-------------|----------|--------------|
56
+ | func_id | func_name | description | priority | dependency |
57
+
58
+ ### 2.2 Function Priority Distribution
59
+ | Priority | Function Points | Percentage | Module Distribution |
60
+ |----------|-----------------|------------|--------------------|
61
+ | **P0 (Core)** | count | percent | modules |
62
+ | **P1 (Important)** | count | percent | modules |
63
+ | **P2 (Optional)** | count | percent | modules |
64
+
65
+ ---
66
+
67
+ ## 3. Module Priority & Phasing (ISA-95 Stage 3: Functions of Interest)
68
+
69
+ ### 3.1 MoSCoW Priority Analysis
70
+ | Priority | Definition | Module | Description |
71
+ |----------|------------|--------|-------------|
72
+
73
+ ### 3.2 Implementation Phases
74
+
75
+ #### Phase 1 (MVP - Minimum Viable Product)
76
+ **Core Chain**: core_chain
77
+ | Module | Function Points | Deliverables |
78
+ |--------|-----------------|--------------|
79
+
80
+ **MVP Acceptance Criteria**:
81
+ - ✅ criteria
82
+
83
+ #### Phase 2 (Full Version - Stage 1)
84
+ <!-- Same structure as above -->
85
+
86
+ #### Phase 3 (Stage 2 Planning)
87
+ <!-- Same structure as above -->
88
+
89
+ ---
90
+
91
+ ## 4. Module Dependencies
92
+
93
+ ### 4.1 Dependency Matrix
94
+ | Module | Dependent Module | Dependency Type | Description |
95
+ |--------|------------------|-----------------|-------------|
96
+
97
+ ### 4.2 Dependency Graph
98
+
99
+ ```mermaid
100
+ graph TD
101
+ M01[M01 System Foundation] --> M02[M02 Module Name]
102
+ M01 --> M04[M04 Module Name]
103
+ M02 --> M03[M03 Module Name]
104
+ %% Draw directed acyclic graph based on dependency matrix
105
+ ```
106
+
107
+ ### 4.3 Circular Dependency Check
108
+ <!-- Must confirm no circular dependencies -->
109
+
110
+ ---
111
+
112
+ ## 5. Module Implementation Sequence
113
+
114
+ ### 5.1 Implementation Phase Ordering
115
+
116
+ ```mermaid
117
+ graph LR
118
+ P0[Phase 0: Infrastructure] --> P1[Phase 1: Core Entities]
119
+ P1 --> P2[Phase 2: Core Workflows]
120
+ P2 --> P3[Phase 3: Value-Added Features]
121
+ P3 --> P4[Phase 4: Data Analytics]
122
+ %% Adjust based on actual phases
123
+ ```
124
+
125
+ ### 5.2 Parallel Development Recommendations
126
+ | Phase | Parallel Modules | Description |
127
+ |-------|------------------|-------------|
128
+
129
+ ---
130
+
131
+ ## 6. Module Boundary Definition
132
+
133
+ ### 6.1 Module Responsibility Boundaries
134
+ | Module | Core Responsibilities | Excluded Responsibilities | Boundary Notes |
135
+ |--------|----------------------|--------------------------|----------------|
136
+
137
+ ### 6.2 Data Ownership
138
+ | Data Entity | Owner Module | Read-Only Modules | Description |
139
+ |-------------|--------------|-------------------|-------------|
140
+
141
+ ---
142
+
143
+ ## 7. Tech Stack Capability Reuse Analysis
144
+
145
+ ### 7.1 Reusable Capabilities
146
+ | Required Function | Existing Capability | Reuse Level | Development Effort | Notes |
147
+ |-------------------|---------------------|-------------|--------------------|-------|
148
+
149
+ ### 7.2 New Development Capabilities
150
+ | Capability | Module | Development Priority | Estimated Effort | Notes |
151
+ |------------|--------|---------------------|------------------|-------|
152
+
153
+ ---
154
+
155
+ ## 8. Risks & Mitigation Measures
156
+
157
+ ### 8.1 Technical Risks
158
+ | Risk Item | Affected Modules | Impact Level | Probability | Mitigation Measures |
159
+ |-----------|------------------|--------------|-------------|---------------------|
160
+
161
+ ### 8.2 Business Risks
162
+ | Risk Item | Affected Modules | Impact Level | Probability | Mitigation Measures |
163
+ |-----------|------------------|--------------|-------------|---------------------|
164
+
165
+ ---
166
+
167
+ ## 9. Module Summary
168
+ | Module ID | Module Name | Function Points | Priority | Implementation Phase | Dependencies | Core Responsibilities |
169
+ |-----------|-------------|-----------------|----------|---------------------|--------------|-----------------------|
170
+
171
+ ---
172
+
173
+ ## 10. Sign-off
174
+ | Role | Name | Date | Signature |
175
+ |------|------|------|-----------|
@@ -27,6 +27,12 @@
27
27
  <field name="text">Manually write JSON files</field>
28
28
  </block>
29
29
 
30
+ <block type="rule" id="R-MERMAID" level="mandatory" desc="All diagrams must use Mermaid syntax">
31
+ <field name="text">MANDATORY: All diagrams (domain model, dependency graph, implementation phases) MUST use Mermaid syntax.</field>
32
+ <field name="text">ASCII art diagrams are FORBIDDEN. Use graph TB, graph TD, graph LR as appropriate.</field>
33
+ <field name="text">Reference workspace-template/docs/rules/mermaid-rule.md for compatibility guidelines.</field>
34
+ </block>
35
+
30
36
  <!-- ============================================================
31
37
  Main Processing Sequence
32
38
  ============================================================ -->
@@ -161,8 +167,15 @@
161
167
  </branch>
162
168
  </block>
163
169
 
170
+ <!-- Read module design template -->
171
+ <block type="task" id="B10-TPL" action="read-file" desc="Read module design template">
172
+ <field name="path">${skill_path}/templates/MODULE-DESIGN-TEMPLATE.md</field>
173
+ <field name="output" var="template_content"/>
174
+ </block>
175
+
164
176
  <!-- Step 4: Generate .module-design.md -->
165
177
  <block type="task" id="B11" action="generate" desc="Generate module design document">
178
+ <field name="template" value="${template_content}"/>
166
179
  <field name="output_path" value="${iteration_path}/01.product-requirement/.module-design.md"/>
167
180
  <field name="sections">
168
181
  - ISA-95 Analysis Summary (if complex)
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: speccrew-product-manager-orchestration
3
3
  version: 2.0.0
4
- description: Product Manager 核心编排技能(纯路由层 v2.0),负责工作流恢复路由和各 Phase Skill dispatch-to-worker 调度。所有业务逻辑由独立的 Phase Skill 执行。
4
+ description: Product Manager core orchestration skill (pure routing layer v2.0), responsible for workflow resume routing and dispatch-to-worker scheduling for each Phase Skill. All business logic is executed by independent Phase Skills.
5
5
  tools: Read, Write, Glob, Grep, Bash, Agent
6
6
  ---
7
7
 
@@ -34,32 +34,32 @@ tools: Read, Write, Glob, Grep, Bash, Agent
34
34
 
35
35
  # Product Manager Orchestration (v2.0)
36
36
 
37
- 纯路由层编排技能,负责:
37
+ Pure routing layer orchestration skill, responsible for:
38
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 的强制性用户确认门禁
39
+ 1. **Workflow Initialization** - Phase 0 initialization and returning resume target
40
+ 2. **Resume Routing** - Jump to the correct Phase based on `resume_target`
41
+ 3. **Phase Dispatch** - Each Phase has only one `dispatch-to-worker` call
42
+ 4. **User Confirmation Gates** - Mandatory user confirmation gates for Phase 3 and Phase 4a
43
43
 
44
44
  ## Architecture: Pure Routing Layer
45
45
 
46
- Skill 是**纯路由层**,所有业务逻辑由独立的 Phase Skill 执行:
46
+ This Skill is a **pure routing layer**, all business logic is executed by independent Phase Skills:
47
47
 
48
48
  | Phase | Block ID | Skill | Purpose |
49
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` | 验证清单、用户审核、最终确认 |
50
+ | Phase 0 | P0 | `speccrew-pm-phase0-init` | Workflow initialization, iteration directory creation/locating, resume state detection |
51
+ | Phase 1 | P1 | `speccrew-pm-phase1-knowledge-check` | Knowledge base status detection, module matching, knowledge initialization |
52
+ | Phase 2 | P2 | `speccrew-pm-phase2-complexity-assess` | Complexity assessment, simple/complex path decision |
53
+ | Phase 3 | P3 | `speccrew-pm-requirement-clarify` | Requirement clarification, Q&A collection |
54
+ | Phase 4 Simple | P4-SIMPLE | `speccrew-pm-requirement-simple` | Simple requirements: single PRD generation |
55
+ | Phase 4a | P4A | `speccrew-pm-requirement-model` | Complex requirements: ISA-95 modeling |
56
+ | Phase 4b | P4B | `speccrew-pm-requirement-analysis` | Complex requirements: Master PRD generation |
57
+ | Phase 5 | P5 | `speccrew-pm-phase5-subprd-dispatch` | Sub-PRD Worker dispatch |
58
+ | Phase 6 | P6 | `speccrew-pm-phase6-verify-confirm` | Verification checklist, user review, final confirmation |
59
59
 
60
60
  ## User Confirmation Gates (MANDATORY)
61
61
 
62
- Phase 3 Phase 4a 之后有**强制性用户确认门禁**:
62
+ There are **mandatory user confirmation gates** after Phase 3 and Phase 4a:
63
63
 
64
64
  ### R-CONFIRM Rule Block
65
65
 
@@ -81,9 +81,9 @@ Phase 3 和 Phase 4a 之后有**强制性用户确认门禁**:
81
81
  ```
82
82
 
83
83
  **Key Points:**
84
- - `action="user-confirm"` — 必须等待用户明确确认
85
- - `skippable="false"` — 不可跳过
86
- - checkpoint 写入**必须**在用户确认后执行
84
+ - `action="user-confirm"` — Must wait for explicit user confirmation
85
+ - `skippable="false"` — Cannot be skipped
86
+ - Checkpoint write **MUST** be executed after user confirmation
87
87
 
88
88
  ## Resume Router
89
89
 
@@ -114,18 +114,18 @@ Phase 0 输出 `resume_target` 控制恢复跳转:
114
114
 
115
115
  | Parameter | Type | Required | Description |
116
116
  |-----------|------|----------|-------------|
117
- | `user_requirement` | string | Yes | 用户需求描述或需求文档路径 |
118
- | `workspace_root` | string | Yes | speccrew-workspace 根目录路径 |
119
- | `source_path` | string | No | 项目源代码根目录(从 .speccrewrc 读取) |
120
- | `language` | string | No | 用户语言(默认自动检测) |
117
+ | `user_requirement` | string | Yes | User requirement description or requirement document path |
118
+ | `workspace_root` | string | Yes | speccrew-workspace root directory path |
119
+ | `source_path` | string | No | Project source code root directory (read from .speccrewrc) |
120
+ | `language` | string | No | User language (default auto-detect) |
121
121
 
122
122
  ## Output
123
123
 
124
- - `status` - 执行状态 (success / partial / failed)
125
- - `prd_files` - 生成的 PRD 文件列表
126
- - `feature_list` - 功能清单文件路径
127
- - `workflow_stage` - 当前工作流阶段状态
128
- - `next_agent` - 下一步建议的 Agent
124
+ - `status` - Execution status (success / partial / failed)
125
+ - `prd_files` - List of generated PRD files
126
+ - `feature_list` - Feature list file path
127
+ - `workflow_stage` - Current workflow stage status
128
+ - `next_agent` - Recommended next Agent
129
129
 
130
130
  ---
131
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.7.18",
3
+ "version": "0.7.20",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {