@xulthekl/team-flow 0.64.0 → 0.67.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 (77) 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 +60 -0
  9. package/GEMINI.md +1 -1
  10. package/INSTALL.md +1 -1
  11. package/README.md +1 -1
  12. package/agents/architecture-design.md +1 -1
  13. package/agents/architecture-reviewer.md +6 -2
  14. package/agents/prd-completeness-reviewer.md +10 -0
  15. package/agents/prd-writer.md +1 -0
  16. package/agents/release-archivist.md +2 -0
  17. package/docs/README_en.md +1 -1
  18. package/docs/team-flow /344/275/277/347/224/250/350/257/264/346/230/216/357/274/210/347/240/224/345/217/221/345/233/242/351/230/237/347/211/210/357/274/211.md" +8 -6
  19. package/gemini-extension.json +1 -1
  20. package/hooks/session-start +2 -2
  21. package/llms.txt +1 -1
  22. package/package.json +1 -1
  23. package/plugin.json +1 -1
  24. package/prd/v1/prd.md +1 -1
  25. package/scripts/guard/checks/arch-gate-exemptions.mjs +5 -3
  26. package/scripts/guard/checks/arch-readiness.mjs +1 -1
  27. package/scripts/guard/checks/arch-snapshot.mjs +5 -3
  28. package/scripts/guard/checks/history-risk.mjs +132 -0
  29. package/scripts/guard/checks/prd-clarity-state.mjs +41 -0
  30. package/scripts/guard/checks/prd-clarity.mjs +176 -0
  31. package/scripts/guard/guard.mjs +16 -8
  32. package/scripts/infer-workflow.mjs +20 -0
  33. package/scripts/lib/arch-merge.mjs +384 -50
  34. package/scripts/lib/arch-parse.mjs +5 -2
  35. package/scripts/lib/arch-registry.mjs +523 -0
  36. package/scripts/lib/arch-scan-code.mjs +518 -0
  37. package/scripts/lib/cmd-arch.mjs +9 -1
  38. package/scripts/lib/cmd-doctor.mjs +3 -3
  39. package/scripts/lib/cmd-prd.mjs +84 -1
  40. package/scripts/lib/cmd-solutions.mjs +3 -0
  41. package/scripts/lib/cmd-state.mjs +31 -1
  42. package/scripts/lib/config-loader.mjs +20 -0
  43. package/scripts/lib/solutions-capture.mjs +5 -0
  44. package/scripts/lib/solutions-index-gen.mjs +33 -3
  45. package/scripts/lib/solutions-inject.mjs +34 -9
  46. package/scripts/lib/state-loader.mjs +13 -0
  47. package/scripts/team-flow.mjs +3 -0
  48. package/skills/architecture-design/SKILL.md +29 -11
  49. package/skills/architecture-design/chapters/ch04-entity-to-aggregate.md +18 -7
  50. package/skills/architecture-design/chapters/ch06-integration.md +12 -3
  51. package/skills/architecture-design/glossary.md +5 -1
  52. package/skills/architecture-design/references/adr-templates.md +56 -0
  53. package/skills/architecture-design/references/context-map-8.md +47 -0
  54. package/skills/architecture-design/references/ddd-evented-playbook.md +41 -0
  55. package/skills/architecture-design/references/s3.5-architecture-template.md +36 -4
  56. package/skills/architecture-design/references/s3.5-loading-protocol.md +5 -4
  57. package/skills/architecture-design/references/s3.5-product-architecture.md +6 -6
  58. package/skills/architecture-design/templates/architecture.md +20 -0
  59. package/skills/ce-brainstorm/SKILL.md +3 -3
  60. package/skills/ce-brainstorm/references/grounding.md +1 -1
  61. package/skills/ce-brainstorm/references/prd-84-authoring-spec.md +26 -3
  62. package/skills/ce-brainstorm/references/prototype-loop.md +8 -0
  63. package/skills/ce-compound/references/concepts-vocabulary.md +1 -1
  64. package/skills/ce-compound/references/full-mode-workflow.md +2 -2
  65. package/skills/ce-compound/references/lightweight-mode.md +1 -1
  66. package/skills/ce-compound/references/promotion-rules.md +1 -1
  67. package/skills/ce-compound/references/three-tier-index.md +1 -1
  68. package/skills/ce-plan/references/research-workflow.md +1 -1
  69. package/skills/jarvis/references/protocols.md +1 -0
  70. package/skills/release-archivist/SKILL.md +21 -0
  71. package/skills/release-archivist/references/closing-procedures.md +1 -1
  72. package/skills/workflow-orchestrator/SKILL.md +8 -4
  73. package/skills/workflow-orchestrator/references/s1-path-router.md +7 -0
  74. package/skills/workflow-orchestrator/references/s2-prd-prototype-loop.md +16 -2
  75. package/skills/workflow-orchestrator/references/s3-plan-pipeline.md +1 -1
  76. package/skills/workflow-start/SKILL.md +1 -1
  77. package/templates/prd.md +9 -1
