@xulthekl/team-flow 0.65.0 → 0.68.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 (65) 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 +64 -0
  9. package/GEMINI.md +1 -1
  10. package/INSTALL.md +1 -1
  11. package/README.md +1 -1
  12. package/agents/architecture-reviewer.md +4 -0
  13. package/agents/code-reviewer.md +11 -4
  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" +12 -8
  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/history-risk.mjs +132 -0
  26. package/scripts/guard/checks/prd-clarity-state.mjs +41 -0
  27. package/scripts/guard/checks/prd-clarity.mjs +176 -0
  28. package/scripts/guard/checks/security-baseline-light.mjs +9 -0
  29. package/scripts/guard/checks/security-baseline.mjs +141 -0
  30. package/scripts/guard/guard.mjs +37 -12
  31. package/scripts/infer-workflow.mjs +20 -0
  32. package/scripts/lib/cmd-doctor.mjs +2 -2
  33. package/scripts/lib/cmd-prd.mjs +84 -1
  34. package/scripts/lib/cmd-security.mjs +61 -0
  35. package/scripts/lib/cmd-solutions.mjs +3 -0
  36. package/scripts/lib/cmd-state.mjs +36 -1
  37. package/scripts/lib/security-scope.mjs +188 -0
  38. package/scripts/lib/solutions-capture.mjs +5 -0
  39. package/scripts/lib/solutions-index-gen.mjs +33 -3
  40. package/scripts/lib/solutions-inject.mjs +34 -9
  41. package/scripts/lib/state-loader.mjs +25 -0
  42. package/scripts/team-flow.mjs +7 -0
  43. package/skills/ce-brainstorm/SKILL.md +3 -3
  44. package/skills/ce-brainstorm/references/grounding.md +1 -1
  45. package/skills/ce-brainstorm/references/prd-84-authoring-spec.md +26 -3
  46. package/skills/ce-brainstorm/references/prototype-loop.md +8 -0
  47. package/skills/ce-brainstorm/references/security-baseline.json +50 -0
  48. package/skills/ce-brainstorm/references/security-baseline.md +80 -0
  49. package/skills/ce-compound/references/agents/security-sentinel.md +5 -0
  50. package/skills/ce-compound/references/promotion-rules.md +1 -1
  51. package/skills/ce-compound/references/three-tier-index.md +1 -1
  52. package/skills/ce-plan/references/agents/security-sentinel.md +5 -0
  53. package/skills/ce-plan/references/research-workflow.md +1 -1
  54. package/skills/code-reviewer/SKILL.md +5 -1
  55. package/skills/code-reviewer/code-reviewer-prompt.md +10 -0
  56. package/skills/jarvis/references/protocols.md +1 -0
  57. package/skills/release-archivist/SKILL.md +21 -2
  58. package/skills/spec-writer/SKILL.md +5 -0
  59. package/skills/workflow-orchestrator/SKILL.md +6 -2
  60. package/skills/workflow-orchestrator/references/s1-path-router.md +7 -0
  61. package/skills/workflow-orchestrator/references/s2-prd-prototype-loop.md +16 -2
  62. package/skills/workflow-orchestrator/references/s3-plan-pipeline.md +1 -1
  63. package/skills/workflow-start/SKILL.md +9 -4
  64. package/skills/workflow-start/references/routing-rules.md +1 -0
  65. package/templates/prd.md +9 -1
