agentic-flow-kit 1.5.0 → 1.7.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.
- package/modules/hosts/claude/commands/wf-build.md +7 -0
- package/modules/hosts/claude/commands/wf-design.md +6 -0
- package/modules/hosts/claude/commands/wf-new-task.md +2 -0
- package/modules/hosts/codex/commands/wf-build.md +7 -0
- package/modules/hosts/codex/commands/wf-design.md +6 -0
- package/modules/hosts/codex/commands/wf-new-task.md +2 -0
- package/modules/hosts/cursor/commands/wf-build.md +7 -0
- package/modules/hosts/cursor/commands/wf-design.md +6 -0
- package/modules/hosts/cursor/commands/wf-new-task.md +2 -0
- package/modules/hosts/opencode/commands/wf-build.md +7 -0
- package/modules/hosts/opencode/commands/wf-design.md +6 -0
- package/modules/hosts/opencode/commands/wf-new-task.md +2 -0
- package/modules/hosts/trae/commands/wf-build.md +7 -0
- package/modules/hosts/trae/commands/wf-design.md +6 -0
- package/modules/hosts/trae/commands/wf-new-task.md +2 -0
- package/package.json +1 -1
- package/src/run-tests.mjs +16 -9
- package/src/sync-hosts.mjs +100 -62
- package/src/sync-hosts.test.mjs +39 -0
- package/templates/AGENTS.md +2 -1
- package/templates/_agents/commands/build.md +7 -0
- package/templates/_agents/commands/design.md +6 -0
- package/templates/_agents/commands/new-task.md +2 -0
- package/templates/_agents/scripts/check-ledger-invariant.mjs +18 -0
- package/templates/_agents/scripts/check-ledger-invariant.test.mjs +16 -0
- package/templates/_agents/scripts/check-loop.mjs +122 -28
- package/templates/_agents/scripts/check-loop.test.mjs +121 -0
- package/templates/_agents/scripts/check-stage-index.mjs +40 -0
- package/templates/_agents/scripts/check-stage-index.test.mjs +77 -0
- package/templates/_agents/scripts/confirm-doc.mjs +52 -3
- package/templates/_agents/scripts/confirm-doc.test.mjs +51 -1
- package/templates/_agents/scripts/edit-face-check.mjs +107 -0
- package/templates/_agents/scripts/edit-face-check.test.mjs +98 -0
- package/templates/_agents/scripts/fill-intent.mjs +32 -3
- package/templates/_agents/scripts/fill-intent.test.mjs +13 -0
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +52 -1
- package/templates/_agents/scripts/policy.mjs +62 -0
- package/templates/_agents/scripts/verify-wiki-consistency.test.mjs +81 -0
- package/templates/_agents/scripts/verify.mjs +11 -3
- package/templates/_agents/scripts/verify.test.mjs +30 -3
- package/templates/_agents/scripts/wiki-search.test.mjs +58 -0
- package/templates/_agents/scripts-test-exempt.txt +2 -3
- package/templates/_github/workflows/kit-ci.yml +21 -1
|
@@ -8,6 +8,12 @@ description: Build 阶段:起 plan + 实现代码 + 自验(确认后才动代码
|
|
|
8
8
|
|
|
9
9
|
> AI 起草 plan,用户确认;进计划模式列改动,用户确认;最后才动代码。两道确认门。
|
|
10
10
|
|
|
11
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
12
|
+
|
|
13
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
14
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
15
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:plan 任务拆解与两道确认门位置。
|
|
16
|
+
|
|
11
17
|
## 1. 执行
|
|
12
18
|
|
|
13
19
|
### 1.1 起草 plan
|
|
@@ -53,6 +59,7 @@ description: Build 阶段:起 plan + 实现代码 + 自验(确认后才动代码
|
|
|
53
59
|
## 4. 改权威源后必跑(薄适配同步防漏)
|
|
54
60
|
|
|
55
61
|
- 改 `templates/_agents/{commands,roles}/*.md` 正文后跑 `node bin/flow-kit.mjs sync-hosts --diff` → 拍板 → `--apply` 单向同步(只动正文段,frontmatter 不动);口径与边界详见 `.agents/commands/sync-hosts.md`
|
|
62
|
+
- 改根 `AGENTS.md`(owned 常驻面)后跑 `node .agents/scripts/edit-face-check.mjs`——工作树面快检(阶段索引/引用/预算 advisory),别等提交门才发觉砍坏(2026-10-09 B2)
|
|
56
63
|
|
|
57
64
|
## 5. 改 doctor / check-loop 后必跑(三处口径对账)
|
|
58
65
|
|
|
@@ -6,6 +6,12 @@ description: Design 阶段:起 spec(L2/L3 强制,L1 可省略)
|
|
|
6
6
|
|
|
7
7
|
> L2/L3 强制;L1 走快车道(直接跳 `next: build.md` 起草 Quick-Plan)。
|
|
8
8
|
|
|
9
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
10
|
+
|
|
11
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
12
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
13
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:spec 方案取舍与 L3 复核安排。
|
|
14
|
+
|
|
9
15
|
## 1. 执行
|
|
10
16
|
|
|
11
17
|
1. 确认同名入口文档已批准:新需求为 approved intent,修复为已确认的 incident 草稿;否则拒绝,分别回 `plan.md` / `maintain.md`(2026-09-30 起机器强制:fill-spec / confirm-doc 对前置未过直接拒绝 exit 2、不落盘不记账)。
|
|
@@ -27,6 +27,8 @@ description: AI-Native 闭环总入口:6 阶段指令索引(Plan→Design→Buil
|
|
|
27
27
|
| **协作道**(敏捷优先,审计异步补) | L0 例行 / L1 实现级 | L0 直接 commit,豁免 intent;L1 快车道(intent 一句话确认 + 极简 plan)即动工。独立复核不设同步前置,check-loop 与事后 review 兜底;确认/代录可 `--batch` 批量(仅 L0/L1) |
|
|
28
28
|
| **防御道**(严谨优先,确认同步拦) | L2 规则/契约 / L3 数据与运行时结构 | 同步确认门:spec 确认通过方可起草 plan,plan 确认后方可动手;L3 加新会话独立复核,未确认不放行 |
|
|
29
29
|
|
|
30
|
+
> **L2/L3 起草期合并预览**:三件套起草按 [design.md §0](design.md) 一次呈现要点总览(逐件确认代录不变)。
|
|
31
|
+
>
|
|
30
32
|
> 定级结果落 intent frontmatter `risk_level`(=级别,`fill-intent.mjs` 自动写入,机器选道用);协作道勾触达红线会被 check-loop 判「红线判低」hard 拦(就高升级 L2/L3 并补同名 spec)。
|
|
31
33
|
|
|
32
34
|
## 3. 路由判断
|
|
@@ -8,6 +8,12 @@ description: Build 阶段:起 plan + 实现代码 + 自验(确认后才动代码
|
|
|
8
8
|
|
|
9
9
|
> AI 起草 plan,用户确认;进计划模式列改动,用户确认;最后才动代码。两道确认门。
|
|
10
10
|
|
|
11
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
12
|
+
|
|
13
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
14
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
15
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:plan 任务拆解与两道确认门位置。
|
|
16
|
+
|
|
11
17
|
## 1. 执行
|
|
12
18
|
|
|
13
19
|
### 1.1 起草 plan
|
|
@@ -53,6 +59,7 @@ description: Build 阶段:起 plan + 实现代码 + 自验(确认后才动代码
|
|
|
53
59
|
## 4. 改权威源后必跑(薄适配同步防漏)
|
|
54
60
|
|
|
55
61
|
- 改 `templates/_agents/{commands,roles}/*.md` 正文后跑 `node bin/flow-kit.mjs sync-hosts --diff` → 拍板 → `--apply` 单向同步(只动正文段,frontmatter 不动);口径与边界详见 `.agents/commands/sync-hosts.md`
|
|
62
|
+
- 改根 `AGENTS.md`(owned 常驻面)后跑 `node .agents/scripts/edit-face-check.mjs`——工作树面快检(阶段索引/引用/预算 advisory),别等提交门才发觉砍坏(2026-10-09 B2)
|
|
56
63
|
|
|
57
64
|
## 5. 改 doctor / check-loop 后必跑(三处口径对账)
|
|
58
65
|
|
|
@@ -6,6 +6,12 @@ description: Design 阶段:起 spec(L2/L3 强制,L1 可省略)
|
|
|
6
6
|
|
|
7
7
|
> L2/L3 强制;L1 走快车道(直接跳 `next: build.md` 起草 Quick-Plan)。
|
|
8
8
|
|
|
9
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
10
|
+
|
|
11
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
12
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
13
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:spec 方案取舍与 L3 复核安排。
|
|
14
|
+
|
|
9
15
|
## 1. 执行
|
|
10
16
|
|
|
11
17
|
1. 确认同名入口文档已批准:新需求为 approved intent,修复为已确认的 incident 草稿;否则拒绝,分别回 `plan.md` / `maintain.md`(2026-09-30 起机器强制:fill-spec / confirm-doc 对前置未过直接拒绝 exit 2、不落盘不记账)。
|
|
@@ -27,6 +27,8 @@ description: AI-Native 闭环总入口:6 阶段指令索引(Plan→Design→Buil
|
|
|
27
27
|
| **协作道**(敏捷优先,审计异步补) | L0 例行 / L1 实现级 | L0 直接 commit,豁免 intent;L1 快车道(intent 一句话确认 + 极简 plan)即动工。独立复核不设同步前置,check-loop 与事后 review 兜底;确认/代录可 `--batch` 批量(仅 L0/L1) |
|
|
28
28
|
| **防御道**(严谨优先,确认同步拦) | L2 规则/契约 / L3 数据与运行时结构 | 同步确认门:spec 确认通过方可起草 plan,plan 确认后方可动手;L3 加新会话独立复核,未确认不放行 |
|
|
29
29
|
|
|
30
|
+
> **L2/L3 起草期合并预览**:三件套起草按 [design.md §0](design.md) 一次呈现要点总览(逐件确认代录不变)。
|
|
31
|
+
>
|
|
30
32
|
> 定级结果落 intent frontmatter `risk_level`(=级别,`fill-intent.mjs` 自动写入,机器选道用);协作道勾触达红线会被 check-loop 判「红线判低」hard 拦(就高升级 L2/L3 并补同名 spec)。
|
|
31
33
|
|
|
32
34
|
## 3. 路由判断
|
|
@@ -8,6 +8,12 @@ description: Build 阶段:起 plan + 实现代码 + 自验(确认后才动代码
|
|
|
8
8
|
|
|
9
9
|
> AI 起草 plan,用户确认;进计划模式列改动,用户确认;最后才动代码。两道确认门。
|
|
10
10
|
|
|
11
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
12
|
+
|
|
13
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
14
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
15
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:plan 任务拆解与两道确认门位置。
|
|
16
|
+
|
|
11
17
|
## 1. 执行
|
|
12
18
|
|
|
13
19
|
### 1.1 起草 plan
|
|
@@ -53,6 +59,7 @@ description: Build 阶段:起 plan + 实现代码 + 自验(确认后才动代码
|
|
|
53
59
|
## 4. 改权威源后必跑(薄适配同步防漏)
|
|
54
60
|
|
|
55
61
|
- 改 `templates/_agents/{commands,roles}/*.md` 正文后跑 `node bin/flow-kit.mjs sync-hosts --diff` → 拍板 → `--apply` 单向同步(只动正文段,frontmatter 不动);口径与边界详见 `.agents/commands/sync-hosts.md`
|
|
62
|
+
- 改根 `AGENTS.md`(owned 常驻面)后跑 `node .agents/scripts/edit-face-check.mjs`——工作树面快检(阶段索引/引用/预算 advisory),别等提交门才发觉砍坏(2026-10-09 B2)
|
|
56
63
|
|
|
57
64
|
## 5. 改 doctor / check-loop 后必跑(三处口径对账)
|
|
58
65
|
|
|
@@ -6,6 +6,12 @@ description: Design 阶段:起 spec(L2/L3 强制,L1 可省略)
|
|
|
6
6
|
|
|
7
7
|
> L2/L3 强制;L1 走快车道(直接跳 `next: build.md` 起草 Quick-Plan)。
|
|
8
8
|
|
|
9
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
10
|
+
|
|
11
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
12
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
13
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:spec 方案取舍与 L3 复核安排。
|
|
14
|
+
|
|
9
15
|
## 1. 执行
|
|
10
16
|
|
|
11
17
|
1. 确认同名入口文档已批准:新需求为 approved intent,修复为已确认的 incident 草稿;否则拒绝,分别回 `plan.md` / `maintain.md`(2026-09-30 起机器强制:fill-spec / confirm-doc 对前置未过直接拒绝 exit 2、不落盘不记账)。
|
|
@@ -27,6 +27,8 @@ description: AI-Native 闭环总入口:6 阶段指令索引(Plan→Design→Buil
|
|
|
27
27
|
| **协作道**(敏捷优先,审计异步补) | L0 例行 / L1 实现级 | L0 直接 commit,豁免 intent;L1 快车道(intent 一句话确认 + 极简 plan)即动工。独立复核不设同步前置,check-loop 与事后 review 兜底;确认/代录可 `--batch` 批量(仅 L0/L1) |
|
|
28
28
|
| **防御道**(严谨优先,确认同步拦) | L2 规则/契约 / L3 数据与运行时结构 | 同步确认门:spec 确认通过方可起草 plan,plan 确认后方可动手;L3 加新会话独立复核,未确认不放行 |
|
|
29
29
|
|
|
30
|
+
> **L2/L3 起草期合并预览**:三件套起草按 [design.md §0](design.md) 一次呈现要点总览(逐件确认代录不变)。
|
|
31
|
+
>
|
|
30
32
|
> 定级结果落 intent frontmatter `risk_level`(=级别,`fill-intent.mjs` 自动写入,机器选道用);协作道勾触达红线会被 check-loop 判「红线判低」hard 拦(就高升级 L2/L3 并补同名 spec)。
|
|
31
33
|
|
|
32
34
|
## 3. 路由判断
|
|
@@ -8,6 +8,12 @@ description: Build 阶段 · 起 plan + 实现代码 + 自验(两道确认门
|
|
|
8
8
|
|
|
9
9
|
> AI 起草 plan,用户确认;进计划模式列改动,用户确认;最后才动代码。两道确认门。
|
|
10
10
|
|
|
11
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
12
|
+
|
|
13
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
14
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
15
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:plan 任务拆解与两道确认门位置。
|
|
16
|
+
|
|
11
17
|
## 1. 执行
|
|
12
18
|
|
|
13
19
|
### 1.1 起草 plan
|
|
@@ -53,6 +59,7 @@ description: Build 阶段 · 起 plan + 实现代码 + 自验(两道确认门
|
|
|
53
59
|
## 4. 改权威源后必跑(薄适配同步防漏)
|
|
54
60
|
|
|
55
61
|
- 改 `templates/_agents/{commands,roles}/*.md` 正文后跑 `node bin/flow-kit.mjs sync-hosts --diff` → 拍板 → `--apply` 单向同步(只动正文段,frontmatter 不动);口径与边界详见 `.agents/commands/sync-hosts.md`
|
|
62
|
+
- 改根 `AGENTS.md`(owned 常驻面)后跑 `node .agents/scripts/edit-face-check.mjs`——工作树面快检(阶段索引/引用/预算 advisory),别等提交门才发觉砍坏(2026-10-09 B2)
|
|
56
63
|
|
|
57
64
|
## 5. 改 doctor / check-loop 后必跑(三处口径对账)
|
|
58
65
|
|
|
@@ -6,6 +6,12 @@ description: Design 阶段 · 起 spec(L2/L3 强制,L1 可省略直接进 bu
|
|
|
6
6
|
|
|
7
7
|
> L2/L3 强制;L1 走快车道(直接跳 `next: build.md` 起草 Quick-Plan)。
|
|
8
8
|
|
|
9
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
10
|
+
|
|
11
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
12
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
13
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:spec 方案取舍与 L3 复核安排。
|
|
14
|
+
|
|
9
15
|
## 1. 执行
|
|
10
16
|
|
|
11
17
|
1. 确认同名入口文档已批准:新需求为 approved intent,修复为已确认的 incident 草稿;否则拒绝,分别回 `plan.md` / `maintain.md`(2026-09-30 起机器强制:fill-spec / confirm-doc 对前置未过直接拒绝 exit 2、不落盘不记账)。
|
|
@@ -27,6 +27,8 @@ description: AI-Native 闭环总入口 · 6 阶段路由(新需求 → plan /
|
|
|
27
27
|
| **协作道**(敏捷优先,审计异步补) | L0 例行 / L1 实现级 | L0 直接 commit,豁免 intent;L1 快车道(intent 一句话确认 + 极简 plan)即动工。独立复核不设同步前置,check-loop 与事后 review 兜底;确认/代录可 `--batch` 批量(仅 L0/L1) |
|
|
28
28
|
| **防御道**(严谨优先,确认同步拦) | L2 规则/契约 / L3 数据与运行时结构 | 同步确认门:spec 确认通过方可起草 plan,plan 确认后方可动手;L3 加新会话独立复核,未确认不放行 |
|
|
29
29
|
|
|
30
|
+
> **L2/L3 起草期合并预览**:三件套起草按 [design.md §0](design.md) 一次呈现要点总览(逐件确认代录不变)。
|
|
31
|
+
>
|
|
30
32
|
> 定级结果落 intent frontmatter `risk_level`(=级别,`fill-intent.mjs` 自动写入,机器选道用);协作道勾触达红线会被 check-loop 判「红线判低」hard 拦(就高升级 L2/L3 并补同名 spec)。
|
|
31
33
|
|
|
32
34
|
## 3. 路由判断
|
|
@@ -9,6 +9,12 @@ description: Build 阶段 · 起 plan + 实现代码 + 自验(两道确认门
|
|
|
9
9
|
|
|
10
10
|
> AI 起草 plan,用户确认;进计划模式列改动,用户确认;最后才动代码。两道确认门。
|
|
11
11
|
|
|
12
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
13
|
+
|
|
14
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
15
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
16
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:plan 任务拆解与两道确认门位置。
|
|
17
|
+
|
|
12
18
|
## 1. 执行
|
|
13
19
|
|
|
14
20
|
### 1.1 起草 plan
|
|
@@ -54,6 +60,7 @@ description: Build 阶段 · 起 plan + 实现代码 + 自验(两道确认门
|
|
|
54
60
|
## 4. 改权威源后必跑(薄适配同步防漏)
|
|
55
61
|
|
|
56
62
|
- 改 `templates/_agents/{commands,roles}/*.md` 正文后跑 `node bin/flow-kit.mjs sync-hosts --diff` → 拍板 → `--apply` 单向同步(只动正文段,frontmatter 不动);口径与边界详见 `.agents/commands/sync-hosts.md`
|
|
63
|
+
- 改根 `AGENTS.md`(owned 常驻面)后跑 `node .agents/scripts/edit-face-check.mjs`——工作树面快检(阶段索引/引用/预算 advisory),别等提交门才发觉砍坏(2026-10-09 B2)
|
|
57
64
|
|
|
58
65
|
## 5. 改 doctor / check-loop 后必跑(三处口径对账)
|
|
59
66
|
|
|
@@ -7,6 +7,12 @@ description: Design 阶段 · 起 spec(L2/L3 强制,L1 可省略直接进 wf
|
|
|
7
7
|
|
|
8
8
|
> L2/L3 强制;L1 走快车道(直接跳 `next: build.md` 起草 Quick-Plan)。
|
|
9
9
|
|
|
10
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
11
|
+
|
|
12
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
13
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
14
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:spec 方案取舍与 L3 复核安排。
|
|
15
|
+
|
|
10
16
|
## 1. 执行
|
|
11
17
|
|
|
12
18
|
1. 确认同名入口文档已批准:新需求为 approved intent,修复为已确认的 incident 草稿;否则拒绝,分别回 `plan.md` / `maintain.md`(2026-09-30 起机器强制:fill-spec / confirm-doc 对前置未过直接拒绝 exit 2、不落盘不记账)。
|
|
@@ -28,6 +28,8 @@ description: 闭环总入口 · 路由判断(新需求 → wf-plan / 修复
|
|
|
28
28
|
| **协作道**(敏捷优先,审计异步补) | L0 例行 / L1 实现级 | L0 直接 commit,豁免 intent;L1 快车道(intent 一句话确认 + 极简 plan)即动工。独立复核不设同步前置,check-loop 与事后 review 兜底;确认/代录可 `--batch` 批量(仅 L0/L1) |
|
|
29
29
|
| **防御道**(严谨优先,确认同步拦) | L2 规则/契约 / L3 数据与运行时结构 | 同步确认门:spec 确认通过方可起草 plan,plan 确认后方可动手;L3 加新会话独立复核,未确认不放行 |
|
|
30
30
|
|
|
31
|
+
> **L2/L3 起草期合并预览**:三件套起草按 [design.md §0](design.md) 一次呈现要点总览(逐件确认代录不变)。
|
|
32
|
+
>
|
|
31
33
|
> 定级结果落 intent frontmatter `risk_level`(=级别,`fill-intent.mjs` 自动写入,机器选道用);协作道勾触达红线会被 check-loop 判「红线判低」hard 拦(就高升级 L2/L3 并补同名 spec)。
|
|
32
34
|
|
|
33
35
|
## 3. 路由判断
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-flow-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "AI-Native 闭环工作流 + wiki 知识层脚手架——flow-kit init 一条命令为新项目装好 .agents 工作流引擎(阶段命令/角色契约/门禁钩子/kb 检索/看板/规则面预算)+ workflow 文档闭环 + wiki 知识库,装完自包含、零运行时依赖",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
package/src/run-tests.mjs
CHANGED
|
@@ -11,16 +11,17 @@ import { fileURLToPath } from 'node:url';
|
|
|
11
11
|
|
|
12
12
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
13
13
|
|
|
14
|
+
// src/ 侧按盘面枚举,不硬编码清单(2026-10-09 审查 P0-1)——此前硬编码 8 项,`src/sync-hosts.test.mjs`
|
|
15
|
+
// 漏挂:npm test 不跑它,CI 也盖不住(ci.yml shipped 步骤只 glob `.agents/scripts/*.test.mjs`),
|
|
16
|
+
// 而 `templates/_agents/commands/sync-hosts.md:62`「npm test 含 sync-hosts.test.mjs 8 场景」随模板
|
|
17
|
+
// 下发 5 个装户宿主。检查 20 只扫 `templates/_agents/scripts/` 面,结构上抓不到 src/ 漏挂。
|
|
18
|
+
// 改 glob 后:新增 src 测试文件不可能再被静默漏跑(枚举漂移由盘面兜住,不靠人记得补)。
|
|
19
|
+
// 含宿主门禁模块回归(2026-09-27 host-gates-p1:dotnet-ca BRE 豁免/fail-closed + trae 强推 token 化)。
|
|
14
20
|
const nodeSuites = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'src/fresh-init.test.mjs',
|
|
20
|
-
'src/stack-profile.test.mjs',
|
|
21
|
-
// 宿主门禁模块回归(2026-09-27 host-gates-p1:dotnet-ca BRE 豁免/fail-closed + trae 强推 token 化)
|
|
22
|
-
'src/gate-dotnet-ca.test.mjs',
|
|
23
|
-
'src/trae-hooks.test.mjs',
|
|
21
|
+
...fs.readdirSync(path.join(ROOT, 'src'))
|
|
22
|
+
.filter((f) => f.endsWith('.test.mjs'))
|
|
23
|
+
.sort()
|
|
24
|
+
.map((f) => `src/${f}`),
|
|
24
25
|
...fs.readdirSync(path.join(ROOT, 'templates/_agents/scripts'))
|
|
25
26
|
.filter((f) => f.endsWith('.test.mjs'))
|
|
26
27
|
.sort()
|
|
@@ -46,4 +47,10 @@ for (const rel of nodeSuites) {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
console.log(`\n${failed ? `❌ ${failed} 个套件失败` : '✅ 全部套件通过'}`);
|
|
50
|
+
// 机器可读汇总行(2026-10-09 审查 P0-2):verify.mjs 的凭证计数**只认这一行**。
|
|
51
|
+
// 此前它 pop 通配「合计: PASS n / FAIL n」,而 45+ 套件每个都打印自己那行同形文本——
|
|
52
|
+
// 取到的是字母序最后一个套件的场景数(本仓实况:workflows-check.test.mjs 的 15),
|
|
53
|
+
// 于是「一行机器事实」的 passed 字段落成了错的事实。独立前缀 + 套件口径,嵌套同形行不再被误取。
|
|
54
|
+
// 口径:SUITES = 本编排器实际执行的套件数(lint 不计入;lint 红照样 exit 1,凭证不落)。
|
|
55
|
+
console.log(`[run-tests] 合计: SUITES ${nodeSuites.length} / FAILED ${failed}`);
|
|
49
56
|
process.exit(failed ? 1 : 0);
|
package/src/sync-hosts.mjs
CHANGED
|
@@ -47,93 +47,113 @@ function listMd(dir) {
|
|
|
47
47
|
// roles 权威源 → 全部宿主 agents 各一份
|
|
48
48
|
// hostDirOf:宿主 → 适配目录名。包源布局 = 宿主键(modules/hosts/opencode/…);装户布局 = HOSTS[h].dir
|
|
49
49
|
// (项目根下 .opencode/…,带点)——2026-10-07 sync-hosts-target-fix 加装户支持时引入。
|
|
50
|
-
|
|
50
|
+
// hostFilter(2026-10-09 sync-hosts-root-coverage):宿主级过滤(多根模式下「项目根宿主点」根只扫
|
|
51
|
+
// 实际存在 dir 的宿主——不存在=没装该宿主点,不算缺失不算漂移)。
|
|
52
|
+
function pairsFor(authRel, hostDirOf = (h) => h, hostFilter = null) {
|
|
51
53
|
const out = [];
|
|
52
54
|
const norm = authRel.split(path.sep).join('/');
|
|
55
|
+
// 条目带 h(宿主键)——faces 计数用「实际生成配对 > 0 的宿主数」(复核 P2-2:存在但空的宿主点
|
|
56
|
+
// 目录此前被计入「N 宿主」,对账面自描述轻微夸大)
|
|
53
57
|
if (norm.startsWith('commands/') && norm.endsWith('.md')) {
|
|
54
58
|
const name = norm.slice('commands/'.length, -'.md'.length);
|
|
55
59
|
for (const [h, v] of Object.entries(HOSTS)) {
|
|
56
|
-
if (
|
|
60
|
+
if (hostFilter && !hostFilter(h)) continue;
|
|
61
|
+
if (v.commandPrefix) out.push({ h, adapterRel: `${hostDirOf(h)}/commands/${v.commandPrefix}${name}.md` });
|
|
57
62
|
}
|
|
58
63
|
} else if (norm.startsWith('roles/') && norm.endsWith('.md')) {
|
|
59
64
|
const name = norm.slice('roles/'.length, -'.md'.length);
|
|
60
|
-
for (const h of Object.keys(HOSTS))
|
|
65
|
+
for (const h of Object.keys(HOSTS)) {
|
|
66
|
+
if (hostFilter && !hostFilter(h)) continue;
|
|
67
|
+
out.push({ h, adapterRel: `${hostDirOf(h)}/agents/${name}.md` });
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
return out;
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
// diffHosts:权威源正文段 vs 薄适配正文段的漂移分析(B-b 语义;pure function)。
|
|
66
74
|
// authorityRoot:权威源根(含 commands/ + roles/)
|
|
67
|
-
//
|
|
75
|
+
// 多根对账(2026-10-09 sync-hosts-root-coverage):adapterRoots = [{root, hostDirOf, hostFilter?, label?}]——
|
|
76
|
+
// 包源布局传两根(modules/hosts 宿主键形态 + 项目根 HOSTS.dir 形态宿主点);装户布局单根。
|
|
77
|
+
// 向后兼容:旧单根入参 adaptersRoot/hostDirOf 归一为单元素数组。
|
|
78
|
+
// 根因教训(engine-quality-round2 B1):包源布局此前只扫 modules/hosts,项目根宿主点(本仓 .zcode/)
|
|
79
|
+
// 完全不在扫描面——bb69e19「81 对全对齐」声明漏掉 .zcode 三份(独立复核 P2-3 实证)。
|
|
68
80
|
// hostDirOf:宿主 → 适配目录名(默认宿主键 = 包源布局;装户布局传 (h) => HOSTS[h].dir)
|
|
69
|
-
// 返回:{ drift, inSync, authorityMissing, adapterOrphans,
|
|
70
|
-
// drift
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (!fs.existsSync(authorityRoot)) return { drift: [], inSync: 0, authorityMissing: [], adapterOrphans: [], note: `权威源根不存在:${authorityRoot}` };
|
|
81
|
+
// 返回:{ drift, inSync, authorityMissing, adapterOrphans, faces }
|
|
82
|
+
// drift 条目自带 root(applyForward 按它定位适配文件);faces = 对账面自描述行(防不可解释的「N 对」)
|
|
83
|
+
export function diffHosts(opts) {
|
|
84
|
+
const authorityRoot = opts.authorityRoot;
|
|
85
|
+
const roots = opts.adapterRoots || [{ root: opts.adaptersRoot, hostDirOf: opts.hostDirOf || ((h) => h), label: null }];
|
|
86
|
+
if (!fs.existsSync(authorityRoot)) return { drift: [], inSync: 0, authorityMissing: [], adapterOrphans: [], faces: [], note: `权威源根不存在:${authorityRoot}` };
|
|
76
87
|
|
|
77
88
|
const drift = [];
|
|
89
|
+
const adapterOrphans = [];
|
|
78
90
|
let inSync = 0;
|
|
79
91
|
const adapterSeen = new Set();
|
|
80
92
|
const authorityMissing = [];
|
|
93
|
+
const faces = [];
|
|
81
94
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
for (const spec of roots) {
|
|
96
|
+
const { root, hostDirOf, hostFilter, label } = spec;
|
|
97
|
+
const rootHosts = new Set(); // 该根实际生成配对 > 0 的宿主(faces 计数口径,复核 P2-2)
|
|
98
|
+
// 扫权威源 commands/ + roles/
|
|
99
|
+
for (const sub of ['commands', 'roles']) {
|
|
100
|
+
const subAbs = path.join(authorityRoot, sub);
|
|
101
|
+
for (const f of listMd(subAbs)) {
|
|
102
|
+
const authRel = `${sub}/${f}`;
|
|
103
|
+
const authAbs = path.join(authorityRoot, authRel);
|
|
104
|
+
const authSha = bodySha(authAbs);
|
|
105
|
+
const pairs = pairsFor(authRel, hostDirOf, hostFilter);
|
|
106
|
+
if (pairs.length === 0) continue;
|
|
107
|
+
for (const { h, adapterRel } of pairs) {
|
|
108
|
+
rootHosts.add(h);
|
|
109
|
+
adapterSeen.add(adapterRel);
|
|
110
|
+
const adapterAbs = path.join(root, adapterRel);
|
|
111
|
+
const adapterSha = bodySha(adapterAbs);
|
|
112
|
+
if (adapterSha === null) {
|
|
113
|
+
// 未安装的宿主不算「缺失」——那是没装,不是漂移(2026-10-07:装户只装部分宿主时,
|
|
114
|
+
// 旧行为会把未装宿主的全部适配文件列成 authorityMissing,装户 --apply 恒 exit 1 且刷屏)
|
|
115
|
+
if (fs.existsSync(path.dirname(adapterAbs))) authorityMissing.push({ authRel, adapterRel });
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (authSha === adapterSha) { inSync++; continue; }
|
|
119
|
+
drift.push({ authRel, adapterRel, authSha, adapterSha, root });
|
|
100
120
|
}
|
|
101
|
-
if (authSha === adapterSha) { inSync++; continue; }
|
|
102
|
-
drift.push({ authRel, adapterRel, authSha, adapterSha });
|
|
103
121
|
}
|
|
104
122
|
}
|
|
105
|
-
}
|
|
106
123
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
faces.push(label ? `${label}(${rootHosts.size} 宿主)` : `${root}(${rootHosts.size} 宿主)`);
|
|
125
|
+
// 扫薄适配找孤儿(权威源无对应文件)
|
|
126
|
+
for (const h of Object.keys(HOSTS)) {
|
|
127
|
+
if (hostFilter && !hostFilter(h)) continue;
|
|
128
|
+
for (const sub of ['agents', 'commands']) {
|
|
129
|
+
const subAbs = path.join(root, hostDirOf(h), sub);
|
|
130
|
+
for (const f of listMd(subAbs)) {
|
|
131
|
+
const adapterRel = `${hostDirOf(h)}/${sub}/${f}`;
|
|
132
|
+
if (adapterSeen.has(adapterRel)) continue;
|
|
133
|
+
let authGuess;
|
|
134
|
+
const prefix = HOSTS[h] && HOSTS[h].commandPrefix;
|
|
135
|
+
if (sub === 'commands' && prefix && f.startsWith(prefix)) {
|
|
136
|
+
// 命令层薄适配带宿主 commandPrefix(2026-09-28:opencode 对齐 trae 后两宿主同口径)
|
|
137
|
+
authGuess = `commands/${f.slice(prefix.length)}`;
|
|
138
|
+
} else if (sub === 'agents') {
|
|
139
|
+
authGuess = `roles/${f}`;
|
|
140
|
+
} else {
|
|
141
|
+
authGuess = `commands/${f}`;
|
|
142
|
+
}
|
|
143
|
+
adapterOrphans.push({ adapterRel, authGuess });
|
|
124
144
|
}
|
|
125
|
-
adapterOrphans.push({ adapterRel, authGuess });
|
|
126
145
|
}
|
|
127
146
|
}
|
|
128
147
|
}
|
|
129
148
|
|
|
130
|
-
return { drift, inSync, authorityMissing, adapterOrphans };
|
|
149
|
+
return { drift, inSync, authorityMissing, adapterOrphans, faces };
|
|
131
150
|
}
|
|
132
151
|
|
|
133
152
|
// printDiff:人类可读 diff 报告(B-b 语义:正文段比对 + frontmatter 双方不动)
|
|
134
153
|
function printDiff(result) {
|
|
135
|
-
const { drift, inSync, authorityMissing, adapterOrphans, note } = result;
|
|
154
|
+
const { drift, inSync, authorityMissing, adapterOrphans, note, faces } = result;
|
|
136
155
|
if (note) console.log(`ℹ️ ${note}\n`);
|
|
156
|
+
if (faces && faces.length) console.log(` 对账面:${faces.join(' + ')}`);
|
|
137
157
|
console.log(` 正文对齐:${inSync} 对`);
|
|
138
158
|
if (authorityMissing.length) {
|
|
139
159
|
console.log(` 权威源声明但薄适配缺失(${authorityMissing.length},apply 不自动创建——薄适配须经 add-host 接管):`);
|
|
@@ -152,12 +172,13 @@ function printDiff(result) {
|
|
|
152
172
|
}
|
|
153
173
|
|
|
154
174
|
// applyForward:把权威源正文段同步到薄适配(保留薄适配原 frontmatter)
|
|
175
|
+
// 漂移条目自带 root(多根对账,2026-10-09 sync-hosts-root-coverage)——按它定位适配文件。
|
|
155
176
|
// 返回:{ synced: [{adapterRel}] }
|
|
156
|
-
function applyForward({ authorityRoot
|
|
177
|
+
function applyForward({ authorityRoot }, drift) {
|
|
157
178
|
const synced = [];
|
|
158
|
-
for (const { authRel, adapterRel } of drift) {
|
|
179
|
+
for (const { authRel, adapterRel, root } of drift) {
|
|
159
180
|
const authAbs = path.join(authorityRoot, authRel);
|
|
160
|
-
const adapterAbs = path.join(
|
|
181
|
+
const adapterAbs = path.join(root, adapterRel);
|
|
161
182
|
const authText = fs.readFileSync(authAbs, 'utf8');
|
|
162
183
|
const adapterText = fs.readFileSync(adapterAbs, 'utf8');
|
|
163
184
|
const { body } = splitFm(authText);
|
|
@@ -189,26 +210,43 @@ export function syncHosts(args, pkgRoot) {
|
|
|
189
210
|
// 解析为**包安装目录**,于是 doctor §7.x 报漂移、照提示跑 `--apply` 会去改包源仓(装户自己的适配层纹丝不动)。
|
|
190
211
|
const target = path.resolve(dir || process.cwd() || pkgRoot);
|
|
191
212
|
// 布局判定(与 doctor.checkAdapterDrift 同口径):
|
|
192
|
-
// 包源(templates/_agents 与 modules/hosts 同时存在)→ 权威源 = <target>/templates/_agents
|
|
213
|
+
// 包源(templates/_agents 与 modules/hosts 同时存在)→ 权威源 = <target>/templates/_agents
|
|
214
|
+
// 薄适配根(2026-10-09 sync-hosts-root-coverage 多根)= ① modules/hosts(宿主键形态,全宿主)
|
|
215
|
+
// + ② 项目根 HOSTS.dir 实际存在的宿主点(如本仓 .zcode/——此前不在扫描面,bb69e19「81 对全对齐」
|
|
216
|
+
// 漏掉其三份,独立复核 P2-3 实证);不存在 = 没装该宿主点,不算缺失。
|
|
193
217
|
// 装户(其余)→ 权威源 = <target>/.agents,薄适配根 = <target>(宿主目录 .opencode/.trae/… 直接位于项目根)
|
|
194
218
|
const isSourceRepo = fs.existsSync(path.join(target, 'templates', '_agents'))
|
|
195
219
|
&& fs.existsSync(path.join(target, 'modules', 'hosts'));
|
|
196
220
|
const authorityRoot = isSourceRepo ? path.join(target, 'templates', '_agents') : path.join(target, '.agents');
|
|
197
|
-
const
|
|
221
|
+
const adapterRoots = isSourceRepo
|
|
222
|
+
? [
|
|
223
|
+
{ root: path.join(target, 'modules', 'hosts'), hostDirOf: (h) => h, label: 'modules/hosts' },
|
|
224
|
+
{
|
|
225
|
+
root: target,
|
|
226
|
+
hostDirOf: (h) => (HOSTS[h] && HOSTS[h].dir) || h,
|
|
227
|
+
hostFilter: (h) => HOSTS[h] && fs.existsSync(path.join(target, HOSTS[h].dir)),
|
|
228
|
+
label: '项目根宿主点',
|
|
229
|
+
},
|
|
230
|
+
]
|
|
231
|
+
: [{
|
|
232
|
+
root: target,
|
|
233
|
+
hostDirOf: (h) => (HOSTS[h] && HOSTS[h].dir) || h,
|
|
234
|
+
hostFilter: (h) => HOSTS[h] && fs.existsSync(path.join(target, HOSTS[h].dir)),
|
|
235
|
+
label: '项目根宿主点',
|
|
236
|
+
}];
|
|
198
237
|
if (!fs.existsSync(authorityRoot)) {
|
|
199
238
|
fail(`未找到权威源目录:${authorityRoot}——目标根 ${target} 既非包源(无 templates/_agents)也非装户(无 .agents);用 --dir <项目根> 指定`);
|
|
200
239
|
}
|
|
201
240
|
const layout = isSourceRepo ? '包源' : '装户';
|
|
202
|
-
|
|
203
|
-
const hostDirOf = isSourceRepo ? (h) => h : (h) => (HOSTS[h] && HOSTS[h].dir) || h;
|
|
204
|
-
const result = diffHosts({ authorityRoot, adaptersRoot, hostDirOf });
|
|
241
|
+
const result = diffHosts({ authorityRoot, adapterRoots });
|
|
205
242
|
|
|
206
243
|
if (apply && result.drift.length > 0) {
|
|
207
|
-
const { synced } = applyForward({ authorityRoot
|
|
244
|
+
const { synced } = applyForward({ authorityRoot }, result.drift);
|
|
208
245
|
console.log(`▶ flow-kit sync-hosts --apply → ${target}(${layout}布局)`);
|
|
246
|
+
console.log(` 对账面:${result.faces.join(' + ')}`);
|
|
209
247
|
console.log(` 按权威源正文覆盖薄适配正文段 ${synced.length} 份(薄适配 frontmatter 不动):`);
|
|
210
248
|
for (const rel of synced) console.log(` - ${rel}`);
|
|
211
|
-
const after = diffHosts({ authorityRoot,
|
|
249
|
+
const after = diffHosts({ authorityRoot, adapterRoots });
|
|
212
250
|
console.log(` 同步后正文对齐:${after.inSync} 对;权威源缺失:${after.authorityMissing.length};正文漂移:${after.drift.length}`);
|
|
213
251
|
return after.drift.length === 0 && after.authorityMissing.length === 0 ? 0 : 1;
|
|
214
252
|
}
|
package/src/sync-hosts.test.mjs
CHANGED
|
@@ -237,5 +237,44 @@ syncHosts(process.argv.slice(2), root);
|
|
|
237
237
|
check('实仓薄适配无缺失无正文漂移', r.authorityMissing.length === 0 && r.drift.length === 0, `missing=${r.authorityMissing.length} drift=${r.drift.length} ${sample}`);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
// ============ 场景 10-12:包源布局多根对账(2026-10-09 sync-hosts-root-coverage,B1)============
|
|
241
|
+
// 根因教训(bb69e19「81 对全对齐」漏 .zcode 三份,独立复核 P2-3):包源布局此前只扫 modules/hosts,
|
|
242
|
+
// 项目根 HOSTS.dir 形态宿主点(本仓 .zcode/)不在扫描面。三场景钉住:漂移可检出 / apply 可修复且
|
|
243
|
+
// frontmatter 保留 / 对账面自描述行在案。
|
|
244
|
+
{
|
|
245
|
+
// S10:包源 fixture + 项目根 .zcode/agents 漂移(正文旧 + frontmatter zcode 风格)→ --diff 报漂移
|
|
246
|
+
const fx = mkFixture();
|
|
247
|
+
W(path.join(fx, '.zcode/agents/implementer.md'),
|
|
248
|
+
`---\nname: implementer\ndescription: zcode 本仓风格\n---\n\n# Implementer · v0\n\n旧版正文 implementer v0\n`);
|
|
249
|
+
const r = runSyncHosts(fx, ['--diff']);
|
|
250
|
+
const out = r.stdout + r.stderr;
|
|
251
|
+
check('S10 项目根宿主点漂移:--diff 报 .zcode/agents/implementer.md',
|
|
252
|
+
out.includes('.zcode/agents/implementer.md') && /正文段漂移/.test(out), out.slice(0, 600));
|
|
253
|
+
check('S10 对账面自描述:含「项目根宿主点(1 宿主)」', /对账面:.*项目根宿主点(1 宿主)/.test(out), out.split('\n').slice(0, 4).join('\n'));
|
|
254
|
+
|
|
255
|
+
// S11:--apply 修复项目根漂移——正文覆盖为权威源、frontmatter 保留、漂移归零
|
|
256
|
+
const r2 = runSyncHosts(fx, ['--apply']);
|
|
257
|
+
const out2 = r2.stdout + r2.stderr;
|
|
258
|
+
const synced = /- \.zcode\/agents\/implementer\.md/.test(out2);
|
|
259
|
+
const fixed = R(path.join(fx, '.zcode/agents/implementer.md'));
|
|
260
|
+
check('S11 --apply 同步清单含 .zcode 条目', synced, out2.slice(0, 500));
|
|
261
|
+
check('S11 --apply 正文覆盖 + frontmatter 保留',
|
|
262
|
+
fixed.includes('权威源正文 implementer v1') && fixed.includes('description: zcode 本仓风格'),
|
|
263
|
+
fixed.slice(0, 200));
|
|
264
|
+
check('S11 --apply 后漂移归零', /正文漂移:\s*0/.test(out2), out2.slice(-300));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
{
|
|
268
|
+
// S12:装户布局 faces 自描述(回归钉住——装户单根 label=项目根宿主点,行为不变)
|
|
269
|
+
const fx = fs.mkdtempSync(path.join(os.tmpdir(), 'fk-synchosts-adopter-'));
|
|
270
|
+
W(path.join(fx, '.agents/roles/implementer.md'),
|
|
271
|
+
`---\ndescription: Implementer 角色契约\n---\n\n# Implementer · v1\n\n权威源正文 implementer v1\n`);
|
|
272
|
+
W(path.join(fx, '.zcode/agents/implementer.md'),
|
|
273
|
+
`---\nname: implementer\ndescription: zcode\n---\n\n# Implementer · v1\n\n权威源正文 implementer v1\n`);
|
|
274
|
+
const r = runSyncHostsByCwd(fx, ['--diff']);
|
|
275
|
+
const out = r.stdout + r.stderr;
|
|
276
|
+
check('S12 装户布局:faces 单根自描述 + 对齐 1 对', /对账面:项目根宿主点(1 宿主)/.test(out) && /正文对齐:\s*1\s*对/.test(out), out.slice(0, 400));
|
|
277
|
+
}
|
|
278
|
+
|
|
240
279
|
console.log(`\n合计: PASS ${pass} / FAIL ${failCount}`);
|
|
241
280
|
process.exit(failCount ? 1 : 0);
|
package/templates/AGENTS.md
CHANGED
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
- **`git commit` / `git merge` / `git push` 三处一律禁 `--no-verify`**——被拦说明产出不合规,按提示修完原路重试。
|
|
29
29
|
- 项目专属门禁挂 `.agents/hooks/local-pre-commit`。装户五条硬规则(配对、验收、确认留痕、敏感信息、双源台账)与 `audit` 档见 `workflow/README.md`「硬规则」。
|
|
30
30
|
- 提交遵循 Conventional Commits 中文(feat / fix / docs / style / refactor / perf)。L1+ 三段式闭环链:`docs(*)` approved 留痕 → 代码 → 关单 `docs(*)`,相邻提交即同一闭环(2026-10-04 修订)。
|
|
31
|
-
- **确认门(2026-09-27 起)**:intent/spec/plan 的 approved/done 与 incident 的 fixed/closed(两跳、无单跳)唯一入口 = `node .agents/scripts/confirm-doc.mjs <path>`,放弃态走显式 `--to superseded|cancelled`(合法前态见脚本提示;四终态同样内容绑定),两形态:① 用户终端亲手运行键入「可以」(TTY,AI 会话内被拒);② **对话委托代录**——用户在对话内明确确认后,AI 跑 `confirm-doc.mjs <path> --delegated "
|
|
31
|
+
- **确认门(2026-09-27 起)**:intent/spec/plan 的 approved/done 与 incident 的 fixed/closed(两跳、无单跳)唯一入口 = `node .agents/scripts/confirm-doc.mjs <path>`,放弃态走显式 `--to superseded|cancelled`(合法前态见脚本提示;四终态同样内容绑定),两形态:① 用户终端亲手运行键入「可以」(TTY,AI 会话内被拒);② **对话委托代录**——用户在对话内明确确认后,AI 跑 `confirm-doc.mjs <path> --delegated "<授权摘要>"` 逐件代录(默认一次一份,多份并录被拒),台账如实记 `source: chat-delegated`,永不伪装 TTY 行(check-loop 15 指纹+台账对账拦截,与 source 无关);L0/L1 协作道可 `--batch` 多份一次代录(台账 `brief:true`,15 并录告警豁免;L2/L3 仍逐份)。
|
|
32
|
+
- **改动面 scope = 授权的机器事实(2026-10-09 起)**:confirm-doc 落账自动记 `scope{files,sha256}`(被确认文档 + `git status` 实测未提交改动集,机器派生、**AI 无输入面**)。分辨力由 scope + 指纹承担,`--delegated` 的摘要降级为人类可读留痕——**「每次换一句原话」纪律退役**,复用同一句摘要不再削弱任何判据。check-loop 15 校验受管行带 scope 且摘要自洽(`policyVersion ≥ 7` 起,旧版本与存量行零新增告警)。
|
|
32
33
|
|
|
33
34
|
### 检索、看板与量化
|
|
34
35
|
|
|
@@ -23,6 +23,12 @@ next: .agents/commands/test.md
|
|
|
23
23
|
|
|
24
24
|
> AI 起草 plan,用户确认;进计划模式列改动,用户确认;最后才动代码。两道确认门。
|
|
25
25
|
|
|
26
|
+
## 0. 三件套合并预览(L2/L3 起草期,2026-10-09 engine-quality-round2 C)
|
|
27
|
+
|
|
28
|
+
起草 intent / spec / plan 任一件后,**在输出草稿全文前先给三件要点总览**(各一件:目标 / 关键取舍 /
|
|
29
|
+
验收判据 diff,合计 ≤12 行)——用户一次看整体再逐件拍板,省三次盲确认的上下文切换。
|
|
30
|
+
确认纪律不变:逐件过目全文 + 逐件 `confirm-doc` 代录(禁并录、禁复用同句)。本阶段总览侧重:plan 任务拆解与两道确认门位置。
|
|
31
|
+
|
|
26
32
|
## 1. 执行
|
|
27
33
|
|
|
28
34
|
### 1.1 起草 plan
|
|
@@ -68,6 +74,7 @@ next: .agents/commands/test.md
|
|
|
68
74
|
## 4. 改权威源后必跑(薄适配同步防漏)
|
|
69
75
|
|
|
70
76
|
- 改 `templates/_agents/{commands,roles}/*.md` 正文后跑 `node bin/flow-kit.mjs sync-hosts --diff` → 拍板 → `--apply` 单向同步(只动正文段,frontmatter 不动);口径与边界详见 `.agents/commands/sync-hosts.md`
|
|
77
|
+
- 改根 `AGENTS.md`(owned 常驻面)后跑 `node .agents/scripts/edit-face-check.mjs`——工作树面快检(阶段索引/引用/预算 advisory),别等提交门才发觉砍坏(2026-10-09 B2)
|
|
71
78
|
|
|
72
79
|
## 5. 改 doctor / check-loop 后必跑(三处口径对账)
|
|
73
80
|
|