@aipper/aiws-spec 0.0.23 → 0.0.25

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 (210) hide show
  1. package/README.md +22 -0
  2. package/docs/aiws-bootstrap-routing-design.md +138 -0
  3. package/docs/aiws-governance-positioning.md +69 -0
  4. package/docs/cli-interface.md +87 -5
  5. package/docs/collaboration-artifacts.md +62 -0
  6. package/docs/opencode-omo-adapter.md +135 -0
  7. package/docs/opencode-omo-validation-checklist.md +90 -0
  8. package/docs/spec-contract.md +26 -11
  9. package/docs/superpowers-collaboration-adoption.md +92 -0
  10. package/docs/workflow-delegation-contracts.json +274 -0
  11. package/docs/workflow-delegation-contracts.md +248 -0
  12. package/docs/workflow-delegation-contracts.schema.json +176 -0
  13. package/docs/workflow-governance-rules.json +294 -0
  14. package/docs/workflow-governance-rules.md +63 -0
  15. package/docs/workflow-governance-rules.schema.json +182 -0
  16. package/docs/workflow-review-gates.json +72 -0
  17. package/docs/workflow-review-gates.md +36 -0
  18. package/docs/workflow-review-gates.schema.json +67 -0
  19. package/docs/workflow-router-rules.json +196 -0
  20. package/docs/workflow-router-rules.md +83 -0
  21. package/docs/workflow-router-rules.schema.json +119 -0
  22. package/docs/workflow-stage-contracts.json +148 -0
  23. package/docs/workflow-stage-contracts.md +70 -0
  24. package/docs/workflow-stage-contracts.schema.json +98 -0
  25. package/package.json +1 -1
  26. package/templates/workspace/.agents/skills/using-aiws/SKILL.md +83 -0
  27. package/templates/workspace/.agents/skills/ws-bugfix/SKILL.md +30 -7
  28. package/templates/workspace/.agents/skills/ws-commit/SKILL.md +26 -1
  29. package/templates/workspace/.agents/skills/ws-delegate/SKILL.md +75 -0
  30. package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +46 -9
  31. package/templates/workspace/.agents/skills/ws-dev/SKILL.md +81 -11
  32. package/templates/workspace/.agents/skills/ws-finish/SKILL.md +101 -60
  33. package/templates/workspace/.agents/skills/ws-frontend-design/SKILL.md +126 -0
  34. package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +22 -1
  35. package/templates/workspace/.agents/skills/ws-plan/SKILL.md +61 -2
  36. package/templates/workspace/.agents/skills/ws-plan-verify/SKILL.md +20 -0
  37. package/templates/workspace/.agents/skills/ws-preflight/SKILL.md +23 -0
  38. package/templates/workspace/.agents/skills/ws-quality-review/SKILL.md +56 -0
  39. package/templates/workspace/.agents/skills/ws-review/SKILL.md +24 -0
  40. package/templates/workspace/.agents/skills/ws-spec-review/SKILL.md +57 -0
  41. package/templates/workspace/.agents/skills/ws-verify-before-complete/SKILL.md +59 -0
  42. package/templates/workspace/.claude/commands/using-aiws.md +24 -0
  43. package/templates/workspace/.claude/commands/ws-bugfix.md +11 -6
  44. package/templates/workspace/.claude/commands/ws-commit.md +2 -1
  45. package/templates/workspace/.claude/commands/ws-deliver.md +6 -2
  46. package/templates/workspace/.claude/commands/ws-dev.md +5 -2
  47. package/templates/workspace/.claude/commands/ws-finish.md +19 -19
  48. package/templates/workspace/.claude/commands/ws-plan.md +9 -5
  49. package/templates/workspace/.claude/commands/ws-quality-review.md +24 -0
  50. package/templates/workspace/.claude/commands/ws-spec-review.md +24 -0
  51. package/templates/workspace/.claude/commands/ws-verify-before-complete.md +24 -0
  52. package/templates/workspace/.claude/skills/p-aiws-change-archive/SKILL.md +24 -0
  53. package/templates/workspace/.claude/skills/p-aiws-change-finish/SKILL.md +24 -0
  54. package/templates/workspace/.claude/skills/p-aiws-change-list/SKILL.md +18 -0
  55. package/templates/workspace/.claude/skills/p-aiws-change-new/SKILL.md +26 -0
  56. package/templates/workspace/.claude/skills/p-aiws-change-next/SKILL.md +19 -0
  57. package/templates/workspace/.claude/skills/p-aiws-change-start/SKILL.md +33 -0
  58. package/templates/workspace/.claude/skills/p-aiws-change-status/SKILL.md +19 -0
  59. package/templates/workspace/.claude/skills/p-aiws-change-sync/SKILL.md +19 -0
  60. package/templates/workspace/.claude/skills/p-aiws-change-templates-init/SKILL.md +18 -0
  61. package/templates/workspace/.claude/skills/p-aiws-change-templates-which/SKILL.md +18 -0
  62. package/templates/workspace/.claude/skills/p-aiws-change-validate/SKILL.md +23 -0
  63. package/templates/workspace/.claude/skills/p-aiws-hooks-install/SKILL.md +30 -0
  64. package/templates/workspace/.claude/skills/p-aiws-hooks-status/SKILL.md +18 -0
  65. package/templates/workspace/.claude/skills/p-aiws-init/SKILL.md +27 -0
  66. package/templates/workspace/.claude/skills/p-aiws-rollback/SKILL.md +18 -0
  67. package/templates/workspace/.claude/skills/p-aiws-update/SKILL.md +26 -0
  68. package/templates/workspace/.claude/skills/p-aiws-validate/SKILL.md +22 -0
  69. package/templates/workspace/.claude/skills/p-tasks-plan/SKILL.md +37 -0
  70. package/templates/workspace/.claude/skills/using-aiws/SKILL.md +83 -0
  71. package/templates/workspace/.claude/skills/ws-analyze/SKILL.md +26 -0
  72. package/templates/workspace/.claude/skills/ws-bugfix/SKILL.md +111 -0
  73. package/templates/workspace/.claude/skills/ws-commit/SKILL.md +127 -0
  74. package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +231 -0
  75. package/templates/workspace/.claude/skills/ws-dev/SKILL.md +168 -0
  76. package/templates/workspace/.claude/skills/ws-finish/SKILL.md +220 -0
  77. package/templates/workspace/.claude/skills/ws-frontend-design/SKILL.md +126 -0
  78. package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +52 -0
  79. package/templates/workspace/.claude/skills/ws-migrate/SKILL.md +54 -0
  80. package/templates/workspace/.claude/skills/ws-plan/SKILL.md +138 -0
  81. package/templates/workspace/.claude/skills/ws-plan-verify/SKILL.md +61 -0
  82. package/templates/workspace/.claude/skills/ws-preflight/SKILL.md +55 -0
  83. package/templates/workspace/.claude/skills/ws-pull/SKILL.md +119 -0
  84. package/templates/workspace/.claude/skills/ws-push/SKILL.md +110 -0
  85. package/templates/workspace/.claude/skills/ws-quality-review/SKILL.md +56 -0
  86. package/templates/workspace/.claude/skills/ws-req-change/SKILL.md +41 -0
  87. package/templates/workspace/.claude/skills/ws-req-contract-sync/SKILL.md +17 -0
  88. package/templates/workspace/.claude/skills/ws-req-contract-validate/SKILL.md +12 -0
  89. package/templates/workspace/.claude/skills/ws-req-flow-sync/SKILL.md +28 -0
  90. package/templates/workspace/.claude/skills/ws-req-review/SKILL.md +32 -0
  91. package/templates/workspace/.claude/skills/ws-review/SKILL.md +50 -0
  92. package/templates/workspace/.claude/skills/ws-rule/SKILL.md +23 -0
  93. package/templates/workspace/.claude/skills/ws-spec-review/SKILL.md +57 -0
  94. package/templates/workspace/.claude/skills/ws-submodule-setup/SKILL.md +65 -0
  95. package/templates/workspace/.claude/skills/ws-verify-before-complete/SKILL.md +59 -0
  96. package/templates/workspace/.codex/prompts/ws-dev.md +5 -1
  97. package/templates/workspace/.githooks/commit-msg +109 -0
  98. package/templates/workspace/.iflow/commands/ws-commit.toml +2 -1
  99. package/templates/workspace/.iflow/commands/ws-deliver.toml +6 -2
  100. package/templates/workspace/.iflow/commands/ws-finish.toml +19 -19
  101. package/templates/workspace/.opencode/command/using-aiws.md +29 -0
  102. package/templates/workspace/.opencode/command/ws-bugfix.md +11 -6
  103. package/templates/workspace/.opencode/command/ws-commit.md +2 -1
  104. package/templates/workspace/.opencode/command/ws-delegate.md +33 -0
  105. package/templates/workspace/.opencode/command/ws-deliver.md +6 -2
  106. package/templates/workspace/.opencode/command/ws-dev.md +5 -2
  107. package/templates/workspace/.opencode/command/ws-finish.md +19 -19
  108. package/templates/workspace/.opencode/command/ws-plan.md +12 -5
  109. package/templates/workspace/.opencode/command/ws-preflight.md +4 -0
  110. package/templates/workspace/.opencode/command/ws-quality-review.md +30 -0
  111. package/templates/workspace/.opencode/command/ws-review.md +3 -0
  112. package/templates/workspace/.opencode/command/ws-spec-review.md +30 -0
  113. package/templates/workspace/.opencode/command/ws-verify-before-complete.md +27 -0
  114. package/templates/workspace/.opencode/commands/p-aiws-change-archive.md +27 -0
  115. package/templates/workspace/.opencode/commands/p-aiws-change-finish.md +27 -0
  116. package/templates/workspace/.opencode/commands/p-aiws-change-list.md +26 -0
  117. package/templates/workspace/.opencode/commands/p-aiws-change-new.md +27 -0
  118. package/templates/workspace/.opencode/commands/p-aiws-change-next.md +27 -0
  119. package/templates/workspace/.opencode/commands/p-aiws-change-start.md +27 -0
  120. package/templates/workspace/.opencode/commands/p-aiws-change-status.md +27 -0
  121. package/templates/workspace/.opencode/commands/p-aiws-change-sync.md +27 -0
  122. package/templates/workspace/.opencode/commands/p-aiws-change-templates-init.md +26 -0
  123. package/templates/workspace/.opencode/commands/p-aiws-change-templates-which.md +26 -0
  124. package/templates/workspace/.opencode/commands/p-aiws-change-validate.md +27 -0
  125. package/templates/workspace/.opencode/commands/p-aiws-hooks-install.md +26 -0
  126. package/templates/workspace/.opencode/commands/p-aiws-hooks-status.md +26 -0
  127. package/templates/workspace/.opencode/commands/p-aiws-init.md +23 -0
  128. package/templates/workspace/.opencode/commands/p-aiws-rollback.md +16 -0
  129. package/templates/workspace/.opencode/commands/p-aiws-update.md +22 -0
  130. package/templates/workspace/.opencode/commands/p-aiws-validate.md +17 -0
  131. package/templates/workspace/.opencode/commands/using-aiws.md +29 -0
  132. package/templates/workspace/.opencode/commands/ws-analyze.md +30 -0
  133. package/templates/workspace/.opencode/commands/ws-bugfix.md +35 -0
  134. package/templates/workspace/.opencode/commands/ws-commit.md +70 -0
  135. package/templates/workspace/.opencode/commands/ws-delegate.md +33 -0
  136. package/templates/workspace/.opencode/commands/ws-deliver.md +58 -0
  137. package/templates/workspace/.opencode/commands/ws-dev.md +36 -0
  138. package/templates/workspace/.opencode/commands/ws-finish.md +71 -0
  139. package/templates/workspace/.opencode/commands/ws-handoff.md +25 -0
  140. package/templates/workspace/.opencode/commands/ws-migrate.md +25 -0
  141. package/templates/workspace/.opencode/commands/ws-plan-verify.md +28 -0
  142. package/templates/workspace/.opencode/commands/ws-plan.md +27 -0
  143. package/templates/workspace/.opencode/commands/ws-preflight.md +34 -0
  144. package/templates/workspace/.opencode/commands/ws-pull.md +87 -0
  145. package/templates/workspace/.opencode/commands/ws-push.md +93 -0
  146. package/templates/workspace/.opencode/commands/ws-quality-review.md +30 -0
  147. package/templates/workspace/.opencode/commands/ws-req-change.md +45 -0
  148. package/templates/workspace/.opencode/commands/ws-req-contract-sync.md +21 -0
  149. package/templates/workspace/.opencode/commands/ws-req-contract-validate.md +16 -0
  150. package/templates/workspace/.opencode/commands/ws-req-flow-sync.md +23 -0
  151. package/templates/workspace/.opencode/commands/ws-req-review.md +36 -0
  152. package/templates/workspace/.opencode/commands/ws-review.md +33 -0
  153. package/templates/workspace/.opencode/commands/ws-rule.md +27 -0
  154. package/templates/workspace/.opencode/commands/ws-spec-review.md +30 -0
  155. package/templates/workspace/.opencode/commands/ws-submodule-setup.md +57 -0
  156. package/templates/workspace/.opencode/commands/ws-verify-before-complete.md +27 -0
  157. package/templates/workspace/.opencode/oh-my-opencode.json.example +17 -0
  158. package/templates/workspace/.opencode/skills/p-aiws-change-archive/SKILL.md +24 -0
  159. package/templates/workspace/.opencode/skills/p-aiws-change-finish/SKILL.md +24 -0
  160. package/templates/workspace/.opencode/skills/p-aiws-change-list/SKILL.md +18 -0
  161. package/templates/workspace/.opencode/skills/p-aiws-change-new/SKILL.md +26 -0
  162. package/templates/workspace/.opencode/skills/p-aiws-change-next/SKILL.md +19 -0
  163. package/templates/workspace/.opencode/skills/p-aiws-change-start/SKILL.md +33 -0
  164. package/templates/workspace/.opencode/skills/p-aiws-change-status/SKILL.md +19 -0
  165. package/templates/workspace/.opencode/skills/p-aiws-change-sync/SKILL.md +19 -0
  166. package/templates/workspace/.opencode/skills/p-aiws-change-templates-init/SKILL.md +18 -0
  167. package/templates/workspace/.opencode/skills/p-aiws-change-templates-which/SKILL.md +18 -0
  168. package/templates/workspace/.opencode/skills/p-aiws-change-validate/SKILL.md +23 -0
  169. package/templates/workspace/.opencode/skills/p-aiws-hooks-install/SKILL.md +30 -0
  170. package/templates/workspace/.opencode/skills/p-aiws-hooks-status/SKILL.md +18 -0
  171. package/templates/workspace/.opencode/skills/p-aiws-init/SKILL.md +27 -0
  172. package/templates/workspace/.opencode/skills/p-aiws-rollback/SKILL.md +18 -0
  173. package/templates/workspace/.opencode/skills/p-aiws-update/SKILL.md +26 -0
  174. package/templates/workspace/.opencode/skills/p-aiws-validate/SKILL.md +22 -0
  175. package/templates/workspace/.opencode/skills/p-tasks-plan/SKILL.md +37 -0
  176. package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +87 -0
  177. package/templates/workspace/.opencode/skills/ws-analyze/SKILL.md +26 -0
  178. package/templates/workspace/.opencode/skills/ws-bugfix/SKILL.md +111 -0
  179. package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +127 -0
  180. package/templates/workspace/.opencode/skills/ws-delegate/SKILL.md +63 -0
  181. package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +231 -0
  182. package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +168 -0
  183. package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +220 -0
  184. package/templates/workspace/.opencode/skills/ws-frontend-design/SKILL.md +126 -0
  185. package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +52 -0
  186. package/templates/workspace/.opencode/skills/ws-migrate/SKILL.md +54 -0
  187. package/templates/workspace/.opencode/skills/ws-plan/SKILL.md +148 -0
  188. package/templates/workspace/.opencode/skills/ws-plan-verify/SKILL.md +61 -0
  189. package/templates/workspace/.opencode/skills/ws-preflight/SKILL.md +60 -0
  190. package/templates/workspace/.opencode/skills/ws-pull/SKILL.md +119 -0
  191. package/templates/workspace/.opencode/skills/ws-push/SKILL.md +110 -0
  192. package/templates/workspace/.opencode/skills/ws-quality-review/SKILL.md +63 -0
  193. package/templates/workspace/.opencode/skills/ws-req-change/SKILL.md +41 -0
  194. package/templates/workspace/.opencode/skills/ws-req-contract-sync/SKILL.md +17 -0
  195. package/templates/workspace/.opencode/skills/ws-req-contract-validate/SKILL.md +12 -0
  196. package/templates/workspace/.opencode/skills/ws-req-flow-sync/SKILL.md +28 -0
  197. package/templates/workspace/.opencode/skills/ws-req-review/SKILL.md +32 -0
  198. package/templates/workspace/.opencode/skills/ws-review/SKILL.md +57 -0
  199. package/templates/workspace/.opencode/skills/ws-rule/SKILL.md +23 -0
  200. package/templates/workspace/.opencode/skills/ws-spec-review/SKILL.md +64 -0
  201. package/templates/workspace/.opencode/skills/ws-submodule-setup/SKILL.md +65 -0
  202. package/templates/workspace/.opencode/skills/ws-verify-before-complete/SKILL.md +59 -0
  203. package/templates/workspace/AGENTS.md +72 -29
  204. package/templates/workspace/AI_WORKSPACE.md +4 -4
  205. package/templates/workspace/changes/README.md +26 -2
  206. package/templates/workspace/changes/templates/proposal.md +15 -0
  207. package/templates/workspace/changes/templates/tasks.md +9 -2
  208. package/templates/workspace/manifest.json +279 -2
  209. package/templates/workspace/tools/ws_change_check.py +27 -5
  210. package/templates/workspace/tools/ws_resolve_sub_target.sh +1 -0