@@ -0,0 +1,56 @@
1
+ # ADR 模板库 + deviation 登记接入(O6)
2
+
3
+ > **定位**:ADR 是**架构修订决策门 deviation 登记的 Rationale/Consequences 载体**,
4
+ > **不另起 `docs/adr/` 目录**(防双轨漂移——可机读登记唯一落点 = `orchestrator.yaml:replan_log`)。
5
+ > `adr-tools` / PR 流程属 git 流程,**映射进 replan_log 而非照搬**。
6
+
7
+ ## 何时写(Offer ADRs sparingly · 三条件,全部满足才写完整 ADR)
8
+
9
+ 1. **难逆转**(改回代价高:BC 边界 / 聚合所有权 / 全局契约 / 存储选型);
10
+ 2. **无上下文会困惑**(后来者不读会重新争论同一问题);
11
+ 3. **真实权衡**(存在过实质备选方案,而非显然选择)。
12
+ 不满足 → 只在 `replan_log` 留一行(trigger/before/after/approved_by 已足够),**不产出 ADR 文件**。
13
+
14
+ ## 五模板(按场景选一)
15
+
16
+ ### 1. MADR(完整决策记录)
17
+ ```markdown
18
+ # ADR-<seq>: <决策标题>
19
+ ## 状态 <提议|采纳|废弃|被 <ADR> 取代>
20
+ ## 背景 <forces:约束与压力>
21
+ ## 决策 <我们选择…>
22
+ ## 后果 <正 | 负 | 风险>
23
+ ```
24
+
25
+ ### 2. 轻量(默认首选)
26
+ ```markdown
27
+ ADR-<seq>: <标题> — 采纳 <date>
28
+ 背景:<一句>;决策:<一句>;后果:<正/负各一句>
29
+ ```
30
+
31
+ ### 3. Y-Statement(单句形)
32
+ ```markdown
33
+ <境况>,我们采用 <方案> 来满足 <驱动>,以换取 <正果/代价>,由 <人/机制> 复审。
34
+ ```
35
+
36
+ ### 4. 废弃记录
37
+ ```markdown
38
+ ADR-<seq> 已废弃(<date>,<原因>)。原决策见 replan_log seq=<n>;替代 = <新决策或「无」>。
39
+ ```
40
+
41
+ ### 5. RFC(须广泛评审的难逆转决策)
42
+ ```markdown
43
+ RFC-<seq>: <标题> — 提议 <date>;问题 / 备选方案(≥2)/ 推荐 / 评审人 / 结论
44
+ (评审结论仍须回写 replan_log——机读登记不在 RFC 内闭环)
45
+ ```
46
+
47
+ ## 与 replan_log 的映射(O6 判据:变更级 ADR/偏差登记落到可机读处)
48
+
49
+ | replan_log 字段 | ADR 对应 |
50
+ |---|---|
51
+ | `seq` / `trigger: arch-deviation` | ADR-<seq> / 状态行 |
52
+ | `before` / `after` | 背景 forces → 决策(改动前后) |
53
+ | `approved_by` | 状态:采纳 |
54
+ | (Rationale/Consequences 正文) | ADR 正文——**存于 change 制品或演进日志,replan_log 只存指针与摘要** |
55
+
56
+ **防泛滥**:一次决策门默认产出 = replan_log 一行;三条件全满足才升级为完整 ADR。
@@ -0,0 +1,47 @@
1
+ # Context Map · 经典 8 模式与决策流(O7)
2
+
3
+ > 产品级快照 §1.2 与变更级 Context Map 变更的**选型参考**(内联 reference,红牌 4:不引外部路由壳)。
4
+ > 教学同步:ch04「限界上下文 / Context Map」节与本文件同源(教 = 用,消除 3 vs 8 漂移)。
5
+
6
+ ## 8 模式全集
7
+
8
+ | # | 模式 | 一句话语义 | 典型信号 |
9
+ |---|------|-----------|---------|
10
+ | 1 | **Separate Ways** | 两上下文各走各的,不集成 | 集成成本 > 收益;无共享语言需求 |
11
+ | 2 | **Partnership** | 两团队共同演进、双向承诺 | 对等团队、共同目标、长期协作 |
12
+ | 3 | **Customer-Supplier** | 上游供能力、下游提需求,协商契约 | 明确的供需方;契约可谈 |
13
+ | 4 | **Conformist** | 下游全盘接受上游模型,放弃翻译 | 上游强势/模型稳定;翻译不划算 |
14
+ | 5 | **Open Host Service** | 上游开放标准协议供多下游消费 | 对外开放能力;多下游 |
15
+ | 6 | **Anti-Corruption Layer** | 下游建防腐层翻译上游概念 | 上游模型脏/惯性大;须隔离污染 |
16
+ | 7 | **Shared Kernel** | 两上下文共享部分模型,变更须协商 | 高度耦合的核心域子集;小团队 |
17
+ | 8 | **Published Language** | 标准化语义词汇,跨组织共享语言 | 与 OHS 天然配对;外部伙伴消费 |
18
+
19
+ **PL 与 OHS 配对**:OHS 给协议形状,PL 给语义词汇——只有 OHS 无 PL 时下游仍需猜测语义(配对使用,计数上仍是两个独立模式)。
20
+
21
+ ## 决策流(选型顺序:从"不集成"到"深耦合")
22
+
23
+ ```mermaid
24
+ flowchart LR
25
+ A[需要集成吗?] -->|否| SW[Separate Ways]
26
+ A -->|是, 对等团队| P[Partnership]
27
+ A -->|是, 有供需| CS[Customer-Supplier]
28
+ CS -->|下游愿受制| CF[Conformist]
29
+ CS -->|须隔离污染| ACL[Anti-Corruption Layer]
30
+ CS -->|对外开放/多下游| OHS["OHS + Published Language"]
31
+ A -->|核心域共享子集| SK[Shared Kernel]
32
+ ```
33
+
34
+ **决策纪律**:① 先问"要不要集成"再选模式;② 关系类型写进产品级快照 §1.2 表的「关系类型」列(8 选 1);
35
+ ③ 变更级 context_map 条目经 `.arch-delta.json` 登记(kind=context_map,pattern 枚举即本表 8 项,宿主 fields.source_bc);
36
+ ④ **CML(Context Mapper DSL)导出 = NO-GO**(工具锁定、ROI 低)——图用 Mermaid。
37
+
38
+ ## Mermaid 生成(扩产品级 §1.2 既有图)
39
+
40
+ ```mermaid
41
+ flowchart LR
42
+ order -->|C-S| payment
43
+ payment -->|"OHS+PL"| partner
44
+ downstream -.->|ACL| upstream
45
+ ```
46
+ - 关系标注取模式缩写:SK / C-S / Conf / ACL / OHS+PL / SW / Partner。
47
+ - 跨域 ≥3 BC 时按「受影响优先级」分步细化(守加载预算,见 s3.5-loading-protocol.md)。
@@ -0,0 +1,41 @@
1
+ # DDD 事件化设计手册 · Saga 补偿与 Projection 重建(O5)
2
+
3
+ > **设计层 ONLY(红牌 2)**:本文件只产矩阵/策略/表格进架构产物,**绝不生成可执行代码**。
4
+ > 补偿逻辑、幂等键、重建步骤须**人审**(AI 仅出草案)。边界:聚合内事务 ≠ 跨聚合 saga
5
+ > (聚合状态机在产品级 §4,saga 不得画进聚合状态机)。
6
+
7
+ ## 1. 命令 / 查询分离(为什么跨聚合最终一致)
8
+
9
+ - Command 侧:单聚合事务内强一致(聚合根守护不变量);跨聚合**不共享事务**。
10
+ - Query 侧:读模型由事件投影派生(CQRS),可异步、可最终一致、可按视图重构。
11
+ - 判据:需要跨聚合强一致?→ 先质疑建模(多半该合并聚合或改流程);确实要 → Saga 编排补偿,不拉分布式事务。
12
+
13
+ ## 2. Saga 补偿矩阵模板(变更级/产品级 §4 附表)
14
+
15
+ | 步 | 参与聚合/BC | 正向动作 | 触发事件 | 补偿动作 | 超时策略 | 幂等键 | 失败升级 |
16
+ |----|------------|---------|---------|---------|---------|--------|---------|
17
+ | 1 | order:Order | PlaceOrder | OrderPlaced | CancelOrder(未支付可撤) | 5s | orderId+step | 人工介入 |
18
+ | 2 | payment:Payment | Charge | PaymentCaptured | Refund | 10s | paymentId+step | 重试≤3 后告警 |
19
+
20
+ 填写纪律:每个正向动作**必须**有补偿列(不可补偿 → 显式标「人工兜底」,不留空);超时与幂等键必填。
21
+
22
+ ## 3. Projection 重建策略(读模型灾备)
23
+
24
+ 1. **先在 staging 重建再切生产**——禁止直接对生产读模型做全量重放。
25
+ 2. 重建源 = 事件存储/发件箱全量 + 水位标记;重建过程幂等(同幂等键重复消费无副作用)。
26
+ 3. 重建后做**对账**(写模型聚合数/关键计数 vs 读模型投影)→ 差异清零才切流。
27
+ 4. 重建属运维剧本:进 `docs/` 运维文档或 ADR,**不进代码库生成**。
28
+
29
+ ## 4. 幂等键与事件版本化
30
+
31
+ - 幂等键 = `业务主键 + 步骤/事件类型`(消费侧登记已处理键;重复投递直接 ACK)。
32
+ - 事件版本化:**门禁见产品级快照 §3.2(O4)**——major/minor/tombstone + 消费侧 upcasting;
33
+ 本手册不重复定义,只约束「saga 步骤引用的事件必须是已定版事件」。
34
+
35
+ ## 5. 产物落点
36
+
37
+ | 产物 | 位置 |
38
+ |------|------|
39
+ | Saga 补偿矩阵 | 变更级 `architecture.md` §4 附近 或 产品级快照 §3 附表 |
40
+ | Projection 重建 | 同上(策略段)+ 运维文档引用 |
41
+ | registry 登记 | 事件经 `.arch-delta.json` kind=event(宿主 fields.owner_aggregate) |
@@ -1,6 +1,6 @@
1
1
  # S3.5 产品级架构文档模板(v0.35.0,v0.14 §60)
2
2
 
3
- > 产品级架构设计(architecture 阶段)产出的权威文档模板。基于 4A + DDD 方法论,覆盖 6 类产物。
3
+ > 产品级架构设计(architecture 阶段)产出的权威文档模板。基于 4A + DDD 方法论,覆盖 6 类产物(+ §0 统一语言索引 / §1 子域-BC 拆分的结构增强,产物计数不变)。
4
4
  > 位置:`docs/architecture/iterations/vN/architecture.md`(预测态快照,P1:不写全局当前态)。
5
5
  > 产出后须经产品级评审门(architecture-reviewer product 视角)PASS 才进 S3(2026-08-19:ARCH 上移 S3 前,原"进 S4")。
6
6
 
@@ -16,7 +16,31 @@ superseded_by: null # 下一版快照路径(退役时填)
16
16
  ---
17
17
  # 产品级架构设计 · 迭代 vN
18
18
 
