speccrew 0.6.69 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/.speccrew/agents/speccrew-task-worker.md +1 -1
  2. package/.speccrew/agents/speccrew-team-leader.md +336 -189
  3. package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +161 -0
  4. package/.speccrew/skills/speccrew-agentflow-manager/workflow.agentflow.xml +347 -0
  5. package/.speccrew/skills/speccrew-deploy-build/SKILL.md +3 -56
  6. package/.speccrew/skills/speccrew-deploy-build/workflow.agentflow.xml +125 -0
  7. package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +3 -64
  8. package/.speccrew/skills/speccrew-deploy-migrate/workflow.agentflow.xml +135 -0
  9. package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +4 -156
  10. package/.speccrew/skills/speccrew-deploy-smoke-test/workflow.agentflow.xml +178 -0
  11. package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +3 -135
  12. package/.speccrew/skills/speccrew-deploy-startup/workflow.agentflow.xml +223 -0
  13. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +10 -2
  14. package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +254 -0
  15. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +10 -2
  16. package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +259 -0
  17. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +10 -2
  18. package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +245 -0
  19. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +10 -2
  20. package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +262 -0
  21. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +10 -2
  22. package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +244 -0
  23. package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +10 -2
  24. package/.speccrew/skills/speccrew-dev-review-backend/workflow.agentflow.xml +251 -0
  25. package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +10 -2
  26. package/.speccrew/skills/speccrew-dev-review-desktop/workflow.agentflow.xml +214 -0
  27. package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +10 -2
  28. package/.speccrew/skills/speccrew-dev-review-frontend/workflow.agentflow.xml +213 -0
  29. package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +10 -2
  30. package/.speccrew/skills/speccrew-dev-review-mobile/workflow.agentflow.xml +214 -0
  31. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -1
  32. package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +222 -0
  33. package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +7 -1
  34. package/.speccrew/skills/speccrew-fd-feature-analyze/workflow.agentflow.xml +223 -0
  35. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +7 -1
  36. package/.speccrew/skills/speccrew-fd-feature-design/workflow.agentflow.xml +322 -0
  37. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +3 -39
  38. package/.speccrew/skills/speccrew-get-timestamp/workflow.agentflow.xml +43 -0
  39. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +57 -508
  40. package/.speccrew/skills/{speccrew-knowledge-bizs-api-analyze-xml/SKILL.md → speccrew-knowledge-bizs-api-analyze/workflow.agentflow.xml} +1 -154
  41. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +73 -283
  42. package/.speccrew/skills/{speccrew-knowledge-bizs-api-graph-xml/SKILL.md → speccrew-knowledge-bizs-api-graph/workflow.agentflow.xml} +0 -298
  43. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +931 -801
  44. package/.speccrew/skills/{speccrew-knowledge-bizs-dispatch-xml/SKILL.md → speccrew-knowledge-bizs-dispatch/workflow.agentflow.xml} +42 -272
  45. package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +263 -71
  46. package/.speccrew/skills/{speccrew-knowledge-bizs-identify-entries-xml/SKILL.md → speccrew-knowledge-bizs-identify-entries/workflow.agentflow.xml} +8 -184
  47. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +200 -181
  48. package/.speccrew/skills/{speccrew-knowledge-bizs-init-features-xml/SKILL.md → speccrew-knowledge-bizs-init-features/workflow.agentflow.xml} +7 -134
  49. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +5 -89
  50. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/workflow.agentflow.xml +129 -0
  51. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +454 -326
  52. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-analyze-xml/SKILL.md → speccrew-knowledge-bizs-ui-analyze/workflow.agentflow.xml} +8 -128
  53. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +302 -247
  54. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-graph-xml/SKILL.md → speccrew-knowledge-bizs-ui-graph/workflow.agentflow.xml} +7 -199
  55. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +267 -156
  56. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-style-extract-xml/SKILL.md → speccrew-knowledge-bizs-ui-style-extract/workflow.agentflow.xml} +7 -151
  57. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -122
  58. package/.speccrew/skills/speccrew-knowledge-graph-query/workflow.agentflow.xml +106 -0
  59. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -80
  60. package/.speccrew/skills/speccrew-knowledge-graph-write/workflow.agentflow.xml +152 -0
  61. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +371 -265
  62. package/.speccrew/skills/{speccrew-knowledge-module-summarize-xml/SKILL.md → speccrew-knowledge-module-summarize/workflow.agentflow.xml} +7 -197
  63. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +45 -333
  64. package/.speccrew/skills/{speccrew-knowledge-system-summarize-xml/SKILL.md → speccrew-knowledge-system-summarize/workflow.agentflow.xml} +0 -177
  65. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +174 -727
  66. package/.speccrew/skills/{speccrew-knowledge-techs-dispatch-xml/SKILL.md → speccrew-knowledge-techs-dispatch/workflow.agentflow.xml} +10 -351
  67. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +20 -150
  68. package/.speccrew/skills/{speccrew-knowledge-techs-generate-xml/SKILL.md → speccrew-knowledge-techs-generate/workflow.agentflow.xml} +0 -169
  69. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +75 -587
  70. package/.speccrew/skills/{speccrew-knowledge-techs-generate-conventions-xml/SKILL.md → speccrew-knowledge-techs-generate-conventions/workflow.agentflow.xml} +0 -153
  71. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +463 -297
  72. package/.speccrew/skills/{speccrew-knowledge-techs-generate-quality-xml/SKILL.md → speccrew-knowledge-techs-generate-quality/workflow.agentflow.xml} +0 -164
  73. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +57 -292
  74. package/.speccrew/skills/{speccrew-knowledge-techs-generate-ui-style-xml/SKILL.md → speccrew-knowledge-techs-generate-ui-style/workflow.agentflow.xml} +2 -193
  75. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +49 -335
  76. package/.speccrew/skills/{speccrew-knowledge-techs-index-xml/SKILL.md → speccrew-knowledge-techs-index/workflow.agentflow.xml} +0 -167
  77. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +28 -109
  78. package/.speccrew/skills/{speccrew-knowledge-techs-init-xml/SKILL.md → speccrew-knowledge-techs-init/workflow.agentflow.xml} +0 -189
  79. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -487
  80. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/workflow.agentflow.xml +278 -0
  81. package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +3 -71
  82. package/.speccrew/skills/speccrew-pm-knowledge-detector/workflow.agentflow.xml +108 -0
  83. package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +3 -107
  84. package/.speccrew/skills/speccrew-pm-module-initializer/workflow.agentflow.xml +139 -0
  85. package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -115
  86. package/.speccrew/skills/speccrew-pm-module-matcher/workflow.agentflow.xml +146 -0
  87. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +3 -343
  88. package/.speccrew/skills/speccrew-pm-requirement-analysis/workflow.agentflow.xml +174 -0
  89. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +3 -91
  90. package/.speccrew/skills/speccrew-pm-requirement-assess/workflow.agentflow.xml +173 -0
  91. package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +3 -224
  92. package/.speccrew/skills/speccrew-pm-requirement-clarify/workflow.agentflow.xml +159 -0
  93. package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +3 -275
  94. package/.speccrew/skills/speccrew-pm-requirement-model/workflow.agentflow.xml +210 -0
  95. package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +3 -76
  96. package/.speccrew/skills/speccrew-pm-requirement-simple/workflow.agentflow.xml +120 -0
  97. package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +7 -1
  98. package/.speccrew/skills/speccrew-pm-sub-prd-generate/workflow.agentflow.xml +218 -0
  99. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +7 -1
  100. package/.speccrew/skills/speccrew-sd-backend/workflow.agentflow.xml +264 -0
  101. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +7 -1
  102. package/.speccrew/skills/speccrew-sd-desktop/workflow.agentflow.xml +288 -0
  103. package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +7 -1
  104. package/.speccrew/skills/speccrew-sd-framework-evaluate/workflow.agentflow.xml +235 -0
  105. package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +7 -1
  106. package/.speccrew/skills/speccrew-sd-frontend/workflow.agentflow.xml +299 -0
  107. package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +7 -1
  108. package/.speccrew/skills/speccrew-sd-mobile/workflow.agentflow.xml +301 -0
  109. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +165 -284
  110. package/.speccrew/skills/speccrew-test-case-design/workflow.agentflow.xml +210 -0
  111. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +204 -324
  112. package/.speccrew/skills/speccrew-test-code-gen/workflow.agentflow.xml +265 -0
  113. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +205 -184
  114. package/.speccrew/skills/speccrew-test-reporter/workflow.agentflow.xml +284 -0
  115. package/.speccrew/skills/speccrew-test-runner/SKILL.md +242 -241
  116. package/.speccrew/skills/speccrew-test-runner/workflow.agentflow.xml +314 -0
  117. package/bin/cli.js +8 -1
  118. package/lib/commands/init.js +11 -3
  119. package/lib/commands/update.js +11 -3
  120. package/lib/commands/validate.js +565 -0
  121. package/lib/utils.js +43 -0
  122. package/package.json +1 -1
  123. package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
  124. package/workspace-template/scripts/validate-agentflow.js +637 -0
  125. package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
  126. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
  127. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
  128. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
  129. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
  130. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
  131. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
  132. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
  133. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
  134. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
  135. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1087
  136. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
  137. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
