@xulthekl/team-flow 0.49.0 → 0.50.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 (42) 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 +36 -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/guard/checks/tasks-complete.mjs +39 -3
  25. package/scripts/guard/checks/tasks-gate-exemptions.mjs +49 -0
  26. package/scripts/lib/arch-precheck.mjs +190 -0
  27. package/scripts/lib/cmd-arch.mjs +5 -1
  28. package/scripts/lib/cmd-doctor.mjs +9 -2
  29. package/scripts/lib/cmd-state.mjs +2 -0
  30. package/scripts/lib/state-loader.mjs +7 -0
  31. package/scripts/lint/rules/behavior-consistency.mjs +3 -1
  32. package/scripts/team-flow.mjs +8 -1
  33. package/skills/architecture-design/SKILL.md +17 -3
  34. package/skills/build-executor/SKILL.md +2 -2
  35. package/skills/build-executor/references/execution-modes.md +1 -1
  36. package/skills/build-executor/task-reviewer-prompt.md +5 -4
  37. package/skills/code-reviewer/SKILL.md +1 -1
  38. package/skills/code-reviewer/code-reviewer-prompt.md +5 -4
  39. package/skills/contract-builder/SKILL.md +35 -4
  40. package/skills/release-archivist/SKILL.md +11 -2
  41. package/skills/workflow-start/SKILL.md +18 -7
  42. package/skills/workflow-start/references/routing-rules.md +3 -1
@@ -1,3 +1,3 @@
1
- # team-flow v0.49.0 | 阶段: {{state}} | 工作流: {{workflow}}
1
+ # team-flow v0.50.0 | 阶段: {{state}} | 工作流: {{workflow}}
2
2
  当前阶段允许的操作由 workflow-start 路由规则定义。
3
3
  禁止跨越 DP gate 进入下一阶段。变更范围以 execution-contract.md 的 Intent Lock 为准。
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "name": "team-flow",
11
11
  "description": "8-state spec workflow + compound global compounding + architecture-design (4A/DDD) + local HTML prototype + product-level orchestration + bootstrap + e2e + session handoff + workflow feedback + independent business analysis. 26 skills + 17 agents with embedded TDD, SDD, code review, debugging, delta spec sync, and design-system-driven prototyping.",
12
- "version": "0.49.0",
12
+ "version": "0.50.0",
13
13
  "source": "./",