19
- ## 1 限界上下文(Context Map) <a id="bc"></a>
19
+ ## 0 统一语言索引(per-BC) <a id="ul"></a>
20
+
21
+ > **唯一内容写入点 = `docs/architecture/CONCEPTS.md`**(业务统一语言;根位置自 v0.23.0 已弃用)。本节**只放索引**(术语 → 锚点),**不含定义内容**——零双写、零漂移;业务语言不进 registry(非架构结构)。
22
+ > **预算**:本节约 ~150 token,计入加载协议 ~2K 总预算(人审把关,无机械校验——见 s3.5-loading-protocol.md)。
23
+ > **日期锚门控**:存量快照(`established_at` < 2026-09-25,**或 `established_at` 缺失/不可解析**)无本节**或无 §1.1 子域段** → 评审 WARN 不 FAIL(存量不追溯)。
24
+
25
+ | 所属 BC | 术语 | 详情锚点 |
26
+ |---------|------|----------|
27
+ | order | 客户=下单人 | docs/architecture/CONCEPTS.md#order |
28
+ | payment | 客户=付款人(同词异义) | docs/architecture/CONCEPTS.md#payment |
29
+
30
+ ## 1 子域与限界上下文 <a id="bc"></a>
31
+
32
+ ### 1.1 子域(问题空间 · 投资分级)
33
+
34
+ | 子域 | 分类 | 业务问题(一句话,与实现载体脱钩) |
35
+ |------|------|-----------------------------------|
36
+ | 订单履约 | Core | 下单-支付-发货全链路,核心竞争力所在 |
37
+ | 结算对账 | Supporting | 保障性工作,最小定制即可 |
38
+ | 基础数据 | Generic | 通用能力,买或复用 |
39
+
40
+ > **分类驱动投资**:Core 深建模 / Supporting 最小定制 / Generic 买或复用(Vernon《IDDD》问题空间纪律)。
41
+ > **纪律**:子域描述只写**业务问题**,**不列 service / 包名 / 类名**(问题空间 ≠ 解空间;按实现载体划子域是已知失效模式)。
42
+
43
+ ### 1.2 限界上下文(解空间 · Context Map)
20
44
 
21
45
  | 上下文 | 职责(一句话) | 依赖 | 关系类型 | 语言边界/关键术语 |
22
46
  |--------|------------|------|---------|-----------------|
@@ -30,7 +54,7 @@ flowchart LR
30
54
  order -->|C-S| stock
