@xulthekl/team-flow 0.49.0 → 0.51.0

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 (61) hide show
  1. package/.claude/always/phase-guard.md +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.codex-plugin/plugin.json +1 -1
  5. package/.cursor-plugin/marketplace.json +1 -1
  6. package/.cursor-plugin/plugin.json +1 -1
  7. package/.github/plugin/marketplace.json +2 -2
  8. package/CHANGELOG.md +67 -0
  9. package/GEMINI.md +1 -1
  10. package/INSTALL.md +2 -2
  11. package/README.md +1 -1
  12. package/agents/architecture-design.md +1 -1
  13. package/agents/code-reviewer.md +1 -1
  14. package/docs/README_en.md +2 -2
  15. package/docs/artifact-contract.md +2 -0
  16. package/docs/decision-points.md +23 -0
  17. package/docs/state-machine.md +1 -1
  18. package/docs/usage-guide.md +7 -4
  19. package/gemini-extension.json +1 -1
  20. package/hooks/session-start +2 -2
  21. package/llms.txt +1 -1
  22. package/package.json +2 -1
  23. package/plugin.json +1 -1
  24. package/scripts/ensure-branch.mjs +58 -32
  25. package/scripts/guard/checks/tasks-complete.mjs +39 -3
  26. package/scripts/guard/checks/tasks-gate-exemptions.mjs +49 -0
  27. package/scripts/lib/arch-merge.mjs +32 -9
  28. package/scripts/lib/arch-precheck.mjs +190 -0
  29. package/scripts/lib/cmd-arch.mjs +5 -1
  30. package/scripts/lib/cmd-deisolate.mjs +15 -16
  31. package/scripts/lib/cmd-doctor.mjs +9 -2
  32. package/scripts/lib/cmd-publish.mjs +4 -7
  33. package/scripts/lib/cmd-state.mjs +2 -0
  34. package/scripts/lib/conventions-generator.mjs +9 -7
  35. package/scripts/lib/execution-plan.mjs +18 -3
  36. package/scripts/lib/git-utils.mjs +172 -14
  37. package/scripts/lib/glaf4-delegation.mjs +5 -2
  38. package/scripts/lib/severity.mjs +71 -0
  39. package/scripts/lib/solutions-capture.mjs +14 -0
  40. package/scripts/lib/solutions-index-gen.mjs +2 -2
  41. package/scripts/lib/solutions-inject.mjs +2 -3
  42. package/scripts/lib/solutions-promote.mjs +16 -8
  43. package/scripts/lib/state-loader.mjs +7 -0
  44. package/scripts/lint/rules/behavior-consistency.mjs +3 -1
  45. package/scripts/team-flow.mjs +8 -1
  46. package/skills/architecture-design/SKILL.md +17 -3
  47. package/skills/build-executor/SKILL.md +2 -2
  48. package/skills/build-executor/references/execution-modes.md +1 -1
  49. package/skills/build-executor/task-reviewer-prompt.md +5 -4
  50. package/skills/ce-compound/references/promotion-rules.md +9 -2
  51. package/skills/ce-compound/references/three-tier-index.md +1 -1
  52. package/skills/ce-compound/references/write-flow.md +1 -1
  53. package/skills/code-reviewer/SKILL.md +1 -1
  54. package/skills/code-reviewer/code-reviewer-prompt.md +5 -4
  55. package/skills/contract-builder/SKILL.md +35 -4
  56. package/skills/release-archivist/SKILL.md +14 -3
  57. package/skills/release-archivist/references/closing-procedures.md +1 -1
  58. package/skills/release-archivist/references/worktree-merge.md +1 -1
  59. package/skills/workflow-start/SKILL.md +18 -7
  60. package/skills/workflow-start/references/routing-rules.md +3 -1
  61. package/templates/learnings.md +2 -2
@@ -10,7 +10,7 @@
10
10
  ## 淘汰规则(Eviction)
11
11
 
12
12
  当 INDEX.md 超过 150 行硬上限时:
13
- - 按 severity 降序排列(high > medium > low
13
+ - 按 severity 降序排列(critical > high > medium > low;序定义于 `scripts/lib/severity.mjs`)
14
14
  - 保留前 150 条
15
15
  - 淘汰 low severity 且 date 最早的条目
16
16
  - 被淘汰的经验文件保留在阶段目录中(可从文件系统找回),仅从 INDEX.md 移除
@@ -16,7 +16,7 @@ Two responsibilities: requesting review (dispatching a reviewer subagent) and re
16
16
  1. Get SHAs: `BASE_SHA=$(git rev-parse HEAD~1)` and `HEAD_SHA=$(git rev-parse HEAD)`
17
17
  2. Dispatch `general-purpose` subagent using template at `skills/code-reviewer/code-reviewer-prompt.md`
18
18
  3. Fill placeholders: `[DESCRIPTION]` (what was built), `[PLAN_OR_REQUIREMENTS]` (contract/spec reference), `[BASE_SHA]`, `[HEAD_SHA]`, `[WAVE_ID]`, and a distinct `[REVIEW_REPORT_FILE]`.
19
- 4. Require the reviewer to write a non-empty persisted review report at `[REVIEW_REPORT_FILE]`, then record that exact path in the wave receipt: `tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <review-report-path> --verdict <pass|fail>`.
19
+ 4. Require the reviewer to write a non-empty persisted review report at `[REVIEW_REPORT_FILE]` **inside the change review overlay** `<change-dir>/.superpowers/sdd/reviews/` (v0.22 §86: other paths are rejected by the CLI; the overlay directory is auto-created). Then record that exact path in the wave receipt: `tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <review-report-path> --verdict <pass|fail>`.
20
20
  5. Act on feedback: Critical/Important findings require a `fail` receipt, focused repair, re-review, and replacement `pass` receipt before a dependent wave or closing can proceed. Note Minor for later, push back with reasoning if reviewer is wrong.
21
21
 
22
22
  ### Minimality And Scope
@@ -105,9 +105,10 @@ Subagent (general-purpose):
105
105
  ## Output Format
106
106
 
107
107
  Write your full verdict to [REVIEW_REPORT_FILE]. This review report path
108
- must point to a non-empty, persisted review report before the controller
109
- records a receipt. Include the wave ID, base SHA, head SHA, and that review
110
- report path. End with the exact receipt command:
108
+ must resolve inside `<change-dir>/.superpowers/sdd/reviews/` and point to a
109
+ non-empty, persisted review report before the controller records a receipt.
110
+ Include the wave ID, base SHA, head SHA, and that review report path. End
111
+ with the exact receipt command:
111
112
 
112
113
  ```bash
113
114
  tf execution review <change-dir> --wave [WAVE_ID] --base [BASE_SHA] --head [HEAD_SHA] --report [REVIEW_REPORT_FILE] --verdict <pass|fail>
@@ -169,7 +170,7 @@ Subagent (general-purpose):
169
170
  - `[BASE_SHA]` — starting commit
170
171
  - `[HEAD_SHA]` — ending commit
171
172
  - `[WAVE_ID]` — planned execution wave under review
172
- - `[REVIEW_REPORT_FILE]` — REQUIRED: distinct, persisted, non-empty review report path stored in the execution receipt
173
+ - `[REVIEW_REPORT_FILE]` — REQUIRED: distinct, persisted, non-empty review report path under `<change-dir>/.superpowers/sdd/reviews/` (the overlay); stored in the execution receipt
173
174
 
174
175
  **Reviewer returns:** Strengths, Issues (Critical / Important / Minor), Recommendations, Assessment
175
176
 
@@ -113,7 +113,13 @@ See `test-matrix.md` for the full test case matrix (附属产物, 独立 hash).
113
113
 
114
114
  ### Hotfix/Tweak Exemption
115
115
 
116
- hotfix/tweak workflow 不生成 test-matrix.md(guard 豁免);full workflow 确无自动化测试需求的特例(纯文档/纯配置)同理。设置显式 skip + 理由(v0.13 §48.2 可审计豁免,**不允许静默不生成**):
116
+ **hotfix/tweak**:不生成 test-matrix.md 与 tasks.md(guard 豁免),设置显式 skip + 理由(v0.13 §48.2 + v0.22 §85 可审计豁免,**不允许静默不生成**):
117
+ ```bash
118
+ tf state set <change-dir> test_matrix_skipped true && tf state set <change-dir> test_matrix_skip_reason "<一句话说明>"
119
+ tf state set <change-dir> tasks_skipped true && tf state set <change-dir> tasks_skip_reason "<一句话说明>"
120
+ ```
121
+
122
+ **full workflow 特例**(纯文档/纯配置,确无自动化测试需求):**只**豁免测试矩阵,**不得设置 `tasks_skipped`**——`tasks.md` 是 spec-writer 的核心产物,full 路径不允许跳过(v0.22 §85.4);该禁令**代码层强制**:`tasks-complete` 对 full/auto 置键直接 FAIL。
117
123
  ```bash
118
124
  tf state set <change-dir> test_matrix_skipped true && tf state set <change-dir> test_matrix_skip_reason "<一句话说明>"
119
125
  ```
@@ -137,13 +143,38 @@ Refresh if: scope changed in proposal, requirements changed in specs, constraint
137
143
 
138
144
  ## Hotfix Mode
139
145
 
140
- Generate minimal contract: Intent Lock (one sentence), Task List (numbered), Approval Gate (DP-3). Skip Scope Fence, Build Rules, Review Gates, Test Evidence. Still requires DP-3 approval.
146
+ **适用判据**(须同时满足;任一条不满足 走完整契约):
147
+
148
+ 1. 改动文件 ≤2
149
+ 2. 不新增/变更:API 签名、请求响应 schema、DB schema、`filter.args` 等配置契约 key
150
+ 3. 变更性质 = 文案 / 样式 / 布局 / 提示语 / 日志措辞
151
+
152
+ **轻契约骨架**(目标 ≤60 行;>60 行须在 DP-3 摘要说明理由;>100 行视为不适用轻契约、回退完整契约):
153
+
154
+ | 章节 | 内容 |
155
+ |---|---|
156
+ | `## Intent Lock` | 1-2 句(问题 + 范围) |
157
+ | `## 锁定值表` | 改前/改后逐字——防实现偏差的核心,必留 |
158
+ | `## 范围栅栏` | 改动文件 + 禁改项清单 |
159
+ | `## Execution Batch` | 编号任务(含验证任务) |
160
+ | `## Test Matrix` | 测试策略——**代码解析锚点,标题不可删**(除非 `test_matrix_skipped=true`) |
161
+ | `## Approval Gate (DP-3)` | 审批对象声明 |
162
+
163
+ **移出轻契约**:AC 覆盖矩阵、信息量守恒核对表、DOM 结构详述、金字塔/复杂度分析、人工核验义务(改由 closing 总结承载);Review Gates 章节不写入契约,但 **wave 级 review receipt 仍须由 build-executor 记录**——closing 的 `execution-reviews-passed` 维度对 hotfix 同样考核(`guard.mjs:75`)。
164
+
165
+ **其余代码锚点**:涉及 UI 时保留 `## UX 增量`;GLAF4 委托时保留 `## GLAF4 Delegation`。除此之外的段落代码不解析,可自由裁剪;但契约全文入 `contract_hash`,裁剪后须 `tf state rebuild`。
166
+
167
+ **质量不变量(不得因轻量化削减)**:锁定值逐字、范围栅栏、测试策略、Escalation 条件。
168
+
169
+ Still requires DP-3 approval.
170
+
171
+ **非存量 hotfix/tweak 必须设置显式 skip(v0.13 §50 + v0.22 §85)**:hotfix/tweak 不生成矩阵与 `tasks.md`,但 closing 的 `tests-passing` / `tasks-complete` 两个门禁仍考核非存量 change——生成最小契约后立即执行上方 Hotfix/Tweak Exemption 段的四条 `tf state set`,否则 release-archivist 轻量收尾会被门禁阻断(v0.22 §85:修复前 `tasks-complete` 无豁免分支,closing 死锁)。
141
172
 
142
- **非存量 hotfix/tweak 必须设置显式 skip(v0.13 §50)**:hotfix/tweak 不生成矩阵,但 closing tests-passing 门禁仍考核非存量 change——生成最小契约后立即执行 Hotfix/Tweak Exemption 段的两条 `tf state set`(`test_matrix_skipped=true` + 理由),否则 release-archivist 轻量收尾会被门禁阻断。
173
+ **`tasks.md` 归属(v0.22 §85)**:hotfix/tweak 默认跳过(上条),但若该 change 确实需要任务记录,`tasks.md` 由本 skill 一并产出——归属 contract-builder(本 skill 已有 `tasks.md Execution Batches` Artifact Mapping,反向生成成本最低);任务文本不再经 spec-writer(hotfix/tweak 已跳过它)。
143
174
 
144
175
  ## Guardrails
145
176
 
146
- - **状态字段禁写(v0.30.0)**:仅写本 skill 的 `dp_3_*` 决策字段;**MUST NOT** 修改 `state`/`workflow` 核心字段——状态转换由主代理经 `tf state transition` 执行。`tf state init` 只创建状态文件,不改 `state` 值(来源:workflow-feedback 2026-08-01)。
177
+ - **状态字段禁写(v0.30.0;v0.22 §85 澄清写入白名单)**:仅写本 skill 的 `dp_3_*` 决策字段,以及本 skill 职责内的门禁豁免键——`test_matrix_skipped` / `test_matrix_skip_reason`(v0.13 §50)、`tasks_skipped` / `tasks_skip_reason`(v0.22 §85);**MUST NOT** 修改 `state`/`workflow` 核心字段——状态转换由主代理经 `tf state transition` 执行。`tf state init` 只创建状态文件,不改 `state` 值(来源:workflow-feedback 2026-08-01)。
147
178
 
148
179
  - Do not continue to implementation if ambiguity remains
149
180
  - Do not approve the contract on the user's behalf
@@ -161,7 +161,7 @@ Merge change-level architecture artifacts to the global `docs/architecture/` bas
161
161
  tf arch-merge <change-dir>
162
162
  ```
163
163
 
164
- This merges `architecture/{architecture,database,api}.md` and `architecture/sql/` into the global architecture docs. Skip silently when `architecture/` does not exist (architecture-design was `skipped`).
164
+ This merges `architecture/{architecture,database,api}.md` and `architecture/sql/` into the global architecture docs. Skip silently when `architecture/` does not exist (architecture-design was `skipped`) — 前置判据见 `## Lightweight Closure > 回写链前置判据`(v0.22 §87:先判断再决定是否执行命令)。
165
165
 
166
166
  **Execution order (mandatory, v0.12 §43.4)**: `arch-merge` → `prototype-sync` → `test-merge` → `compound promotion`. Do not parallelise — global docs must not be in a half-updated state.
167
167
 
@@ -193,7 +193,7 @@ This merges `test-matrix.md` into `docs/test-ledger/`:
193
193
  - **appendChangelog**: archive test-matrix.md → `changelog/{change-id}.md`
194
194
  - **rewriteIndex**: recalculate module/case/deferred counts, rewrite `INDEX.md`
195
195
 
196
- Skip silently when `test-matrix.md` does not exist (legacy change or test_matrix_skipped=true).
196
+ Skip silently when `test-matrix.md` does not exist (legacy change or test_matrix_skipped=true) — 前置判据见 `## Lightweight Closure > 回写链前置判据`(v0.22 §87:先判断再决定是否执行命令)。
197
197
 
198
198
  **Execution verification**: check stdout output for `test-merge complete` confirmation. If the command did not execute or failed, Step 5 Report's `Test Matrix` row (from Step 2b) must note the reason.
199
199
 
@@ -207,7 +207,9 @@ tf solutions promote <change-dir>
207
207
 
208
208
  This checks the change's `learnings.md` (change root; v0.49.0 §83.3.5 path unification) for entries meeting promotion criteria:
209
209
  - severity ≥ medium AND type = pitfall/pattern → promote to global `docs/solutions/`
210
- - domain+type matches existing global entry → mark as "confirmed pattern", upgrade severity
210
+ - domain+type matches existing global entry → mark as "confirmed pattern", upgrade severity (low → medium → high → critical)
211
+
212
+ Valid `severity` values: `critical` | `high` | `medium` | `low` (ordered; lowercase, case-sensitive; v0.23 §91 — the order is defined once in `scripts/lib/severity.mjs`).
211
213
 
212
214
  Report promotion results in the closing summary. Promotion is advisory — failures do not block closing.
213
215
 
@@ -266,6 +268,15 @@ This check is advisory — skip if the user declines. If the user reports issues
266
268
 
267
269
  Verify files exist and are non-empty, run `node --check` on code files, skip 5-step verification. Still record DP-6 and DP-7.
268
270
 
271
+ **回写链前置判据(v0.22 §87)**:先按下表判断适用性,**不适用则不执行命令**(v0.22 实测:逐项跑完才知道不适用,占 release-archivist 80% 耗时)。本表 4 行判据**仅在 Lightweight Closure 适用**;其中 arch-merge 与 test-merge 两行的 "Skip silently" 见 `### Architecture Merge`(:164 正文句)与 `### Test Merge`(:196 正文句)。
272
+
273
+ | 回写项 | 前置判据 | 不满足时登记 |
274
+ |---|---|---|
275
+ | arch-merge | `test -d <change-dir>/architecture/` | `skipped` |
276
+ | prototype-sync | 契约含 `## UX 增量` 段 | `no UX delta` |
277
+ | test-merge | `test -f <change-dir>/test-matrix.md` | `skipped` |
278
+ | compound promotion | `test -f <change-dir>/learnings.md` | `no learnings` |
279
+
269
280
  **⚠️ tests-passing 门禁不因轻量收尾而豁免(v0.13 §50)**:hotfix/tweak 的 `executing→closing` guard 同样挂 `tests-passing`。非存量 change 仅记 DP-6/DP-7 不足以放行——必须二选一:① `test_matrix_skipped=true` + `test_matrix_skip_reason` 已由 contract-builder 设置(hotfix/tweak 常规路径,先 `tf state get` 核实);② 有代码变更时补跑测试套件并 `tf test record <change-dir> --from <输出>`。
270
281
 
271
282
  ## Exception Handling
@@ -26,7 +26,7 @@ tf solutions promote <change-dir>
26
26
 
27
27
  Promotion criteria:
28
28
  - severity ≥ medium AND type = pitfall/pattern → promote to global `docs/solutions/`
29
- - domain+type matches existing global entry → mark as "confirmed pattern", upgrade severity
29
+ - domain+type matches existing global entry → mark as "confirmed pattern", upgrade severity (low → medium → high → critical)
30
30
 
31
31
  Report promotion results in the closing summary. Promotion is advisory — failures do not block closing.
32
32
 
@@ -25,7 +25,7 @@ team-flow 的 change 实施在 worktree 隔离环境(`tf isolate` → `.worktr
25
25
 
26
26
  ## 多仓库策略(Case A)
27
27
 
28
- 多仓库工作区(bff/ui 等独立 git 仓库)中,`tf deisolate` 自动识别 Case A 布局(`.worktrees/<change>/<repo>/`),逐 repo 执行合并。每个独立仓库是一个独立 git 操作,互不依赖。
28
+ 多仓库工作区(bff/ui 等独立 git 仓库)中,`tf deisolate` 自动识别 Case A 布局(`.worktrees/<change>/<repo>/`,含 `service/<repo>` 两层嵌套,v0.23 §92.3.7),逐 repo 执行合并。每个独立仓库是一个独立 git 操作,互不依赖。
29
29
 
30
30
  ## 依赖链顺序
31
31
 
@@ -87,7 +87,7 @@ Guard: `arch_design_decision` in `.team-flow.yaml` is `null` → must run before
87
87
 
88
88
  > **⛔ 串行约束(v0.30.0)**:四步严格串行。**修复子代理(architecture-design)完成前 MUST NOT dispatch 审查子代理(architecture-reviewer)**——并行会使审查跑在修复之前、误报"全部未修复"FAIL(来源:workflow-feedback 2026-08-01)。并行白名单:仅多个独立 change 的工作可并行;修复→审查、设计→审查必须串行。
89
89
 
90
- 1. **Dispatch**: `architecture-design` as sub-agent(**输入含 `docs/architecture/iterations/<vN>/architecture.md` 产品级架构快照**,v0.36.0——变更级只引用产品级聚合注册表,不重定义)→ returns `decision` + `reason` + `artifacts`。**⛔ 记录子代理 ID**(后续循环修正和 DP-A 调整必须通过此 ID 恢复,禁止启动新子代理)
90
+ 1. **Dispatch**: 先跑 `tf arch precheck <change-dir> --json`(v0.22 §88.3.2:确定性证据工具,正常调用退出码恒 0;`signal: none` 时子代理走 Fast Path,只读 brief + precheck 输出)→ dispatch `architecture-design` as sub-agent(**输入含 `docs/architecture/iterations/<vN>/architecture.md` 产品级架构快照**,v0.36.0——变更级只引用产品级聚合注册表,不重定义;**Fast Path 命中时不传快照**)→ returns `decision` + `reason` + `artifacts`。**⛔ 记录子代理 ID**(后续循环修正和 DP-A 调整必须通过此 ID 恢复,禁止启动新子代理)
91
91
  2. **Auto-review** (decision=required 时触发): 校验产物文件存在且非空 → dispatch `architecture-reviewer` sub-agent(**记录子代理 ID**,agent 会直接写审查报告到 `changes/<name>/architecture/auto-review.md`)→ FAIL 则通过 **SendMessage 恢复原 architecture-design 子代理**修正(≤3 轮 + 收敛检测,不收敛转人工)
92
92
  3. **Reasonableness check + state write**: PASS/PASS_WITH_WARNINGS → write `arch_design_decision` + `arch_review_*` to yaml; skipped + brief 含架构关键词 → BLOCK; required + artifacts 缺失 → BLOCK; required + auto-review FAIL → BLOCK
93
93
  4. **DP-A 用户确认门(v0.29.0 §37)**: 输出架构决策摘要 → AskUserQuestion 确认 → 需要调整时**必须通过 SendMessage 恢复原子代理**修改(禁止主代理直接修改,禁止启动新子代理)→ 修改后 SendMessage 恢复原 reviewer 重新 auto-review → 回到本步骤重新确认。含项目规范变更提示(advisory)。详见 `references/routing-rules.md`「Step 4: DP-A」
@@ -132,7 +132,7 @@ Contract exists and approved, contract matches artifacts. Include `DP-4: 执行
132
132
  Execution hit blockage: test failure, unexpected behavior, build error, task cannot proceed. After debugging, route back to build-executor.
133
133
 
134
134
  ### Route to code-reviewer
135
- The current planned wave is implemented and ready for spec-compliance + code-quality verification. A reviewer must write an `tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>` receipt before any dependent wave or closing transition.
135
+ The current planned wave is implemented and ready for spec-compliance + code-quality verification. A reviewer must write an `tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>` receipt before any dependent wave or closing transition. **`--report` 必须落在 change review overlay 内**(`<change-dir>/.superpowers/sdd/reviews/`,v0.22 §86)——其他路径被 CLI 拒绝(`execution-plan.mjs` 的 `validateReviewReportEvidence`);派发审查子代理时直接给 overlay 路径,避免"任务指令写 `reviews/`、CLI 只认 overlay"导致的双写副本。
136
136
 
137
137
  **v0.39.0 主动串行编排**:workflow-start 在每个 wave 完成后主动 dispatch code-reviewer,而不是等待 build-executor 完成所有 wave。这是 workflow-start 的编排责任,不是 build-executor 的责任。
138
138
 
@@ -167,10 +167,20 @@ work.
167
167
 
168
168
  ### Fast-Path Routing
169
169
 
170
- **DP-0 处理**(v0.22.5 F03 修复):hotfix/tweak 路径隐式跳过 DP-0(`dp_0_confirmed` 保持 `null`),因为意图已明确(修复/微调),无需从零探索。contract-builder 的 DP-3 审批成为唯一门禁。
170
+ **DP-0 处理**(v0.22.5 F03;**v0.22 §88 修正**):hotfix/tweak 路径**仍执行 DP-0**(快速形态:确认 scope / 约束 / AC / 沟通偏好,不重新问"你想做什么")——实测 H1 的 `dp_0_decisions` 承载了后续契约与实施的全部基线(scope/约束/AC/模式/沟通偏好),隐式跳过会使该信息无处安放;`arch_design_decision == skipped` 时 DP-0 可与 DP-A 合并为一次确认(见下「确认点合并」)。contract-builder 的 DP-3 审批仍是唯一硬门禁。
171
171
 
172
- - **Hotfix**: Route to contract-builder (minimal), skip need-explorer + spec-writer, guard check `exploring bridging --workflow hotfix`, then `bridging -> approved-for-build`, after DP-3 → build-executor (recommend, show, and confirm an execution mode), after → release-archivist (lightweight). Hotfix may skip `proposal.md`, `design.md`, `tasks.md`, and `specs/`, but it still requires a fresh minimal `execution-contract.md`, DP-3 approval, and a current execution plan before build. **architecture-design 不豁免**(v0.9 §26):同样过 architecture-design 子代理判断门,快速判定是否涉及架构变更(hotfix 可能正是架构缺陷导致)
173
- - **Tweak**: Route to build-executor (direct edit), skip need-explorer + spec-writer + contract-builder, guard check `exploring approved-for-build --workflow tweak`, after → release-archivist (lightweight). **architecture-design 不豁免**(v0.9 §26):同样过 architecture-design 子代理判断门
172
+ **确认点合并(v0.22 §88.3.1)**:为减少用户交互轮次,以下三组可合并为**一次** AskUserQuestion。**门禁强度不变**——`dp_0_confirmed` / `dp_a_result` / `dp_3_result` / `dp_4_result` 仍须写入,guard 维度(`dp3-approved` / `execution-plan-ready`)不豁免:
173
+
174
+ | 合并组 | 触发条件 | 合并后形态 |
175
+ |---|---|---|
176
+ | DP-0 + DP-A | `arch_design_decision == skipped` | 一次「变更基线确认」:brief 继承 + 架构判定结果 |
177
+ | DP-3 + G4 + DP-4 | 契约已产出且 hash 有效 | 一次「实施授权确认」:批准契约 + 同步选择 + 执行模式 |
178
+ | DP-7 + 代码落地 + G5 | 恒成立 | 一次「归档确认」 |
179
+
180
+ **不合并**:`arch_design_decision == required` 时 DP-A 必须独立——用户需单独审架构产物。
181
+
182
+ - **Hotfix**: Route to contract-builder (minimal), skip need-explorer + spec-writer, guard check `exploring bridging --workflow hotfix`, then `bridging -> approved-for-build`, after DP-3 → build-executor (recommend, show, and confirm an execution mode), after → release-archivist (lightweight). Hotfix may skip `proposal.md`, `design.md`, and `specs/`, but it still requires a fresh minimal `execution-contract.md`, DP-3 approval, and a current execution plan before build. **`tasks.md` 不得静默缺失(v0.22 §85)**:hotfix 默认不产出该文件,但必须由 contract-builder 显式登记 `tasks_skipped=true` + `tasks_skip_reason`(或一并产出最小任务清单,归属 contract-builder)——`tasks-complete` 在 closing 考核该维度,静默缺失会死锁(修复前即此状态)。**architecture-design 不豁免**(v0.9 §26):同样过 architecture-design 子代理判断门,快速判定是否涉及架构变更(hotfix 可能正是架构缺陷导致)
183
+ - **Tweak**: Route to build-executor (direct edit), skip need-explorer + spec-writer + contract-builder, guard check `exploring approved-for-build --workflow tweak`, after → release-archivist (lightweight). **`tasks.md` 须显式 skip(v0.22 §85)**:tweak 跳过 spec-writer 与 contract-builder,故既无原生 `tasks.md` 也无人代写——由**主代理**经 `tf state set` 写入 `tasks_skipped=true` + `tasks_skip_reason`(`tf state set` 是 CLI 调用,不违反 Artifact Ownership 的 Edit/Write 禁令),否则 `tasks-complete` 在 closing 死锁。tweak 的 `executing:closing` 不含 `test-matrix-complete`(`guard.mjs:82`),矩阵豁免非 guard 必需。**architecture-design 不豁免**(v0.9 §26):同样过 architecture-design 子代理判断门
174
184
 
175
185
  Post-transition: 💡 `tf inject <change-dir>` to update phase-guard artifacts.
176
186
 
@@ -238,7 +248,7 @@ build-executor 修复 findings 后,workflow-start 必须:
238
248
  - **No routing to spec-writer without architecture-design gate pass** (v0.9 §26): `arch_design_decision` must be `required` or `skipped` (not `null`). hotfix/tweak 不豁免
239
249
  - **No arch state write without auto-review PASS** (v0.28.1 §36): when `decision: required`, auto-review MUST complete with PASS or PASS_WITH_WARNINGS before writing `arch_design_decision` to yaml. FAIL → loop fix (≤3 rounds) or escalate to human
240
250
  - **No routing past DP-A without user confirmation** (v0.29.0 §37): architecture-design 四步协议完成后,必须经 DP-A 用户确认门(AskUserQuestion)才能路由到 spec-writer。用户选择"需要调整"时,修改必须通过子代理执行,修改后重新 auto-review + 重新 DP-A 确认
241
- - **Artifact Ownership — 主代理不得直接修改子代理产物** (v0.29.0 §37): 子代理是其产物的唯一负责人(architecture-design → `architecture/` 目录,spec-writer → `proposal.md`/`specs/`/`design.md`/`tasks.md`,contract-builder → `execution-contract.md`,build-executor → 代码文件)。**tasks.md 的勾选状态属执行期写入区**(v0.49.0 §83.3.4):任务文本归 spec-writer,勾选标记由 build-executor 在 wave 完成时回写(主代理只检查不代写)。主代理(workflow-start)不得通过 Read + Edit/Write 直接修改子代理的产物文件。修改必须通过 `SendMessage` 恢复原子代理(优先)或启动新子代理执行。**v0.39.0 强化**:主代理 MUST NOT 直接 Edit/Write 任何文件 under `changes/<name>/` 或 `.worktrees/`——无论改动量大小,必须通过 SendMessage 委托子代理执行。例外:仅当子代理无法启动且用户明确授权时,主代理可直接修改,但必须在修改后重新触发对应的 review 验证
251
+ - **Artifact Ownership — 主代理不得直接修改子代理产物** (v0.29.0 §37): 子代理是其产物的唯一负责人(architecture-design → `architecture/` 目录,spec-writer → `proposal.md`/`specs/`/`design.md`/`tasks.md`,contract-builder → `execution-contract.md`,build-executor → 代码文件)。**tasks.md 的勾选状态属执行期写入区**(v0.49.0 §83.3.4):任务文本归 spec-writer,勾选标记由 build-executor 在 wave 完成时回写(主代理只检查不代写)。**hotfix/tweak 路径的 tasks.md 归属 contract-builder**(v0.22 §85):该路径跳过 spec-writer,若 change 需要任务记录则由 contract-builder 一并产出;默认路径是显式跳过(`tasks_skipped=true` + `tasks_skip_reason`——hotfix 由 contract-builder 写入,tweak 由主代理写入)。主代理(workflow-start)不得通过 Read + Edit/Write 直接修改子代理的产物文件。修改必须通过 `SendMessage` 恢复原子代理(优先)或启动新子代理执行。**v0.39.0 强化**:主代理 MUST NOT 直接 Edit/Write 任何文件 under `changes/<name>/` 或 `.worktrees/`——无论改动量大小,必须通过 SendMessage 委托子代理执行。例外:仅当子代理无法启动且用户明确授权时,主代理可直接修改,但必须在修改后重新触发对应的 review 验证
242
252
  - **修复后必须 re-review** (v0.39.0): build-executor 修复 findings 后,workflow-start 必须 dispatch code-reviewer re-review 确认修复有效,记录 review receipt(verdict=pass)。禁止在 review receipt 未记录或 verdict!=pass 时进入下一阶段
243
253
  - **No cross-change artifact modification (v0.30.0)**: 处理 change X 时 **MUST NOT** 编辑 `changes/Y/`(Y≠X)下任何产物。发现跨 change 依赖/问题时:① 在 change X 的 ADR/proposal 中显式声明依赖;② change Y 进入 workflow-start 时,扫描是否有其他 change 声明了对 Y 的依赖并提醒用户;③ change Y 的产物修改必须走 Y 自己的完整流程(architecture-design → auto-review → DP-A),不得绕过。跨 change 一致性核查可调度 `cross-change-consistency-checker` agent(来源:workflow-feedback 2026-08-01)
244
254
 
@@ -255,7 +265,8 @@ workflow-start 负责写入以下字段到 `.team-flow.yaml`:
255
265
  - `dp_1_*`:need-explorer 完成后的需求澄清决策
256
266
  - `dp_2_*`:spec-writer 完成后的规格决策
257
267
  - `dp_3_*`:contract-builder 完成后的契约决策
258
- - `dp_5_*`:build-executor 执行决策 / bug-investigator 调试决策(共享 dp_5;dp_4 预留未用)
268
+ - `dp_4_*`:执行模式选择(由 `tf execution plan --confirm` 程序化写入,不在 SETTABLE_FIELDS;`execution-plan-ready` 维度校验其指向当前 plan revision)
269
+ - `dp_5_*`:build-executor 执行决策 / bug-investigator 调试决策
259
270
  - `dp_6_*`:release-archivist 完成后的验证决策
260
271
  - `dp_7_*`:release-archivist 归档确认决策
261
272
 
@@ -13,6 +13,8 @@ Guard: `arch_design_decision` in `.team-flow.yaml` is `null` → must run before
13
13
 
14
14
  ### Step 1: Dispatch architecture-design sub-agent
15
15
 
16
+ **先跑证据工具(v0.22 §88.3.2)**:`tf arch precheck <change-dir> --json` —— 输出确定性证据(架构关键词的变更语境命中 / 否定命中 / 仅提及 + 改动文件分类),退出码恒 0。`signal: none` → 子代理走 Fast Path(只读 brief + precheck 输出,不读全量 `docs/architecture/`);`weak` / `strong` → 完整路径。判断权在子代理,precheck 只用于缩小输入范围。
17
+
16
18
  Dispatch `architecture-design` as sub-agent with inputs:
17
19
  - `change-brief.md`(scope / AC / 技术方向)
18
20
  - `requirement/vN/plan.md` 高阶技术设计段
@@ -228,7 +230,7 @@ Guard: `... check <dir> approved-for-build executing --json` → fail = BLOCK.
228
230
  Execution hit blockage: test failure, unexpected behavior, build error. After debugging, route back to build-executor.
229
231
 
230
232
  ## Route to code-reviewer
231
- Current planned wave implemented and ready for review. Reviewer must write:
233
+ Current planned wave implemented and ready for review. Reviewer must write the report **inside the change review overlay** `<change-dir>/.superpowers/sdd/reviews/` (v0.22 §86: other paths are rejected by the CLI), then record:
232
234
  ```bash
233
235
  tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>
234
236
  ```
@@ -16,7 +16,7 @@
16
16
  phase: cross-phase # 阶段名(prd/plan/architecture/prototype/spec/build/review/cross-phase)或具体领域阶段
17
17
  domain: <领域> # 如 jest / sdd / spring-boot;注入时按领域过滤
18
18
  type: pitfall # pitfall | pattern | insight
19
- severity: medium # high | medium | low
19
+ severity: medium # critical | high | medium | low(小写;critical = 安全/数据/合规级高危经验)
20
20
  date: YYYY-MM-DD
21
21
  ---
22
22
 
@@ -45,7 +45,7 @@ date: YYYY-MM-DD
45
45
  | 条件 | 行为 |
46
46
  |---|---|
47
47
  | `severity` ≥ medium 且 `type` = pitfall / pattern | 晋升到全局 `docs/solutions/<phase>/`,并追加 INDEX 行 |
48
- | 与全局 INDEX 已有条目 domain + type 匹配 | 不新建文件:升级已有条目 severity(low→medium→high)+ 条目 frontmatter `confirmed` 计数 +1 + 更新 INDEX 行 |
48
+ | 与全局 INDEX 已有条目 domain + type 匹配 | 不新建文件:升级已有条目 severity(low medium high → critical)+ 条目 frontmatter `confirmed` 计数 +1 + 更新 INDEX 行 |
49
49
  | 其他 | 保留在本文件;promote 输出中列为 skipped 并附原因 |
50
50
 
51
51
  **条目质量要求**:写「正确做法」前先验证它在系统层面成立——局部观察得出的 workaround 若被沉淀为通则,会被后续 change 当经验复用,反而固化缺陷(v0.49.0 §83.2.2 的实证教训)。