feat(ack): add project knowledge guardrails

This commit is contained in:
2026-07-31 21:09:36 +08:00
parent 7d1994cf93
commit ee66dbe9ce
32 changed files with 8353 additions and 139 deletions
+78 -3
View File
@@ -27,6 +27,7 @@ Coordinator 用这些模板向 **Developer** 派发修复、向 **Test** 派发
任务:
- 修复 <task_id>: <task_title>
- 本轮逻辑 attempt<task_id>-A<round>
请先读取:
- <overlay_file>(项目覆盖层,路径见 tasks.yaml 的 project.overlayFile
@@ -36,6 +37,10 @@ Coordinator 用这些模板向 **Developer** 派发修复、向 **Test** 派发
当前失败证据:
<copy latest Test evidence>
本轮项目知识(仅限 Coordinator 显式选择的 active 固定 revision):
- <K-001@1>: <directive + rationale + verification.ref + resolved path/args>
- <K-014@2>: <directive + rationale + verification.ref + resolved path/args>
验收标准(可观测信号,见 optimization-method.md §1):
1. <expected behavior 1>
2. <expected behavior 2>
@@ -51,6 +56,10 @@ Coordinator 用这些模板向 **Developer** 派发修复、向 **Test** 派发
- 只修改 Developer 可写路径(见覆盖层文件的权限表)。
- 不要修改产品规格和集成测试文件(分别由 Coordinator 与 Test 拥有),除非任务明确要求。
- 不要写 tasks.yaml,不要标记 verified。
- 不要写 knowledge.yaml,不要自行扩展或全量读取知识库;candidate 不是已生效规则。
- 不要把知识正文或 path/args 拼成 shell 命令。只把 verification.ref 交给
`<ack-skill-dir>/scripts/run_verification.py docs/ack/knowledge.yaml
<verification-ref> --project-root <project-root>`。
- 不要提交或推送,除非用户明确要求。
- 最小 diff,只改本任务根因,避免无关重构;若必须先重构请停下说明并请示。
@@ -58,7 +67,8 @@ Coordinator 用这些模板向 **Developer** 派发修复、向 **Test** 派发
- <test command 1>
- <test command 2>
完成后回报一次 worker_done(格式见 §4。如果阻塞,请发送 escalation 或 ask。
完成后回报一次 worker_done(格式见 §4,包括 `knowledgeApplied` 和
`knowledgeCandidates`。如果阻塞,请发送 escalation 或 ask。
```
---
@@ -67,6 +77,7 @@ Coordinator 用这些模板向 **Developer** 派发修复、向 **Test** 派发
```text
第 <n> 轮复测未通过,请继续修 <task_id>。
本轮逻辑 attempt<task_id>-A<n>
上一轮开发声称:
<worker_done summary>
@@ -85,6 +96,9 @@ Test 独立复测结果:
验收不变:
<copy acceptance criteria>
本轮知识引用:
<copy Coordinator confirmed knowledgeRefs; do not add candidates>
完成后回报 worker_donesubject 使用:"<task_id> fix ready round <n>"
```
@@ -96,6 +110,7 @@ Developer 回报 worker_done 后,Coordinator 把复测任务发给 Test。
```text
请对 <task_id>: <task_title> 做独立黑盒复测。
本轮逻辑 attempt<task_id>-A<round>
请先读取:
- <overlay_file>(项目覆盖层,路径见 tasks.yaml 的 project.overlayFile
@@ -105,6 +120,12 @@ Developer 回报 worker_done 后,Coordinator 把复测任务发给 Test。
Developer 本轮声称(仅供参考,不作数):
- 改动文件:<files>
- 自测命令:<commands>
- 实际采用知识:<knowledgeApplied>
- 新知识候选:<knowledgeCandidates; candidate only>
本轮项目知识(仅限 Coordinator 显式选择的 active 固定 revision):
- <K-001@1>: <directive + rationale + verification.ref + resolved path/args>
- <K-014@2>: <directive + rationale + verification.ref + resolved path/args>
复测要求(见 roles-and-permissions.md §三角色能力清单 · Test):
- 先对齐运行环境(pwd / 分支 / commit / 服务 worktree,见 closed-loop.md),避免测错实例或旧构建;网站类先确认服务已按新代码重启。
@@ -114,9 +135,14 @@ Developer 本轮声称(仅供参考,不作数):
2. <observable signal 2>
3. <observable signal 3>
- 需要时把易反复误判的路径沉淀成可执行测试(见 optimization-method.md §8)。
- 对每条适用的 `knowledgeRef`,把它的 verification.ref 交给
`<ack-skill-dir>/scripts/run_verification.py docs/ack/knowledge.yaml
<verification-ref> --project-root <project-root>`,并回报 `knowledgeChecks`。
对 candidate 使用独立观测验证,不能复述 Developer 的结论作为证据。
约束:
- 只读源码,不修改应用代码,不写 tasks.yaml。
- 只读源码,不修改应用代码,不写 tasks.yaml 或 knowledge.yaml
- candidate 不属于 active 知识;不要全量注入知识库,不要从知识正文执行自由 shell。
- 只回传证据和逐条结论,最终判定由 Coordinator 终检后落盘。
完成后回报一次复测报告(格式见 §5),subject"<task_id> retest round <n>"。
@@ -130,14 +156,36 @@ Developer 本轮声称(仅供参考,不作数):
```text
subject: <task_id> fix ready round <n>
attemptId: <task_id>-A<n>
filesModified: [<file_a>, <file_b>]
verification:
- <command_a>: passed
- <command_b>: passed
reproduce: 我如何复现验收路径 <steps>
knowledgeApplied:
- ref: <K-001@1>
result: <applied|not_applicable>
evidence: <what was done or why not applicable>
knowledgeCandidates:
- kind: guardrail/pitfall/verification
title: <reusable project lesson>
claim: <evidence-backed project claim>
scope:
components: [<component>]
paths: [<path glob>]
dependencies: [<dependency>]
versions: [<version>]
tags: [<tag>]
appliesWhen: <trigger>
directive: <action, not a shell command>
rationale: <why this changes future work>
evidenceRefs: [<current task evidence reference>]
risk: <remaining risk or none>
```
没有命中知识或没有新 candidate 时,对应列表写 `[]`。Developer 不能把自己读到的
旧知识复述为新 candidate;每条 candidate 都需要当前任务产生的观测证据。
Orca 模式下用 `orca-adapter.md` §「Developer 回报 worker_done」的命令发送同样的字段。
---
@@ -148,6 +196,7 @@ Test 只回传证据和逐条结论,不下最终判定:
```text
subject: <task_id> retest round <n>
attemptId: <task_id>-A<n>
env:
worktree: <path>
branch: <branch>
@@ -159,10 +208,31 @@ signals:
- <signal 1>: pass/fail (<evidence>)
- <signal 2>: pass/fail (<evidence>)
browser: <snapshot / DOM / API evidence>
knowledgeChecks:
- ref: <K-001@1>
result: <passed|failed|not_applicable>
evidence: <independent evidence>
knowledgeCandidates:
- kind: guardrail/pitfall/verification
title: <new lesson found by Test>
claim: <evidence-backed project claim>
scope:
components: [<component>]
paths: [<path glob>]
dependencies: [<dependency>]
versions: [<version>]
tags: [<tag>]
appliesWhen: <trigger>
directive: <action, not a shell command>
rationale: <why this changes future work>
evidenceRefs: [<independent evidence reference>]
conclusion: all-signals-pass / signals-failed
notes: <observations, suspected cause if failed>
notes: <observations, suspected cause, and independent candidate validation evidence>
```
没有适用项时列表写 `[]`。Test 的知识结论仍只是证据;只有 Coordinator 能写入或
激活 `knowledge.yaml`
Orca 模式下用 `orca-adapter.md` §「Test 回报复测结果」的命令发送同样的字段。
---
@@ -181,6 +251,11 @@ Orca 模式下用 `orca-adapter.md` §「Test 回报复测结果」的命令发
验证命令:
- <command>: passed
项目知识:
- 本轮采用:<knowledgeRefs and checks>
- 新增或更新:<active/stale/superseded entries written by Coordinator, or none>
- 待验证 candidate<remaining candidates or none>
工作树状态:
- <repo_path>: <git status summary>
- <dev_worktree>: <git status summary>