31
55
  ```
32
56
 
33
- **关系类型枚举(6 种)**:Shared Kernel / Customer-Supplier / Conformist / Anti-Corruption Layer / Open Host Service / Separate Ways。
57
+ **关系类型枚举(经典 8 模式,O7)**:Shared Kernel / Customer-Supplier / Conformist / Anti-Corruption Layer / Open Host Service / Separate Ways / **Partnership** / **Published Language**(PL 与 OHS 天然配对)。选型走**决策流**(Separate Ways → Partnership → Customer-Supplier → Conformist → OHS+PL → ACL → Shared Kernel)——详见 `references/context-map-8.md`(含 Mermaid 生成指引;CML DSL 导出 = NO-GO)。
34
58
 
35
59
  ## 2 聚合注册表 <a id="aggregates"></a>
36
60
 
@@ -64,6 +88,12 @@ flowchart LR
64
88
  | OrderPlaced | 领域 | order:Order | PlaceOrder | orderId, items | payment, stock | order-summary-view |
65
89
  | PaymentCaptured | 集成 | payment:Payment | 支付回调 | orderId, paymentId | order:Order | order-summary-view |
66
90
 
91
+ > **事件 schema 版本策略门禁(O4)**:事件化场景**必填版本字段**(缺失 → 评审阻塞,不放行)——
92
+ > **major** = breaking(删字段/改语义,消费方必挂):须提供 upcasting 迁移路径;**minor** = 加可选字段(向后兼容);
93
+ > **tombstone** = 退役事件显式标记(禁静默消失,同红牌 6)。版本一经发布**只增不改**;
94
+ > upcasting 在**消费侧**做(读入旧版本事件时升格),生产侧不重写历史(依据「Version events from day one」)。
95
+ > 事件条目经 `.arch-delta.json`(kind=event,`fields.owner_aggregate` 挂宿主)登记进 registry.events 载体。
96
+
67
97
  ### 3.3 事件流图
68
98
  > mermaid:事件→指令级联链(覆盖 saga/process manager 跨聚合长流程一致性)
69
99
 
@@ -72,6 +102,8 @@ flowchart LR
72
102
  |--------|-------------|-------------------|
73
103
  | order-summary-view | OrderPlaced, PaymentCaptured | 异步 |
74
104
 
105
+ > 跨聚合最终一致的 **Saga 补偿矩阵 + Projection 重建策略 + 幂等键** 模板见 `references/ddd-evented-playbook.md`(O5,设计层 ONLY 不生成代码)。
106
+
75
107
  > 显式声明:事件用于**变更通知与投影驱动,不引入事件溯源持久化**。事件命名规范 `OrderPlaced`(名词+过去式动词),全系统一致。
76
108
 
77
109
  ## 4 聚合状态迁移 <a id="state-machines"></a>
@@ -85,7 +117,7 @@ flowchart LR
85
117
  | 创建 | PlaceOrder | order | 已支付 | 总金额>0 |
86
118
  | 已支付 | Ship | order | 已发货 | 已收款 |
87
119
 
88
- > 区分**聚合状态机**(本表,聚合事务边界内)与**跨聚合流程状态机**(入 saga,不在聚合状态机内表达)。
120
+ > 区分**聚合状态机**(本表,聚合事务边界内)与**跨聚合流程状态机**(入 saga,不在聚合状态机内表达)——saga 补偿矩阵模板见 `references/ddd-evented-playbook.md`(O5)。
89
121
 
90
122
  ## 5 数据模型 / ER(概念级) <a id="erd"></a>
91
123
 
@@ -16,7 +16,8 @@
16
16
  1. **先索引、后按域**:子代理先读 ① 索引层做路由(识别 change 触及哪些 BC),再按需加载 ② 该域的详细页。
17
17
  2. **单域单次**:跨多域时一次只装载一个域文件,逐域分步处理(与 ch06 增量 SOP 对齐)。
18
18
  3. **引用非复制**:只读不改;产品级聚合注册表是唯一事实源,change 内设计**引用**注册表 id,不重定义。
19
- 4. **迭代状态判定**(P1):读快照还是读全局由迭代状态决定——
19
+ 4. **业务语言 grounding(O2)**:变更级设计加载触及 BC 的业务术语时,读快照 §0 索引定位 → 跳转 `docs/architecture/CONCEPTS.md` 取定义(**唯一内容写入点**,根位置自 v0.23.0 已弃用;§0 只路由不装载定义)。本项计入 ~2K 预算(§0 ~150 token + 按需读 CONCEPTS.md 相关节),**人审把关**。
20
+ 5. **迭代状态判定**(P1):读快照还是读全局由迭代状态决定——
20
21
  - 迭代中(`snapshot_status: in-flight`)→ 读 `iterations/vN/` 快照(产品级决策权威)
21
22
  - 迭代收尾(`snapshot_status: superseded/archived`)→ 读全局当前态(唯一权威)
22
23
 
@@ -28,10 +29,10 @@
28
29
  2. 触及域按"受影响优先级"逐域分步处理(每步 ≤1 域)。
29
30
  3. 加载前做 token 估算,超预算 → 告警 + 降级,而非硬约束失败。
30
31
 
31
- ## token 预算自动化校验
32
+ ## token 预算校验(人审项)
32
33
 
33
- - 锚点(§1-2)与域页 token 预算加**自动化校验**(镜像 frontmatter-lint 模式,进 npm test)——不靠 LLM 自律。
34
- - S3.5 产物自检 + S4 审计抽查:`iterations/vN/architecture.md` 的 §1-2 必须一句话级;`domains/<bc>.md` 单文件 ≤1500 token(超出继续拆子页)。
34
+ - 锚点(§1-2)、§0 统一语言索引与域页 token 预算均为**人审自查项**(S3.5 产物自检 + S4 审计抽查),**无机械门禁**——本节原写「进 `npm test`」(自动化校验表述)属悬空规范,已于 2026-09-25 按设计方案 §2.6 处置 (b) 改写(补齐机械校验的路线见该方案 CQ-9,可行性已上调,留待独立批次)。
35
+ - 具体口径:`iterations/vN/architecture.md` 的 §0 ≤ ~150 token、§1-2 必须一句话级;`domains/<bc>.md` 单文件 ≤1500 token(超出继续拆子页)。
35
36
 
36
37
  ## 与既有加载协议的关系
37
38
 
@@ -20,7 +20,7 @@
20
20
  | 步 | 动作 | 方法论 | 产出 |
21
21
  |----|------|--------|------|
22
22
  | 0 | 输入梳理 | 读 PRD 功能清单 + plan 技术方向 + prototype + CONCEPTS + 现有基线 | 功能域→候选业务能力映射 |
23
- | 1 | 限界上下文识别 | 功能域分组 + 词汇聚类 + 活动对象矩阵(ch04,重叠>70% 合并) | Context Map:BC 表 + 关系图(6 关系类型)+ 语言边界术语表 |
23
+ | 1 | 子域与限界上下文识别 | 子域分类 Core/Supporting/Generic(ch04,问题空间先行,不列实现载体)+ 功能域分组 + 词汇聚类 + 活动对象矩阵(重叠>70% 合并) | §1.1 子域地图(问题空间·投资分级)+ Context Map:BC 表 + 关系图(6 关系类型)+ 语言边界术语表 + **§0 统一语言索引**(per-BC,术语→CONCEPTS.md 锚点,**不含定义**) |
24
24
  | 2 | 聚合识别 | 聚合四要素(ch04)+ 活动对象矩阵 | 聚合注册表(唯一事实源) |
25
25
  | 3 | 指令与事件识别 | CQRS 指令分流(ch05:Command/Read/Query + 阻断测试)+ 事件三类 | 指令表 + 事件表 + 事件流图 + 读模型投影清单 |
26
26
  | 4 | 聚合状态迁移 | 聚合根=状态机守卫(Vernon) | stateDiagram + 状态表(含触发源上下文、guard 不变量) |
@@ -33,7 +33,7 @@
33
33
 
34
34
  **按域详细页产出(v0.36.3,domains/ 生产者)**:Step 1 识别 BC 后、Step 2-6 每个触及域细化时,同步产出 `domains/<bc>.md`(职责/聚合明细/指令事件/状态迁移/ER 局部/时序/对外契约)与 `diagrams/`(erd/sequences)——它们是按域分段加载(`s3.5-loading-protocol.md` 第②段)与 reviewer product A1 的审查对象;单文件 ≤1500 token。
35
35
 
36
- **模板**:按 `references/s3.5-architecture-template.md` 骨架产出(6 产物 + 厚锚点 + marker + provenance)。
36
+ **模板**:按 `references/s3.5-architecture-template.md` 骨架产出(6 产物 + **§0 统一语言索引** + **§1 子域/BC 拆分** + 厚锚点 + marker + provenance;§0/§1.1 的日期锚门控见该模板注释)。
37
37
 
38
38
  ## 产品级评审门(Step 8)
39
39
 
@@ -41,7 +41,7 @@
41
41
 
42
42
  | 维度 | 校验 |
43
43
  |------|------|
44
- | A1 | 结构完备(6 产物章节存在 + marker/锚点可解析,机械预检) |
44
+ | A1 | 结构完备(6 产物章节 + §0 统一语言索引 per-BC·无定义列 + §1.1 子域段与 §1.2 物理分离·含三分类·业务问题列非空·**反例:不含 service/包名类实现载体词** + marker/锚点可解析,机械预检;存量 `established_at` < 2026-09-25 **或日期缺失/不可解析** → WARN 不 FAIL) |
45
45
  | A2 | SQL/结构有效(机械 grep,若含 sql/) |
46
46
  | A3 | 跨域一致性(AA↔IA 双对齐,F2 门禁) |
47
47
  | A4 | 与 PRD 功能清单覆盖映射(F001_P0 逐条 → BC/聚合/API) |
@@ -49,7 +49,7 @@
49
49
  | A6 | conventions 合规 |
50
50
 
51
51
  规则:≤3 轮修复循环 + 收敛检测(连续两轮不一致项不缩小 → 转人工);PASS 才进 S3(2026-08-19:ARCH 上移 S3 前,原"进 S4")。
52
- **skip 时**:architecture-reviewer 不执行,但 skip 必须物化(iterations/vN/SKIPPED 标记 + 理由)。
52
+ **skip 时**:architecture-reviewer 不执行,但 skip 必须物化(**统一命名 `iterations/vN/SKIPPED.md`**——审计 B8:存量有 `SKIPPED` 与 `SKIPPED.md` 两种形态,自本规范起一律带 `.md`;最小内容三段 = 迭代 / 判定(日期+判定者)/ 理由,详式可加覆盖判断与衔接)。
53
53
 
54
54
  ### 复利捕获(Step 9,v0.36.3 复利链路修复)
55
55
 
@@ -83,7 +83,7 @@ ARCH 完成(评审 PASS 或 skip 已物化)后,**阻塞确认**(AskUserQ
83
83
 
84
84
  ## 完成条件
85
85
 
86
- - `docs/architecture/iterations/vN/architecture.md` 已产出(6 产物,provenance 标注)
86
+ - `docs/architecture/iterations/vN/architecture.md` 已产出(6 产物 + §0/§1.1 结构增强,provenance 标注)
87
87
  - 产品级评审门 verdict = PASS(或 skip 已物化)
88
88
  - orchestrator.yaml 中 ARCH 阶段状态 = completed(workflow_phase: architecture)
89
89
  - **未触发** arch-merge 全局覆盖写(预测态不进实际态,P1)
@@ -92,6 +92,6 @@ ARCH 完成(评审 PASS 或 skip 已物化)后,**阻塞确认**(AskUserQ
92
92
  ## 常见陷阱
93
93
 
94
94
  - **过度详设**:契约级(每 API schema/每表全字段)留给 change 落地涌现,产品级只做结构级(P4)。
95
- - **skip 不物化**:跳过必须写 iterations/vN/SKIPPED + 理由,否则 S4 arch-readiness 卡死 hotfix 通道(v0.32.2 C1 死锁链同类)。
95
+ - **skip 不物化**:跳过必须写 `iterations/vN/SKIPPED.md`(命名统一见上,B8)+ 理由,否则 S4 arch-readiness 卡死 hotfix 通道(v0.32.2 C1 死锁链同类)。
96
96
  - **事件只识别不投影**:引入事件必须补"读模型投影清单"(§3.4),否则读模型更新无定义。
97
97
  - **ER 先行**:先画 ER 再定聚合 = 数据库驱动设计,违背 DDD(顺序纪律)。
@@ -2,9 +2,19 @@
2
2
  change_id: <change-name>
3
3
  date: YYYY-MM-DD
4
4
  arch_design_decision: required | skipped
5
+ mode: inline | sdd # O9 必填:执行形态
6
+ provenance: forward-designed | reverse-engineered | mixed # O9 必填:来源性质
7
+ as_is_anchor: <version@章节锚点 或 none> # O9 必填:As-Is 冻结锚(§1 复制源)
8
+ iteration_version: <vN 或 none> # O9 必填:所属产品级迭代
9
+ product_snapshot: <docs/architecture/iterations/vN/architecture.md 或 none> # O9 必填
5
10
  ---
6
11
  # Architecture 增量设计: <change-name>
7
12
 
13
+ > **O9 可读性纪律(设计意图前置 · 证据下沉)**:
14
+ > ① **首屏 = 设计意图**——本文件开头(H1 后)先用 ≤10 行说清「为什么改、改什么、关键取舍」,人读不懂即不合格;
15
+ > ② **`file:line` 级举证与 ADR-lite 正文下沉**到各节末尾「证据」小字或 `evidence/` 子目录,**不得淹没设计意图**(emp-auth 实测 126KB/30+ 处 file:line 的法医化膨胀是反例);
16
+ > ③ 证据可下沉**不可删除**(判据完整性不削弱);frontmatter 5 项必填(缺项 → 评审 WARN,存量按日期锚门控不追溯)。
17
+
8
18
  ## 1. As-Is 基线(冻结复制)
9
19
 
10
20
  > 从全局 ARCHITECTURE.md 复制当前相关 BC/聚合/Context Map 到此处。
@@ -46,6 +56,16 @@ arch_design_decision: required | skipped
46
56
  | 聚合 | 操作类型 | 命令/查询 | 事务边界 | 说明 |
47
57
  |------|---------|---------|---------|------|
48
58
 
59
+ ### 2.5 领域事件变更(O4 · 事件化场景必填版本字段,缺失 → 评审阻塞)
60
+
61
+ | 事件 | 操作(new/extend/retire) | 源聚合 | schema 版本 | 兼容级别(major/minor) | 携带数据变更 | 消费方 |
62
+ |------|------------------------|--------|------------|----------------------|------------|--------|
63
+ | OrderPlaced | extend | order:Order | 1.2.0 | minor | +shippingAddress(可选) | payment, stock |
64
+
65
+ > 版本策略 / upcasting / tombstone 纪律见产品级快照 §3.2 的「事件 schema 版本策略门禁」段;
66
+ > retire 须带 reason;事件经 `.arch-delta.json`(kind=event,`fields.owner_aggregate` 挂宿主)登记。
67
+ > **无事件增量时本节留空即可**(勿删节——O9 结构完整性依赖章节存在)。
68
+
49
69
  ## 3. 变更分叉级联分析
50
70
 
51
71
  ### 3.1 直接依赖
@@ -195,13 +195,13 @@ For detailed routing logic, read `references/phase0-routing.md`. Summary:
195
195
  - **0.1b Classify**: software → continue; non-software → `references/universal-brainstorming.md`; neither → respond directly
196
196
  - **0.1c Verdict**: verdict-shaped requests → offer `/ce-pov` handoff via `references/verdict-routing.md`
197
197
  - **0.2 Assess**: clear requirements → skip to Phase 2.5; ambiguous → full brainstorm
198
- - **0.3 Scope**: Lightweight / Standard / Deep (+ feature vs product); arm visual-probe and blindspot tripwires
198
+ - **0.3 Scope**: Lightweight / Standard / Deep (+ feature vs product); arm visual-probe and blindspot tripwires. **Scope 推荐降阈值(agent-governance P1-2 · A 档)**:需求一句话可述、无跨模块疑点、`arch_baseline` 已建档时,**默认推荐 Lightweight**(跳 BP-1~3 + Path A 轻确认),用户确认即走;含糊/多义/涉新模块 → 推荐 Standard(含糊才升 Deep)。推荐是建议非决定,用户可任选档位;**判定不清时按 Standard 起步**(宁多问不漏问)。
199
199
  - **0.4 Spine**: create 5-task tracking spine for Standard/Deep
200
200
  - **0.5 Iteration**: resolve `ITERATION_VERSION` from `requirement/` directory (legacy: fallback `prd/`)
201
201
 
202
202
  ### Phase 1: Understand the Idea
203
203
 
204
- **1.1 Context Scan** — For Standard/Deep, dispatch grounding scout sub-agent (extraction-tier) to produce a grounding dossier. For the scout prompt, scratch directory setup, and Slack routing, read `references/grounding.md`. Two rules: **verify before claiming** (check infrastructure exists) and **defer design to planning**.
204
+ **1.1 Context Scan** — For Standard/Deep, dispatch grounding scout sub-agent (extraction-tier) to produce a grounding dossier. For the scout prompt, scratch directory setup, and Slack routing, read `references/grounding.md`. Two rules: **verify before claiming** (check infrastructure exists) and **defer design to planning**. **复利注入(P2-3 顶层调用,不限 scope)**:Phase 1 开始前跑 `tf solutions inject --phase prd --limit 5`(CLI 内含见习/红区门控;**Lightweight 同样注入**——它是轻命令,不随 scout 一起被 scope 门掉,防 A 档默认轻档路径零注入);空结果静默跳过——冷启动不计收益 0。
205
205
 
206
206
  **1.2 Pressure Test** — Scan opening for rigor gaps (evidence, specificity, counterfactual, attachment). Read `references/product-pressure-test.md` for per-tier lens catalog. Session-settled decisions count as already-probed.
207
207
 
@@ -273,7 +273,7 @@ Read `references/brainstorm-sections.md` for doc-warranted criteria. If warrante
273
273
 
274
274
  ### QA-4: PRD Quality Check
275
275
 
276
- Fires after Phase 3 (or Phase 3.5 if prototype loop ran). Read `references/evidence-chain-validation.md` for QA-4 criteria. Evaluates PRD completeness and traceability against business analysis artifacts. **冻结前完整性评审(6 维,含 §8.4 信息齐备性与业务可读形态 D6)的派发点已归并**:standalone 路径由 Phase 3.5(`references/prototype-loop.md` §3.5.5)派发 prd-completeness-reviewer;orchestrated 路径由 orchestrator S2 派发(见 `workflow-orchestrator/references/s2-prd-prototype-loop.md`);**QA-4 自身不重复派发**,仅按评审结果判定是否回 Phase 1.3/Phase 3 修订。
276
+ Fires after Phase 3 (or Phase 3.5 if prototype loop ran). Read `references/evidence-chain-validation.md` for QA-4 criteria. Evaluates PRD completeness and traceability against business analysis artifacts. **冻结前完整性评审(6 维,含 §8.4 信息齐备性与业务可读形态 D6)的派发点已归并**:standalone 路径由 Phase 3.5(`references/prototype-loop.md` §3.5.5)派发 prd-completeness-reviewer;orchestrated 路径由 orchestrator S2 派发(见 `workflow-orchestrator/references/s2-prd-prototype-loop.md`);**QA-4 自身不重复派发**,仅按评审结果判定是否回 Phase 1.3/Phase 3 修订。**冻结前先过清晰度机械门 `tf prd check-clarity`(P0-1,checker 先于 reviewer,FAIL 则回改不派发)**——调用细则见 `references/prototype-loop.md` §3.5.5 前置段(standalone)/ `s2-prd-prototype-loop.md` step 3.4(orchestrated)。
277
277
 
278
278
  ### Phase 3.6: PRD ↔ Scenario/Process Bidirectional Validation
279
279
 
@@ -9,7 +9,7 @@ Detailed context scanning logic for Phase 1.1. The main SKILL.md describes the h
9
9
  **Standard and Deep** — Two passes:
10
10
 
11
11
  *Constraint Check (inline)* — Use the project's active instructions and conventions already in your context. Read `STRATEGY.md` if it exists for product direction and `CONCEPTS.md` if it exists for canonical vocabulary — it lives at **`docs/architecture/CONCEPTS.md`** (the repo-root location was retired in v0.23.0, so a root-only probe misses bootstrapped projects). Use canonical names in dialogue, approaches, and the Product Contract.
12
- - **Solutions index (v0.5)**: Read `docs/solutions/INDEX.md` if it exists. Filter entries where `phase = prd OR phase = cross-phase` and `domain` matches the current topic. Inject the **top 5** summaries as context constraints, ordered **severity → phase-match → date** (the CLI's ordering). Widen the window with `tf solutions inject --phase prd --limit <n>` when cross-phase entries saturate it — otherwise this stage's own entries are unreachable. If INDEX.md does not exist or is empty, skip silently — a missing index makes the CLI print one WARN, which is not an error.
12
+ - **Solutions index (v0.5)**: Run `tf solutions inject --phase prd --limit 5` first(CLI 内含 P2-2 见习/红区门控); only if the CLI is unavailable, fall back to reading `docs/solutions/INDEX.md` manually — filter `phase = prd OR cross-phase` + domain match, top 5, ordered **severity → phase-match → date**. **手动降级不降门(P2-2)**:跳过 `flags=probation`(见习)行与红区关键词行(`DP-A`/`Code Landing`/`publish`/`发布闸`/`代码落地`)。If INDEX.md does not exist or is empty, skip silently — a missing index makes the CLI print one WARN, which is not an error(冷启动不计收益 0)。
13
13
 
14
14
  ## Topic Scan (Grounding Scout)
15
15
 
@@ -66,6 +66,11 @@
66
66
 
67
67
  **禁止**:把字段信息写成跨句的散文;**允许**:字段表(更推荐)、编号列表中的单行「字段:规则」。
68
68
 
69
+ **撰写指引剥离(模板实例化,P0-1 同步)**:模板(`templates/prd.md`)中的 `>` 元指令指引段
70
+ (「语汇/精确/完整性」「可解析性」及剥离规则自身)**不写入 PRD 正文**——它们是给撰写者的指令,
71
+ 且自带弱词示例,保留会触发冻结前 `tf prd check-clarity` FAIL(无豁免通道)。执行者侧同步声明见
72
+ `prd-writer` agent 禁令清单。
73
+
69
74
  ---
70
75
 
71
76
  ## 3. 六条生成原则
@@ -99,12 +104,27 @@
99
104
 
100
105
  ## 4. 精确性(弱词规则)
101
106
 
102
- **禁用**:比较级(较快 / 更好)、主观词(友好 / 简洁)、歧义词(支持 / 处理 / 适当)、
103
- 开放式(等 / 尽可能 / 视情况)、漏洞词(必要时 / 一般)。
107
+ **禁用(8 类,ISO/IEC/IEEE 29148 弱词规则;v0.65 后勘误扩全——checker 按本 8 类扫描)**:
108
+ 1. **比较级与最高级**(较快 / 更好 / 最快)——给出比较基准与具体数值;
109
+ 2. **主观评价词**(友好 / 简洁 / 易用 / 美观)——改为可观察的行为描述;
110
+ 3. **歧义词**(支持 / 处理 / 适当 / 尽量 / 总是 / 必要时)——明确条件与边界;
111
+ 4. **开放式表述**(等 / 尽可能 / 视情况 / 至少 / 不限于)——列出确切实例;
112
+ 5. **漏洞词**(可能 / 如适用 / 一般 / 通常)——明确触发条件;
113
+ 6. **否定句单独出现**(「不支持 X」)——改为「当 X 时,系统执行 Y」;
114
+ 7. **连接歧义**(「A 和/或 B」)——拆分条目或用决策表;
115
+ 8. **被动语态**(「应被校验」)——明确动作主体。
104
116
 
105
117
  **理由**:PRD 是下游(plan / spec / 代码生成)的输入。模糊表述**不会**被当作"待澄清",
106
118
  **会被下游自行解释**,产生静默缺陷。精确不是洁癖,是正确性的前提。
107
119
 
120
+ > **机械门校准注(2026-09-25)**:示例词中 **「处理」**(机械扫描会命中模板段名
121
+ > 「系统功能处理说明书」→ 死循环)与 **单字「等」**(子串命中「等待/等于」等一切含字场景)
122
+ > **刻意不入** `prd-clarity.mjs` 机械词表——这两词的判读由 LLM 审查层(prd-completeness-reviewer
123
+ > 精确性检查)覆盖;机械词表对 §4 的其余示例词全量收录。调词表须同步本节(单真相源)。
124
+
125
+ > 第 6–8 类为 2026-09-25 随 DEC-8a 复议补齐(原仅 5 类散文;8 类全集此前散落在工作区
126
+ > 设计文档的镜像弱词表中——单真相源裁定后全集收口于本节)。
127
+
108
128
  ---
109
129
 
110
130
  ## 5. 完整性:内部校验清单(**不写入正文**)
@@ -161,7 +181,10 @@ UI **11 维**:页面布局 / 权限规则 / 区块说明 / 搜索模块 / 表
161
181
  | 4 | 无弱词(见 §4) |
162
182
  | 5 | 维度清单未写入正文(见 §5) |
163
183
 
164
- > **非脚本门禁**:本节不得接入机械门禁脚本(弱词检测先落 LLM 审查层)。
184
+ > **勘误(2026-09-25,DEC-8a 推翻,Q5)**:弱词检测**已**落地机械门 `scripts/guard/checks/prd-clarity.mjs`
185
+ > (`tf prd check-clarity`,冻结前调用)——本文件 §4 为其**规则权威正文**,写 PRD 与调 checker 都以本节为准。
186
+ > LLM 审查层保留并存(checker 管机械可判定项,prd-completeness-reviewer 管语义完整性)。
187
+ > 机械门不检的其余自查节(可读性自查等)仍非脚本门禁。
165
188
 
166
189
  ---
167
190
 
@@ -39,6 +39,14 @@ PRD 文档写入后、Handoff 之前,执行原型内循环。原型是 PRD 的
39
39
 
40
40
  ## 3.5.5 PRD 完整性评审(冻结前门禁,v0.47 全路径适用)
41
41
 
42
+ **前置机械门(agent-governance P0-1,checker 先跑)**:派发 reviewer **之前**先运行清晰度机械门:
43
+
44
+ ```
45
+ tf prd check-clarity <工作区根> # 自动定位 requirement/vN/prd.md
46
+ ```
47
+
48
+ 末行 `STATUS: PASS | FAIL`(FAIL 时退出码非零)——**FAIL → 直接回 Phase 1.3/Phase 3 修订,不派发 reviewer**(机械门已拦,省一轮 LLM 评审);PASS → 继续下方派发。判据与豁免边界见 `scripts/guard/checks/prd-clarity.mjs` 头注(首版无豁免通道:误报改 PRD 或走代码变更调词表)。
49
+
42
50
  **所有 standalone 路径的冻结前必过门禁**:有原型(原型审查通过后)、无 UI 功能点(§3.5.1)、用户跳过原型(§3.5.1)三条路径均须派发——不因跳过原型循环而跳过完整性评审(orchestrated 路径对应 `s2-prd-prototype-loop.md` step 3.5)。
43
51
 
44
52
  派发 `prd-completeness-reviewer` 子代理(独立上下文),评审 PRD「是否完整到能支撑后续 plan/spec 实施」(区别于 Phase 2.6 claim verifier——后者管"说得对不对",本评审管"说得全不全")。
@@ -1,6 +1,6 @@
1
1
  # CONCEPTS.md vocabulary rules
2
2
 
3
- `CONCEPTS.md` defines the words that mean something specific in this codebase — substrate that `docs/solutions/` and AGENTS.md can cite without redefinition. Lives at the repo root. Terms enter two ways — accretion and seeding (below) — and the file is created the first time either path produces a qualifying entry.
3
+ `CONCEPTS.md` defines the words that mean something specific in this codebase — substrate that `docs/solutions/` and AGENTS.md can cite without redefinition. Lives at `docs/architecture/CONCEPTS.md` (the repo-root location was retired in v0.23.0; if a root file exists, migrate it). Terms enter two ways — accretion and seeding (below) — and the file is created the first time either path produces a qualifying entry.
4
4
 
5
5
  ## How terms enter: accretion and seeding
6
6
 
@@ -262,7 +262,7 @@ When creating a new doc, preserve the section order from `assets/resolution-temp
262
262
 