14
14
  "author": {
15
15
  "name": "LT",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-flow",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking) + business-analysis (independent requirement/scenario artifact). 26 skills + 17 agents, one install.",
5
5
  "source": "./",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-flow",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Spec-first workflow that bridges OpenSpec-style planning and Superpowers-style execution discipline.",
5
5
  "author": {
6
6
  "name": "MageByte",
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "Unified workflow plugin marketplace for Cursor (team-flow: team-flow + compound + architecture-design + prototype).",
8
- "version": "0.49.0"
8
+ "version": "0.50.0"
9
9
  },
10
10
  "plugins": [
11
11
  {
@@ -2,7 +2,7 @@
2
2
  "name": "team-flow",
3
3
  "displayName": "team-flow",
4
4
  "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking) + business-analysis (independent requirement/scenario artifact). 26 skills + 17 agents, one install.",
5
- "version": "0.49.0",
5
+ "version": "0.50.0",
6
6
  "author": {
7
7
  "name": "LT",
8
8
  "url": "https://github.com/LT"
@@ -6,13 +6,13 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Unified workflow plugins and skills for AI coding agents (team-flow: team-flow + compound + architecture-design + prototype).",
9
- "version": "0.49.0"
9
+ "version": "0.50.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "team-flow",
14
14
  "description": "Unified workflow with planning artifacts, execution contracts, TDD, review gates, systematic debugging, delta spec sync, architecture-design, independent business analysis, and local HTML prototyping.",
15
- "version": "0.49.0",
15
+ "version": "0.50.0",
16
16
  "source": ".",
17
17
  "author": {
18
18
  "name": "LT",
package/CHANGELOG.md CHANGED
@@ -4,6 +4,42 @@ All notable changes to `team-flow` will be documented in this file.
4
4
 
5
5
  The format loosely follows Keep a Changelog.
6
6
 
7
+ ## [0.50.0] - 2026-09-09
8
+
9
+ ### Fixed(hotfix 路径死锁 + 轻量路径仪式成本)
10
+
11
+ 设计来源:`docs/architecture-api-db-design-enhancement-v0.22.md` §85-§88(2026-09-09,fytx-gateway-parent 3 条 workflow-feedback:20260909-103500-guard / 20260909-103600-cli-command / 20260909-112755-sop-flow)
12
+
13
+ **根因簇 R1 — hotfix/tweak 产物归属链断裂**(closing 死锁)
14
+
15
+ - **可审计豁免**:`executing:closing` 的 `tasks-complete` 维度对 hotfix/tweak 必然 FAIL(跳过 spec-writer,tasks.md 无原生产出者),与 SKILL「may skip tasks.md」冲突且无豁免路径 → 新增 `tasks_skipped` + `tasks_skip_reason`(与 `test_matrix_skipped` 同构的可审计豁免范式),存量 change 走 legacy 豁免;新增 `scripts/guard/checks/tasks-gate-exemptions.mjs` 作为判定唯一真相源(`tasks-complete.mjs`)
16
+ - **字段贯通**:`state-loader`(BUILTIN_DEFAULTS + writeState 序列化)、`cmd-state`(SETTABLE_FIELDS)、`tf doctor` 卫生巡检(skip 无理由 + 引用文件缺失)三处同步
17
+ - **模式门控**(P4 终检补,LT 2026-09-09 决策):`tasks_skipped` 仅对 hotfix/tweak 合法——full/auto 置键直接 FAIL 并引导两条出路(产出 `tasks.md` / 先 `tf state set <dir> workflow hotfix|tweak`),消除「文档说不允许、代码却放行」的口径分裂;`auto` 归一化为 full(与 `cmd-state.mjs:163` 同口径,安全侧默认)
18
+ - **横展**:tweak 路径存在同类死锁,一并修;`docs/decision-points.md` 补录 DP-A(v0.29.0 引入时遗漏)并新增「确认点合并」节
19
+
20
+ **根因簇 R2 — CLI 输入约束未上浮到接口层**(两处)
21
+
22
+ - **jest 需 `--json`**:解析器要求 JSON 输出但 help/SKILL 未声明 → 顶层 help + build-executor SKILL 补声明
23
+ - **`tf execution review --report` 须在 change overlay 内**:路径约束仅存在于报错文案 → 顶层 help + 5 处 SKILL 补声明(横展 code-reviewer / execution-modes / routing-rules)
24
+ - **清单化扫描**:`scripts/lib/*.mjs` 全部输入校验点逐条核对文档声明,其余约束或报错自解释、或已声明,不额外补文档
25
+
26
+ **根因簇 R3 — 轻量规定不可执行**
27
+
28
+ - **contract-builder `## Hotfix Mode` 重写**:适用判据 3 条 + 轻契约骨架 6 章节(Intent Lock / 锁定值表 / 范围栅栏 / Execution Batch / Test Matrix / Approval Gate)+ 移出清单 + 代码锚点 + 质量不变量
29
+ - **release-archivist `## Lightweight Closure` 补回写链前置判据**:arch-merge / prototype-sync / test-merge / compound promotion 四项「何时适用」表,消除 `skip silently` 的适用性歧义(`:164`/`:196` 加回指)
30
+ - **Hotfix/Tweak Exemption 拆块**:hotfix/tweak 块与 full 特例块分离,避免 full 流程被卷入 skip 引导
31
+
32
+ **根因簇 R4 — 仪式成本未按风险分级**
33
+
34
+ - **确认点合并**:hotfix 6 个确认点(DP-0 / DP-A / DP-3 / G4 / DP-4 / DP-7)合并为 3 组(变更基线 / 实施授权 / 归档);先修正 DP-0 口径矛盾(保留 DP-0,`:170` 表述修正);`arch_design_decision == required` 时 DP-A 不合并;门禁维度与 state 字段不变——减少的是交互轮次,不是门禁强度
35
+ - **`tf arch precheck` 证据工具**:新增 `scripts/lib/arch-precheck.mjs`——输出确定性证据(架构关键词的变更语境命中 / 否定命中 / 仅提及 + 改动文件分类),**退出码恒 0**;architecture-design 据此走 Fast Path(`signal: none` 时只读 brief + precheck 输出,不读全量 `docs/architecture/`),**判断权仍在子代理**(证据与 brief 不符必须回退完整路径)
36
+
37
+ ### Tests & Tooling
38
+
39
+ - 新增 `tests/lib/guard-tasks-gate.test.mjs`(12 例,含 5 例模式门控)、`tests/lib/arch-precheck.test.mjs`(7 例)
40
+ - `tests/lib/cmd-doctor.test.mjs` 补 `checkChangeTestGates()` 覆盖(9 例,此前该函数无任何测试)
41
+ - 新增 `npm run lint:skills`(此前 lint 脚本存在但未接入任何 npm script);修正 `behavior-consistency` 规则误报(`route to \`references/...\`` 被当作 skill 名,error 级),6 error → 5 error(余下 5 项为既有 SKILL.md 超行数,记入待办)
42
+
7
43
  ## [0.49.0] - 2026-09-09
8
44
 
9
45
  ### Fixed(execution plan 冻结边界与复利链路修复)
package/GEMINI.md CHANGED
@@ -8,7 +8,7 @@ The workflow is self-contained and does not require OpenSpec or Superpowers at r
8
8
 
9
9
 
10
10
  <!-- team-flow-phase-guard-start -->
11
- # team-flow v0.49.0 | 阶段: {{state}} | 工作流: {{workflow}}
11
+ # team-flow v0.50.0 | 阶段: {{state}} | 工作流: {{workflow}}
12
12
  当前阶段允许的操作由 workflow-start 路由规则定义。
13
13
  禁止跨越 DP gate 进入下一阶段。变更范围以 execution-contract.md 的 Intent Lock 为准。
14
14
  <!-- team-flow-phase-guard-end -->
package/INSTALL.md CHANGED
@@ -7,7 +7,7 @@
7
7
  - [Fission-AI/OpenSpec](https://github.com/Fission-AI/OpenSpec) — 规划引擎(Schema 验证、Delta Spec、工件解析)
8
8
  - [obra/superpowers](https://github.com/obra/superpowers) — 执行纪律(TDD 铁律、SDD、系统化调试、代码审查)
9
9
 
10
- 当前发布版本:**v0.49.0**。
10
+ 当前发布版本:**v0.50.0**。
11
11
 
12
12
  ---
13
13
 
@@ -809,4 +809,4 @@ Checkpoint 是任务级恢复上下文。`result-ready` handoff 在继续受影
809
809
 
810
810
  推荐流程:`exploring -> specifying -> bridging -> approved-for-build -> execution plan -> executing -> closing`
811
811
 
812
- hotfix 快速路径:`exploring -> bridging -> approved-for-build -> executing`。hotfix 可以跳过完整的 `proposal.md`、`design.md`、`tasks.md`、`specs/`,但仍然必须先生成一份新的最小 `execution-contract.md`,并完成 DP-3 批准后才能开始实现。
812
+ hotfix 快速路径:`exploring -> bridging -> approved-for-build -> executing`。hotfix 可以跳过完整的 `proposal.md`、`design.md`、`specs/`,但仍然必须先生成一份新的最小 `execution-contract.md`,并完成 DP-3 批准后才能开始实现。`tasks.md` 不允许静默缺失(v0.22 §85):须由 contract-builder 显式登记 `tasks_skipped=true` + `tasks_skip_reason`,或一并产出最小任务清单。
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # team-flow
2
2
 
3
- > 当前版本:`v0.49.0`
3
+ > 当前版本:`v0.50.0`
4
4
 
5
5
  > 统一插件:**team-flow**(spec 驱动开发)+ **compound-engineering 核心子集**(全局复利)+ **architecture-design**(4A+DDD 增量设计)+ **prototype**(本地 HTML 原型)+ **e2e**(AC 驱动 E2E)+ **workflow-orchestrator**(产品级编排)+ **workflow-bootstrap**(既有项目接入)。一次安装,七套能力协同。
6
6
 
@@ -37,7 +37,7 @@ You are an independent architecture designer. You read the change brief, plan, e
37
37
  | `mode` | `change`(默认,workflow-start 五项检查)\| `product`(v0.36.0,S3.5 产品级架构设计) |
38
38
  | `change_brief_path` | change-brief.md 路径(scope / AC / 技术方向;change 模式必填) |
39
39
  | `plan_path` | requirement/vN/plan.md 路径(高阶技术设计段) |
40
- | `snapshot_path` | docs/architecture/iterations/vN/architecture.md(产品级快照;change 模式主输入,product 模式产出目标) |
40
+ | `snapshot_path` | docs/architecture/iterations/vN/architecture.md(产品级快照;change 模式主输入,product 模式产出目标;**Fast Path 命中时不传**) |
41
41
  | `specs_dir` | changes/<name>/specs/ 路径(现有规格,如有) |
42
42
  | `global_arch_dir` | docs/architecture/ 路径(As-Is 基线) |
43
43
 
@@ -15,7 +15,7 @@ You are an independent Code Reviewer. You review code changes for quality, spec
15
15
 
16
16
  ## Iron Law
17
17
 
18
- You are a reviewer. You did NOT write the code. You read the implementation, compare it against specs/requirements, check code quality, and produce a verdict with findings. You MUST write the review report to disk at the path specified by the orchestration layer (typically `changes/<name>/code-review.md`). Do NOT modify any implementation files — only write the review report.
18
+ You are a reviewer. You did NOT write the code. You read the implementation, compare it against specs/requirements, check code quality, and produce a verdict with findings. You MUST write the review report to disk at the path specified by the orchestration layer it MUST resolve inside the change review overlay `<change-dir>/.superpowers/sdd/reviews/` (v0.22 §86: the CLI rejects any path outside it). Do NOT modify any implementation files — only write the review report.
19
19
 
20
20
  ## Inputs
21
21
 
package/docs/README_en.md CHANGED
@@ -126,7 +126,7 @@ npm install -g team-flow
126
126
 
127
127
  ### Version
128
128
 
129
- - Current: `v0.49.0`
129
+ - Current: `v0.50.0`
130
130
  - v0.9.1 highlights: DP-4 execution-mode recommendations, a portable runtime across 17 platforms, and a raw-package smoke with no plugin-root variable.
131
131
  - Self-contained — no OpenSpec or Superpowers runtime required
132
132
  - Upstream: [Fission-AI/OpenSpec](https://github.com/Fission-AI/OpenSpec), [obra/superpowers](https://github.com/obra/superpowers)
@@ -279,7 +279,7 @@ not implemented, so this documentation does not claim `/tf:*` commands.
279
279
 
280
280
  ### Fast Paths (hotfix / tweak)
281
281
 
282
- - **hotfix** — ≤2 files, no new modules → `exploring -> bridging -> approved-for-build -> executing`. It may skip full planning artifacts such as `proposal.md`, `design.md`, `tasks.md`, and `specs/`, but it still requires a fresh minimal `execution-contract.md` plus DP-3 approval before implementation
282
+ - **hotfix** — ≤2 files, no new modules → `exploring -> bridging -> approved-for-build -> executing`. It may skip full planning artifacts such as `proposal.md`, `design.md`, and `specs/`, but it still requires a fresh minimal `execution-contract.md` plus DP-3 approval before implementation. `tasks.md` is not silently skipped (v0.22 §85): contract-builder records an explicit `tasks_skipped=true` + `tasks_skip_reason`, or produces a minimal task list
283
283
  - **tweak** — ≤4 files, config/docs only → skip planning + bridging, direct edit
284
284
 
285
285
  ---
@@ -45,6 +45,8 @@ Defines:
45
45
  - dependency-aware work breakdown
46
46
  - completion units that become named execution waves in the execution plan
47
47
 
48
+ > **hotfix/tweak 豁免(v0.22 §85)**:该路径跳过 spec-writer,`tasks.md` 默认显式跳过(`tasks_skipped=true` + `tasks_skip_reason`)——**hotfix 由 contract-builder 写入,tweak 由主代理写入**(tweak 不经过 contract-builder);若 change 需要任务清单,归属 contract-builder 产出。closing 的 `tasks-complete` 门禁按该键豁免。
49
+
48
50
  ### `execution-contract.md`
49
51
 
50
52
  Defines:
@@ -74,6 +74,16 @@
74
74
  - **预期输出**:用户确认归档并批准 delta spec 合并,或要求调整合并范围后再执行
75
75
  - **关联 skill**:`team-flow:release-archivist`
76
76
 
77
+ ## DP-A: 架构设计确认(v0.29.0 §37)
78
+
79
+ - **编号**:DP-A
80
+ - **名称**:架构设计用户确认门
81
+ - **触发条件**:architecture-design 子代理返回判定结果 + auto-review 完成后、路由 spec-writer 前
82
+ - **所需输入**:架构决策摘要(decision + reason + artifacts)、auto-review verdict
83
+ - **预期输出**:用户确认接受(`dp_a_result: confirmed`)或要求调整(`adjustment_requested`——须经 SendMessage 恢复原子代理修改后重新确认)
84
+ - **关联 skill**:`team-flow:workflow-start`(编排层把关;**非状态转换 guard 维度**)
85
+ - **状态字段**:`dp_a_result` / `dp_a_timestamp` / `dp_a_adjustments`
86
+
77
87
  ## 决策点与 Skill 映射总览
78
88
 
79
89
  | 编号 | 名称 | 关联 Skill | 阶段 |
@@ -86,3 +96,16 @@
86
96
  | DP-5 | 调试升级 | `team-flow:bug-investigator` | 执行 |
87
97
  | DP-6 | 验证失败 | `team-flow:release-archivist` | 收尾 |
88
98
  | DP-7 | 归档确认 | `team-flow:release-archivist` | 收尾 |
99
+ | DP-A | 架构设计确认 | `team-flow:workflow-start` | 架构 |
100
+
101
+ ## 确认点合并(v0.22 §88.3.1)
102
+
103
+ 以下三组可合并为**一次** AskUserQuestion——减少的是用户交互轮次,**门禁强度不变**(`dp_*` 字段仍须写入,guard 维度不豁免):
104
+
105
+ | 合并组 | 触发条件 |
106
+ |--------|----------|
107
+ | DP-0 + DP-A | `arch_design_decision == skipped` |
108
+ | DP-3 + G4 + DP-4 | 契约已产出且 hash 有效 |
109
+ | DP-7 + 代码落地 + G5 | 恒成立 |
110
+
111
+ `arch_design_decision == required` 时 DP-A 必须独立(用户需单独审架构产物)。
@@ -157,6 +157,6 @@ If the contract changed, the artifacts changed.
157
157
  ## Fast-Path Notes
158
158
 
159
159
  - `hotfix` follows `exploring -> bridging -> approved-for-build -> executing`.
160
- - `hotfix` may skip full planning artifacts such as `proposal.md`, `design.md`, `tasks.md`, and `specs/`.
160
+ - `hotfix` may skip full planning artifacts such as `proposal.md`, `design.md`, and `specs/`; `tasks.md` requires an explicit `tasks_skipped=true` + `tasks_skip_reason` (v0.22 §85) rather than a silent skip. The key is rejected for `full`/`auto` workflows — declare the mode first (`tf state set <dir> workflow hotfix|tweak`) or produce `tasks.md`.
161
161
  - `hotfix` still requires a fresh minimal `execution-contract.md` and explicit DP-3 approval before implementation.
162
162
  - `tweak` remains the only path that can jump directly from `exploring` to `approved-for-build`.
@@ -1,6 +1,6 @@
1
1
  # team-flow 使用说明(研发团队版)
2
2
 
3
- > 版本锚点:v0.47.0(26 skills + 17 agents)· 更新日期:2026-08-21
3
+ > 版本锚点:v0.50.0(26 skills + 17 agents)· 更新日期:2026-09-09
4
4
  > 读者:使用 team-flow 做日常研发的工程师。不需要你懂插件内部实现,只需要照着路径走。
5
5
  > 配套文档:安装细节见 [INSTALL.md](../INSTALL.md);状态机细节见 [state-machine.md](state-machine.md);决策点细节见 [decision-points.md](decision-points.md);平台差异见 [platform-matrix.md](platform-matrix.md)。
6
6
 
@@ -164,7 +164,7 @@ workflow-start 在初始化时自动推断(`tf runtime infer`),你也可
164
164
  | **hotfix** | ≤2 任务、≤2 文件、不动 schema/API | 跳过需求探索和规划制品,最小契约仍需 DP-3 批准 | test-matrix-complete、执行计划回执 |
165
165
  | **tweak** | ≤4 任务的纯配置/文档类 | 直接进 approved-for-build,直接编辑 | 执行计划、逐 wave 审查回执、测试矩阵 |
166
166
 
167
- **注意**:hotfix/tweak 豁免测试矩阵时**必须显式 skip 并写明理由**(`tf state set test_matrix_skipped true` + `test_matrix_skip_reason`),门禁不接受无理由跳过。架构设计判断门(五项检查)**两种模式都不豁免**。
167
+ **注意**:hotfix/tweak 豁免测试矩阵与 `tasks.md` 时**必须显式 skip 并写明理由**(`tf state set test_matrix_skipped true` + `test_matrix_skip_reason`;`tf state set tasks_skipped true` + `tasks_skip_reason`),门禁不接受无理由跳过。架构设计判断门(五项检查)**两种模式都不豁免**。
168
168
 
169
169
  ### 4.3 决策点(DP)——什么时候需要你拍板
170
170
 
@@ -427,6 +427,7 @@ tf prototype branch <prd-vN> | tf prototype deisolate <prd-vN> [--merge]
427
427
  tf solutions capture|index-gen|inject|promote
428
428
  tf arch init [--mode reconstruction|design] # 项目架构基线打戳(存量豁免键)
429
429
  tf arch show
430
+ tf arch precheck <change-dir> [--json] # 架构判断门证据(signal none/weak/strong,退出码恒 0)
430
431
  tf inject <dir> [--platforms claude,cursor,...] # 按当前状态生成 phase-guard 注入各平台
431
432
  tf config [--resolve-model <profile>] # mechanical/standard/strong/review 四档
432
433
  tf runtime check-update | infer <dir> | guard ... | config ... | asset read <path>
@@ -482,8 +483,7 @@ tf runtime check-update | infer <dir> | guard ... | config ... | asset read <pat
482
483
  │ ├── execution-contract.md # 执行契约(contract_hash)
483
484
  │ ├── test-matrix.md # 测试矩阵(12 列,test_matrix_hash)
484
485
  │ ├── learnings.md # 复利经验(closing 门禁要求或显式 skip)
485
- ├── code-review.md / *-review.md # 各审查报告
486
- │ └── .superpowers/ # 运行时 overlay
486
+ └── .superpowers/ # 运行时 overlay(审查报告已迁至 sdd/reviews/)
487
487
  │ ├── sdd/ # execution-plan.json / reviews/ / checkpoints / progress.md
488
488
  │ └── test-evidence/ # tf test record 的 runner 原始输出证据
489
489
 
@@ -514,6 +514,8 @@ tf runtime guard check <change-dir> <from> <to> --json
514
514
  | `no programmatic test evidence recorded` | 没有 `tf test record` 记录 | 跑测试 → `tf test record <dir> --from <输出文件>` |
515
515
  | `recorded-by` 校验失败 | 手工写了 test_result | 手工通道已关闭,必须走 tf test record;或显式 skip+理由 |
516
516
  | `test matrix skip reason missing` | skip 了矩阵没写理由 | `tf state set test_matrix_skip_reason "<理由>"` |
517
+ | `tasks skip reason missing` | skip 了 tasks.md 没写理由 | `tf state set tasks_skip_reason "<理由>"` |
518
+ | `tasks_skipped is only valid for hotfix/tweak` | full/auto 路径置了 skip 键 | 产出 tasks.md,或 `tf state set <dir> workflow <hotfix\|tweak>` 先声明模式 |
517
519
  | `dp_3_result` / `dp_4_result` 缺失 | DP 决策未记录 | 回到对应决策点完成确认 |
518
520
  | `plan revision <N>` 不匹配 | DP-4 记录没引用当前计划版本 | 重新 `tf execution plan`(或 revise) |
519
521
  | `base == head` review 被拒 | 空 diff 审查 | 用真实的 wave 起止 commit |
@@ -530,6 +532,7 @@ tf runtime guard check <change-dir> <from> <to> --json
530
532
 
531
533
  每条门禁都有合法逃生舱,但**必须显式+留痕**:
532
534
  - 测试矩阵:`test_matrix_skipped=true` + `test_matrix_skip_reason`
535
+ - tasks.md:`tasks_skipped=true` + `tasks_skip_reason`(**仅 hotfix/tweak**;full/auto 置键会被 `tasks-complete` 直接 FAIL——先 `tf state set <dir> workflow <hotfix|tweak>` 声明模式,或产出 tasks.md)
533
536
  - 复利:`tf state set compound_skipped true`
534
537
  - 架构 skip:物化 `iterations/vN/SKIPPED` 标记 + 理由
535
538
  - 隔离失败:`--force`(会警告)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-flow",
3
3
  "description": "Unified workflow plugin: team-flow (spec-driven dev) + compound-engineering core subset + architecture-design (4A/DDD) + prototype (local HTML) + business-analysis (independent requirement/scenario artifact). 26 skills, one install.",
4
- "version": "0.49.0",
4
+ "version": "0.50.0",
5
5
  "contextFileName": "GEMINI.md"
6
6
  }
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env bash
2
- # v0.49.0: auto-sync CLI version with plugin version
2
+ # v0.50.0: auto-sync CLI version with plugin version
3
3
  set -e
4
4
 
5
5
  # ═══════════════════════════════════════════════════════════════
6
6
  # Plugin version (update this when releasing new versions)
7
7
  # ═══════════════════════════════════════════════════════════════
8
- PLUGIN_VERSION="0.49.0"
8
+ PLUGIN_VERSION="0.50.0"
9
9
 
10
10
  # ═══════════════════════════════════════════════════════════════
11
11
  # Step 1: Auto-sync CLI version with plugin version
package/llms.txt CHANGED
@@ -3,7 +3,7 @@
3
3
  ## Overview
4
4
  spec-superflow is a self-contained workflow integration plugin for Claude Code, Cursor, OpenAI Codex CLI/App, GitHub Copilot CLI, Gemini CLI, OpenCode, WorkBuddy, and Trae. It merges spec-driven planning artifacts (proposal, specs, design, tasks) with disciplined execution guardrails (TDD, review gates, controlled handoff) into one unified workflow.
5
5
 
6
- Current version: v0.49.0.
6
+ Current version: v0.50.0.
7
7
 
8
8
  ## Key Documents
9
9
  - README.md: Chinese homepage with full usage guide and FAQ
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xulthekl/team-flow",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Unified plugin (26 skills + 17 agents) integrating team-flow, compound-engineering, architecture-design, prototype, design-system, workflow-orchestrator, workflow-bootstrap, e2e, session-handoff, workflow-feedback, business-analysis for multi-agent coding tools.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,6 +18,7 @@
18
18
  "test:e2e:plugin-sync": "node tests/e2e/scripts/plugin-sync.mjs",
19
19
  "test:e2e:llm": "TF_E2E_LLM=1 node --test --test-concurrency=1 tests/e2e/workflow/*.test.mjs",
20
20
  "validate": "node scripts/validate-artifacts",
21
+ "lint:skills": "node scripts/lint/lint-skills.mjs",
21
22
  "version": "node scripts/team-flow.mjs version $npm_new_version && node scripts/check-version-consistency.mjs && git add -A",
22
23
  "check-versions": "node scripts/check-version-consistency.mjs",
23
24
  "setup-hooks": "node scripts/install-git-hooks.mjs"
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-flow",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking) + business-analysis (independent requirement/scenario artifact). 26 skills + 17 agents, one install.",
5
5
  "author": {
6
6
  "name": "LT"
@@ -1,15 +1,51 @@
1
1
  // scripts/guard/checks/tasks-complete.mjs — verify all tasks in tasks.md are checked off
2
+ //
3
+ // v0.22 §85(workflow-feedback 20260909-103500-guard):新增 legacy 与显式 skip 两条豁免。
4
+ // 修复前 hotfix/tweak(跳过 spec-writer,无 tasks.md)在 executing:closing 必然 FAIL,
5
+ // 与 workflow-start SKILL 的 "may skip tasks.md" 表述冲突,导致 closing 死锁。
2
6
  import fs from 'node:fs';
3
7
  import path from 'node:path';
8
+ import { readState } from '../../lib/state-loader.mjs';
9
+ import {
10
+ isLegacyChange,
11
+ fullWorkflowSkipViolation,
12
+ tasksSkipMissingReason,
13
+ TASKS_SKIP_REASON_HINT,
14
+ TASKS_SKIP_FULL_FORBIDDEN_HINT,
15
+ } from './tasks-gate-exemptions.mjs';
4
16
 
5
17
  /**
6
18
  * Check that tasks.md has no unchecked items and at least one completed item.
7
- * Returns { pass, failures[] }.
19
+ * Returns { pass, failures[], reason? }.
8
20
  */
9
21
  export function checkTasksComplete(changeDir) {
22
+ const state = readState(changeDir);
23
+
24
+ if (isLegacyChange(state)) {
25
+ return { pass: true, failures: [], reason: 'legacy change — initialized before v0.32.0' };
26
+ }
27
+
28
+ if (state.tasks_skipped === 'true') {
29
+ // v0.22 §85.4(LT 2026-09-09):full/auto 不允许跳过——tasks.md 是 spec-writer 核心产物。
30
+ // 与 contract-builder SKILL「full 不得设置 tasks_skipped」及 usage-guide 的口径一致。
31
+ if (fullWorkflowSkipViolation(state)) {
32
+ return { pass: false, failures: [TASKS_SKIP_FULL_FORBIDDEN_HINT] };
33
+ }
34
+ if (tasksSkipMissingReason(state)) {
35
+ return { pass: false, failures: [TASKS_SKIP_REASON_HINT] };
36
+ }
37
+ return { pass: true, failures: [], reason: `explicitly skipped: ${state.tasks_skip_reason}` };
38
+ }
39
+
10
40
  const tasksPath = path.join(changeDir, 'tasks.md');
11
41
  if (!fs.existsSync(tasksPath)) {
12
- return { pass: false, failures: ['tasks.md: missing'] };
42
+ return {
43
+ pass: false,
44
+ failures: [
45
+ 'tasks.md: missing — produce it, or skip explicitly '
46
+ + '(tf state set <dir> tasks_skipped true && tf state set <dir> tasks_skip_reason "<why>")',
47
+ ],
48
+ };
13
49
  }
14
50
 
15
51
  const content = fs.readFileSync(tasksPath, 'utf-8');
@@ -28,4 +64,4 @@ export function checkTasksComplete(changeDir) {
28
64
  }
29
65
 
30
66
  return { pass: true, failures: [] };
31
- }
67
+ }
@@ -0,0 +1,49 @@
1
+ // scripts/guard/checks/tasks-gate-exemptions.mjs — v0.22 §85 tasks-complete 门禁豁免
2
+ //
3
+ // 背景(workflow-feedback 20260909-103500-guard):
4
+ // hotfix/tweak 跳过 spec-writer(workflow-start SKILL.md:172/173),tasks.md 的任务文本
5
+ // 无原生产出者;而 guard 的 executing:closing 仍考核 tasks-complete(guard.mjs:75/82)。
6
+ // 修复前该矛盾导致 closing 死锁,只能由编排层补录 tasks.md 绕过。
7
+ //
8
+ // 本模块与 test-gate-exemptions.mjs 同构:显式跳过优于静默豁免(v0.13 §48 原则),
9
+ // 跳过必须附理由才放行;存量 change(无 schema_version)沿用 legacy 豁免。
10
+ import { isLegacyChange } from './test-gate-exemptions.mjs';
11
+
12
+ export { isLegacyChange };
13
+
14
+ /** v0.22 §85:显式跳过 tasks.md 且理由非空(可审计豁免)。 */
15
+ export function hasExplicitTasksSkip(state) {
16
+ return state?.tasks_skipped === 'true'
17
+ && typeof state?.tasks_skip_reason === 'string'
18
+ && state.tasks_skip_reason.trim().length > 0;
19
+ }
20
+
21
+ /** skip 已置但理由缺失 → 门禁拒绝并引导补理由。 */
22
+ export function tasksSkipMissingReason(state) {
23
+ return state?.tasks_skipped === 'true' && !hasExplicitTasksSkip(state);
24
+ }
25
+
26
+ /**
27
+ * v0.22 §85.4(LT 2026-09-09 决策):`tasks_skipped` 仅对 hotfix/tweak 合法。
28
+ * full 的 tasks.md 是 spec-writer 核心产物,必然产出——缺失即流程异常,应 FAIL 暴露而非豁免掩盖。
29
+ * `auto`/缺失归一化为 full(与 cmd-state.mjs:163 的 auto→full 归一化同口径,安全侧默认)。
30
+ * 无存量风险:tasks_skipped 是 v0.50.0 新字段。
31
+ */
32
+ export function isFullWorkflow(state) {
33
+ const workflow = state?.workflow;
34
+ return workflow == null || workflow === '' || workflow === 'auto' || workflow === 'full';
35
+ }
36
+
37
+ /** full/auto 置了 skip → 拒绝,并给出两条可操作出路(不是死锁)。 */
38
+ export function fullWorkflowSkipViolation(state) {
39
+ return state?.tasks_skipped === 'true' && isFullWorkflow(state);
40
+ }
41
+
42
+ export const TASKS_SKIP_REASON_HINT =
43
+ 'tasks_skipped=true requires tasks_skip_reason — record it: '
44
+ + "tf state set <dir> tasks_skip_reason '<why this change needs no tasks.md>'";
45
+
46
+ export const TASKS_SKIP_FULL_FORBIDDEN_HINT =
47
+ 'tasks_skipped is only valid for hotfix/tweak — full workflow must produce tasks.md. '
48
+ + 'Either produce tasks.md, or, if this change is truly a hotfix/tweak, '
49
+ + 'declare the mode first: tf state set <dir> workflow <hotfix|tweak>';
@@ -0,0 +1,190 @@
1
+ // scripts/lib/arch-precheck.mjs — tf arch precheck:架构判断门的确定性证据工具(v0.22 §88.3.2)
2
+ //
3
+ // 定位:**证据工具,不是判断者**。本命令只输出"架构信号命中情况",
4
+ // 判断仍归 architecture-design 子代理(v0.9 §26 的独立性不变)。
5
+ // 退出码恒为 0 —— 不阻断流程,也不替代判断。
6
+ //
7
+ // 动机(workflow-feedback 20260909-112755):hotfix 对表现层文案改动跑完整架构门
8
+ // 消耗 41,864 tk,结论必然 skipped。让子代理在 signal=none 时只读 brief + 本命令输出
9
+ // (不读全量 docs/architecture/)可大幅降本,同时保留独立判断与回退能力。
10
+ //
11
+ // 设计约束(H1 实测校准):
12
+ // - 关键词须为**高置信度**短语——裸 `schema` / `api` 会误命中测试矩阵术语("schema 覆盖声明")
13
+ // - 否定表述须识别——"不动 filter.args" / "无聚合" 是**负向**证据,不能计为命中
14
+ // - 文件提取须去噪——`node_modules/` 引用非改动文件;同名文件按最完整路径去重
15
+ import fs from 'node:fs';
16
+ import path from 'node:path';
17
+
18
+ /** 架构关键词表(对应 architecture-design SKILL 五项检查 + 配置契约 key)。 */
19
+ const ARCH_KEYWORDS = [
20
+ // 1 聚合
21
+ '聚合', '聚合根', 'aggregate',
22
+ // 2 限界上下文
23
+ '限界上下文', 'bounded context',
24
+ // 3 读写模型
25
+ '读写模型', 'cqrs', '写模型', '读模型',
26
+ // 4 API(精确短语,避免裸 api 假阳性)
27
+ 'api 签名', 'api 端点', 'api 变更', 'api 新增', '新增 api', 'api 契约', 'endpoint', '端点',
28
+ // 5 DB schema(精确短语,避免裸 schema 误命中测试矩阵术语)
29
+ 'db schema', '数据库 schema', '表结构', 'ddl', '数据库表', '索引变更',
30
+ // 配置契约 key
31
+ 'filter.args',
32
+ ];
33
+
34
+ /**
35
+ * 否定上下文(行级):否定词可能出现在关键词**之后**同句(如"范围外…`filter.args` …一律不动")。
36
+ * 宽松匹配是刻意的——误判为 negated 只会让门走完整路径(安全),
37
+ * 误判为 positive 才会放行 fast path(危险)。
38
+ */
39
+ const LINE_NEGATION_RE = /(不动|不涉及|不变更|不新增|不修改|不改变|不调整|不包含|严禁|不得|禁止|零变更|无变更|无新增|无修改|保持不变|unchanged|no change|without)/i;
40
+ const NEGATION_ADJACENT_RE = /(不|无|非|未|零|no|not)\s*$/;
41
+
42
+ /**
43
+ * 变更语境:关键词前文出现变更动词才计为**正向**信号。
44
+ * 仅"提到"关键词(如"按 filter.args 断言写回")属中性,不构成架构变更信号。
45
+ */
46
+ const CHANGE_VERB_RE = /(新增|修改|变更|调整|增加|删除|引入|扩展|重构|改造|迁移|升级|add|new|modify|change|update|refactor|migrate)/i;
47
+
48
+ const PRESENTATION_EXTS = new Set(['.vue', '.jsx', '.tsx', '.less', '.css', '.scss', '.sass', '.html']);
49
+ const BACKEND_EXTS = new Set(['.java', '.go', '.py', '.rb', '.rs', '.kt', '.kts', '.cs']);
50
+ const CONFIG_EXTS = new Set(['.yaml', '.yml', '.json', '.sql', '.toml', '.ini', '.properties']);
51
+ const SCRIPT_EXTS = new Set(['.js', '.ts', '.mjs', '.cjs', '.mts', '.cts']);
52
+ const TEST_PATTERNS = [
53
+ /\.spec\.[cm]?[jt]sx?$/i,
54
+ /\.test\.[cm]?[jt]sx?$/i,
55
+ /Tests?\.java$/,
56
+ /_test\.go$/i,
57
+ /^test_.*\.py$/i,
58
+ /Tests?\.(kt|cs)$/,
59
+ ];
60
+
61
+ const CODE_EXT_PATTERN = [...PRESENTATION_EXTS, ...BACKEND_EXTS, ...CONFIG_EXTS, ...SCRIPT_EXTS]
62
+ .map(e => e.slice(1))
63
+ .sort((a, b) => b.length - a.length)
64
+ .join('|');
65
+
66
+ const FILE_RE = new RegExp(`(?:[\\w.-]+/)*[\\w.-]+\\.(?:${CODE_EXT_PATTERN})(?![\\w])`, 'gi');
67
+
68
+ function classifyFile(file) {
69
+ const ext = path.extname(file).toLowerCase();
70
+ const base = path.basename(file);
71
+ if (TEST_PATTERNS.some(re => re.test(base))) return 'test';
72
+ if (PRESENTATION_EXTS.has(ext)) return 'presentation';
73
+ if (BACKEND_EXTS.has(ext)) return 'backend';
74
+ if (CONFIG_EXTS.has(ext)) return 'config';
75
+ if (SCRIPT_EXTS.has(ext)) return 'script';
76
+ return 'other';
77
+ }
78
+
79
+ /** 文件提取:剔除 node_modules 引用,同名文件保留最完整路径。 */
80
+ function extractFiles(text) {
81
+ const byBase = new Map();
82
+ for (const m of text.matchAll(FILE_RE)) {
83
+ const f = m[0];
84
+ if (/(^|\/)node_modules\//.test(f)) continue;
85
+ const base = path.basename(f);
86
+ const prev = byBase.get(base);
87
+ if (!prev || f.length > prev.length) byBase.set(base, f);
88
+ }
89
+ return [...byBase.values()];
90
+ }
91
+
92
+ /** 关键词逐次出现的语境统计:negated(否定)/ positive(变更动词)/ neutral(仅提及)。 */
93
+ function findKeyword(text, keyword) {
94
+ const kw = keyword.toLowerCase();
95
+ const stat = { occurrences: 0, positive: 0, negated: 0, neutral: 0 };
96
+ for (const line of text.split('\n')) {
97
+ const lowerLine = line.toLowerCase();
98
+ let idx = lowerLine.indexOf(kw);
99
+ while (idx !== -1) {
100
+ stat.occurrences += 1;
101
+ const before = line.slice(Math.max(0, idx - 30), idx);
102
+ if (LINE_NEGATION_RE.test(line) || NEGATION_ADJACENT_RE.test(before)) stat.negated += 1;
103
+ else if (CHANGE_VERB_RE.test(before)) stat.positive += 1;
104
+ else stat.neutral += 1;
105
+ idx = lowerLine.indexOf(kw, idx + kw.length);
106
+ }
107
+ }
108
+ return stat;
109
+ }
110
+
111
+ /**
112
+ * 扫描 change 的规划制品,返回架构信号证据。
113
+ * @returns {{ signal: 'none'|'weak'|'strong', hits: object, evidence: string[], sources: string[] }}
114
+ */
115
+ export function collectArchSignals(changeDir) {
116
+ const sources = [];
117
+ for (const name of ['change-brief.md', 'execution-contract.md']) {
118
+ const p = path.join(changeDir, name);
119
+ if (fs.existsSync(p)) sources.push({ name, text: fs.readFileSync(p, 'utf-8') });
120
+ }
121
+
122
+ const text = sources.map(s => s.text).join('\n');
123
+
124
+ const keywords = [];
125
+ const negated = [];
126
+ const neutral = [];
127
+ for (const kw of ARCH_KEYWORDS) {
128
+ const stat = findKeyword(text, kw);
129
+ if (stat.occurrences === 0) continue;
130
+ if (stat.positive > 0) keywords.push(kw);
131
+ else if (stat.negated > 0) negated.push(kw);
132
+ else neutral.push(kw);
133
+ }
134
+
135
+ const files = { presentation: [], backend: [], config: [], script: [], test: [], other: [] };
136
+ for (const f of extractFiles(text)) files[classifyFile(f)].push(f);
137
+
138
+ const hasSql = files.config.some(f => f.toLowerCase().endsWith('.sql'));
139
+
140
+ let signal;
141
+ if (keywords.length > 0) signal = 'strong';
142
+ else if (files.backend.length > 0 || hasSql) signal = 'weak';
143
+ else if (files.presentation.length > 0) signal = 'none';
144
+ else signal = 'weak';
145
+
146
+ const evidence = [];
147
+ if (sources.length === 0) {
148
+ evidence.push('no change-brief.md / execution-contract.md found — signal defaults to weak');
149
+ }
150
+ evidence.push(keywords.length === 0
151
+ ? 'no architecture keyword in change context'
152
+ : `architecture keyword in change context: ${keywords.join(', ')}`);
153
+ if (negated.length > 0) evidence.push(`negated (not a signal): ${negated.join(', ')}`);
154
+ if (neutral.length > 0) evidence.push(`mentioned without change context (not a signal): ${neutral.join(', ')}`);
155
+ evidence.push(
156
+ `code files — presentation=${files.presentation.length}, backend=${files.backend.length}, `
157
+ + `config=${files.config.length}, script=${files.script.length}, test=${files.test.length}`,
158
+ );
159
+ if (signal === 'none') {
160
+ evidence.push('all evidence points to presentation-layer only — fast-path candidate (sub-agent must still confirm)');
161
+ }
162
+
163
+ return {
164
+ signal,
165
+ hits: { keywords, negatedKeywords: negated, neutralKeywords: neutral, files },
166
+ evidence,
167
+ sources: sources.map(s => s.name),
168
+ };
169
+ }
170
+
171
+ export async function run(positionals, values) {
172
+ const changeDirArg = positionals[0];
173
+ if (!changeDirArg) {
174
+ console.error('Usage: tf arch precheck <change-dir> [--json]');
175
+ process.exit(2);
176
+ }
177
+ const changeDir = path.resolve(changeDirArg);
178
+ const result = collectArchSignals(changeDir);
179
+
180
+ if (values.json) {
181
+ console.log(JSON.stringify(result, null, 2));
182
+ } else {
183
+ console.log(`arch precheck — signal: ${result.signal}`);
184
+ console.log(` sources: ${result.sources.join(', ') || '(none)'}`);
185
+ for (const line of result.evidence) console.log(` - ${line}`);
186
+ console.log(' note: evidence only — the architecture-design sub-agent still makes the decision.');
187
+ }
188
+ // 证据工具:恒以 0 退出,不阻断流程。
189
+ process.exit(0);
190
+ }
@@ -6,6 +6,7 @@
6
6
  import fs from 'node:fs';
7
7
  import path from 'node:path';
8
8
  import { parseArgs } from 'node:util';
9
+ import * as archPrecheck from './arch-precheck.mjs';
9
10
 
10
11
  const ARCH_STATE_FILE = '.team-flow/arch-state.json';
11
12
 
@@ -16,6 +17,7 @@ export async function run(args) {
16
17
  'project-root': { type: 'string' },
17
18
  mode: { type: 'string', default: 'reconstruction' },
18
19
  'baseline-ref': { type: 'string', default: 'prd/vN/' },
20
+ json: { type: 'boolean', default: false },
19
21
  },
20
22
  allowPositionals: true,
21
23
  });
@@ -23,7 +25,9 @@ export async function run(args) {
23
25
  const sub = positionals[0];
24
26
  if (sub === 'init') return init(values);
25
27
  if (sub === 'show') return show(values);
26
- console.error('Usage: tf arch init [--mode reconstruction|design] [--baseline-ref <prd/vN/>] | tf arch show');
28
+ // v0.22 §88.3.2:架构门判据的确定性证据工具(证据 only,退出码恒 0)
29
+ if (sub === 'precheck') return archPrecheck.run(positionals.slice(1), values);
30
+ console.error('Usage: tf arch init [--mode reconstruction|design] [--baseline-ref <prd/vN/>] | tf arch show | tf arch precheck <change-dir> [--json]');
27
31
  process.exit(2);
28
32
  }
29
33
 
@@ -5,6 +5,8 @@ import { loadConfig } from './config-loader.mjs';
5
5
  import { PLATFORM_RUNTIME_INVENTORY } from './platform-runtime-inventory.mjs';
6
6
  // 非法 state 巡检所需的共享常量与读取器(来源:workflow-feedback 2026-08-01,#100004)。
7
7
  import { readState, VALID_STATES } from './state-loader.mjs';
8
+ // v0.22 §85:tasks_skipped 豁免判定复用 guard 侧唯一真相源,避免同一规则两处实现漂移。
9
+ import { hasExplicitTasksSkip } from '../guard/checks/tasks-gate-exemptions.mjs';
8
10
 
9
11
  const RUNTIME_SKILLS = new Set([
10
12
  'workflow-start', 'need-explorer', 'spec-writer', 'contract-builder',
@@ -258,8 +260,8 @@ function checkChangeStates(root) {
258
260
  return { pass: true, message: `${checked} change(s) have legal state values` };
259
261
  }
260
262
 
261
- // v0.13 §52 B4 测试门禁卫生巡检(C1-domain-policy 事件修复):
262
- // 1. test_matrix_skipped=true 必须附 test_matrix_skip_reason(可审计豁免);
263
+ // v0.13 §52 B4 测试门禁卫生巡检(C1-domain-policy 事件修复);v0.22 §85 扩展 tasks_skipped:
264
+ // 1. test_matrix_skipped / tasks_skipped = true 必须附对应 reason(可审计豁免);
263
265
  // 2. 状态引用的产物文件必须存在(arch_review_report / test_evidence_path)——
264
266
  // C1 现场曾出现 arch_review_report 指向不存在的 auto-review.md。
265
267
  // DP 时间戳顺序检查评估后未纳入:closing 后的 DP-7 时间戳晚于 last_transition 属合法,
@@ -283,6 +285,11 @@ function checkChangeTestGates(root) {
283
285
  && !(typeof state.test_matrix_skip_reason === 'string' && state.test_matrix_skip_reason.trim())) {
284
286
  issues.push(`${d}: test_matrix_skipped=true without test_matrix_skip_reason`);
285
287
  }
288
+ // v0.22 §85:tasks_skipped 沿用同一可审计豁免范式(跳过必须附理由),
289
+ // 判定复用 tasks-gate-exemptions 的共享谓词(与 guard 同一真相源)。
290
+ if (state.tasks_skipped === 'true' && !hasExplicitTasksSkip(state)) {
291
+ issues.push(`${d}: tasks_skipped=true without tasks_skip_reason`);
292
+ }
286
293
  for (const field of ['arch_review_report', 'test_evidence_path']) {
287
294
  const ref = state[field];
288
295
  if (typeof ref === 'string' && ref.trim() && !existsSync(join(changeDir, ref))) {
@@ -38,6 +38,8 @@ const SETTABLE_FIELDS = [
38
38
  'compound_skipped',
39
39
  // Test matrix gate (v0.12 §45.4 + v0.13 §48.2)
40
40
  'test_matrix_skipped', 'test_matrix_skip_reason',
41
+ // Tasks gate (v0.22 §85:hotfix/tweak 显式跳过 tasks.md,须附理由)
42
+ 'tasks_skipped', 'tasks_skip_reason',
41
43
  ];
42
44
 
43
45
  export async function run(args) {
@@ -74,6 +74,9 @@ const BUILTIN_DEFAULTS = {
74
74
  test_matrix_skip_reason: null,
75
75
  // Test evidence (v0.13 §50:tf test record 落盘的 runner 输出证据路径)
76
76
  test_evidence_path: null,
77
+ // Tasks gate (v0.22 §85:hotfix/tweak 跳过 spec-writer 时显式跳过 tasks.md)
78
+ tasks_skipped: null,
79
+ tasks_skip_reason: null,
77
80
  // 注意:schema_version 故意不在 BUILTIN_DEFAULTS 中(v0.13 §48.1)——
78
81
  // 它只由 `tf state init` 在 change 创建时打戳,字段缺失本身就是"存量 change"信号。
79
82
  };
@@ -196,6 +199,10 @@ export function writeState(changeDir, state) {
196
199
  lines.push('');
197
200
  lines.push('# === Test evidence (v0.13 §50) ===');
198
201
  lines.push(`test_evidence_path: ${state.test_evidence_path ?? 'null'}`);
202
+ lines.push('');
203
+ lines.push('# === Tasks gate (v0.22 §85) ===');
204
+ lines.push(`tasks_skipped: ${state.tasks_skipped ?? 'null'}`);
205
+ lines.push(`tasks_skip_reason: ${state.tasks_skip_reason ?? 'null'}`);
199
206
 
200
207
  fs.writeFileSync(filePath, lines.join('\n') + '\n', 'utf-8');
201
208
  }
@@ -25,7 +25,9 @@ export default {
25
25
 
26
26
  // Check 2: "route to" consistency with workflow-start
27
27
  if (skillName !== 'workflow-start') {
28
- const routeRefs = [...content.matchAll(/[Rr]oute to [`""]?([a-z-]+)[`""]?/g)];
28
+ // v0.22 §90:加 `(?![a-z\/-])` 排除路径式目标——原正则把 "route to `references/xxx.md`"
29
+ // 捕获为 skill 名 "references",产生 error 级误报(ce-plan SKILL.md:64)。
30
+ const routeRefs = [...content.matchAll(/[Rr]oute to [`""]?([a-z-]+)[`""]?(?![a-z\/-])/g)];
29
31
  for (const [, target] of routeRefs) {
30
32
  // This skill says "route to X" — workflow-start should have a corresponding rule
31
33
  // We flag this for manual verification (can't easily cross-check without loading workflow-start)
@@ -67,6 +67,8 @@ Commands:
67
67
  arch init [--mode reconstruction|design] [--baseline-ref <prd/vN/>]
68
68
  Stamp project-level arch_baseline into .team-flow/arch-state.json (v0.35.0 §59.4)
69
69
  arch show Show current project architecture baseline state
70
+ arch precheck <change-dir> [--json]
71
+ Emit deterministic architecture-gate evidence (v0.22 §88; evidence only, exit 0)
70
72
  arch-merge <change-dir> [--project-root <path>] [--dry-run]
71
73
  Merge architecture delta into global docs/architecture/
72
74
  test-merge <change-dir> [--project-root <path>] [--dry-run]
@@ -81,6 +83,9 @@ Commands:
81
83
  Detect project layout (single/monorepo/multi-repo) + code repos, write repo_layout config (v1.0 §3)
82
84
  test record <dir> --from <runner-output> [--runner auto|maven-surefire|jest|pytest]
83
85
  Record programmatic test evidence (v0.13 §50; feeds tests-passing gate)
86
+ jest requires --json output (e.g. npx jest --json --outputFile=<path>);
87
+ maven-surefire: console summary or surefire XML dir/file;
88
+ pytest: terminal summary or junit XML (--junitxml)
84
89
  config [options] Display or modify configuration
85
90
  config --resolve-model <profile> Resolve a configured model profile without switching models
86
91
  state <sub> <dir> Manage .team-flow.yaml state (init|check|transition|get|rebuild)
@@ -109,7 +114,9 @@ Commands:
109
114
  execution revise <change-dir> --mode sdd --confirm --reason <text> --wave <id>:<strategy>:<task,...> [--acknowledge-recommendation]
110
115
  Upgrade inline/batch to SDD, or replan existing SDD waves, as a new revision
111
116
  execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict pass|fail
112
- Record one review receipt for a planned wave
117
+ Record one review receipt for a planned wave.
118
+ --report must resolve inside <change-dir>/.superpowers/sdd/reviews/
119
+ (the change review overlay; other paths are rejected)
113
120
  deisolate <change-dir> [--merge] [--force] [--clean] [--json]
114
121
  Show worktree status / merge branch back / clean worktree
115
122
  runtime check-update Run a portable update check for canonical skills
@@ -67,7 +67,7 @@ description: 基于 4A 企业架构 + DDD 领域驱动设计的架构/API/DB 设
67
67
 
68
68
  - `change-brief.md`(scope / AC / 技术方向)
69
69
  - `requirement/vN/plan.md` 高阶技术设计段(模块边界/技术选型/数据流/关键聚合划分)
70
- - `docs/architecture/iterations/vN/architecture.md`(产品级架构快照,**主输入**,v0.35.0)——BC 边界/聚合所有权/全局契约的唯一事实源
70
+ - `docs/architecture/iterations/vN/architecture.md`(产品级架构快照,**主输入**,v0.35.0)——BC 边界/聚合所有权/全局契约的唯一事实源;**Fast Path 下不读**(见 `### Fast Path`)
71
71
  - 全局 `docs/architecture/`(As-Is 实际态基线,已落地部分)
72
72
  - 现有 `specs/`(若有)
73
73
 
@@ -81,6 +81,20 @@ description: 基于 4A 企业架构 + DDD 领域驱动设计的架构/API/DB 设
81
81
  4. **API 变更**:是否涉及 API 新增/变更(端点、方法签名、请求响应 schema)
82
82
  5. **DB schema 变更**:是否涉及数据库表结构、字段、索引变更
83
83
 
84
+ ### Fast Path:precheck 证据驱动(v0.22 §88.3.2)
85
+
86
+ > **术语区分**:本节的 Fast Path 专指**架构判断门的快路径**,与 workflow-start 的 Fast-Path Routing(hotfix/tweak 路由)无关。
87
+ > **优先级**:本节条件优先于下文「执行流程」与「上下文加载协议」——Fast Path 命中时,那两节的架构文件读取要求一律不适用。
88
+
89
+ **先跑证据工具**:`tf arch precheck <change-dir> --json` —— 输出确定性证据(架构关键词的**变更语境**命中 / 否定命中 / 仅提及;改动文件按表现层/后端/配置/脚本/测试分类)。**正常调用退出码恒 0(缺参数属用法错误 exit 2),它是证据不是判断**。
90
+
91
+ | precheck 输出 | 路径 | 行为 |
92
+ |---|---|---|
93
+ | `signal: none`(无正向架构关键词 ∧ 无后端文件 ∧ 无 `.sql` ∧ 有表现层文件) | **Fast Path** | 只读 `change-brief.md` + precheck 输出;本路径**不读 `docs/architecture/` 下任何文件(含 `INDEX.md`)**;执行五项检查后返回 `skipped`,reason 引用 precheck 证据 |
94
+ | `signal: weak` / `strong` | 完整路径 | 现状(读快照 + 全局基线 + 完整五项检查) |
95
+
96
+ **红线**:Fast Path 下若发现 precheck 证据与 brief 不符(如 brief 明确提到新增聚合但 precheck 未命中),**必须回退完整路径**——判断权始终在本子代理,precheck 只用于缩小输入范围。
97
+
84
98
  ### 路由分流(v0.35.0 新增)
85
99
 
86
100
  当产品级架构快照存在时(已建档项目),判定结果再按"产品级决策 vs change 内实现细节"分流:
@@ -103,7 +117,7 @@ description: 基于 4A 企业架构 + DDD 领域驱动设计的架构/API/DB 设
103
117
  ### 执行流程
104
118
 
105
119
  ```
106
- 1. 读取输入(brief + plan + specs + 全局 ARCHITECTURE.md
120
+ 1. 读取输入(brief + plan + specs + 全局 ARCHITECTURE.md)——**Fast Path 裁剪为「brief + precheck 输出」**
107
121
  2. 执行五项检查
108
122
  3. 全部为否:
109
123
  → decision: skipped
@@ -196,7 +210,7 @@ architecture-design 执行时的上下文组装:
196
210
  1. 执行 `tf solutions inject --phase architecture`(失败静默)——注入 `docs/solutions/` 中 phase=architecture 的历史架构决策经验(BC 边界取舍/聚合划分理由/事件投影设计踩坑)
197
211
  2. 读取失败 / 无条目 → 静默跳过,不阻断(advisory 级,与 S1 复利注入同语义)
198
212
 
199
- **始终加载**:
213
+ **始终加载**(**Fast Path 除外**——见上文 `### Fast Path`,该路径不读 `docs/architecture/` 下任何文件):
200
214
  1. `Read docs/architecture/INDEX.md`(~50行摘要)
201
215
  2. `Read changes/<name>/change-brief.md`(如有)
202
216
  3. `Read changes/<name>/proposal.md`(如有)
@@ -142,9 +142,9 @@ For full/hotfix by default. Execute waves as dispatched by workflow-start.
142
142
 
143
143
  每个 wave 完成、通知 workflow-start 审查前,验证测试**实际执行**的数量(设计增强方案 v0.18 §76,来源:workflow-feedback 2026-08-06——64% 测试静默跳过但报告全绿):
144
144
 
145
- 1. 运行测试套件后,用 `tf test record <change-dir> --from <runner-output-file>` 解析**实际执行数量**(`Tests run: N`)。
145
+ 1. 运行测试套件后,用 `tf test record <change-dir> --from <runner-output-file>` 解析**实际执行数量**。**证据文件的产出形态随 runner 而异(v0.22 §86)**:jest 必须 `--json`(如 `npx jest --json --outputFile=<path>`;控制台汇总行 `Tests: N passed` 不被解析);maven-surefire 用控制台汇总行(`Tests run: N`)或 surefire XML 目录/文件;pytest 用 terminal summary 或 junit XML(`--junitxml=<path>`)。解析规则以 `scripts/lib/test-record.mjs` 为准(新增 runner 需先在该处注册)。
146
146
  2. 对照 test-matrix 当前 wave 覆盖的用例数(**分母排除 `test_tier=e2e`**——E2E case 由 Playwright 执行,不进入 `mvn test`/`npm test` 的 `Tests run: N`,口径与 code-reviewer Step 5b / release-archivist Step 2b 一致):实际执行数明显低于预期(< 70%)→ **警告 + 调查**(@Nested 静默跳过、测试未被发现、编译期跳过等),未查明前不得报告 "N tests pass"。
147
- 3. 报告引用实际执行数(`Tests run: N`),而非 BUILD SUCCESS 或编译通过数量。
147
+ 3. 报告引用实际执行数(按 runner 的计数口径),而非 BUILD SUCCESS 或编译通过数量。
148
148
 
149
149
  ### Per-Task Loop
150
150
  1. **Dispatch implementer**: Load the template with `tf runtime asset read skills/build-executor/implementer-prompt.md`. Extract task brief with `scripts/task-brief PLAN_FILE N`. Include: where task fits, brief path, interfaces from prior tasks, report file path.
@@ -35,7 +35,7 @@ Dispatch according to the persisted plan, review each planned wave, and run a fi
35
35
  1. Read the current plan with `tf execution show <change-dir> --json`; only waves with `current: true` and `eligible: true` may start.
36
36
  2. A `parallel` wave may dispatch independent tasks simultaneously only when the platform supports concurrent dispatch.
37
37
  3. A `serial` wave dispatches one task at a time in listed order.
38
- 4. After every wave, write a review report, then record one receipt:
38
+ 4. After every wave, write a review report **inside the change review overlay** `<change-dir>/.superpowers/sdd/reviews/` (v0.22 §86: other paths are rejected; the overlay is auto-created), then record one receipt:
39
39
  ```bash
40
40
  tf execution review <change-dir> \
41
41
  --wave <wave-id> --base <sha> --head <sha> --report <review-report-path> --verdict <pass|fail>
@@ -141,9 +141,10 @@ Subagent (general-purpose):
141
141
  ## Output Format
142
142
 
143
143
  Write your full review to [REVIEW_REPORT_FILE]. This distinct review report
144
- path must point to a non-empty, persisted review report before the
145
- controller records a receipt. After the verdict, provide the exact receipt
146
- command for the controller:
144
+ path must resolve inside `<change-dir>/.superpowers/sdd/reviews/` and point
145
+ to a non-empty, persisted review report before the controller records a
146
+ receipt. After the verdict, provide the exact receipt command for the
147
+ controller:
147
148
 
148
149
  ```bash
149
150
  tf execution review <change-dir> --wave [WAVE_ID] --base [BASE_SHA] --head [HEAD_SHA] --report [REVIEW_REPORT_FILE] --verdict <pass|fail>
@@ -184,7 +185,7 @@ Subagent (general-purpose):
184
185
  - `[BRIEF_FILE]` — REQUIRED: the task brief file (`scripts/task-brief PLAN N` prints the path; same file the implementer worked from)
185
186
  - `[GLOBAL_CONSTRAINTS]` — the binding requirements copied verbatim from the plan's Global Constraints section or the spec: exact values, formats, and stated relationships between components (not process rules — those are already in this template)
186
187
  - `[IMPLEMENTER_REPORT_FILE]` — REQUIRED: the file the implementer wrote its detailed report to
187
- - `[REVIEW_REPORT_FILE]` — REQUIRED: a distinct, persisted, non-empty file where the reviewer writes this review; this exact path is stored in the receipt
188
+ - `[REVIEW_REPORT_FILE]` — REQUIRED: a distinct, persisted, non-empty file under `<change-dir>/.superpowers/sdd/reviews/` (the overlay) where the reviewer writes this review; this exact path is stored in the receipt
188
189
  - `[BASE_SHA]` — commit before this task
189
190
  - `[HEAD_SHA]` — current commit
190
191
  - `[DIFF_FILE]` — REQUIRED: the path the controller wrote the review package to (`scripts/review-package BASE HEAD` prints the unique path it wrote; the package never enters the controller's context)
@@ -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
 
@@ -266,6 +266,15 @@ This check is advisory — skip if the user declines. If the user reports issues
266
266
 
267
267
  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
268
 
269
+ **回写链前置判据(v0.22 §87)**:先按下表判断适用性,**不适用则不执行命令**(v0.22 实测:逐项跑完才知道不适用,占 release-archivist 80% 耗时)。本表 4 行判据**仅在 Lightweight Closure 适用**;其中 arch-merge 与 test-merge 两行的 "Skip silently" 见 `### Architecture Merge`(:164 正文句)与 `### Test Merge`(:196 正文句)。
270
+
271
+ | 回写项 | 前置判据 | 不满足时登记 |
272
+ |---|---|---|
273
+ | arch-merge | `test -d <change-dir>/architecture/` | `skipped` |
274
+ | prototype-sync | 契约含 `## UX 增量` 段 | `no UX delta` |
275
+ | test-merge | `test -f <change-dir>/test-matrix.md` | `skipped` |
276
+ | compound promotion | `test -f <change-dir>/learnings.md` | `no learnings` |
277
+
269
278
  **⚠️ 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
279
 
271
280
  ## Exception Handling
@@ -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
  ```