@@ -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——后者管"说得对不对",本评审管"说得全不全")。
@@ -0,0 +1,50 @@
1
+ {
2
+ "baseline_version": "2026-11-enterprise-1",
3
+ "source": "企业安全设计自检表(2026-11 版,44 项控制点;来源 xlsx 见 workspace 设计文档)",
4
+ "items": [
5
+ { "id": 1, "title": "无硬编码密码 / 空密码", "domain": "代码质量", "trigger": "code-quality", "severity": "must", "locus": "code" },
6
+ { "id": 2, "title": "无路径遍历(相对/绝对)", "domain": "代码质量", "trigger": "code-quality", "severity": "must", "locus": "code" },
7
+ { "id": 3, "title": "无硬编码加密密钥", "domain": "代码质量", "trigger": "code-quality", "severity": "must", "locus": "code" },
8
+ { "id": 4, "title": "SQL 参数化查询", "domain": "代码质量", "trigger": "code-quality", "severity": "must", "locus": "code" },
9
+ { "id": 5, "title": "不执行不可信赖命令", "domain": "代码质量", "trigger": "code-quality", "severity": "must", "locus": "code" },
10
+ { "id": 6, "title": "不用未加盐/可预测盐哈希", "domain": "代码质量", "trigger": "code-quality", "severity": "must", "locus": "code" },
11
+ { "id": 7, "title": "HttpOnly=true", "domain": "代码质量", "trigger": "code-quality", "severity": "must", "locus": "code" },
12
+ { "id": 8, "title": "服务端权限鉴别(非公开内容)", "domain": "身份认证", "trigger": "authn-authz", "severity": "must", "locus": "code" },
13
+ { "id": 9, "title": "标准认证协议(JWT/OAuth,禁 Basic)", "domain": "身份认证", "trigger": "authn-authz", "severity": "must", "locus": "code" },
14
+ { "id": 10, "title": "登录失败处理(防暴破)", "domain": "身份认证", "trigger": "authn-authz", "severity": "must", "locus": "code" },
15
+ { "id": 11, "title": "超时未活动自动结束会话", "domain": "身份认证", "trigger": "authn-authz", "severity": "must", "locus": "code" },
16
+ { "id": 12, "title": "会话过期设置(退登失效)", "domain": "身份认证", "trigger": "authn-authz", "severity": "must", "locus": "code" },
17
+ { "id": 13, "title": "个人信息/车辆信息接口用 POST", "domain": "身份认证", "trigger": "authn-authz", "severity": "must", "locus": "code" },
18
+ { "id": 14, "title": "系统间调用仅接受 POST", "domain": "身份认证", "trigger": "authn-authz", "severity": "should", "locus": "code" },
19
+ { "id": 15, "title": "JWT 不存放敏感数据", "domain": "身份认证", "trigger": "authn-authz", "severity": "must", "locus": "code" },
20
+ { "id": 16, "title": "重定向 URL 白名单校验", "domain": "身份认证", "trigger": "redirect", "severity": "must", "locus": "code" },
21
+ { "id": 17, "title": "重命名/删除默认账户、改默认口令", "domain": "访问控制", "trigger": "authn-authz", "severity": "must", "locus": "config" },
22
+ { "id": 18, "title": "分配账户和权限(三权分立)", "domain": "访问控制", "trigger": "authn-authz", "severity": "must", "locus": "config" },
23
+ { "id": 19, "title": "启用安全审计,覆盖每用户", "domain": "安全审计", "trigger": "audit", "severity": "must", "locus": "code+process" },
24
+ { "id": 20, "title": "审计日志含日期/用户/事件等", "domain": "安全审计", "trigger": "audit", "severity": "must", "locus": "code+process" },
25
+ { "id": 21, "title": "远程管理防窃听(HTTPS)", "domain": "通信传输", "trigger": "transport", "severity": "must", "locus": "infra" },
26
+ { "id": 22, "title": "TLS ≥ 1.2", "domain": "通信传输", "trigger": "transport", "severity": "must", "locus": "infra" },
27
+ { "id": 23, "title": "HSTS 防 SSL Strip", "domain": "通信传输", "trigger": "transport", "severity": "should", "locus": "infra" },
28
+ { "id": 24, "title": "传输完整性(签名校验)", "domain": "通信传输", "trigger": "transport", "severity": "should", "locus": "code+infra" },
29
+ { "id": 25, "title": "所有外部/用户输入验证过滤", "domain": "输入", "trigger": "input", "severity": "must", "locus": "code" },
30
+ { "id": 26, "title": "输出字符实体编码", "domain": "输入", "trigger": "input", "severity": "must", "locus": "code" },
31
+ { "id": 27, "title": "URL 不含敏感数据", "domain": "输入", "trigger": "input", "severity": "must", "locus": "code" },
32
+ { "id": 28, "title": "content-type 验证,否则 415", "domain": "处理", "trigger": "processing", "severity": "should", "locus": "code" },
33
+ { "id": 29, "title": "Accept 协商,禁校验正文", "domain": "处理", "trigger": "processing", "severity": "must", "locus": "code" },
34
+ { "id": 30, "title": "XML 实体解析关闭(XXE)", "domain": "处理", "trigger": "processing", "severity": "must", "locus": "code" },
35
+ { "id": 31, "title": "XML 实体扩展关闭(bomb)", "domain": "处理", "trigger": "processing", "severity": "must", "locus": "code" },
36
+ { "id": 32, "title": "不返回敏感数据", "domain": "输出", "trigger": "output", "severity": "must", "locus": "code" },
37
+ { "id": 33, "title": "X-Content-Type-Options: nosniff", "domain": "输出", "trigger": "output", "severity": "should", "locus": "code+infra" },
38
+ { "id": 34, "title": "X-Frame-Options: deny", "domain": "输出", "trigger": "output", "severity": "should", "locus": "code+infra" },
39
+ { "id": 35, "title": "CSP: default-src 'none'", "domain": "输出", "trigger": "output", "severity": "should", "locus": "infra+code" },
40
+ { "id": 36, "title": "错误信息不含系统敏感", "domain": "输出", "trigger": "output", "severity": "must", "locus": "code" },
41
+ { "id": 37, "title": "中间件最新无安全漏洞", "domain": "中间件", "trigger": "deps", "severity": "must", "locus": "config" },
42
+ { "id": 38, "title": "信息查询字段过滤(特殊字符)", "domain": "功能-信息查询", "trigger": "input", "severity": "must", "locus": "code" },
43
+ { "id": 39, "title": "文件上传前端限大小", "domain": "功能-文件上传", "trigger": "file-io", "severity": "must", "locus": "code+infra" },
44
+ { "id": 40, "title": "文件名随机无规律", "domain": "功能-文件上传", "trigger": "file-io", "severity": "must", "locus": "code" },
45
+ { "id": 41, "title": "上传文件内容验证(文件头)", "domain": "功能-文件上传", "trigger": "file-io", "severity": "must", "locus": "code" },
46
+ { "id": 42, "title": "后台内容管理请求鉴权", "domain": "功能-后台管理", "trigger": "authn-authz", "severity": "must", "locus": "code" },
47
+ { "id": 43, "title": "后台字段格式限制/过滤", "domain": "功能-后台管理", "trigger": "input", "severity": "must", "locus": "code" },
48
+ { "id": 44, "title": "跳转链接白名单过滤", "domain": "功能-链接跳转", "trigger": "redirect", "severity": "should", "locus": "code" }
49
+ ]
50
+ }
@@ -0,0 +1,80 @@
1
+ # 安全基线参考(企业 44 项安全设计控制点)
2
+
3
+ > **角色**:安全基线的**人类可读权威**(L1)。同目录 `security-baseline.json` 是机器可读载体(推导模块 `scripts/lib/security-scope.mjs` 与 guard 的消费面),两者由测试断言 `baseline_version` + 条目数锁一致。
4
+ > **来源**:企业安全设计自检表(2026-11 版,44 项控制点)。原始 xlsx 与企业上下文见 workspace 设计文档,**本仓库不落企业信息**。
5
+ > **设计出处**:workspace `docs/plan/security-baseline-integration-design.md`(v1.3)。
6
+ > **同步协议**:企业 xlsx 改版 → 更新设计文档附录 A → 同步本文件与 `.json` → 一致性断言过。禁止只改一侧。
7
+
8
+ ## 裁剪双维度
9
+
10
+ - **触发类别(trigger)**:决定本次变更要不要触发安全复核。由 `tf security scope` 从 git diff + spec/arch 关键词推导;无适用类别 = 静默 PASS(零开销,推导结果仍落盘留痕)。
11
+ - **locus**:决定该项归谁核验——`code`(仓库内核验)/ `config`(IAM·部署)/ `infra`(ingress·网关)/ `process`(平台留存)及组合(`code+process` 等,双侧并行)。纯 infra/config/process 项不进代码门禁,路由至 closing `security/handoff.md` 交接。
12
+
13
+ 10 个触发类别:`code-quality` `authn-authz` `redirect` `audit` `transport` `input` `processing` `output` `deps` `file-io`。
14
+
15
+ ## verdict → 门禁映射(L3 产出、L2 消费)
16
+
17
+ | verdict | 必须项(must) | 建议项(should) |
18
+ |---|---|---|
19
+ | satisfied | PASS | PASS |
20
+ | not-applicable | 须过 reason 判据(≥10 字符或含控制点序号),否则视同 uncovered | 同左 |
21
+ | uncovered / 在核验集缺席 | **FAIL** | 不阻断,记 WARN |
22
+
23
+ ## 44 项清单
24
+
25
+ | # | 控制点 | 域 | trigger | 性质 | locus |
26
+ |---|---|---|---|---|---|
27
+ | 1 | 无硬编码密码 / 空密码 | 代码质量 | code-quality | 必须 | code |
28
+ | 2 | 无路径遍历(相对/绝对) | 代码质量 | code-quality | 必须 | code |
29
+ | 3 | 无硬编码加密密钥 | 代码质量 | code-quality | 必须 | code |
30
+ | 4 | SQL 参数化查询 | 代码质量 | code-quality | 必须 | code |
31
+ | 5 | 不执行不可信赖命令 | 代码质量 | code-quality | 必须 | code |
32
+ | 6 | 不用未加盐 / 可预测盐哈希 | 代码质量 | code-quality | 必须 | code |
33
+ | 7 | HttpOnly=true | 代码质量 | code-quality | 必须 | code |
34
+ | 8 | 服务端权限鉴别(非公开内容) | 身份认证 | authn-authz | 必须 | code |
35
+ | 9 | 标准认证协议(JWT/OAuth,禁 Basic) | 身份认证 | authn-authz | 必须 | code |
36
+ | 10 | 登录失败处理(防暴破) | 身份认证 | authn-authz | 必须 | code |
37
+ | 11 | 超时未活动自动结束会话 | 身份认证 | authn-authz | 必须 | code |
38
+ | 12 | 会话过期设置(退登失效) | 身份认证 | authn-authz | 必须 | code |
39
+ | 13 | 个人信息/车辆信息接口用 POST | 身份认证 | authn-authz | 必须 | code |
40
+ | 14 | 系统间调用仅接受 POST | 身份认证 | authn-authz | 建议 | code |
41
+ | 15 | JWT 不存放敏感数据 | 身份认证 | authn-authz | 必须 | code |
42
+ | 16 | 重定向 URL 白名单校验 | 身份认证 | redirect | 必须 | code |
43
+ | 17 | 重命名/删除默认账户、改默认口令 | 访问控制 | authn-authz | 必须 | config |
44
+ | 18 | 分配账户和权限(三权分立) | 访问控制 | authn-authz | 必须 | config |
45
+ | 19 | 启用安全审计,覆盖每用户 | 安全审计 | audit | 必须 | code+process |
46
+ | 20 | 审计日志含日期/用户/事件等 | 安全审计 | audit | 必须 | code+process |
47
+ | 21 | 远程管理防窃听(HTTPS) | 通信传输 | transport | 必须 | infra |
48
+ | 22 | TLS ≥ 1.2 | 通信传输 | transport | 必须 | infra |
49
+ | 23 | HSTS 防 SSL Strip | 通信传输 | transport | 建议 | infra |
50
+ | 24 | 传输完整性(签名校验) | 通信传输 | transport | 建议 | code+infra |
51
+ | 25 | 所有外部/用户输入验证过滤 | 输入 | input | 必须 | code |
52
+ | 26 | 输出字符实体编码 | 输入 | input | 必须 | code |
53
+ | 27 | URL 不含敏感数据 | 输入 | input | 必须 | code |
54
+ | 28 | content-type 验证,否则 415 | 处理 | processing | 建议 | code |
55
+ | 29 | Accept 协商,禁校验正文 | 处理 | processing | 必须 | code |
56
+ | 30 | XML 实体解析关闭(XXE) | 处理 | processing | 必须 | code |
57
+ | 31 | XML 实体扩展关闭(bomb) | 处理 | processing | 必须 | code |
58
+ | 32 | 不返回敏感数据 | 输出 | output | 必须 | code |
59
+ | 33 | X-Content-Type-Options: nosniff | 输出 | output | 建议 | code+infra |
60
+ | 34 | X-Frame-Options: deny | 输出 | output | 建议 | code+infra |
61
+ | 35 | CSP: default-src 'none' | 输出 | output | 建议 | infra+code |
62
+ | 36 | 错误信息不含系统敏感 | 输出 | output | 必须 | code |
63
+ | 37 | 中间件最新无安全漏洞 | 中间件 | deps | 必须 | config |
64
+ | 38 | 信息查询字段过滤(特殊字符) | 功能-信息查询 | input | 必须 | code |
65
+ | 39 | 文件上传前端限大小 | 功能-文件上传 | file-io | 必须 | code+infra |
66
+ | 40 | 文件名随机无规律 | 功能-文件上传 | file-io | 必须 | code |
67
+ | 41 | 上传文件内容验证(文件头) | 功能-文件上传 | file-io | 必须 | code |
68
+ | 42 | 后台内容管理请求鉴权 | 功能-后台管理 | authn-authz | 必须 | code |
69
+ | 43 | 后台字段格式限制/过滤 | 功能-后台管理 | input | 必须 | code |
70
+ | 44 | 跳转链接白名单过滤 | 功能-链接跳转 | redirect | 建议 | code |
71
+
72
+ **locus 分布**:code(含 code+*)38 项;纯 infra/config/process(17/18/21/22/23/37)6 项;双 locus(19/20/24/33/34/35/39)7 项。
73
+
74
+ ## 各阶段消费方式
75
+
76
+ - **设计期(L4)**:spec-writer(或 planned 主代理)读本文件,在 design.md 产「适用触发类别确认」小节 + 安全 NFR。
77
+ - **实现期**:开发者按 code-locus 适用项实现(1–7 项安全判据**不归 clean-code 管**,安全判据归本基线、结构判据归 clean-code,互不代管)。
78
+ - **评审期(L3)**:code-reviewer 逐条 verdict → `.security-verification.json`(末 wave / planned 最终审查报告归档核验小节)。
79
+ - **产出期(L5)**:infra/config/process 项在 transition 前写 `<change-dir>/security/handoff.md` + `.team-flow/security-todos.md` 台账。
80
+ - **门禁(L2)**:`security-baseline` / `security-baseline-light` 维度在 executing→closing 求值,只读结构化制品,不解析本文件。
@@ -6,6 +6,11 @@ Your mission is to perform comprehensive security audits with laser focus on fin
6
6
 