263
263
  **First, read `references/concepts-vocabulary.md`.** This is unconditional. Do not pre-judge from memory that nothing qualifies — the reference's criteria are non-obvious and qualifying terms often live in the surrounding conversation rather than the new doc itself. Reading the reference is what makes the rest of the phase possible.
264
264
 
265
- Then, applying those criteria, scan the new doc **and** the surrounding conversation for qualifying domain terms. If `CONCEPTS.md` exists at repo root, add missing qualifying terms and refine existing entries when new precision surfaced. If it does not exist and at least one qualifying term surfaced, create it.
265
+ Then, applying those criteria, scan the new doc **and** the surrounding conversation for qualifying domain terms. If `docs/architecture/CONCEPTS.md` exists (repo-root location retired in v0.23.0), add missing qualifying terms and refine existing entries when new precision surfaced. If it does not exist and at least one qualifying term surfaced, create it at `docs/architecture/CONCEPTS.md`.
266
266
 
267
267
  **Verify behavior assertions against source before writing them.** When an entry asserts how code behaves (states, transitions, limits, semantics), Read the defining source at the current tree first — an entry drafted from a session-level summary is exactly how wrong semantics enter the glossary. Phase 2.45 re-checks these entries, but the cheap fix is to not write the error.
268
268
 
@@ -384,7 +384,7 @@ After the learning is written and the refresh decision is made, check whether th
384
384
  ```
385
385
  c. In full interactive mode, explain to the user why this matters — agents working in this repo (including fresh sessions, other tools, or collaborators without the plugin) won't know to check `docs/solutions/` unless the instruction file surfaces it. Show the proposed change and where it would go, then use the platform's blocking question tool to get consent before making the edit: `AskUserQuestion` in Claude Code (call `ToolSearch` with `select:AskUserQuestion` first if its schema isn't loaded), `request_user_input` in Codex, `ask_question` in Antigravity CLI (`agy`), `ask_user` in Pi (requires the `pi-ask-user` extension). Fall back to presenting the proposal in chat only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes) — not because a schema load is required. Never silently skip the question. In lightweight mode (interactive or headless), output a one-liner note and move on. In full headless mode, **do not edit instruction files** — surface the gap in the terminal report as `Instruction-file edit: gap noted, not applied` (headless scope is documentation capture, not project-config edits; a human-invoked interactive run applies the edit with consent)
386
386
 
387
- 5. **If `CONCEPTS.md` exists at repo root, run a parallel discoverability check for it.** Assess whether the instruction file would lead an agent to discover the project's shared domain vocabulary. Use the same workflow as the `docs/solutions/` check above: same target file, same edit-placement judgment, same consent-then-edit interaction shape per mode. A line in an existing section is almost always better than a new headed section. Example calibration when nothing else fits:
387
+ 5. **If `docs/architecture/CONCEPTS.md` exists (repo-root location retired in v0.23.0), run a parallel discoverability check for it.** Assess whether the instruction file would lead an agent to discover the project's shared domain vocabulary. Use the same workflow as the `docs/solutions/` check above: same target file, same edit-placement judgment, same consent-then-edit interaction shape per mode. A line in an existing section is almost always better than a new headed section. Example calibration when nothing else fits:
388
388
 
389
389
  ```