@@ -0,0 +1,173 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="requirement-assess-main" status="pending" version="1.0" desc="Quick impact assessment for new requirements">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="requirement_text" required="true" type="string" desc="New requirement description"/>
9
+ <field name="workspace_path" required="true" type="string" desc="Absolute path to speccrew workspace"/>
10
+ <field name="system_overview_path" required="false" type="string" desc="Path to system-overview.md"/>
11
+ <field name="language" required="true" type="string" desc="Target language for output"/>
12
+ </block>
13
+
14
+ <!-- ============================================================
15
+ Global Constraints
16
+ ============================================================ -->
17
+ <block type="rule" id="R1" level="mandatory" desc="Execution constraints">
18
+ <field name="text">This skill is READ-ONLY - do not modify any files</field>
19
+ <field name="text">Use knowledge graph query for cross-module dependency analysis</field>
20
+ </block>
21
+
22
+ <!-- ============================================================
23
+ Main Processing Sequence
24
+ ============================================================ -->
25
+ <sequence id="S1" name="Requirement Assessment" status="pending" desc="Assess new requirement impact">
26
+
27
+ <!-- Step 1: Understand the Requirement -->
28
+ <block type="task" id="B1" action="analyze" desc="Analyze the new requirement">
29
+ <field name="input" value="${requirement_text}"/>
30
+ <field name="extract">
31
+ - What business problem does it solve?
32
+ - What entities are involved?
33
+ - What processes are affected?
34
+ </field>
35
+ <field name="output" var="requirement_analysis"/>
36
+ </block>
37
+
38
+ <!-- Step 2: Load System Context -->
39
+ <block type="task" id="B2" action="read-file" desc="Read system overview">
40
+ <field name="path" value="${workspace_path}/knowledges/bizs/system-overview.md"/>
41
+ <field name="on_error">continue</field>
42
+ <field name="output" var="system_overview"/>
43
+ </block>
44
+
45
+ <!-- Step 3: Identify potentially affected modules -->
46
+ <block type="task" id="B3" action="analyze" desc="Identify potentially affected modules">
47
+ <field name="input">
48
+ requirement: ${requirement_analysis}
49
+ system_overview: ${system_overview}
50
+ </field>
51
+ <field name="identify">
52
+ - Which business domain the requirement belongs to
53
+ - Which modules are potentially related
54
+ - Which business processes are involved
55
+ </field>
56
+ <field name="output" var="affected_modules"/>
57
+ </block>
58
+
59
+ <!-- Step 4: Load related module overviews -->
60
+ <block type="loop" id="L1" over="${affected_modules}" as="module" desc="Load related module overviews">
61
+ <block type="task" id="B4" action="read-file" desc="Read module overview">
62
+ <field name="path" value="${workspace_path}/knowledges/bizs/${module.name}/${module.name}-overview.md"/>
63
+ <field name="on_error">continue</field>
64
+ <field name="output" var="module_overview"/>
65
+ </block>
66
+ </block>
67
+
68
+ <!-- Step 5: Query Knowledge Graph -->
69
+ <block type="task" id="B5" action="run-skill" desc="Query knowledge graph for dependencies">
70
+ <field name="skill">speccrew-knowledge-graph-query</field>
71
+ <field name="action">trace-dependencies</field>
72
+ <field name="entities" value="${affected_modules.entities}"/>
73
+ <field name="output" var="dependency_graph"/>
74
+ </block>
75
+
76
+ <!-- Step 6: Determine Change Type -->
77
+ <block type="task" id="B6" action="analyze" desc="Determine change type using decision tree">
78
+ <field name="input">
79
+ requirement: ${requirement_analysis}
80
+ affected_modules: ${affected_modules}
81
+ dependencies: ${dependency_graph}
82
+ </field>
83
+ <field name="decision_tree">
84
+ IF involves new business entity -> NEW FEATURE
85
+ ELSE IF modifies core attributes of existing entity -> MODIFICATION
86
+ ELSE IF adds new process steps but reuses existing entities -> MIXED
87
+ ELSE IF affects cross-module data flow -> CROSS-MODULE CHANGE
88
+ ELSE IF can be handled by configuration -> CONFIGURATION
89
+ </field>
90
+ <field name="output" var="change_type"/>
91
+ </block>
92
+
93
+ <!-- Step 7: Identify Impact Scope -->
94
+ <block type="task" id="B7" action="analyze" desc="Identify impact scope">
95
+ <field name="input">
96
+ affected_modules: ${affected_modules}
97
+ dependency_graph: ${dependency_graph}
98
+ </field>
99
+ <field name="identify">
100
+ - Direct modules: Modules explicitly mentioned in requirement
101
+ - Dependency modules: Upstream/downstream from graph query
102
+ - External integrations: Third-party systems
103
+ - Data entities: New or modified entities
104
+ </field>
105
+ <field name="output" var="impact_scope"/>
106
+ </block>
107
+
108
+ <!-- Step 8: Assess Risk Level -->
109
+ <block type="task" id="B8" action="analyze" desc="Assess risk level">
110
+ <field name="input">
111
+ impact_scope: ${impact_scope}
112
+ change_type: ${change_type}
113
+ </field>
114
+ <field name="risk_factors">
115
+ - Scope: Affects 3+ modules = High
116
+ - Data: Modifies core entity structure = High
117
+ - Integration: Changes external API contracts = High
118
+ - Process: Alters critical business flow = High
119
+ - State: Modifies entity state machine = High
120
+ </field>
121
+ <field name="output" var="risk_level"/>
122
+ </block>
123
+
124
+ <!-- Step 9: Recommend Workflow Path -->
125
+ <block type="task" id="B9" action="analyze" desc="Recommend workflow path">
126
+ <field name="input">
127
+ impact_scope: ${impact_scope}
128
+ change_type: ${change_type}
129
+ risk_level: ${risk_level}
130
+ </field>
131
+ <field name="recommendation_matrix">
132
+ - 1 module, low risk, clear domain -> Simple PRD (skip ISA-95 modeling)
133
+ - 2+ modules, medium risk -> Full requirement-analysis with ISA-95 modeling
134
+ - Cross-module, high risk -> Full requirement-analysis + Master-Sub PRD
135
+ - Configuration only -> Direct implementation, PRD optional
136
+ </field>
137
+ <field name="output" var="recommendation"/>
138
+ </block>
139
+
140
+ <!-- Step 10: Generate Assessment Report -->
141
+ <block type="task" id="B10" action="generate" desc="Generate assessment report">
142
+ <field name="template">Assessment Report Template</field>
143
+ <field name="fill_data">
144
+ requirement_summary: ${requirement_analysis}
145
+ change_type: ${change_type}
146
+ impact_scope: ${impact_scope}
147
+ risk_level: ${risk_level}
148
+ recommendation: ${recommendation}
149
+ graph_findings: ${dependency_graph}
150
+ </field>
151
+ <field name="output" var="assessment_report"/>
152
+ </block>
153
+
154
+ <!-- Checkpoint: Assessment complete -->
155
+ <block type="checkpoint" id="CP1" name="assessment-complete" desc="Verify assessment completed">
156
+ <field name="verify" value="${assessment_report} != null"/>
157
+ </block>
158
+
159
+ </sequence>
160
+
161
+ <!-- ============================================================
162
+ Output Results
163
+ ============================================================ -->
164
+ <block type="output" id="O1" desc="Workflow output results">
165
+ <field name="change_type" from="${change_type}" type="string" desc="Change type: New Feature, Modification, Mixed, Cross-module, Configuration"/>
166
+ <field name="impact_scope" from="${impact_scope}" type="object" desc="Impact scope with direct and indirect modules"/>
167
+ <field name="risk_level" from="${risk_level}" type="string" desc="Risk level: Low, Medium, High"/>
168
+ <field name="recommendation" from="${recommendation}" type="string" desc="Recommended workflow path"/>
169
+ <field name="assessment_report" from="${assessment_report}" type="string" desc="Complete assessment report"/>
170
+ <field name="message" value="Requirement assessment completed" type="string" desc="Status message"/>
171
+ </block>
172
+
173
+ </workflow>
@@ -34,232 +34,11 @@ Applies ISA-95 Stage 1 (Domain Description) for clarification:
34
34
 