@@ -0,0 +1,67 @@
1
+ {
2
+ "type": "object",
3
+ "required": [
4
+ "version",
5
+ "title",
6
+ "description",
7
+ "purpose",
8
+ "gates",
9
+ "unifiedRules",
10
+ "evidence",
11
+ "notes"
12
+ ],
13
+ "properties": {
14
+ "version": { "type": "integer" },
15
+ "title": { "type": "string", "minLength": 1 },
16
+ "description": { "type": "string", "minLength": 1 },
17
+ "purpose": {
18
+ "type": "array",
19
+ "minItems": 1,
20
+ "items": { "type": "string", "minLength": 1 }
21
+ },
22
+ "gates": {
23
+ "type": "array",
24
+ "minItems": 1,
25
+ "items": {
26
+ "type": "object",
27
+ "required": ["id", "name", "stage", "focus", "mustRead", "mustWrite", "blockers", "exitCriteria", "next"],
28
+ "properties": {
29
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9_]+$" },
30
+ "name": { "type": "string", "minLength": 1, "pattern": "^ws-[a-z0-9-]+$" },
31
+ "stage": { "type": "string", "minLength": 1 },
32
+ "focus": { "type": "string", "minLength": 1 },
33
+ "mustRead": { "type": "string", "minLength": 1 },
34
+ "mustWrite": { "type": "string", "minLength": 1 },
35
+ "blockers": { "type": "string", "minLength": 1 },
36
+ "exitCriteria": { "type": "string", "minLength": 1 },
37
+ "next": { "type": "string", "minLength": 1 }
38
+ },
39
+ "additionalProperties": false
40
+ }
41
+ },
42
+ "unifiedRules": {
43
+ "type": "array",
44
+ "minItems": 1,
45
+ "items": { "type": "string", "minLength": 1 }
46
+ },
47
+ "evidence": {
48
+ "type": "array",
49
+ "minItems": 1,
50
+ "items": {
51
+ "type": "object",
52
+ "required": ["label", "value"],
53
+ "properties": {
54
+ "label": { "type": "string", "minLength": 1 },
55
+ "value": { "type": "string", "minLength": 1 }
56
+ },
57
+ "additionalProperties": false
58
+ }
59
+ },
60
+ "notes": {
61
+ "type": "array",
62
+ "minItems": 1,
63
+ "items": { "type": "string", "minLength": 1 }
64
+ }
65
+ },
66
+ "additionalProperties": false
67
+ }
@@ -0,0 +1,196 @@
1
+ {
2
+ "version": 1,
3
+ "title": "workflow-router-rules",
4
+ "description": "Machine-readable bootstrap/router rules for the aiws default workflow entry.",
5
+ "purpose": [
6
+ "这份文档把 `using-aiws` / `ws-router` 的路由规则收口为机器可读真值,避免不同工具各自发明“先做什么”的入口逻辑。",
7
+ "重点不是自动执行控制器,而是强制任何 coding task 先读真值文件、先判定 workflow,再进入具体 `ws-*` skill。"
8
+ ],
9
+ "truthFiles": [
10
+ "AI_PROJECT.md",
11
+ "REQUIREMENTS.md",
12
+ "AI_WORKSPACE.md"
13
+ ],
14
+ "bootstrapEntry": {
15
+ "name": "using-aiws",
16
+ "kind": "skill",
17
+ "summary": "默认 workflow bootstrap/router:先读真值,再把任务路由到正确的 `ws-*` 入口。",
18
+ "outputContract": [
19
+ "Root / Found / Missing",
20
+ "Task intent / Binding status / Route",
21
+ "Why / Next"
22
+ ]
23
+ },
24
+ "universalSequence": [
25
+ {
26
+ "step": "read_truths",
27
+ "action": "先定位项目根,并读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。",
28
+ "why": "router 不能绕过真值文件,否则会把 workflow 判断建立在会话猜测上。"
29
+ },
30
+ {
31
+ "step": "classify_intent",
32
+ "action": "判断当前任务是在做需求变更、实现、评审、收尾还是交接。",
33
+ "why": "先判 workflow,再决定进入哪个 skill;不能一开始就跳进实现。"
34
+ },
35
+ {
36
+ "step": "check_binding",
37
+ "action": "检查任务是否具备 `Req_ID` / `Problem_ID` / change 上下文 / Verify 入口等最小绑定。",
38
+ "why": "缺失绑定时必须阻断或回退到 `ws-plan`,避免无归因实现。"
39
+ },
40
+ {
41
+ "step": "route_or_clarify",
42
+ "action": "给出单一路由结果;若意图不明确,则先问关键澄清问题并停止。",
43
+ "why": "default-routed workflow 的关键不是自动执行,而是避免模糊任务直接进入实现。"
44
+ }
45
+ ],
46
+ "routingRules": [
47
+ {
48
+ "id": "missing_truths",
49
+ "intent": "仓库未初始化或真值缺失",
50
+ "match": "缺失任一真值文件,或无法确定项目根目录。",
51
+ "routeTo": "ws-preflight",
52
+ "gate": "先补齐真值或确认项目根,不进入实现。",
53
+ "rationale": "所有后续 skill 都依赖真值文件;缺失时 router 只能回退到 preflight/init 路径。"
54
+ },
55
+ {
56
+ "id": "unclear_intent",
57
+ "intent": "用户目标、归因或验收不清晰",
58
+ "match": "无法明确当前是需求变更、实现、评审、finish 还是 handoff;或无法明确 `Req_ID` / `Problem_ID` / Verify。",
59
+ "routeTo": "clarify",
60
+ "gate": "必须先问 1-3 个关键澄清问题,然后停止。",
61
+ "rationale": "router 的职责是阻断模糊任务,而不是用猜测替代路由。"
62
+ },
63
+ {
64
+ "id": "requirements_change",
65
+ "intent": "需求/验收/合同变更",
66
+ "match": "任务涉及 `REQUIREMENTS.md`、requirements CSV、spec contract、验收标准或 workflow 真值变更。",
67
+ "routeTo": "ws-req-review",
68
+ "gate": "先做需求评审,再决定是否进入 `ws-plan` / `ws-dev`。",
69
+ "rationale": "需求真值变更必须先过 review,不能直接编码。"
70
+ },
71
+ {
72
+ "id": "review_request",
73
+ "intent": "审计/评审/找风险",
74
+ "match": "用户明确要求 review、audit、评审、找 bug、识别风险或检查回归。",
75
+ "routeTo": "ws-review",
76
+ "gate": "先给 findings;除非用户另行要求,不先改代码。",
77
+ "rationale": "评审任务与实现任务的输出契约不同,必须优先走 review。"
78
+ },
79
+ {
80
+ "id": "finish_request",
81
+ "intent": "收尾/合并/推送/cleanup",
82
+ "match": "用户要求 finish、merge、push、收尾、交付完成、清理 worktree 或 branch。",
83
+ "routeTo": "ws-finish",
84
+ "gate": "必须满足 finish gate,不能跳过 validate / push / cleanup。",
85
+ "rationale": "finish 是独立治理阶段,不能与普通实现混用。"
86
+ },
87
+ {
88
+ "id": "handoff_request",
89
+ "intent": "交接/归档总结",
90
+ "match": "用户要求 handoff、交接说明、archive summary、会话总结或接力说明。",
91
+ "routeTo": "ws-handoff",
92
+ "gate": "先确认 change 已 finish 或 archive 上下文存在。",
93
+ "rationale": "handoff 依赖已有证据与归档上下文,不应在实现前触发。"
94
+ },
95
+ {
96
+ "id": "plan_first",
97
+ "intent": "中大型实现或需要建立 change 上下文",
98
+ "match": "任务是多步实现、跨文件、跨模块、需要方案、需要新建 change/worktree,或当前还没有计划工件。",
99
+ "routeTo": "ws-plan",
100
+ "gate": "plan 过 gate 前不进入 `ws-dev`。",
101
+ "rationale": "medium/complex 任务必须先生成可落盘计划,避免 router 直接跳进实现。"
102
+ },
103
+ {
104
+ "id": "direct_implementation",
105
+ "intent": "小步实现/修复/配置调整",
106
+ "match": "目标明确、归因清晰、验证入口明确,且无需先改 requirements 或单独评审。",
107
+ "routeTo": "ws-dev",
108
+ "gate": "若执行中发现复杂度升高,必须回退到 `ws-plan`。",
109
+ "rationale": "router 允许明确的小步任务直接实现,但必须保留回退计划阶段的门。"
110
+ }
111
+ ],
112
+ "routeCases": [
113
+ {
114
+ "id": "case_missing_truths",
115
+ "scenario": "仓库未初始化或真值缺失时,不能直接开始实现。",
116
+ "request": "在一个还没执行 aiws init 的仓库里继续开发这个功能。",
117
+ "expectedRuleId": "missing_truths",
118
+ "expectedRoute": "ws-preflight",
119
+ "why": "缺失真值文件时只能先补齐 preflight/init 路径。"
120
+ },
121
+ {
122
+ "id": "case_unclear_continue",
123
+ "scenario": "用户只说继续,但没有明确当前 change、归因或验证入口。",
124
+ "request": "继续。",
125
+ "expectedRuleId": "unclear_intent",
126
+ "expectedRoute": "clarify",
127
+ "why": "这种场景必须先澄清意图和绑定,不能猜测实现。"
128
+ },
129
+ {
130
+ "id": "case_requirements_change",
131
+ "scenario": "任务要修改 REQUIREMENTS、requirements CSV 或 workflow 真值。",
132
+ "request": "更新 REQUIREMENTS.md 和 requirements/requirements-issues.csv,补充验收标准。",
133
+ "expectedRuleId": "requirements_change",
134
+ "expectedRoute": "ws-req-review",
135
+ "why": "需求真值变更必须先做需求评审。"
136
+ },
137
+ {
138
+ "id": "case_review_request",
139
+ "scenario": "用户明确要求 review、审计、找风险或检查回归。",
140
+ "request": "review 这批改动,先给我风险和回归点,不要先改代码。",
141
+ "expectedRuleId": "review_request",
142
+ "expectedRoute": "ws-review",
143
+ "why": "评审任务的输出契约是 findings,不应直接进入实现。"
144
+ },
145
+ {
146
+ "id": "case_finish_request",
147
+ "scenario": "用户要求合并、push、cleanup 或 finish 当前 change。",
148
+ "request": "把 demo-change finish 掉并 push,顺便 cleanup worktree。",
149
+ "expectedRuleId": "finish_request",
150
+ "expectedRoute": "ws-finish",
151
+ "why": "finish 是独立治理阶段,必须先走 finish gate。"
152
+ },
153
+ {
154
+ "id": "case_handoff_request",
155
+ "scenario": "用户要求 handoff、交接说明、archive summary 或接力文档。",
156
+ "request": "给这个 change 写 handoff,并补 archive summary。",
157
+ "expectedRuleId": "handoff_request",
158
+ "expectedRoute": "ws-handoff",
159
+ "why": "handoff 依赖已有 finish/archive 上下文,不能当成普通实现。"
160
+ },
161
+ {
162
+ "id": "case_plan_first",
163
+ "scenario": "任务是跨文件、多步实现,且需要先建立 change/worktree 或方案。",
164
+ "request": "实现 dashboard 的阶段治理视图并补测试,需要新建 change 和计划。",
165
+ "expectedRuleId": "plan_first",
166
+ "expectedRoute": "ws-plan",
167
+ "why": "中大型实现应先落盘计划,再进入 dev。"
168
+ },
169
+ {
170
+ "id": "case_direct_implementation",
171
+ "scenario": "任务是小步明确修复,归因和验证入口都已清楚。",
172
+ "request": "修复 codex install-skills 的默认路径,并补一条可复现回归。",
173
+ "expectedRuleId": "direct_implementation",
174
+ "expectedRoute": "ws-dev",
175
+ "why": "小步明确实现允许直接进入 dev,但仍保留回退到 plan 的门。"
176
+ }
177
+ ],
178
+ "clarificationTriggers": [
179
+ "用户只说“继续”“优化一下”“看一下”,但没有明确目标对象或当前阶段。",
180
+ "无法把任务绑定到 `Req_ID` / `Problem_ID` / change 上下文。",
181
+ "没有可复现验证入口,且无法从 `AI_WORKSPACE.md` 推断。",
182
+ "当前描述同时包含需求变更、实现和收尾,但没有明确优先级。"
183
+ ],
184
+ "universalRules": [
185
+ "router 自己不是实现阶段;先判定 workflow,再进入具体 `ws-*` skill。",
186
+ "除缺失真值场景外,router 至少要给出一个明确的 `Route:` 结果或明确的澄清问题。",
187
+ "当 `routeTo=clarify` 时,必须停止,不直接写代码。",
188
+ "当 `routeTo=ws-plan` / `ws-dev` / `ws-review` / `ws-finish` / `ws-handoff` / `ws-req-review` 时,后续行为必须遵循对应 skill 契约。",
189
+ "任何 route 都不能绕过 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。"
190
+ ],
191
+ "notes": [
192
+ "default-routed workflow 不等于 daemon / pane / runtime orchestration;这一版只固定真值和入口。",
193
+ "`using-aiws` 可以作为默认入口;若未来需要更短命名,可再引入 `ws-router` 作为等价别名。",
194
+ "Claude/OpenCode/Codex 的 native 目录不同,但 router 语义必须共用同一份 JSON 真值。"
195
+ ]
196
+ }
@@ -0,0 +1,83 @@
1
+ # workflow-router-rules
2
+
3
+ <!-- Generated from packages/spec/docs/workflow-router-rules.json by scripts/sync-workflow-router-rules.mjs. Do not hand edit. -->
4
+
5
+ ## 目的
6
+
7
+ 这份文档把 `using-aiws` / `ws-router` 的路由规则收口为机器可读真值,避免不同工具各自发明“先做什么”的入口逻辑。
8
+
9
+ 重点不是自动执行控制器,而是强制任何 coding task 先读真值文件、先判定 workflow,再进入具体 `ws-*` skill。
10
+
11
+ ## 真值入口
12
+
13
+ router 在做任何 workflow 判断前,必须先读取:
14
+
15
+ - `AI_PROJECT.md`
16
+ - `REQUIREMENTS.md`
17
+ - `AI_WORKSPACE.md`
18
+
19
+ ## Bootstrap Entry
20
+
21
+ - name: `using-aiws`
22
+ - kind: `skill`
23
+ - summary: 默认 workflow bootstrap/router:先读真值,再把任务路由到正确的 `ws-*` 入口。
24
+ - output contract:
25
+ - Root / Found / Missing
26
+ - Task intent / Binding status / Route
27
+ - Why / Next
28
+
29
+ ## 通用顺序
30
+
31
+ | Step | Action | Why |
32
+ | --- | --- | --- |
33
+ | `read_truths` | 先定位项目根,并读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。 | router 不能绕过真值文件,否则会把 workflow 判断建立在会话猜测上。 |
34
+ | `classify_intent` | 判断当前任务是在做需求变更、实现、评审、收尾还是交接。 | 先判 workflow,再决定进入哪个 skill;不能一开始就跳进实现。 |
35
+ | `check_binding` | 检查任务是否具备 `Req_ID` / `Problem_ID` / change 上下文 / Verify 入口等最小绑定。 | 缺失绑定时必须阻断或回退到 `ws-plan`,避免无归因实现。 |
36
+ | `route_or_clarify` | 给出单一路由结果;若意图不明确,则先问关键澄清问题并停止。 | default-routed workflow 的关键不是自动执行,而是避免模糊任务直接进入实现。 |
37
+
38
+ ## 路由规则
39
+
40
+ | Rule ID | Intent | Match | Route | Gate | Rationale |
41
+ | --- | --- | --- | --- | --- | --- |
42
+ | `missing_truths` | 仓库未初始化或真值缺失 | 缺失任一真值文件,或无法确定项目根目录。 | `ws-preflight` | 先补齐真值或确认项目根,不进入实现。 | 所有后续 skill 都依赖真值文件;缺失时 router 只能回退到 preflight/init 路径。 |
43
+ | `unclear_intent` | 用户目标、归因或验收不清晰 | 无法明确当前是需求变更、实现、评审、finish 还是 handoff;或无法明确 `Req_ID` / `Problem_ID` / Verify。 | `clarify` | 必须先问 1-3 个关键澄清问题,然后停止。 | router 的职责是阻断模糊任务,而不是用猜测替代路由。 |
44
+ | `requirements_change` | 需求/验收/合同变更 | 任务涉及 `REQUIREMENTS.md`、requirements CSV、spec contract、验收标准或 workflow 真值变更。 | `ws-req-review` | 先做需求评审,再决定是否进入 `ws-plan` / `ws-dev`。 | 需求真值变更必须先过 review,不能直接编码。 |
45
+ | `review_request` | 审计/评审/找风险 | 用户明确要求 review、audit、评审、找 bug、识别风险或检查回归。 | `ws-review` | 先给 findings;除非用户另行要求,不先改代码。 | 评审任务与实现任务的输出契约不同,必须优先走 review。 |
46
+ | `finish_request` | 收尾/合并/推送/cleanup | 用户要求 finish、merge、push、收尾、交付完成、清理 worktree 或 branch。 | `ws-finish` | 必须满足 finish gate,不能跳过 validate / push / cleanup。 | finish 是独立治理阶段,不能与普通实现混用。 |
47
+ | `handoff_request` | 交接/归档总结 | 用户要求 handoff、交接说明、archive summary、会话总结或接力说明。 | `ws-handoff` | 先确认 change 已 finish 或 archive 上下文存在。 | handoff 依赖已有证据与归档上下文,不应在实现前触发。 |
48
+ | `plan_first` | 中大型实现或需要建立 change 上下文 | 任务是多步实现、跨文件、跨模块、需要方案、需要新建 change/worktree,或当前还没有计划工件。 | `ws-plan` | plan 过 gate 前不进入 `ws-dev`。 | medium/complex 任务必须先生成可落盘计划,避免 router 直接跳进实现。 |
49
+ | `direct_implementation` | 小步实现/修复/配置调整 | 目标明确、归因清晰、验证入口明确,且无需先改 requirements 或单独评审。 | `ws-dev` | 若执行中发现复杂度升高,必须回退到 `ws-plan`。 | router 允许明确的小步任务直接实现,但必须保留回退计划阶段的门。 |
50
+
51
+ ## Route Cases
52
+
53
+ | Case ID | Scenario | Request | Expected Rule | Expected Route | Why |
54
+ | --- | --- | --- | --- | --- | --- |
55
+ | `case_missing_truths` | 仓库未初始化或真值缺失时,不能直接开始实现。 | 在一个还没执行 aiws init 的仓库里继续开发这个功能。 | `missing_truths` | `ws-preflight` | 缺失真值文件时只能先补齐 preflight/init 路径。 |
56
+ | `case_unclear_continue` | 用户只说继续,但没有明确当前 change、归因或验证入口。 | 继续。 | `unclear_intent` | `clarify` | 这种场景必须先澄清意图和绑定,不能猜测实现。 |
57
+ | `case_requirements_change` | 任务要修改 REQUIREMENTS、requirements CSV 或 workflow 真值。 | 更新 REQUIREMENTS.md 和 requirements/requirements-issues.csv,补充验收标准。 | `requirements_change` | `ws-req-review` | 需求真值变更必须先做需求评审。 |
58
+ | `case_review_request` | 用户明确要求 review、审计、找风险或检查回归。 | review 这批改动,先给我风险和回归点,不要先改代码。 | `review_request` | `ws-review` | 评审任务的输出契约是 findings,不应直接进入实现。 |
59
+ | `case_finish_request` | 用户要求合并、push、cleanup 或 finish 当前 change。 | 把 demo-change finish 掉并 push,顺便 cleanup worktree。 | `finish_request` | `ws-finish` | finish 是独立治理阶段,必须先走 finish gate。 |
60
+ | `case_handoff_request` | 用户要求 handoff、交接说明、archive summary 或接力文档。 | 给这个 change 写 handoff,并补 archive summary。 | `handoff_request` | `ws-handoff` | handoff 依赖已有 finish/archive 上下文,不能当成普通实现。 |
61
+ | `case_plan_first` | 任务是跨文件、多步实现,且需要先建立 change/worktree 或方案。 | 实现 dashboard 的阶段治理视图并补测试,需要新建 change 和计划。 | `plan_first` | `ws-plan` | 中大型实现应先落盘计划,再进入 dev。 |
62
+ | `case_direct_implementation` | 任务是小步明确修复,归因和验证入口都已清楚。 | 修复 codex install-skills 的默认路径,并补一条可复现回归。 | `direct_implementation` | `ws-dev` | 小步明确实现允许直接进入 dev,但仍保留回退到 plan 的门。 |
63
+
64
+ ## 必须先澄清的情形
65
+
66
+ - 用户只说“继续”“优化一下”“看一下”,但没有明确目标对象或当前阶段。
67
+ - 无法把任务绑定到 `Req_ID` / `Problem_ID` / change 上下文。
68
+ - 没有可复现验证入口,且无法从 `AI_WORKSPACE.md` 推断。
69
+ - 当前描述同时包含需求变更、实现和收尾,但没有明确优先级。
70
+
71
+ ## 统一规则
72
+
73
+ - router 自己不是实现阶段;先判定 workflow,再进入具体 `ws-*` skill。
74
+ - 除缺失真值场景外,router 至少要给出一个明确的 `Route:` 结果或明确的澄清问题。
75
+ - 当 `routeTo=clarify` 时,必须停止,不直接写代码。
76
+ - 当 `routeTo=ws-plan` / `ws-dev` / `ws-review` / `ws-finish` / `ws-handoff` / `ws-req-review` 时,后续行为必须遵循对应 skill 契约。
77
+ - 任何 route 都不能绕过 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。
78
+
79
+ ## 说明
80
+
81
+ - default-routed workflow 不等于 daemon / pane / runtime orchestration;这一版只固定真值和入口。
82
+ - `using-aiws` 可以作为默认入口;若未来需要更短命名,可再引入 `ws-router` 作为等价别名。
83
+ - Claude/OpenCode/Codex 的 native 目录不同,但 router 语义必须共用同一份 JSON 真值。
@@ -0,0 +1,119 @@
1
+ {
2
+ "type": "object",
3
+ "required": [
4
+ "version",
5
+ "title",
6
+ "description",
7
+ "purpose",
8
+ "truthFiles",
9
+ "bootstrapEntry",
10
+ "universalSequence",
11
+ "routingRules",
12
+ "routeCases",
13
+ "clarificationTriggers",
14
+ "universalRules",
15
+ "notes"
16
+ ],
17
+ "properties": {
18
+ "version": { "type": "integer" },
19
+ "title": { "type": "string", "minLength": 1 },
20
+ "description": { "type": "string", "minLength": 1 },
21
+ "purpose": {
22
+ "type": "array",
23
+ "minItems": 1,
24
+ "items": { "type": "string", "minLength": 1 }
25
+ },
26
+ "truthFiles": {
27
+ "type": "array",
28
+ "minItems": 3,
29
+ "items": { "type": "string", "minLength": 1 }
30
+ },
31
+ "bootstrapEntry": {
32
+ "type": "object",
33
+ "required": ["name", "kind", "summary", "outputContract"],
34
+ "properties": {
35
+ "name": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9-]+$" },
36
+ "kind": { "type": "string", "minLength": 1, "enum": ["skill", "command"] },
37
+ "summary": { "type": "string", "minLength": 1 },
38
+ "outputContract": {
39
+ "type": "array",
40
+ "minItems": 1,
41
+ "items": { "type": "string", "minLength": 1 }
42
+ }
43
+ },
44
+ "additionalProperties": false
45
+ },
46
+ "universalSequence": {
47
+ "type": "array",
48
+ "minItems": 1,
49
+ "items": {
50
+ "type": "object",
51
+ "required": ["step", "action", "why"],
52
+ "properties": {
53
+ "step": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9_]+$" },
54
+ "action": { "type": "string", "minLength": 1 },
55
+ "why": { "type": "string", "minLength": 1 }
56
+ },
57
+ "additionalProperties": false
58
+ }
59
+ },
60
+ "routingRules": {
61
+ "type": "array",
62
+ "minItems": 1,
63
+ "items": {
64
+ "type": "object",
65
+ "required": ["id", "intent", "match", "routeTo", "gate", "rationale"],
66
+ "properties": {
67
+ "id": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9_]+$" },
68
+ "intent": { "type": "string", "minLength": 1 },
69
+ "match": { "type": "string", "minLength": 1 },
70
+ "routeTo": {
71
+ "type": "string",
72
+ "minLength": 1,
73
+ "pattern": "^(clarify|ws-[a-z0-9-]+)$"
74
+ },
75
+ "gate": { "type": "string", "minLength": 1 },
76
+ "rationale": { "type": "string", "minLength": 1 }
77
+ },
78
+ "additionalProperties": false
79
+ }
80
+ },
81
+ "routeCases": {
82
+ "type": "array",
83
+ "minItems": 1,
84
+ "items": {
85
+ "type": "object",
86
+ "required": ["id", "scenario", "request", "expectedRuleId", "expectedRoute", "why"],
87
+ "properties": {
88
+ "id": { "type": "string", "minLength": 1, "pattern": "^case_[a-z0-9_]+$" },
89
+ "scenario": { "type": "string", "minLength": 1 },
90
+ "request": { "type": "string", "minLength": 1 },
91
+ "expectedRuleId": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9_]+$" },
92
+ "expectedRoute": {
93
+ "type": "string",
94
+ "minLength": 1,
95
+ "pattern": "^(clarify|ws-[a-z0-9-]+)$"
96
+ },
97
+ "why": { "type": "string", "minLength": 1 }
98
+ },
99
+ "additionalProperties": false
100
+ }
101
+ },
102
+ "clarificationTriggers": {
103
+ "type": "array",
104
+ "minItems": 1,
105
+ "items": { "type": "string", "minLength": 1 }
106
+ },
107
+ "universalRules": {
108
+ "type": "array",
109
+ "minItems": 1,
110
+ "items": { "type": "string", "minLength": 1 }
111
+ },
112
+ "notes": {
113
+ "type": "array",
114
+ "minItems": 1,
115
+ "items": { "type": "string", "minLength": 1 }
116
+ }
117
+ },
118
+ "additionalProperties": false
119
+ }
@@ -0,0 +1,148 @@
1
+ {
2
+ "version": 1,
3
+ "title": "workflow-stage-contracts",
4
+ "description": "Machine-readable workflow stage contracts for aiws ws-* stages.",
5
+ "purpose": [
6
+ "这份文档把 `aiws` 核心 `ws-*` workflow 的阶段契约写成统一真值,避免不同工具、不同协作者把同一个入口用成不同语义。",
7
+ "重点不是“命令名长什么样”,而是每个阶段必须收什么输入、产出什么结果、在什么情况下必须停止。"
8
+ ],
9
+ "standardChain": [
10
+ "ws-preflight",
11
+ "ws-plan",
12
+ "ws-plan-verify",
13
+ "ws-dev",
14
+ "ws-review",
15
+ "ws-commit",
16
+ "ws-deliver",
17
+ "ws-finish",
18
+ "ws-handoff"
19
+ ],
20
+ "notes": [
21
+ "ws-deliver 用于多 repo / submodule 场景的顺序提交与交付准备。",
22
+ "ws-finish 用于 fast-forward 合并、push 和 worktree cleanup。",
23
+ "ws-handoff 通常在 archive 后使用,为下一次会话留下交接说明。",
24
+ "若存在独立 change worktree,治理信号应优先读取该 worktree;若 worktree metadata 已 stale,则降级为 warning 并回退到当前 worktree。"
25
+ ],
26
+ "stages": [
27
+ {
28
+ "stage": "ws-preflight",
29
+ "goal": "对齐真值文件与协作约束",
30
+ "requiredInputs": "项目根;AI_PROJECT.md;REQUIREMENTS.md;AI_WORKSPACE.md",
31
+ "requiredOutputs": "Root / Found / Missing / Key rules / Next",
32
+ "blockers": "无法确定项目根;真值缺失",
33
+ "next": "ws-plan 或 ws-dev"
34
+ },
35
+ {
36
+ "stage": "ws-plan",
37
+ "goal": "建立 change 绑定并落盘计划",
38
+ "requiredInputs": "任务描述;真值文件;proposal.md(若存在)",
39
+ "requiredOutputs": "plan/...;Bindings;Verify;Risks;Evidence;Next",
40
+ "blockers": "绑定不清;dirty 工作区无法安全建 context;无法写盘",
41
+ "next": "ws-plan-verify"
42
+ },
43
+ {
44
+ "stage": "ws-plan-verify",
45
+ "goal": "检查计划是否满足严格契约",
46
+ "requiredInputs": "plan/...;proposal.md;当前 change",
47
+ "requiredOutputs": "Quality gate;Fix list;可执行最小计划摘要",
48
+ "blockers": "strict 校验失败;无法定位 change",
49
+ "next": "修计划后重跑或进入 ws-dev"
50
+ },
51
+ {
52
+ "stage": "ws-dev",
53
+ "goal": "实施最小改动并验证",
54
+ "requiredInputs": "真值文件;归因目标;计划(medium/complex)",
55
+ "requiredOutputs": "Changed;Verify;Evidence;Next",
56
+ "blockers": "无法归因;没有验证入口;change 上下文不安全",
57
+ "next": "ws-review / ws-commit"
58
+ },
59
+ {
60
+ "stage": "ws-review",
61
+ "goal": "审计规范、风险与验证完整性",
62
+ "requiredInputs": "当前 diff;验证结果;真值文件",
63
+ "requiredOutputs": "review 文件;Top risks;Next",
64
+ "blockers": "无改动可审;无法写审计证据",
65
+ "next": "ws-commit 或修复后重审"
66
+ },
67
+ {
68
+ "stage": "ws-commit",
69
+ "goal": "串联 review、validate、commit 确认",
70
+ "requiredInputs": "staged diff;review 证据;validate stamp;用户确认的 message",
71
+ "requiredOutputs": "Evidence;Context;Commit",
72
+ "blockers": "无 staged changes;submodule dirty;validate 失败;message 未确认",
73
+ "next": "ws-deliver / ws-finish"
74
+ },
75
+ {
76
+ "stage": "ws-deliver",
77
+ "goal": "在 submodule 场景下完成顺序提交与证据收敛",
78
+ "requiredInputs": "change 上下文;.gitmodules;submodules.targets;各 repo 状态",
79
+ "requiredOutputs": "submodule 提交摘要;superproject 提交摘要;Evidence",
80
+ "blockers": "submodule 真值不完整;不在正确 change;commit 未确认",
81
+ "next": "ws-finish"
82
+ },
83
+ {
84
+ "stage": "ws-finish",
85
+ "goal": "安全合并、push、cleanup",
86
+ "requiredInputs": "干净工作区;已提交的 change;push 目标;submodule 真值(若有)",
87
+ "requiredOutputs": "Merge;Push;Worktree cleanup;Evidence",
88
+ "blockers": "dirty 工作区;ff 失败;submodule 无法安全 push",
89
+ "next": "ws-handoff 或 archive"
90
+ },
91
+ {
92
+ "stage": "ws-handoff",
93
+ "goal": "生成可接力的归档交接说明",
94
+ "requiredInputs": "已归档或待归档的 change",
95
+ "requiredOutputs": "changes/archive/.../handoff.md;Next",
96
+ "blockers": "无法定位 change;archive 失败;handoff 无法生成",
97
+ "next": "新 change 通过 Depends_On 接力"
98
+ }
99
+ ],
100
+ "unifiedRules": [
101
+ "每个阶段都必须回指真值文件或 change 工件,不能只依赖会话上下文。",
102
+ "每个阶段都必须有明确输出,不能只给“建议继续”而不留下工件或证据。",
103
+ "遇到阻断条件时必须停止,不能为了推进速度跳过门禁。",
104
+ "如果一个阶段没有留下可审计路径,它就不算真正完成。",
105
+ "`ws-finish` 只有在 merge、push、cleanup 都完成后才算完成;仅本地 merge 成功不等于可进入 `ws-handoff`。"
106
+ ],
107
+ "evidence": {
108
+ "intro": "最少证据集合:",
109
+ "minimum": [
110
+ {
111
+ "label": "planning",
112
+ "value": "`plan/...`、`changes/<change-id>/proposal.md`、`tasks.md`"
113
+ },
114
+ {
115
+ "label": "review",
116
+ "value": "`changes/<change-id>/review/...` 或 `.agentdocs/tmp/review/...`"
117
+ },
118
+ {
119
+ "label": "validate",
120
+ "value": "`.agentdocs/tmp/aiws-validate/*.json`"
121
+ },
122
+ {
123
+ "label": "deliver / finish",
124
+ "value": "`changes/<change-id>/evidence/...`、`state`、merge / push 结果"
125
+ },
126
+ {
127
+ "label": "handoff",
128
+ "value": "`changes/archive/.../handoff.md`"
129
+ }
130
+ ],
131
+ "notes": [
132
+ "tmp review 证据可以作为“进入 commit gate”的临时治理信号,但在交付前应通过 `aiws change evidence` 收敛为持久 review 证据。",
133
+ "finish 生命周期建议区分“本地开始”和“完整完成”两类信号,避免仅凭本地 merge 就误导到 handoff。"
134
+ ]
135
+ },
136
+ "positioning": {
137
+ "intro": "这份阶段契约文档是 `aiws` “治理内核”定位的直接落点:",
138
+ "layers": [
139
+ "`packages/spec/` 继续作为规则真值层",
140
+ "`ws-*` 阶段契约是工作流治理层",
141
+ "`docs/workflow-stage-contracts.json` 是运行时阶段契约的机器可读真值",
142
+ "`docs/workflow-governance-rules.json` 是运行时阶段推断的机器可读真值",
143
+ "CLI / tool-native files 是执行与分发层",
144
+ "review / validate / handoff 等工件属于证据与审计层"
145
+ ],
146
+ "closing": "如果未来要吸收新的 skill、协同角色或外部 workflow,优先判断它能否被映射到这张阶段表;不能稳定映射的能力,不应直接成为核心真值。"
147
+ }
148
+ }