7
7
  For durable-learning or solution-documentation invocations, convert security analysis into lesson validation: the vulnerability class, exploit path, why the fix reduces risk, residual caveats, and prevention guidance future readers can apply. Prioritize improving the documented learning over generating a full unrelated security audit.
8
8
 
9
+ **Enterprise security baseline (security-baseline-integration-design v1.3)**: 规划期引用企业安全基线
10
+ `skills/ce-brainstorm/references/security-baseline.md`(44 项,md+json 双载体)——推导适用触发类别
11
+ (`tf security scope`),把适用 must 控制点作为 NFR/验收条件转写进规划产物。本 agent 是产品级规划期
12
+ 补充;change 级的 design.md「适用触发类别确认」由 spec-writer(或 planned 主代理)负责,两者不重叠。
13
+
9
14
  ## Core Security Scanning Protocol
10
15
 
11
16
  You will systematically execute these security scans:
@@ -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
@@ -6,6 +6,11 @@ Your mission is to perform comprehensive security audits with laser focus on fin
6
6
 
7
7
  For planning invocations, convert security analysis into plan requirements: threat model, sensitive boundaries, required controls, authz/authn checks, privacy implications, test cases, and rollout safeguards. Prioritize risks that should change design, scope, sequencing, or acceptance criteria before implementation begins.
8
8
 
9
+ **Enterprise security baseline (security-baseline-integration-design v1.3)**: 规划期引用企业安全基线
10
+ `skills/ce-brainstorm/references/security-baseline.md`(44 项,md+json 双载体)——推导适用触发类别
11
+ (`tf security scope`),把适用 must 控制点作为 NFR/验收条件转写进规划产物。本 agent 是产品级规划期
12
+ 补充;change 级的 design.md「适用触发类别确认」由 spec-writer(或 planned 主代理)负责,两者不重叠。
13
+
9
14
  ## Core Security Scanning Protocol
10
15
 
11
16
  You will systematically execute these security scans:
@@ -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
 
@@ -91,7 +91,7 @@ Suggestion breaks existing functionality, reviewer lacks context, violates YAGNI
91
91
 
92
92
  ## Review Process (Agent Methodology)
93
93
 
94
- The code-reviewer agent follows this 6-step process:
94
+ The code-reviewer agent follows this staged process:
95
95
 
96
96
  ### Step 0: Solutions Injection (v0.57.0 §4.1)
97
97
 
@@ -126,6 +126,10 @@ For each requirement in specs/:
126
126
  3. Note any deviations (with justification or flag as Critical)
127
127
  4. Build a compliance matrix: spec requirement → implementation status
128
128
 