35
35
  ---
36
36
 
37
- # Workflow
37
+ # AgentFlow Definition
38
38
 
39
- ## Absolute Constraints
39
+ <!-- @agentflow: workflow.agentflow.xml -->
40
40
 
41
- > **Violation = task failure**
42
-
43
- 1. **FORBIDDEN:** `create_file` for documents — use `search_replace` on templates
44
- 2. **FORBIDDEN:** Full-file rewrite — use targeted `search_replace`
45
- 3. **MANDATORY:** Template-first workflow
46
-
47
- ## Step 1: Load Requirement Document
48
-
49
- **Actions:**
50
- 1. Read `requirement_file`
51
- 2. Extract: business problem, target users, functional scope, constraints
52
-
53
- ## Step 2: Load System Knowledge (IF EXISTS)
54
-
55
- **Actions:**
56
- 1. Read `knowledges/bizs/system-overview.md` if exists
57
- 2. Read related `{module}/{module}-overview.md` files if exist
58
-
59
- > ⚠️ Knowledge files are OPTIONAL. Proceed without them if absent.
60
-
61
- ## Step 3: Determine Complexity Mode
62
-
63
- **Auto-detect criteria:**
64
-
65
- | Criteria | Simple | Complex |
66
- |----------|--------|---------|
67
- | Modules | 1 | 2+ or new domain |
68
- | Features | 1-5 | 6+ |
69
- | Integration points | 0-1 | 2+ |
70
-
71
- **Logic:** `complex` if modules >= 2 OR features >= 6 OR new_domain
72
-
73
- ## Step 4: Execute Clarification (Dual Mode)
74
-
75
- ### 4.1 Simple Mode
76
-
77
- - 1-3 key questions, chat-based
78
- - Topics: What to change, what the change is, business reason, acceptance criteria
79
-
80
- > ⚠️ **Switch to file-based if 4+ questions needed**
81
-
82
- ### 4.2 Complex Mode (File-Based)
83
-
84
- > ⚠️ **All rounds use file-based interaction, NOT chat-based.**
85
-
86
- **Clarification Loop — Condition-Driven, No Round Limit**
87
-
88
- The clarification process continues until ALL sufficiency checks pass. There is NO fixed round limit.
89
-
90
- **Initial Round: Core Understanding**
91
-
92
- Create `.clarification-questions-round-1.md`:
93
- ```markdown
94
- # Requirements Clarification - Round 1
95
-
96
- > Fill answers after each "**Answer:**" marker, then notify me.
97
-
98
- ## 1. Business Background & Goals
99
- Based on the document, the system aims to solve: [points]
100
-
101
- **Questions:**
102
- - Is this understanding correct?
103
- - What is the primary business goal?
104
-
105
- **Answer:** <!-- Fill here -->
106
-
107
- ## 2. Target Users & Scenarios
108
- Roles identified: [list]
109
-
110
- **Questions:**
111
- - Additional roles not mentioned?
112
- - Primary use cases for each role?
113
-
114
- **Answer:** <!-- Fill here -->
115
-
116
- ## 3. System Scope & Boundaries
117
- Scope includes: [modules]
118
-
119
- **Questions:**
120
- - All modules required for Phase 1?
121
- - What is explicitly out of scope?
122
-
123
- **Answer:** <!-- Fill here -->
124
- ```
125
-
126
- Notify user:
127
- ```
128
- 📝 Round 1 questions written to:
129
- `01.product-requirement/.clarification-questions-round-1.md`
130
-
131
- Please fill answers after each "**Answer:**" marker, save, and notify me.
132
- ```
133
-
134
- **HARD STOP** — Wait for user confirmation, then read file.
135
-
136
- **Subsequent Rounds — Continue Until Sufficiency Checks Pass**
137
-
138
- After each round:
139
- 1. Read the answered file
140
- 2. Perform sufficiency check (see Step 5)
141
- 3. If ALL 4 checks pass → Proceed to Step 6
142
- 4. If ANY check fails → Generate next round with targeted follow-up questions
143
-
144
- Create `.clarification-questions-round-N.md` (N = current round number) with:
145
- - Follow-up questions based on gaps identified in sufficiency check
146
- - Focus on unanswered items, ambiguities, or new questions raised by user's answers
147
- - Maintain same file format with "**Answer:**" markers
148
-
149
- **Loop Termination Conditions:**
150
- - ALL 4 sufficiency checks pass, OR
151
- - User explicitly states no more questions needed
152
-
153
- > ⚠️ **Do NOT terminate early.** Continue clarification rounds until sufficiency is achieved.
154
- > The round counter (N) has NO upper limit.
155
-
156
- ## Step 5: Sufficiency Check
157
-
158
- > ⚠️ **ALL 4 checks must pass before proceeding.**
159
-
160
- | # | Check Item | Pass Criteria |
161
- |---|------------|---------------|
162
- | 1 | Scope boundaries are clear | Explicit in/out scope defined |
163
- | 2 | Key business rules are documented | At least 1 rule identified |
164
- | 3 | Priority/phasing decisions are made | Phase 1 scope is clear |
165
- | 4 | Integration boundaries are identified | Integration points listed or "none" confirmed |
166
-
167
- **Logic:** If all 4 pass → Step 6. Else → continue to next clarification round.
168
-
169
- > ⚠️ **No round limit.** Continue generating clarification rounds until ALL checks pass.
170
- > Each round should focus on the specific gaps identified in the sufficiency check.
171
-
172
- ## Step 6: Generate .clarification-summary.md
173
-
174
- **Output:** `{iteration_path}/01.product-requirement/.clarification-summary.md`
175
-
176
- **Format:**
177
- ```markdown
178
- # Clarification Summary
179
-
180
- ## Complexity
181
- - Level: [simple | complex]
182
- - Rationale: [reason]
183
-
184
- ## Key Decisions
185
- | # | Decision | Rationale | Source |
186
- |---|----------|-----------|--------|
187
- | 1 | [text] | [reason] | Round X |
188
-
189
- ## Clarification Q&A
190
-
191
- <!-- List all rounds that were conducted. Round count is dynamic. -->
192
-
193
- ### Round 1
194
- | # | Question | Answer | Impact |
195
- |---|----------|--------|--------|
196
- | 1 | [Q] | [A] | [Impact] |
197
-
198
- ### Round 2
199
- [Same format, if conducted]
200
-
201
- <!-- Add more rounds as needed until sufficiency checks pass -->
202
-
203
- ## Sufficiency Checks
204
- - [x] Scope boundaries are clear
205
- - [x] Key business rules are documented
206
- - [x] Priority/phasing decisions are made
207
- - [x] Integration boundaries are identified
208
-
209
- ## Notes
210
- [Additional remarks or gaps]
211
- ```
212
-
213
- ## Step 7: Initialize .checkpoints.json
214
-
215
- > ⚠️ **MANDATORY: Use `update-progress.js` script for all JSON files.**
216
-
217
- ```bash
218
- node speccrew-workspace/scripts/update-progress.js write-checkpoint \
219
- --file {iteration_path}/01.product-requirement/.checkpoints.json \
220
- --checkpoint requirement_clarification \
221
- --passed true
222
- ```
223
-
224
- **Generated structure:**
225
- ```json
226
- {
227
- "stage": "01_prd",
228
- "checkpoints": {
229
- "requirement_clarification": {
230
- "passed": true,
231
- "confirmed_at": "2026-04-10T12:00:00.000Z",
232
- "description": "Requirement clarification completed",
233
- "clarification_file": ".clarification-summary.md",
234
- "complexity": "simple|complex",
235
- "sufficiency_checks": {
236
- "scope_boundaries": true,
237
- "business_rules": true,
238
- "priority_phasing": true,
239
- "integration_boundaries": true
240
- }
241
- }
242
- }
243
- }
244
- ```
245
-
246
- ## Step 8: Output Completion
247
-
248
- ```
249
- ✅ Requirement Clarification Complete
250
-
251
- Complexity Level: [simple | complex]
252
- Clarification File: {path}/.clarification-summary.md
253
- Checkpoint File: {path}/.checkpoints.json
254
-
255
- Key Decisions:
256
- - [Decision 1]
257
- - [Decision 2]
258
-
259
- Sufficiency Checks: 4/4 ✅
260
-
261
- Next: Return to PM Agent for user confirmation before PRD generation.
262
- ```
41
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
263
42
 