390
390
  CONCEPTS.md # shared domain vocabulary (entities, named processes, status concepts) — relevant when orienting to the codebase or discussing domain concepts
@@ -16,7 +16,7 @@ The orchestrator (main conversation) performs ALL of the following in one sequen
16
16
  - YAML frontmatter with track-appropriate fields, applying the YAML-safety quoting rule for array items (see `references/yaml-schema.md` > YAML Safety Rules)
17
17
  - Bug track: Problem, root cause, solution with key code snippets, one prevention tip
18
18
  - Knowledge track: Context, guidance with key examples, one applicability note
19
- 4. **Vocabulary capture (update-only)**: if `CONCEPTS.md` exists at repo root, read `references/concepts-vocabulary.md`, then scan the new doc and the conversation for qualifying terms and add/refine entries silently (same criteria as Phase 2.4). Do **not** bootstrap or seed in lightweight mode — if `CONCEPTS.md` does not exist, defer creation to a Full run, which owns seeding. Record the outcome in the output (e.g., "Vocabulary: 1 entry refined" or "scanned, no qualifying terms"). If you refined `CONCEPTS.md` and the project's active instructions and conventions already in your context do not surface it, add the discoverability tip to the output below — lightweight **tips**, it does not edit instruction files (an interactive Full run owns that edit after consent; headless Full also tips/reports only).
19
+ 4. **Vocabulary capture (update-only)**: if `docs/architecture/CONCEPTS.md` exists (repo-root location retired in v0.23.0 — root-only probe misses bootstrapped projects), read `references/concepts-vocabulary.md`, then scan the new doc and the conversation for qualifying terms and add/refine entries silently (same criteria as Phase 2.4). Do **not** bootstrap or seed in lightweight mode — if `CONCEPTS.md` does not exist, defer creation to a Full run, which owns seeding. Record the outcome in the output (e.g., "Vocabulary: 1 entry refined" or "scanned, no qualifying terms"). If you refined `CONCEPTS.md` and the project's active instructions and conventions already in your context do not surface it, add the discoverability tip to the output below — lightweight **tips**, it does not edit instruction files (an interactive Full run owns that edit after consent; headless Full also tips/reports only).
20
20
  5. **Read-only discoverability check**: Using the project's active instructions and conventions already in your context, assess whether they surface `docs/solutions/` against the three criteria under **Discoverability Check** in `references/full-mode-workflow.md`. Do not open, offer to edit, or edit instruction files; Lightweight only reports the result. Record one of:
21
21
  - `no gap` when active project instructions surface the knowledge store
22
22
  - `gap noted — instruction-file tip emitted` when active project instructions exist but do not surface it
@@ -18,7 +18,7 @@ tf solutions promote <change-dir>
18
18
 
19
19
  满足以下条件的经验从 change 级别晋升到全局 `docs/solutions/`:
20
20
 
21
- - **severity ≥ medium** 且 **type = pitfall 或 pattern** → 晋升到全局 `docs/solutions/<phase>/`
21
+ - **severity ≥ medium** 且 **type = pitfall 或 pattern** → 晋升到全局 `docs/solutions/<phase>/`(`type = correction` 不适用本判定——P2-1 纠错条目由 `tf solutions capture` **直写全局**,不经晋升;其自动注入资格由 P2-2 见习/毕业机制按 confirmations 独立管理)
22
22
  - 与既有条目**文件名与正文签名都相同** → 同一条经验:登记来源 change + 升级 severity(见下「同名条目确认」),**不新建文件**
23
23
  - 与既有条目**同标题但正文不同** → **另一条**经验:新建条目(文件名加 `-2`/`-3` 后缀)——**正文不合并**
24
24
 
@@ -35,7 +35,7 @@ docs/solutions/
35
35
  ---
36
36
  phase: prd # 阶段标签:prd | plan | architecture | prototype | spec | build | review | cross-phase
37
37
  domain: auth # 领域标签(与 PRD/change 的领域对应)
38
- type: pitfall # pitfall | pattern | insight(仅 pitfall/pattern 参与晋升;其余保留在 change 级)
38
+ type: pitfall # pitfall | pattern | insight | correction(correction = P2-1 纠错捕获类,由 capture 直写全局、不经晋升判定;仅 pitfall/pattern 参与 promote 晋升,其余保留在 change 级)
39
39
  severity: high # critical | high | medium | low(序定义于 scripts/lib/severity.mjs)
40
40
  date: 2026-07-15
41
41
  source: change-id # 首次晋升的来源 change
@@ -45,7 +45,7 @@ Collect:
45
45
  - **Tools available + user didn't ask**: Note in output: "Slack tools detected. Ask me to search Slack for organizational context at any point, or include it in your next prompt."
46
46
  - **No tools + user asked**: Note in output: "Slack context was requested but no Slack tools are available. Install and authenticate the Slack plugin to enable organizational context search."
47
47
 