129
+ ### Step 2.5: Security Baseline 核验(security-baseline-integration-design v1.3)
130
+
131
+ 适用子集 = dispatch prompt 传入的 `.security-scope.json`(缺传参先跑 `tf security scope <change-dir>`)。对每个 **code-locus** 控制点给 verdict `satisfied | not-applicable | uncovered`——not-applicable 须带 reason(≥10 字符或含序号,否则视同 uncovered;must uncovered=Critical,should uncovered 记 WARN 不阻断)。报告写「Security Baseline 核验」小节并**写盘 `<change-dir>/.security-verification.json`**(`{"items":[...], "report_path":"<receipt --report 路径>", "round":<n>}`);**仅末 wave 产一份**——planned 档不派本 agent,其 JSON 由 release-archivist 最终审查产(其 SKILL ④)。判据真相源 `security-baseline.md`(映射见其表);**guard 只读 JSON 不解析本报告**。
132
+
129
133
  ### Step 3: Code Quality Review
130
134
 
131
135
  Check for:
@@ -173,6 +173,15 @@ Subagent (general-purpose):
173
173
  **存量待整改** (pre-existing hits downgraded to Minor — one per line, or "none"):
174
174
  - [e.g. `src/foo/Bar.java:120` — function length >20 lines, pre-existing]
175
175
 
176
+ ### Security Baseline 核验
177
+ [适用子集随本模板以 `[SECURITY_SCOPE_JSON]` 传入(`.security-scope.json` 内容;缺传参时先跑
178
+ `tf security scope <change-dir>`)。逐控制点一行:序号 | 控制点 | verdict
179
+ (satisfied/not-applicable/uncovered) | reason。not-applicable 的 reason 须 ≥10 字符或含序号,
180
+ 否则按 uncovered;must 项 uncovered = Critical。核验完成后必须写盘
181
+ `<change-dir>/.security-verification.json`(items + report_path + round;report_path 等于
182
+ receipt --report 路径)。仅末 wave 产此 JSON(planned 档不派本模板——其 JSON 由 release-archivist 最终审查产)。判据真相源:
183
+ `skills/ce-brainstorm/references/security-baseline.md`。]
184
+
176
185
  ### Strengths