264
43
  ---
265
44
 
@@ -0,0 +1,159 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="requirement-clarify-main" status="pending" version="1.0" desc="Requirement clarification with dual-mode support">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="requirement_file" required="true" type="string" desc="Path to requirement document"/>
9
+ <field name="iteration_path" required="true" type="string" desc="Path to iteration directory"/>
10
+ <field name="complexity_hint" required="false" type="string" desc="simple or complex. Auto-detect if not provided"/>
11
+ <field name="language" required="true" type="string" desc="Language code for output content"/>
12
+ </block>
13
+
14
+ <!-- ============================================================
15
+ Global Constraints
16
+ ============================================================ -->
17
+ <block type="rule" id="R1" level="mandatory" desc="Execution constraints">
18
+ <field name="text">Always perform at least 1 clarification round</field>
19
+ <field name="text">Use file-based for complex mode or 4+ questions</field>
20
+ <field name="text">MUST pass all 4 Sufficiency Checks</field>
21
+ </block>
22
+
23
+ <block type="rule" id="R2" level="forbidden" desc="Forbidden actions">
24
+ <field name="text">Skip clarification based on urgency</field>
25
+ <field name="text">Use chat for complex requirements</field>
26
+ <field name="text">Manually write JSON files - MUST use update-progress.js</field>
27
+ <field name="text">Auto-proceed to Phase 4 without PM Agent's user confirmation gate</field>
28
+ </block>
29
+
30
+ <!-- ============================================================
31
+ Main Processing Sequence
32
+ ============================================================ -->
33
+ <sequence id="S1" name="Requirement Clarification" status="pending" desc="Clarify requirements with user">
34
+
35
+ <!-- Step 1: Load Requirement Document -->
36
+ <block type="task" id="B1" action="read-file" desc="Read requirement document">
37
+ <field name="path" value="${requirement_file}"/>
38
+ <field name="output" var="requirement_content"/>
39
+ </block>
40
+
41
+ <!-- Step 2: Load System Knowledge (IF EXISTS) -->
42
+ <block type="task" id="B2" action="read-file" desc="Read system overview if exists">
43
+ <field name="path" value="${workspace_path}/knowledges/bizs/system-overview.md"/>
44
+ <field name="on_error">continue</field>
45
+ <field name="output" var="system_overview"/>
46
+ </block>
47
+
48
+ <!-- Step 3: Determine Complexity Mode -->
49
+ <block type="gateway" id="G1" mode="exclusive" desc="Determine complexity mode">
50
+ <branch test="${complexity_hint} == 'simple'" name="Simple Mode">
51
+ <block type="task" id="B3" action="analyze" desc="Set simple mode">
52
+ <field name="set_var" name="complexity" value="simple"/>
53
+ </block>
54
+ </branch>
55
+ <branch test="${complexity_hint} == 'complex'" name="Complex Mode">
56
+ <block type="task" id="B4" action="analyze" desc="Set complex mode">
57
+ <field name="set_var" name="complexity" value="complex"/>
58
+ </block>
59
+ </branch>
60
+ <branch name="Auto-detect" default="true">
61
+ <block type="task" id="B5" action="analyze" desc="Auto-detect complexity">
62
+ <field name="input" value="${requirement_content}"/>
63
+ <field name="criteria">
64
+ - Simple: modules = 1, features = 1-5, integration = 0-1
65
+ - Complex: modules >= 2 OR features >= 6 OR new_domain
66
+ </field>
67
+ <field name="output" var="complexity"/>
68
+ </block>
69
+ </branch>
70
+ </block>
71
+
72
+ <!-- Step 4: Execute Clarification -->
73
+ <block type="gateway" id="G2" mode="exclusive" desc="Execute clarification based on mode">
74
+ <branch test="${complexity} == 'simple'" name="Simple Mode Clarification">
75
+ <block type="task" id="B6" action="analyze" desc="Simple mode: 1-3 key questions">
76
+ <field name="topics">
77
+ - What to change
78
+ - What the change is
79
+ - Business reason
80
+ - Acceptance criteria
81
+ </field>
82
+ <field name="output" var="clarification_qa"/>
83
+ </block>
84
+ </branch>
85
+ <branch test="${complexity} == 'complex'" name="Complex Mode Clarification">
86
+ <!-- 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
94
+ </field>
95
+ <field name="output" var="questions_file"/>
96
+ </block>
97
+
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>
100
+ </block>
101
+
102
+ <block type="task" id="B8" action="read-file" desc="Read answered questions">
103
+ <field name="path" value="${questions_file}"/>
104
+ <field name="output" var="answered_questions"/>
105
+ </block>
106
+
107
+ <!-- Sufficiency Check -->
108
+ <block type="task" id="B9" action="analyze" desc="Perform sufficiency check">
109
+ <field name="checks">
110
+ 1. Scope boundaries are clear - Explicit in/out scope defined
111
+ 2. Key business rules are documented - At least 1 rule identified
112
+ 3. Priority/phasing decisions are made - Phase 1 scope is clear
113
+ 4. Integration boundaries are identified - Integration points listed or "none" confirmed
114
+ </field>
115
+ <field name="output" var="sufficiency_result"/>
116
+ </block>
117
+ </block>
118
+ </branch>
119
+ </block>
120
+
121
+ <!-- Step 5: Generate .clarification-summary.md -->
122
+ <block type="task" id="B10" action="generate" desc="Generate clarification summary">
123
+ <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
130
+ </field>
131
+ <field name="output" var="summary_path"/>
132
+ </block>
133
+
134
+ <!-- Step 6: Initialize .checkpoints.json -->
135
+ <block type="task" id="B11" action="run-script" desc="Initialize checkpoints via script">
136
+ <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
+ <field name="output" var="checkpoint_result"/>
138
+ </block>
139
+
140
+ <!-- Checkpoint: Clarification complete -->
141
+ <block type="checkpoint" id="CP1" name="clarification-complete" desc="Verify clarification completed">
142
+ <field name="file" value="${summary_path}"/>
143
+ <field name="verify" value="file_exists(${summary_path})"/>
144
+ </block>
145
+
146
+ </sequence>
147
+
148
+ <!-- ============================================================
149
+ Output Results
150
+ ============================================================ -->
151
+ <block type="output" id="O1" desc="Workflow output results">
152
+ <field name="clarification_file" from="${summary_path}" type="string" desc="Path to clarification summary"/>
153
+ <field name="checkpoint_file" value="${iteration_path}/01.product-requirement/.checkpoints.json" type="string" desc="Path to checkpoints file"/>
154
+ <field name="complexity" from="${complexity}" type="string" desc="Complexity level: simple or complex"/>
155
+ <field name="sufficiency_checks" value="4/4 passed" type="string" desc="Sufficiency check results"/>
156
+ <field name="message" value="Requirement clarification completed" type="string" desc="Status message"/>
157
+ </block>
158
+
159
+ </workflow>