48
- **Solutions index (v0.5)**: Read `docs/solutions/INDEX.md` if it exists. Filter entries where `phase = plan OR phase = cross-phase` and `domain` matches the current topic. Inject the **top 5** summaries as planning constraints, ordered **severity → phase-match → date** (the CLI's ordering); widen with `tf solutions inject --phase plan --limit <n>` when cross-phase entries saturate the window. If INDEX.md does not exist or is empty, skip silently — a missing index makes the CLI print one WARN, which is not an error.
48
+ **Solutions index (v0.5)**: Run `tf solutions inject --phase plan --limit 5` first(CLI 内含见习/红区门控); only if the CLI is unavailable, fall back to reading `docs/solutions/INDEX.md` manually — filter `phase = plan OR cross-phase` + domain match, top 5, ordered **severity → phase-match → date**; widen with `--limit <n>` when cross-phase saturates the window. **手动降级不降门(P2-2)**:跳过 `flags=probation`(见习)行与红区关键词行(`DP-A`/`Code Landing`/`publish`/`发布闸`/`代码落地`)。If INDEX.md does not exist or is empty, skip silently — a missing index makes the CLI print one WARN, which is not an error(冷启动不计收益 0)。
49
49
 
50
50
  ## 1.1b Detect Execution Direction Signals
51
51
 
@@ -79,6 +79,7 @@
79
79
  | ② worker | 停止当前 change 推进;不提交半成品;已落 worktree 的工作**保留** |
80
80
  | ③ worker 记录 | **不写任何决策点字段**。两条禁令:① `dp_N_result` 是门禁判据(`dp-gate-passed` 只校验非空),写入 HOLD 值会让 change 呈现"已批准"假象;② `dp_{1,2,3,5,6,7}_decisions` 与 `dp_{1,2,3,5,6,7}_confirmed`(共 12 个)**已于 v0.59.0 移出 `cmd-state.mjs` 的 `SETTABLE_FIELDS` 白名单**——写入即显式报错 `⛔ Field '...' is not settable` 并以非 0 退出(**原为「回显 ✅ 却零写入」的静默假成功,v0.59.0 P4 实测后改为 fail-loud**;`dp_0_decisions`/`dp_0_confirmed` 不在移除之列,二者确有序列化分支)。HOLD 的持久锚点 = 步④ 的 escalation 消息 + 步⑥ 的 Jarvis 决策日志 + change 的 `state` 仍停在门禁前(客观事实)。**约束**:不得新建 `changes/<name>/` 下任何文件(Artifact Ownership:「主会话」此处指 **worker 侧**的主会话——它 MUST NOT 直接 Edit/Write `changes/` 或 `.worktrees/`;与 Jarvis 侧会话无关) |
81
81
  | ④ worker 上报 | `orca orchestration send --type escalation --subject "HOLD at <门>" --body "<摘要>" --json` |
82
+ | ④' 纠错捕获(**条件触发**,agent-governance P2-1) | HOLD 原因属「本可避免的错误」(方案踩坑/判据误判/返工教训,而非需求变更或外部依赖)时,worker 在上报后执行一次纪律级捕获:`tf solutions capture --phase <prd\|build\|review\|cross-phase> --domain <域> --type correction --severity <high\|medium> --summary "<规则化教训:什么场景 + 错误动作 + 正确做法>" --source-event <escalation msg_id 或决策日志行>`。**纪律级 = 无自动钩子**(pre-tool-use-guard 观测不到 HOLD、状态转换在 HOLD 时也不发生——两候选已证伪),漏捕获可接受、**误捕获(噪声条目)不可接受**;无 HOLD 的正常 change 全程零产出。非 Jarvis 场景的人工纠正本迭代不自动捕获(范围收缩,plan §12) |
82
83
  | ⑤ worker 处置 | 用 `orca orchestration worker-retain --dispatch <id>` 标记保留(**不可用 `worker-release`**——官方禁止因 escalation/question/idle 释放)。**语义澄清**:`worker-retain` 的官方定位是 "keep one supervised worker terminal live for debugging",**HOLD 保活属借用**该语义;保活效果与普通 settled 态的差异尚未实测(设计文档 §7.5 ⑪) |
83
84
  | ⑥ Jarvis | 写决策日志 + 早报「等你决定」段(问题/选项/Jarvis 倾向/依据/msg_id) |
84
85
 
@@ -171,6 +171,7 @@ If implementation diverged from the contract, return to `bridging` before closur
171
171
  **planned(v0.64.0:回写与审查全前置,transition 是最后一步——closing 段 light 维度在 transition 时一次性校验,④⑤ 后置会死锁,B-13):**
172
172
  ```
173
173
  ① tf arch-merge <change-dir> --light ← 有架构 surface 才跑;持久源 = 最小 architecture.md(+api/database delta)
174
+ ⚠ 前置 ①-pre 语义段照跑(产 .arch-delta.json)——--light 只是消费方,**不得绕过 delta 校验**(P3 M-5 回指)
174
175
  ② tf test-merge <change-dir> --light ← 有测试触碰才跑;changelog 首行写 change:<name> 归因锚
175
176
  ③ tf solutions capture <args> --source "change:<name>" ← 必执行(归因 = --source;含「无新增决策」空捕获;禁 compound_skipped 自清)
176
177
  ④ final-review.md 复核(≥5 行;**回写之后**核验台账条目 vs diff 抽样,B-01/D5)
@@ -194,6 +195,26 @@ If implementation diverged from the contract, return to `bridging` before closur
194
195
 
195
196
  **架构快照门禁(arch-snapshot,v0.36.0 / v0.36.3)**:本轮迭代产品级架构快照 `iterations/vN/architecture.md` 必须已落盘("先快照后回写"强制化)。**FAIL 升级路径**:回 orchestrator 的 ARCH 阶段补快照;存量升级在途 change(快照缺失但 change 有增量产物)→ WARN 兜底放行;`arch_baseline` 缺失 → WARN 不阻断。hotfix/tweak 豁免(不挂该维度)。判定逻辑见插件内 `scripts/guard/checks/arch-gate-exemptions.mjs`(引用,非调用)。
196
197
 
198
+ ### ①-pre · 语义段:产 `architecture/.arch-delta.json`(O8 两段式,P0-B'' · 在 ① 之前执行)
199
+
200
+ 在 `tf arch-merge` **之前**,从本 change 的架构制品语义抽取结构化增量,写入
201
+ `changes/<name>/architecture/.arch-delta.json`(schema:`delta_version: 1` + `change` + `generated_at` +
202
+ `entries[]`,每条 = `kind/op/key/fields`,kind ∈ `aggregate|bounded_context|subdomain|table|endpoint|event|context_map`,
203
+ op ∈ `new|extend|refactor|retire`——权威定义见**工作区设计文档**(非本插件运行时)`docs/plan/ddd-purity-and-arch-merge-design.md` §5.4-4c):
204
+
205
+ - **必填纪律(A8 机械层,两类处置不同——P4 Major 修正)**:`new`/`extend` 必带 `evidence`(指向本 change 制品出处,
206
+ 如 `architecture.md:§3.2`;含引用文件存在性)——**软着陆期 evidence 类缺失/路径不存在 → WARN 且条目照常消费**,
207
+ v0.66.0 起 abort;`retire`/`refactor` 必带 `reason`(`refactor` 另必带 `prev_key`)——**此二者属结构错误,
208
+ 缺失立即 abort(无软着陆豁免,结构坏无法安全消费)**。
209
+ - **物理事实无需穷举**:DDL 新表、api.md 新端点由确定段**机械补种**(漏登记会 WARN 提示);
210
+ 但**语义意图只经本制品**——`retire`/`refactor`/字段富化/事件(`event`,经 `fields.owner_aggregate` 挂宿主)/
211
+ 上下文映射(`context_map`,经 `fields.source_bc` 挂宿主)**漏写不会被补种**。
212
+ - **基线/既有键上写 `new` 会被软着陆降级为 `extend`**(R3-3)——扩展既有聚合直接写 `extend`。
213
+ - **确定段零 LLM**:`tf arch-merge` 读本制品 → schema 校验 → 合并进 `docs/architecture/.registry/registry.json`
214
+ (首次自动 seed 既有基线,红牌 12)→ 从 registry 生成下游产物。`--light` 不得绕过本制品的校验。
215
+ - **缺失 = 软着陆期合法**(arch-merge 自动走 legacy 重算路径并登记 WARN);**新 change SHOULD 产出**,
216
+ v0.66.0 起 MUST(硬切,退出条件见设计方案 §5.4-7)。direct 分支跳过回写,不产 delta。
217
+
197
218
  ### ① Architecture Merge (v0.10 §28-§31) — MUST run first(legacy/full 序列;planned 走上方 ⚠ 块 ① `--light`,direct 跳过)
198
219
 
199
220
  Merge change-level architecture artifacts to the global `docs/architecture/` baseline **before** the state transition and before any other post-verification step:
@@ -16,7 +16,7 @@ tf prototype-sync <change-dir>
16
16
  >
17
17
  > ① **门禁只能在转换点校验**:`executing→closing` 现挂 `arch-merged` guard 维度——转换时校验全局 `docs/architecture/ARCHITECTURE.md` 已含本 change 增量(marker 区来源列 `change:<name>` **或** 演进日志锚 `### change:<name>`,双通道)。**未回写则转换被拒**。故 arch-merge 必须先于转换执行。
18
18
  > ② **原顺序下"未回写"在状态机层面不可见**:旧序把 arch-merge 放在转换**之后**,而 `VALID_STATES` 无 `closed`、`closing→closed` 转换不存在 → arch-merge 在状态机上**没有任何锚点**,其成败无门禁考核。这是"架构变更必须合并进台账"这条原则长期停留在**文档承诺**而非**代码强制**的机制原因。
19
- > ③ **与 `arch-snapshot` 不冲突**:两者同挂本转换(`arch-snapshot` 是 v0.36.0 的"先快照后回写"),但**维度之间无数据依赖**——`arch-snapshot` 只读 `docs/architecture/iterations/`,`arch-merge` 全流程不触碰该目录(已逐行核对)。"先快照后回写"仍是语义前提(快照在 ARCH 阶段产出,早于整个 closing)。
19
+ > ③ **与 `arch-snapshot` 不冲突**:两者同挂本转换(`arch-snapshot` 是 v0.36.0 的"先快照后回写"),但**维度之间无数据依赖**——`arch-snapshot` 只读 `docs/architecture/iterations/`,`arch-merge` 自 P0-B'-① 起(ddd-purity v1.5)**只读不写**该目录(seedFromSnapshots 读快照聚合),不构成数据依赖(P4 skill-reviewer 修正:原「全流程不触碰(已逐行核对)」已过期)。"先快照后回写"仍是语义前提(快照在 ARCH 阶段产出,早于整个 closing)。
20
20
  > ④ **逃生通道**:若本 change 确无架构增量可回写,登记 `tf state set <change-dir> arch_merge_skipped true` + `arch_merge_skip_reason "<理由>"`,该维度即豁免。注意:跳过键**只豁免门禁维度**,不改变 `tf arch-merge` 命令自身的退出码——命令的失败按 **owner 归属**判定,非本 change 的解析失配只报 WARN,不会阻断你(v0.53.0 §115.8)。
21
21
 
22
22
  If `prototype-sync` reports conflicts, list them in the closing summary and flag for manual resolution. Do not block closing on prototype-sync conflicts (advisory level).