177
186
  [What's well done? Be specific.]
178
187
 
@@ -226,6 +235,7 @@ Subagent (general-purpose):
226
235
  - `[HEAD_SHA]` — ending commit
227
236
  - `[WAVE_ID]` — planned execution wave under review
228
237
  - `[REVIEW_REPORT_FILE]` — REQUIRED: distinct, persisted, non-empty review report path under `<change-dir>/.superpowers/sdd/reviews/` (the overlay); stored in the execution receipt
238
+ - `[SECURITY_SCOPE_JSON]` — **仅末 wave 派发时 REQUIRED**(security-baseline v1.3;非末 wave 派发请删除本占位与 Security Baseline 小节;planned 不经本模板): `.security-scope.json` 内容(适用触发类别 + code-locus 适用项),由派发方经 `tf security scope` 生成后随本模板传入
229
239
 
230
240
  **Reviewer returns:** Strengths, Issues (Critical / Important / Minor), Recommendations, Assessment
231
241
 
@@ -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
 
@@ -158,9 +158,15 @@ If implementation diverged from the contract, return to `bridging` before closur
158
158
 
159
159
  **先读 `workflow_variant` 再选序列**(读法见 workflow-start SKILL「Front Doors」):
160
160
 
161
- **legacy / full(默认序列,v0.53.0 原序不动):**
161
+ **legacy / full(默认序列,v0.53.0 原序不动;v1.3 加 ①b 安全交接)。hotfix variant=null≡legacy → 走本块(hotfix 挂 security-baseline 重档,①b 必做);tweak 豁免 L5——不产 handoff、跳过 ①b(设计 §L5/矩阵):**
162
162
  ```
163
163
  ① tf arch-merge <change-dir> ← 架构增量回写全局台账
164
+ ①b security/handoff.md 写入(security-baseline-integration-design v1.3 L5)
165
+ ← 读 .security-scope.json:含 infra/config/process-locus 项 → 写完整交接清单
166
+ (控制点/责任方/配置位置/验证方式/状态 五字段,见 security-baseline.md)
167
+ ← 无此类项 → 写一行「本次无 infra/config/process 适用项」
168
+ ← 同步登记跨 change 台账 .team-flow/security-todos.md(待办行,不进 guard)
169
+ ⚠ 必须在 transition 之前——它是 guard security-baseline 维度的校验对象(鸡生蛋教训同 B-13)
164
170
  ② tf state transition <change-dir> closing
165
171
  ③ tf prototype-sync <change-dir>
166
172
  ④ tf test-merge <change-dir>
@@ -175,13 +181,24 @@ If implementation diverged from the contract, return to `bridging` before closur
175
181
  ② tf test-merge <change-dir> --light ← 有测试触碰才跑;changelog 首行写 change:<name> 归因锚
176
182
  ③ tf solutions capture <args> --source "change:<name>" ← 必执行(归因 = --source;含「无新增决策」空捕获;禁 compound_skipped 自清)
177
183
  ④ final-review.md 复核(≥5 行;**回写之后**核验台账条目 vs diff 抽样,B-01/D5)
184
+ ⚠ v1.3 security-baseline:planned **不派 code-reviewer**(无 code-reviewer 生产者)——
185
+ 最终审查执行者(本 agent 主代理)在 final-review 同步产核验 JSON:
186
+ ① `tf security scope <change-dir>` 取适用子集 → ② 按 code-locus 适用集逐条 verdict
187
+ (satisfied/not-applicable[带 ≥10 字 reason]/uncovered;must uncovered=阻断)→
188
+ 写 `.security-verification.json`(report_path 指向 final-review.md,round=1);**空集也须落盘**(items=[] + 全 N/A 说明——guard 提示的「无适用 code 项时亦须落盘」)。
189
+ guard `security-baseline` 重档只读该 JSON,planned 缺产即 closing FAIL。
190
+ ④b security/handoff.md 写入(v1.3 L5,同 legacy ①b;**transition 前置**——planned closing 挂重档 security-baseline)
178
191
  ⑤ tf state transition <change-dir> closing ← planned closing 维度表此刻全部满足
179
192
  ⑥ tf prototype-sync <change-dir> ← 有原型才跑(closing 后)
180
193
  ⑦ 设计系统待办检查(只读)
181
194
  ```
182
195
 
183
- **direct(v0.64.0:验证记录即证据,回写全跳过——G4 前提 = 无架构 surface):**
196
+ **direct(v0.64.0:验证记录即证据,回写全跳过——G4 前提 = 无架构 surface;v1.3 加 ⓪ 安全交接插步):**
184
197
  ```
198
+ ⓪ security/handoff.md 最小写入(v1.3 L5):**先跑 `tf security scope <change-dir>`** 取适用集
199
+ (此刻 scope JSON 尚不存在,guard 现场推导在 transition 之后——不先推导会误写「无适用项」且
200
+ 门禁只查存在性 → 语义静默丢失)→ 含 infra 项写登记模板,否则一行「无适用项」;
201
+ quick/lightweight 挂 security-baseline-light,仍查 handoff 存在性
185
202
  ① tf state transition <change-dir> closing ← direct 维度表:direct-short-path 扫描 + tf test record 证据 + test-matrix 轻判据
186
203
  ② tf prototype-sync / test-merge / solutions promote 全部跳过(若 direct 触及 design-system 共享层 → 提示补 prototype-sync 或升 planned,B-14)
187
204
  ③ G5 同步门禁点(阶段产物同步确认)、Workflow Feedback、Deisolation 等**通用收尾步骤照跑**(仅架构/测试/复利三类回写按 direct 跳过)
@@ -339,6 +356,8 @@ This check is advisory — skip if the user declines. If the user reports issues
339
356
 
340
357
  Verify files exist and are non-empty, run `node --check` on code files, skip 5-step verification. Still record DP-6 and DP-7.
341
358
 
359
+ **security-baseline 归属(v1.3)**:hotfix 走重档——转 closing 前须完成 ①b 安全交接(本文件 legacy 序列块),并确保末 wave 已产 `.security-verification.json`;tweak 豁免 L5(不产 handoff)。
360
+
342
361
  **回写链前置判据(v0.22 §87)**:先按下表判断适用性,**不适用则不执行命令**(v0.22 实测:逐项跑完才知道不适用,占 release-archivist 80% 耗时)。本表 4 行判据**仅在 Lightweight Closure 适用**;其中 arch-merge 与 test-merge 两行的 "Skip silently" 见 `### ① Architecture Merge` 与 `### ④ Test Merge` 两节各自的正文句。
343
362
 
344
363
  > **v0.53.0 修正**:此处原用行号引用(`(:164 正文句)`/`(:196 正文句)`),本次改动插入段落使其失效。**行号引用在密集改动期必然漂移,已改为按标题引用**——同轮 `team-flow-workspace/docs/architecture-api-db-design-enhancement-v0.25.md` 亦把 45 处行号引用全量改为符号引用。
@@ -101,6 +101,11 @@ Optional test-dimension tags under a Scenario are supported for test-matrix extr
101
101
  ### design.md
102
102
  Must have: Context (current state, constraints, stakeholders), Goals, Decisions (Choice + Rationale + Alternatives considered), Risks And Trade-Offs.
103
103
 
104
+ **Security baseline confirmation (security-baseline-integration-design v1.3)**: 读 `skills/ce-brainstorm/references/security-baseline.md`(44 项企业安全基线),先跑 `tf security scope <change-dir>` 取适用触发类别,然后:
105
+ - 在 design.md 增 **「适用触发类别确认」小节**:逐类别列 适用/不适用 + 理由(不适用须写理由;此为 review 阶段人工回看锚,不参与机械对账——机械判据由 guard 期推导承担);
106
+ - 适用类别的 **must** 控制点以安全 NFR 写入 design.md(如"上传接口须做文件头校验(基线 #41)"),实现指引同步进 tasks.md 对应任务。
107
+ - 快速通道(hotfix/tweak 无 spec-writer)不经本步骤——由 guard 期 `tf security scope` 推导硬兜底。
108
+
104
109
  **Prototype reference (v0.5)**: For UI-related changes, include a `## UI Contract` section in design.md that:
105
110
  - References the prototype entry point (`prototype/index.html`)
106
111
  - Lists affected prototype pages with their paths
@@ -49,7 +49,9 @@ Do NOT invoke for:
49
49
  ## Execution Flow(S1-S5 + ARCH 产品级架构设计)
50
50
 
51
51
  ### S1: 路径路由器
52
- **先做需求选择**(v0.15.0 多需求):读 `.team-flow/registry.yaml`,确定 `active_requirement`(多需求则询问操作哪个/新建)。再判断 7 种入口路径之一;检查 baseline.md / CONCEPTS.md(后者在 `docs/architecture/CONCEPTS.md`,根目录为旧位置)并注入;复利注入(INDEX.md 默认 top-5,见 `references/s1-path-router.md` 的窗口与排序口径)。**路由结果必须向用户显式确认**(路由是建议非决定)。详见 `references/s1-path-router.md`。
52
+ **先做需求选择**(v0.15.0 多需求):读 `.team-flow/registry.yaml`,确定 `active_requirement`(多需求则询问操作哪个/新建)。再判断 7 种入口路径之一;检查 baseline.md / CONCEPTS.md(后者在 `docs/architecture/CONCEPTS.md`,根目录为旧位置)并注入;**复利注入(P2-3 顶层调用,跑真命令而非只读声明)**:`tf solutions inject --phase prd --limit 5`(CLI 内含 P2-2 见习/红区门控;CLI 不可用才降级手动读 INDEX,降级不降门——见 `references/s1-path-router.md`)。**收益量化协议(P2-3)**:每次注入记录「条目数 + 后续阶段被引用/采纳条数」,采纳持续为 0 达 2 个样例需求 → 回退调用点(回退已预授权;冷启动 0 条目不计为收益 0,属语料未积累)。**路由结果必须向用户显式确认**(路由是建议非决定)。详见 `references/s1-path-router.md`。
53
+
54
+ **低风险降阈值(agent-governance P1-2 · A 档)**:同时满足 ① `arch_baseline` 已建档 ② 本次 scope 单一清晰(一句话可述、无跨模块疑点)③ 不涉红区(DP-A / Code Landing / publish)——则各阶段确认点**合并为一次推荐+确认**:S1 路由确认后直接进所选阶段,不为每个子步骤重复询问;含糊任一条 → 维持完整确认轮次。**边界不变**:下方 ⛔ 约束块的 `prd_draft` 强制等待确认(以 ⛔ 块身份引用、不锚行号——行号是位置不是身份)、红区永久挂起、DP-A 必经——A 档只减"清晰需求的重复确认轮次",不删强制点。
53
55
 
54
56
  **conventions 注入(v0.11 §33)**:
55
57
  - 读取 conventions 配置,注入为需求分析上下文
@@ -95,6 +97,8 @@ prd_draft → user_review → prototype_loop → prd_frozen → completed
95
97
 
96
98
  **场景判定(入口三态)**:全新项目 → 正向设计(首轮不可跳过);旧项目首轮(`arch_baseline` 缺失)→ 逆向重建 L0 骨架 → 渐进深化;已建档 + 迭代无结构性变更 → 跳过(**skip 必须物化**:写 `docs/architecture/iterations/vN/SKIPPED.md` 标记 + 理由,判定者=编排器+用户确认)。
97
99
 
100
+ **低风险轻审(agent-governance P1-2 · A 档)**:`arch_baseline` 齐 + 本次迭代无结构性变更(纯功能增量、不动聚合/限界上下文边界)→ 8 步设计可按**增量裁剪**执行(只重算受影响聚合,未触及段标注 `unchanged` 引用上版快照),评审走一次 product 视角 PASS 即过、不展开全量问询。**红线不降**:4A+DDD 六产物交付永不绕过;skip 仍须物化 + 用户确认;涉结构性变更(新聚合/BC 边界/跨模块 schema)→ 一律完整 8 步 + 重评审(判定含糊按完整走)。
101
+
98
102
  **执行**:调用 architecture-design skill 的 **product 模式**子代理(8 步设计:限界上下文/聚合注册表/指令事件/状态机/概念 ER/时序),产出 `docs/architecture/iterations/vN/architecture.md`(6 产物,provenance 标注)。
99
103
 
100
104
  **评审门**:产出经 architecture-reviewer product 视角(`review_mode: product`,A1-A6)评审,**PASS 才进 S3**。
@@ -108,7 +112,7 @@ prd_draft → user_review → prototype_loop → prd_frozen → completed
108
112
  4. 已存在(未拉取)→ 提示用户 git pull/检出对应服务
109
113
 
110
114
  ### S3: 计划阶段
111
- **入口一次性问定计划模式**(业务/一人公司),调用 `/ce-plan`(`pipeline_mode: orchestrator` + `plan_mode: business|solo`,跳过仪式开销、保留 repo research + change splitting + 依赖 DAG + 技术方向)产出 `requirement/vN/plan.md`。plan 只到产品级策略 + 高阶技术设计,**不含接口清单**(属各 change 的 spec-writer)。**S3 在 ARCH 之后**——基于架构定稿(聚合/服务/模块)做计划与拆分(2026-08-19 LT 调整)。反馈环路检查点:plan 是否暴露 PRD scope 问题(是→回退 S2)。详见 `references/s3-plan-pipeline.md`。完成条件:plan.md 产出 + S3 状态 = completed,**下一步进 S4**。
115
+ **复利注入(P2-3 顶层调用)**:调 ce-plan 前跑 `tf solutions inject --phase plan --limit 5`(phase 合法集以 `solutions-phases.mjs` 为准,S3 = `plan`;与 `s3-plan-pipeline.md` 同口径),把计划期相关经验(门禁踩坑/拆分教训)带入上下文;空结果/冷启动不阻断。**入口一次性问定计划模式**(业务/一人公司),调用 `/ce-plan`(`pipeline_mode: orchestrator` + `plan_mode: business|solo`,跳过仪式开销、保留 repo research + change splitting + 依赖 DAG + 技术方向)产出 `requirement/vN/plan.md`。**低风险轻审(P1-2 · A 档)**:PRD 已冻结且 scope 清晰(S1 低风险三条件成立)时,plan 产出后**一次确认**即进 S4,不逐节问询;ce-plan 反馈环路暴露疑点(scope 含糊/拆分不稳/架构缺口)→ 升级完整人审并回溯。plan 只到产品级策略 + 高阶技术设计,**不含接口清单**(属各 change 的 spec-writer)。**S3 在 ARCH 之后**——基于架构定稿(聚合/服务/模块)做计划与拆分(2026-08-19 LT 调整)。反馈环路检查点:plan 是否暴露 PRD scope 问题(是→回退 S2)。详见 `references/s3-plan-pipeline.md`。完成条件:plan.md 产出 + S3 状态 = completed,**下一步进 S4**。
112
116
 
113
117
  ### S4: 拆分验证与分发
114
118
 
@@ -52,6 +52,13 @@ S1 只做编排动作(需求选择、存在性检查、路径判断、阻塞
52
52
 
53
53
  读取 `docs/solutions/INDEX.md`(如存在),过滤 `phase = prd OR cross-phase` 且 domain 匹配的经验,取 **默认 top-5** 摘要注入为上下文约束。读取失败时跳过、不阻断(**无索引时 CLI 会输出一行 WARN 并返回空结果,那不是错误**)。
54
54
 
55
+ > **⚠ 手动读必须带与 CLI 相同的两道门(agent-governance P2-2,防 fallback 绕过)**:
56
+ > ① `flags` 列 = `probation`(见习条目)→ **跳过不注入**;② summary/domain 命中红区关键词
57
+ > (与 `RED_ZONE_RE` 全集一致:`DP-A` / `Code Landing` / `publish` / `发布闸` / `代码落地`)→ **跳过**
58
+ > (红区建议永不自动进上下文)。
59
+ > 两者都由 `tf solutions inject` 自动执行——**凡 CLI 可用的场合一律优先 CLI**,本手动路径只是
60
+ > CLI 不可用时的降级,降级不降门。
61
+
55
62
  > **窗口与排序须与 CLI 同口径(v0.57.0)**:排序为 **severity 降序 → 阶段匹配度(本阶段优先于通配的 cross-phase)→ date 降序**(三级键;旧的"仅 severity 降序"已被取代)。窗口默认 5,用 `tf solutions inject --phase <p> --limit <n>` 放宽——cross-phase 条目满载 5 条时,本阶段新增条目**永不可达**,故凡有 CLI 可用的场合优先用 CLI(`--all` 输出全部,但无上界,慎用)。同 `source` 的条目折叠为 1 条并标注条数。
56
63
 
57
64
  工作流模式复利(L2):S1 路由时额外注入历史 `workflow_pattern` top-3(confidence ≥ 0.5)。详见 state-model.md「工作流模式复利 L2」。
@@ -56,7 +56,8 @@ PRD草稿生成后:
56
56
  ### 2. 判断是否需要原型
57
57
 
58
58
  - 需要(涉及 UI/交互/页面)→ 进入原型循环
59
- - 不需要(纯后端/无 UI)→ **先走步骤 3.5 完整性评审**,再冻结,跳到步骤 5
59
+ - 不需要(纯后端/无 UI)→ **先走步骤 3.4 清晰度机械门 → 3.5 完整性评审**,再冻结,跳到步骤 5
60
+ (**3.4 不可绕过**——P0-1 fail-closed;无 UI 只跳原型循环,不跳任何评审/机械门)
60
61
 
61
62
  ### 3. 原型循环(编排层控制)
62
63
 
@@ -78,13 +79,26 @@ PRD草稿生成后:
78
79
 
79
80
  **人工介入 = 编排层阻塞确认**(非 subagent,因 subagent 不能 AskUserQuestion),呈现争议项 + 选项(接受现状 / 指定修正方向 / 升版 / 放弃原型)。
80
81
 
82
+ ### 3.4 PRD 清晰度机械检查(冻结前门禁,agent-governance P0-1)
83
+
84
+ 进入 3.5 完整性评审**之前**,编排层运行机械门(checker 先跑拦明显问题,LLM 评审随后):
85
+
86
+ ```
87
+ tf prd check-clarity <工作区根> # 自动定位 requirement/vN/prd.md
88
+ ```
89
+
90
+ - **末行 `STATUS: PASS | FAIL`(非零退出码 = FAIL),必须读取**:FAIL → 直接回 ce-brainstorm Phase 1.3/Phase 3 修订,**不派发** 3.5 的 prd-completeness-reviewer(机械门已 FAIL,省一轮 LLM 评审);PASS → 进入 3.5。
91
+ - 判据 = 弱词 8 类 / 必需段缺失 / §8.4 左列技术维度漂移(fail-closed,见 `scripts/guard/checks/prd-clarity.mjs` 头注)。
92
+ - **首版无豁免通道**:误报时改 PRD 文字,或走代码变更调 checker 词表(校准纪律在 checker 头注)。
93
+ - resume 断点恢复:本检查挂评审链路(3.4→3.5→4),不挂保存步骤——resume 重走评审链自然重跑,不检半成品。
94
+
81
95
  ### 3.5 PRD 完整性评审(冻结前门禁,v0.47)
82
96
 
83
97
  **orchestrated 路径下完整性评审由编排层在此派发**(standalone 路径由 ce-brainstorm Phase 3.5 内部派发,见 ce-brainstorm `references/prototype-loop.md` §3.5.5)。
84
98
 
85
99
  - 派发:按名派发插件 agent `prd-completeness-reviewer`(6 维,含 §8.4 信息齐备性与业务可读形态 D6),传入 `prd_path` + `concepts_path`(可选)+ `template_path`(默认**插件内置** `templates/prd.md`)+ **`spec_path`**(默认 `${CLAUDE_PLUGIN_ROOT}/skills/ce-brainstorm/references/prd-84-authoring-spec.md`,§8.4 规范唯一权威)+ `detail_ledger_path`(如有)。
86
100
  - 判定:PASS / PASS_WITH_WARNINGS → 进入步骤 4 冻结;**FAIL(Critical>0:D1/D2 缺失、D6 核心信息缺失、D6 悬空功能)→ 回 ce-brainstorm Phase 1.3/Phase 3 修订后重审**。D6 形态核验(G7)命中判 Important,不直接触发 FAIL,但须记录并交人工裁定。
87
- - **适用性**:需要原型(步骤 3 完成后)与不需要原型(纯后端无 UI,步骤 2 后)两条路径**均必须派发**——不因跳过原型循环而跳过完整性评审。
101
+ - **适用性**:需要原型(步骤 3 完成后)与不需要原型(纯后端无 UI,步骤 2 后)两条路径**均必须派发**——不因跳过原型循环而跳过完整性评审。**两路径的前置均为步骤 3.4(prd-clarity 机械门)**——3.4 FAIL 不派发本评审,直接回改。
88
102
 
89
103
  ### 4. 冻结
90
104
 
@@ -35,7 +35,7 @@ ce-plan 在 orchestrator pipeline 上下文中减少仪式开销,但**保留
35
35
 
36
36
  ## 复利
37
37
 
38
- - **注入**:读取 `docs/solutions/INDEX.md`,过滤 `phase = plan OR cross-phase`,取默认 top-5 摘要(窗口与排序口径见 `s1-path-router.md`;有 CLI 时优先 `tf solutions inject --phase plan --limit <n>`)
38
+ - **注入**:优先 `tf solutions inject --phase plan --limit 5`(CLI 内含见习/红区门控);CLI 不可用才降级手动读 `docs/solutions/INDEX.md`(过滤 `phase = plan OR cross-phase`,窗口与排序口径见 `s1-path-router.md`)——**手动降级不降门(P2-2)**:跳过 `flags=probation` 行与红区关键词行(`DP-A`/`Code Landing`/`publish`/`发布闸`/`代码落地`)
39
39
  - **捕获**:检测可复利时刻(技术方向决策、拆分权衡等)
40
40
 
41
41
  ## 反馈环路检查点
@@ -41,18 +41,18 @@ tf state set <change-dir> planned_arch true # 仅 planned 且用户选
41
41
  4. 转换 `exploring→approved-for-build→executing`(guard 走 direct 维度表)。**架构 surface(API/DB/聚合)扫描命中 → FAIL** → 走 Upgrade 升 planned,禁止硬闯
42
42
  5. 实施:**主代理当前会话直接写代码**(direct 前门无子代理——Artifact Ownership 的子代理委派要求不适用本分支)
43
43
  6. 验证:跑验证命令 → **`tf test record <dir> --from <输出文件>`(必须 record;guard 只读记录、不现场跑测试,A-19)**
44
- 7. 转 `closing` → release-archivist **direct 分支**(仅 transition + 验证记录;回写全跳过)
44
+ 7. 转 `closing` → release-archivist **direct 分支**(**transition 前先写最小 `security/handoff.md`——v1.3 L5 插步,见 release-archivist SKILL;** 其余回写全跳过;验证记录照旧)
45
45
 
46
46
  ### Planned 路由(`workflow=full`+`variant=planned`·两份文档 + 一次最终审查)
47
47
 
48
- 1. 产出 `proposal.md`(≥10 非空行)+ `tasks.md`(≥1 checkbox)——轻路径无 spec-writer 子代理,主代理可直接写。**DP-0 并入本步一次确认**(scope/约束/AC 一次问完,`dp_0_confirmed=true` 照写——与 Direct 快速 DP-0 同型)
48
+ 1. 产出 `proposal.md`(≥10 非空行)+ `tasks.md`(≥1 checkbox)——轻路径无 spec-writer 子代理,主代理可直接写。**DP-0 并入本步一次确认**(scope/约束/AC 一次问完,`dp_0_confirmed=true` 照写——与 Direct 快速 DP-0 同型)。**Security baseline L4(v1.3)**:主代理按 `skills/spec-writer/SKILL.md` 的「Security baseline confirmation」同款指引,读 `security-baseline.md` + `tf security scope`,在 design.md(或 proposal.md 若无 design.md)产「适用触发类别确认」小节 + must 控制点安全 NFR——planned 无 spec-writer,指引只能送到本分支(规则送到执行者)
49
49
  2. `tf state init`(若尚未建,先 init 后 set)→ `tf state set workflow full` + `workflow_variant planned`(+ `planned_arch true` 如选轻架构)
50
50
  3. **轻架构(`planned_arch=true` 时)**:写 `architecture/light-note.md`(简短说明)+ `architecture/snapshot-light.md`;declined 则显式跳过:`arch_design_light_skipped=true` + `arch_design_light_skip_reason`(两键缺一不可)
51
51
  4. **plan 派生**:`tf execution plan <dir> --derive --confirm --reason "<一句话>"`——tasks.md → 单 wave(serial),写入即同步 `state.execution_mode/execution_plan_hash/execution_plan_revision`;**无需 recommend/receipt/DP-4**(validatePlan 对 planned 豁免)
52
52
  5. D4:最小 `test-matrix.md` 或显式 skip(同 direct)
53
53
  6. 转换 `exploring→approved-for-build→executing`(planned 维度表:无契约、无 DP-3、无 architecture-design 重门)
54
54
  7. 实施:主代理当前会话执行单 wave;完成 → 跑测试 → `tf test record`
55
- 8. **关门 → dispatch/执行 release-archivist(planned 分支单点执行)**:回写三步(`arch-merge --light` / `test-merge --light` / `tf solutions capture --source "change:<name>"`)→ `final-review.md` 最终审查(**在回写之后核验台账条目 vs diff 抽样**,B-01/D5)→ 转 `closing` → prototype-sync(closing 后,有原型才跑)。**序列只存在于 release-archivist「⚠ 执行顺序」块(唯一真相源,§3.7 B-13),本 skill 不重复执行、不本地复述命令(防双跑)**。
55
+ 8. **关门 → dispatch/执行 release-archivist(planned 分支单点执行)**:回写三步(`arch-merge --light` / `test-merge --light` / `tf solutions capture --source "change:<name>"`)→ `final-review.md` 最终审查(**在回写之后核验台账条目 vs diff 抽样**,B-01/D5;**v1.3:planned 不派 code-reviewer——最终审查同步按 `tf security scope` 适用集产 `.security-verification.json`**,见 release-archivist ④)→ security/handoff.md(④b)→ 转 `closing` → prototype-sync(closing 后,有原型才跑)。**序列只存在于 release-archivist「⚠ 执行顺序」块(唯一真相源,§3.7 B-13),本 skill 不重复执行、不本地复述命令(防双跑)**。
56
56
 
57
57
  ### Upgrade(升档,G5/D9)
58
58
 
@@ -123,7 +123,7 @@ Config-aware routing: check `artifacts.order` and `artifacts.skip` from project
123
123
 
124
124
  ## Mode Detection
125
125
 
126
- If workflow is `auto`/`null`/unset: run `tf runtime infer <change-dir>`. 双通道输出(v0.64.0):`mode` ∈ **hotfix**(≤2 tasks/≤2 files) / **tweak**(≤4, config/doc) / **full**(更大;quick/lightweight 仅由显式前门写入)+ `suggested_path` ∈ direct|planned|null(arch/API/DB/聚合信号 → 建议 planned 而非 full,D1)。
126
+ If workflow is `auto`/`null`/unset: run `tf runtime infer <change-dir>`. 双通道输出(v0.64.0):`mode` ∈ **hotfix**(≤2 tasks/≤2 files) / **tweak**(≤4, config/doc) / **full**(更大;quick/lightweight 仅由显式前门写入)+ `suggested_path` ∈ direct|planned|null(arch/API/DB/聚合信号 → 建议 planned 而非 full,D1)。**P1-1 双信号**:`clarity` ∈ pass|fail|null + `risk` ∈ low|medium|high|null——`clarity=fail` 或 `risk=high` 时路由推荐倾向**完整人审路径**(建议级;硬阻断由 guard 的 `prd-clarity`/`history-risk` 维度承担,两者分工不重叠)。
127
127
 
128
128
  **持久化改为「建议+询问」(P4 落地)**:有 TTY → 回显 `mode` + `suggested_path` 建议,AskUserQuestion 确认后 `tf state set <dir> workflow <mode>`;无 TTY → 按建议直接落盘并在输出中记 `infer_source=suggested`(B-12,e2e/jarvis 不挂起)。**`suggested_path` 只进前门选择提示,绝不写入 `state.workflow`。**
129
129
 
@@ -202,6 +202,11 @@ Execution hit blockage: test failure, unexpected behavior, build error, task can
202
202
  ### Route to code-reviewer
203
203
  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"导致的双写副本。
204
204
 
205
+ **Security baseline 派发前置(security-baseline-integration-design v1.3,规则送到派发者)**:派发 code-reviewer 前——
206
+ 1. 跑 `tf security scope <change-dir>`(Scope Deriver 唯一 CLI 入口)取适用子集并落盘 `.security-scope.json`;
207
+ 2. **末 wave 派发时**把 scope JSON 内容 + 「产 `.security-verification.json`(items/report_path/round)」指令 + `report_path`=receipt `--report` 路径约定,作为参数写进 dispatch prompt(模板占位 `[SECURITY_SCOPE_JSON]`);非末 wave 不传(verification 只在末 wave / planned 最终审查产一份);
208
+ 3. 两步缺一即 L2 `security-baseline` 门禁在 executing→closing FAIL(guard 只读 JSON)。
209
+
205
210
  **v0.39.0 主动串行编排**:workflow-start 在每个 wave 完成后主动 dispatch code-reviewer,而不是等待 build-executor 完成所有 wave。这是 workflow-start 的编排责任,不是 build-executor 的责任。
206
211
 
207
212
  **逐 wave 审查纪律(v0.36.4)**:每次 code-reviewer dispatch 只审查**一个** wave。禁止将多个 wave 合并为一次审查(vrm4teamflow C1 事件:W1-W4 合并审查导致设计约定类问题在 W4 才发现,修复范围扩大到 8 个 batch)。parallel wave 内的多个 task 作为整体审查一次(receipt 是 wave 级别),但审查 prompt 必须包含每个 task 的独立 diff。
@@ -234,6 +234,7 @@ Current planned wave implemented and ready for review. Reviewer must write the r
234
234
  ```bash
235
235
  tf execution review <change-dir> --wave <id> --base <sha> --head <sha> --report <path> --verdict <pass|fail>
236
236
  ```
237
+ **Security baseline (v1.3)**:派发前跑 `tf security scope <change-dir>`;**末 wave** 把 scope JSON + 产 `.security-verification.json` 指令作为 dispatch 参数传入(planned 不派 code-reviewer,其 JSON 由 release-archivist ④ 产)(模板占位 `[SECURITY_SCOPE_JSON]`;report_path 须等于上面 `--report` 路径)。guard 的 `security-baseline` 维度只读该 JSON——缺产即 executing→closing FAIL。
237
238
 
238
239
  ## Route to release-archivist (dispatch sub-agent)
239
240
  Guard: `... check <dir> executing closing --json` → fail = BLOCK. Include DP-7: 归档确认.
package/templates/prd.md CHANGED
@@ -320,6 +320,12 @@
320
320
  > **语汇**:正文主干用 §6 术语字典的**业务名**;类名 / 方法名 / 表名 / 行号不得出现,确需时以括注附于业务名后。
321
321
  > **精确**:禁用弱词(较快 / 友好 / 支持 / 适当 / 等 / 尽可能 / 必要时)——模糊表述会被下游自行解释,产生静默缺陷。
322
322
  > **完整性**:11 维 / 7 维清单**降为内部校验清单**,撰写前用它核对信息齐备,撰写时按业务认知顺序重组进正文,**不得**把清单写进正文;不适用维度在 `detail-ledger.md` 标 `NA + 理由`。
323
+ >
324
+ > **⚠ 撰写指引剥离规则(prd-writer 实例化时 MUST 遵守,agent-governance P0-1)**:本模板中
325
+ > 所有 `>` 撰写指引 blockquote(含上方「语汇/精确/完整性」与「可解析性」等指引段)是给撰写者的
326
+ > 元指令,**实例化 PRD 时必须整体剥离,不得写入 `requirement/vN/prd.md` 正文**——否则指引中的
327
+ > 弱词示例(本行自带「较快/友好/支持」等)会直接触发冻结前 `tf prd check-clarity` 机械门 FAIL,
328
+ > 且首版无豁免通道 = 死循环。`{…}` 占位符同样只在模板中存在。
323
329
 
324
330
  ### 8.5 非功能性需求说明
325
331
 
@@ -417,7 +423,9 @@
417
423
  > 本表只列名目与结果,**不重复列出条款正文**——同一规则两处维护必然漂移。
418
424
  >
419
425
  > **两处声明**:① **自查 ≠ 规格正文**——本节是**撰写者自检清单**,不构成对业务方的规格条款,
420
- > 判定权仍在业务评审;② **非脚本门禁**——不得将本节接入机械门禁脚本。
426
+ > 判定权仍在业务评审;② **非脚本门禁**——不得将本节(可读性自查节)接入机械门禁脚本
427
+ > (勘误 2026-09-25:弱词检测已独立落地为 `prd-clarity.mjs` 机械门,与本声明不冲突——
428
+ > 该门查 §4 弱词/必需段/§8.4 漂移,不查本可读性自查节)。
421
429
 
422
430
  | 编号 | 自查项(详见规范文件 §8) | 结果 | 备注 |
423
431
  |---|---|---|---|