@tea-agent/loop-agent 0.13.0-beta.0 → 0.14.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/AGENTS.md +2 -0
- package/CHANGELOG.md +56 -305
- package/README.md +13 -19
- package/dist/commands/init.js +92 -23
- package/dist/executors/pi-event-serializer.js +33 -11
- package/dist/executors/shell-executor.js +200 -21
- package/dist/infrastructure/evaluation/candidate-store.js +5 -1
- package/dist/worker/observe/spec-evidence.js +19 -10
- package/dist/worker/observe/static/app.js +4 -3
- package/dist/worker/observe/static/constants.js +10 -2
- package/dist/worker/observe/static/dag-helpers.js +37 -8
- package/dist/worker/observe/static/dom.js +159 -0
- package/dist/worker/observe/static/format-pool.d.ts +71 -0
- package/dist/worker/observe/static/format-pool.js +67 -0
- package/dist/worker/observe/static/format.js +27 -2
- package/dist/worker/observe/static/index.html +76 -34
- package/dist/worker/observe/static/kpi.js +12 -6
- package/dist/worker/observe/static/markdown-render.js +124 -0
- package/dist/worker/observe/static/shell-chrome.js +8 -2
- package/dist/worker/observe/static/state.js +20 -0
- package/dist/worker/observe/static/styles.css +662 -60
- package/dist/worker/observe/static/views/dag-inspector.js +65 -142
- package/dist/worker/observe/static/views/dag.js +9 -0
- package/dist/worker/observe/static/views/dashboard.js +512 -269
- package/dist/worker/observe/static/views/pool.js +595 -237
- package/dist/worker/observe/static/views/session-timeline.js +577 -11
- package/dist/workflows/dag/backend-test-case-manifest.js +503 -0
- package/dist/workflows/dag/backend-test-execution-contract.js +353 -0
- package/dist/workflows/dag/backend-test-result-contract.js +568 -0
- package/dist/workflows/dag/decision-envelope.js +57 -2
- package/dist/workflows/dag/frontend-implementation-contract.js +240 -0
- package/dist/workflows/dag/frontend-project-capability.js +309 -0
- package/dist/workflows/dag/frontend-repair.js +341 -0
- package/dist/workflows/dag/frontend-risk.js +161 -0
- package/dist/workflows/dag/frontend-verification-trace.js +190 -0
- package/dist/workflows/dag/init-hybrid.js +1020 -125
- package/dist/workflows/dag/repair-artifact.js +43 -3
- package/dist/workflows/dag/skill-instructions.js +4 -2
- package/dist/workflows/dag/types.js +29 -8
- package/docs/README.md +2 -0
- package/docs/agent-dag-recovery-playbook.md +3 -3
- package/docs/agent-dag-runner.md +3 -3
- package/docs/architecture/README.md +3 -3
- package/docs/architecture/dag-execution.md +1 -1
- package/docs/architecture/evolution.md +13 -13
- package/docs/architecture/facts-and-state.md +1 -1
- package/docs/architecture/runtime-boundaries.md +7 -7
- package/docs/architecture/system-overview.md +3 -3
- package/docs/architecture/worker-and-feature.md +3 -3
- package/docs/design/README.md +7 -7
- package/docs/development-principles.md +4 -4
- package/docs/exec-plans/active/README.md +2 -4
- package/docs/exec-plans/completed/README.md +29 -6
- package/docs/feature-workflow.md +57 -32
- package/docs/init-surface.manifest.json +21 -3
- package/docs/loop-agent-harness.md +8 -8
- package/docs/production-readiness.md +1 -1
- package/docs/progress/README.md +20 -3
- package/docs/reports/README.md +53 -7
- package/docs/templates/agent-dag.supervised-implementation.json +127 -8
- package/docs/templates/backend-test-case-manifest.schema.json +190 -0
- package/docs/templates/backend-test-dag.classify.prompt.md +75 -0
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +6 -4
- package/docs/templates/backend-test-dag.json +269 -21
- package/docs/templates/backend-test-dag.retrospect.prompt.md +44 -30
- package/docs/templates/backend-test-dag.review-cases.prompt.md +6 -4
- package/docs/templates/backend-test-execution.schema.json +133 -0
- package/docs/templates/backend-test-result.schema.json +99 -0
- package/docs/templates/branch-merge-report.md +93 -0
- package/docs/templates/frontend-eval/fixtures/failures/01-type-build-error.md +17 -0
- package/docs/templates/frontend-eval/fixtures/failures/02-unit-component-test-fail.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/03-fixture-schema-drift.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/04-missing-loading-empty-error-state.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/05-forbidden-write-writeset-expansion.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/06-unapproved-dependency-add.md +16 -0
- package/docs/templates/frontend-eval/fixtures/failures/07-mock-production-on.md +21 -0
- package/docs/templates/frontend-eval/fixtures/functional/01-simple-component-style.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/02-form-validation.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/03-list-detail-page.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/04-api-mock.md +29 -0
- package/docs/templates/frontend-eval/fixtures/functional/05-permission-auth-gated-ui.md +27 -0
- package/docs/templates/frontend-eval/fixtures/functional/06-ssr-server-client-boundary.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/07-shared-public-component-api.md +28 -0
- package/docs/templates/frontend-eval/fixtures/functional/08-pure-local-no-remote.md +27 -0
- package/docs/templates/frontend-eval/metrics.md +138 -0
- package/docs/templates/frontend-eval/smoke-targets.md +53 -0
- package/docs/templates/frontend-implementation-contract.schema.json +27 -0
- package/docs/verification-matrix.md +1 -1
- package/examples/decision-gate-agent-dag.json +4 -4
- package/examples/hybrid-loop-agent-dag.json +1 -1
- package/package.json +2 -2
- package/skills/ai-engineering-context/SKILL.md +2 -2
- package/skills/browser-tools/SKILL.md +196 -0
- package/skills/browser-tools/browser-content.js +103 -0
- package/skills/browser-tools/browser-cookies.js +35 -0
- package/skills/browser-tools/browser-eval.js +53 -0
- package/skills/browser-tools/browser-hn-scraper.js +108 -0
- package/skills/browser-tools/browser-nav.js +44 -0
- package/skills/browser-tools/browser-pick.js +162 -0
- package/skills/browser-tools/browser-screenshot.js +34 -0
- package/skills/browser-tools/browser-start.js +86 -0
- package/skills/browser-tools/package-lock.json +2556 -0
- package/skills/browser-tools/package.json +19 -0
- package/skills/frontend-implementation/SKILL.md +3 -1
- package/skills/frontend-implementation/references/node-contracts.md +17 -66
- package/skills/frontend-verification/SKILL.md +1 -1
- package/skills/grill-with-docs/SKILL.md +5 -5
- package/skills/grill-with-docs/adr-format.md +3 -3
- package/skills/init-capability-evolution/SKILL.md +5 -5
- package/skills/loop-agent/SKILL.md +5 -5
- package/skills/loop-agent/references/README.md +3 -3
- package/skills/loop-agent/references/command-reference.md +39 -17
- package/skills/loop-agent/references/docs-converge.md +15 -15
- package/skills/loop-agent/references/harness-policy.md +2 -2
- package/skills/loop-agent/references/hybrid-dag.md +20 -15
- package/skills/loop-agent/references/multi-worktree.md +1 -1
- package/skills/loop-agent/references/orchestrator-and-interventions.md +8 -8
- package/skills/loop-agent/references/task-workflow.md +1 -1
- package/skills/loop-agent/references/verification-and-failure-handling.md +6 -4
- package/skills/requesting-code-review/SKILL.md +1 -1
- package/skills/systematic-debugging/CREATION-LOG.md +3 -3
- package/skills/systematic-debugging/SKILL.md +1 -1
- package/skills/systematic-debugging/test-academic.md +1 -1
- package/skills/systematic-debugging/test-pressure-1.md +1 -1
- package/skills/systematic-debugging/test-pressure-2.md +1 -1
- package/skills/systematic-debugging/test-pressure-3.md +1 -1
- package/skills/verification-before-completion/SKILL.md +1 -1
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
前端专用链在 `frontend-scout-pi` 后加入只读 `frontend-mock-assess-pi` 和确定性 contract gate,根据接口契约、后端就绪度、生成期能力 seed 与固化验证入口选择 `native|browser-intercept|request-adapter|not-needed|blocked`。策略直接传给 plan、两阶段 design review、唯一 writer、实现 review 和 closeout;真实请求保持默认,缺少契约、生产隔离或可执行验证时 gate 阻塞。可选 `frontendMock` 配置声明 `auto|required|disabled`、既有服务目录与专项命令;不安全或不完整的显式 required 合同只生成无 writer 的评估链,有可信命令时才增加 `frontend-mock-verify-shell`。Mock-backed 证据只证明前端状态;`not-needed` 需要真实或无远程接口行为证据。未调用后端时 closeout 报告 `Frontend status: mock-validated` 与 `Real integration: pending`。
|
|
20
20
|
|
|
21
|
-
显式专用 `taskKind` 保持兼容并优先于任务源分类,也不扩充 governance profile:`frontend-implementation` 显式选择前端实现 DAG,`backend-test`
|
|
21
|
+
显式专用 `taskKind` 保持兼容并优先于任务源分类,也不扩充 governance profile:`frontend-implementation` 显式选择前端实现 DAG,`frontend-test` 选择 FE-test RAG DAG,`backend-test` 选择后端测试 DAG,`knowledge-sync` 选择 Feature 测试知识回写 DAG,`knowledge-graph-bootstrap` 选择业务知识图谱开荒/增量 DAG。后端测试链为 `analyze-inputs-pi → backend-test-analysis-contract-shell → backend-test-environment-scout-pi → backend-test-execution-contract-shell → generate-backend-functional-cases-pi → emit-backend-case-manifest-pi → backend-test-case-manifest-shell → review-backend-cases-pi → review-backend-cases-gate-shell → generate-backend-pytest-pi → backend-test-traceability-gate-shell → execute-backend-pytest-shell → parse-backend-test-result-shell → classify-backend-test-result-pi → test-retrospect-pi → backend-test-outcome-gate-shell`。analysis/execution/case-manifest gate 写入 run-owned contracts;parse materialize Backend Test Result v1(`contracts/backend-test-result.json`)。Case Manifest 确定性校验 AC→case 覆盖;traceability gate 校验 generated file/symbol。execute 在非空 JUnit 下将 pytest exit 0/1 视为节点成功以便 always-run retrospect;`backend-test-outcome-gate-shell` 以 result.outcome 收口;retrospect 使用 manifest coverageSummary + Result v1,不得自造 coverage%。`evidenceGaps`、未知 framework、secret 值、路径穿越或 preflight 失败时后续 writer/execute 不启动。`knowledge-sync` 链必须绑定 `featureId`;图谱运维公共入口是 `loop-agent knowledge query|graph-init|graph-materialize|graph-promote|graph-incremental-prepare`。治理等级仍由既有 `minimal|standard|reviewed|supervised` 规则推断。
|
|
22
22
|
|
|
23
23
|
### DAG workflow 层级
|
|
24
24
|
|
|
@@ -43,7 +43,7 @@ loop-agent run-dag --dag <temp-dir>/hybrid-dag.json --init-only --canvas-path <t
|
|
|
43
43
|
|
|
44
44
|
`<temp-dir>` 表示平台原生临时目录;实际命令中 macOS 与 Windows 都使用本机路径。`/` 只作为 repo refs、JSON/Markdown evidence refs 和 glob 约定的稳定分隔符。
|
|
45
45
|
|
|
46
|
-
完整 schema 与语义:`
|
|
46
|
+
完整 schema 与语义:`ai_workspace/loop-agent/agent-dag-runner.md`。Workflow 概览:`ai_workspace/loop-agent/loop-agent-harness.md`。
|
|
47
47
|
|
|
48
48
|
**v2 字段**(均可选;缺失时行为同 v1):
|
|
49
49
|
|
|
@@ -86,14 +86,16 @@ loop-agent run-dag --dag <temp-dir>/hybrid-dag.json --init-only --canvas-path <t
|
|
|
86
86
|
|
|
87
87
|
### Supervised implementation flow(减少 main-session intervention)
|
|
88
88
|
|
|
89
|
-
长时 implementation 曾迫使 main session 中途 re-verify、re-review 或 surgical-patch 时,用 `
|
|
89
|
+
长时 implementation 曾迫使 main session 中途 re-verify、re-review 或 surgical-patch 时,用 `ai_workspace/loop-agent/templates/agent-dag.supervised-implementation.json`。
|
|
90
90
|
|
|
91
|
-
**此前 main session 介入原因**:linear hybrid DAG 缺少 in-run writeSet coverage audit
|
|
91
|
+
**此前 main session 介入原因**:linear hybrid DAG 缺少 in-run writeSet coverage audit;旧 supervised write-set gate 在初审返回 `request-revision` 或遗漏 `VERDICT:` 时也会直接 `partial_failed`,需要人工新建下一轮 run。此外还缺少 supervision 前归档的 soft verification、read-only process supervisor(`executor: pi`,`role: supervisor` — 非新 executor)、bounded repair exclusive writer、确定性 hard-verify shell fact,以及 fail-closed review verdict gate(除非 whitelist `VERDICT:` 行存在)。
|
|
92
92
|
|
|
93
93
|
**Supervised topology**(执行前替换所有 `REPLACE/WITH/...` placeholder):
|
|
94
94
|
|
|
95
95
|
```text
|
|
96
96
|
contract-pi → scout-src ∥ scout-tests → plan-pi → write-set-audit-pi
|
|
97
|
+
→ write-set-audit-format-repair-pi → write-set-format-gate-shell
|
|
98
|
+
→ plan-revision-pi → final-write-set-audit-pi → final-write-set-audit-format-repair-pi
|
|
97
99
|
→ write-set-gate-shell → implement-pi → soft-verify-shell → process-supervisor-pi → process-gate-shell
|
|
98
100
|
→ repair-pi → hard-verify-shell
|
|
99
101
|
→ [authority-surface-audit-pi → authority-surface-gate-shell] # 可选
|
|
@@ -102,8 +104,11 @@ contract-pi → scout-src ∥ scout-tests → plan-pi → write-set-audit-pi
|
|
|
102
104
|
|
|
103
105
|
| Stage | 减少 main-session 工作的方式 |
|
|
104
106
|
|-------|------------------------------|
|
|
105
|
-
| `write-set-audit-pi` | implement 前捕获 missing/overlapping writeSet owner |
|
|
106
|
-
| `write-set-
|
|
107
|
+
| `write-set-audit-pi` | implement 前捕获 missing/overlapping writeSet owner;第一条非空行必须是 canonical verdict |
|
|
108
|
+
| `write-set-audit-format-repair-pi` / `final-write-set-audit-format-repair-pi` | 初审和终审各有一次只读格式恢复;只补 canonical verdict/结构并保留 findings,结论不明确时返回 `request-revision`,不得从一般正文猜 pass |
|
|
109
|
+
| `write-set-format-gate-shell` | 接受格式有效的 pass/request-revision,让有界计划修订继续;本 gate 不授权写入 |
|
|
110
|
+
| `plan-revision-pi` | 最多一轮只读计划修订;初审 pass 时输出 `PASS_NO_REVISION_NEEDED`,request-revision 时解决全部 findings;不得扩大 task `allowedPaths` |
|
|
111
|
+
| `final-write-set-audit-pi` + `write-set-gate-shell` | 终审复核有效计划;只有规范化后的最终 `VERDICT: pass` 授权 implement,终审 request-revision 或格式仍无效时 fail-closed |
|
|
107
112
|
| `soft-verify-shell` | supervision 前归档 focused test exit code |
|
|
108
113
|
| `process-supervisor-pi` | read-only audit coverage、boundary drift、verify gap、repair scope;应 prominently 输出 `VERDICT: pass` 或 `VERDICT: request-revision` |
|
|
109
114
|
| `process-gate-shell` | supervisor node JSON 上 runtime `shell.verdictGate`(仅 `pass` 或 `request-revision`) |
|
|
@@ -118,7 +123,7 @@ contract-pi → scout-src ∥ scout-tests → plan-pi → write-set-audit-pi
|
|
|
118
123
|
|
|
119
124
|
**Runtime contract 与 controller identity**:新生成的 DagSpec 使用 `version: 3`,并必须携带 `runtimeContract`(`schemaVersion` / `agentRuntime: "pi-only"` / `repairWriterProtocol: "explicit-node-v1"` / 可选 `minimumControllerVersion`)。v3 是旧 controller 无法忽略的解析边界;capability 与最低版本是新 controller 的执行前兼容门。`init-hybrid` 不硬编码 `minimumControllerVersion`,手写 spec 可按需 pin。每个新 run 必须解析并冻结 controller identity(package version、binary SHA-256、portable fingerprint)到 `controller-identity.json`;解析失败不创建 run。`dag report` 展示 identity 与 runtime-contract compatibility,resume 对漂移、篡改或 legacy-unpinned run 全部 fail closed;legacy run 仍可只读报告或显式 reconcile。
|
|
120
125
|
|
|
121
|
-
Prompt invariant:`
|
|
126
|
+
Prompt invariant:`ai_workspace/loop-agent/templates/agent-dag-process-supervisor.prompt.md`、`ai_workspace/loop-agent/templates/agent-dag-review-verdict.prompt.md`、`ai_workspace/loop-agent/templates/agent-dag-authority-surface-audit.prompt.md`(启用时)。测试:`npx vitest run test/dag-supervised-template.test.ts test/authority-surface.test.ts`。完整叙述:`ai_workspace/loop-agent/agent-dag-runner.md` §「Why main-session interventions happened」。
|
|
122
127
|
|
|
123
128
|
**未实现**:`executor: supervisor`、whole-run automatic retry/resume、`executor: human`/`decision`、browser executor,或 read-only node 对 root `artifacts/**` 的 exemption。注:有界只读 Pi 节点重试已实现(见下「只读 Pi 节点安全重试」)。
|
|
124
129
|
|
|
@@ -144,20 +149,20 @@ loop-agent dag run-task <task-id> --init-only --cwd <repo-root>
|
|
|
144
149
|
|
|
145
150
|
### DAG 与 artifacts source-of-truth 规则
|
|
146
151
|
|
|
147
|
-
- 临时 DAG input spec 放平台原生临时目录(例如 `<temp-dir>/<topic>-dag.json`);可复用 template 放 `examples/` 或 `
|
|
152
|
+
- 临时 DAG input spec 放平台原生临时目录(例如 `<temp-dir>/<topic>-dag.json`);可复用 template 放 `examples/` 或 `ai_workspace/loop-agent/templates/`。
|
|
148
153
|
- **不要**在 `.harness/dag-runs/active/` root 保留手写 DAG input 副本。
|
|
149
154
|
- **不要**把 `.harness/dag-runs/` 内容 commit 到 git。
|
|
150
155
|
- canonical per-run DAG 历史是 `.harness/dag-runs/completed/<run-id>/run.json` 及该 run 目录的 `state.json`、`executor.jsonl`、node artifacts;新建 run directory 使用 `YYYYMMDD-<slug>`。
|
|
151
156
|
- root `artifacts/修改记录.md` 与 `artifacts/验证结果.md` 是 legacy current-work / explicit-write 摘要。不是 per-run 不可变历史,也不是新工作流默认交付路径。
|
|
152
157
|
- Agent DAG read-only node 不得写 root `artifacts/`;若须更新 root artifacts,用显式 `exclusive` write node 或记录了理由、验证与迁移计划的 main-session surgical patch。
|
|
153
158
|
- DAG Cursor 节点交付物必须写入 `.harness/dag-runs/<state>/<run-id>/artifacts/<node-id>/`;`./artifacts/**` 是错误落点。
|
|
154
|
-
- 长期结论须迁入 `
|
|
159
|
+
- 长期结论须迁入 `ai_workspace/loop-agent/exec-plans/`、`ai_workspace/loop-agent/reports/` 或 `ai_workspace/loop-agent/progress/`。从 completed run evidence 汇总 task artifacts 时用 `promote-run <task-id> --run-id <run-id>`;再用 `closeout task <task-id>` 生成 progress。二者 deterministic,且不 mutate completed run facts。
|
|
155
160
|
|
|
156
161
|
**DAG author 的 artifact-boundary 提醒**:大量 *讨论* root `artifacts/**` 的 task 仍遵守同一 write guard — read-only node 仅在 node output 返回发现;exclusive node 保持 `artifacts/**` 在 `forbiddenPaths`,除非 concrete path 在 `writeSet`。不要在 declared writeSet 外 instruct implementer 写 `artifacts/修改记录.md` 或 `artifacts/验证结果.md`(P3 boundary-risk practice)。scout 在链接 skill reference 中发现 stale wording 时,把那些 path 纳入 implementer writeSet,或接受记录的 main-session patch(P2 教训:`hybrid-dag.md` 被 scout 发现但 initial writeSet 遗漏)。
|
|
157
162
|
|
|
158
163
|
### Decision Gate(M3–M5 runtime)
|
|
159
164
|
|
|
160
|
-
Pi reviewer node 设 `decisionGate.enabled: true` 时,runner 从 persisted `assistantText`(优先)或 `result.summary.md`(fallback)解析 **恰好一个** info string 为 `DECISION_ENVELOPE_JSON` 的 fenced block。Schema:`
|
|
165
|
+
Pi reviewer node 设 `decisionGate.enabled: true` 时,runner 从 persisted `assistantText`(优先)或 `result.summary.md`(fallback)解析 **恰好一个** info string 为 `DECISION_ENVELOPE_JSON` 的 fenced block。Schema:`ai_workspace/loop-agent/templates/agent-dag-decision-envelope.schema.json`。Prompt:`ai_workspace/loop-agent/templates/agent-dag-decision-gate.prompt.md`(含 §Recovery Recommendation Consumption 与 schema-adherence 硬规则:勿发明 envelope schema、勿用 `decision: accept`、勿加 extra root key、`audit.runId` 须绑定当前 run id,并填 `audit.nodeId` / `audit.model`)。Playbook:`ai_workspace/loop-agent/agent-dag-recovery-playbook.md`。示例 DAG:`examples/decision-gate-agent-dag.json`。
|
|
161
166
|
|
|
162
167
|
| Milestone | `decisionGate.mode` | 行为 |
|
|
163
168
|
|-----------|---------------------|----------|
|
|
@@ -169,10 +174,10 @@ Pi reviewer node 设 `decisionGate.enabled: true` 时,runner 从 persisted `as
|
|
|
169
174
|
loop-agent dag doctor
|
|
170
175
|
loop-agent dag status --run-id <run-id>
|
|
171
176
|
loop-agent dag report --paused-latest [--json|--markdown] # 最新 paused run;勿与 --lifecycle 并用
|
|
172
|
-
loop-agent dag report [--run-id <run-id>] [--lifecycle active|paused|completed|all] [--json|--markdown] [--failed-only] [--latest] [--action <recovery-action>] # derived per-node report(只读);JSON schema:
|
|
177
|
+
loop-agent dag report [--run-id <run-id>] [--lifecycle active|paused|completed|all] [--json|--markdown] [--failed-only] [--latest] [--action <recovery-action>] # derived per-node report(只读);JSON schema: ai_workspace/loop-agent/templates/agent-dag-report.schema.json;仅 advisory — 见 ai_workspace/loop-agent/agent-dag-recovery-playbook.md
|
|
173
178
|
loop-agent dag closeout-draft [--run-id <run-id>] [--output <path>] # M5:从 completed run facts 生成确定性 closeout draft;默认平台临时目录;仅 advisory;不 mutate completed facts
|
|
174
179
|
loop-agent promote-run <task-id> --run-id <run-id> # 从 completed DAG/one-shot evidence 汇总 task artifacts;不 mutate completed facts
|
|
175
|
-
loop-agent closeout task <task-id> # 从 task artifacts 生成
|
|
180
|
+
loop-agent closeout task <task-id> # 从 task artifacts 生成 ai_workspace/loop-agent/progress closeout
|
|
176
181
|
loop-agent dag reconcile-tasks --glob '<pattern>' [--json|--markdown] # 仅报告的 task/run/artifact/verify drift audit
|
|
177
182
|
loop-agent dag final-verification <task-id> [--output <path>] # 生成 closeout DAG;final verify 依赖 closeout artifact
|
|
178
183
|
loop-agent dag decision inspect --run-id <run-id> [--node-id <node-id>]
|
|
@@ -213,11 +218,11 @@ review-heavy DAG 中长 shell stdout 可能掩盖 proof 时,用 **evidence-sum
|
|
|
213
218
|
- **不要**期望 runner enforce、parse 或 validate `EVIDENCE:` 格式;**不要**在 `shell.verdictGate` 或 shell exit code 已够用时手写 shell grep `EVIDENCE:`。
|
|
214
219
|
- read-only node 不得写 root `artifacts/**`;compact evidence 属于 `.harness/dag-runs/<run-id>/` 下归档的 node output。
|
|
215
220
|
|
|
216
|
-
完整叙述:`
|
|
221
|
+
完整叙述:`ai_workspace/loop-agent/agent-dag-runner.md` §「Evidence Summary as a Practice Convention」。P1 calibration report:`ai_workspace/loop-agent/reports/2026-06-08-agent-dag-practice-p1-evidence-summary-docs.md`。
|
|
217
222
|
|
|
218
223
|
### Authoring checklist(P1–P5 practice guidance — 非 runtime 行为)
|
|
219
224
|
|
|
220
|
-
> 与 `
|
|
225
|
+
> 与 `ai_workspace/loop-agent/agent-dag-runner.md` §「Agent DAG authoring checklist」相同。Calibration reports:`ai_workspace/loop-agent/reports/2026-06-08-agent-dag-practice-p1-evidence-summary-docs.md` … `p5-handoff-closeout-20260608.md`。
|
|
221
226
|
|
|
222
227
|
| # | Check | Expect |
|
|
223
228
|
|---|-------|--------|
|
|
@@ -225,7 +230,7 @@ review-heavy DAG 中长 shell stdout 可能掩盖 proof 时,用 **evidence-sum
|
|
|
225
230
|
| 2 | Executor | 每个 task 显式声明 `executor`;`defaults.executor` 是 schema metadata,非 runtime fallback |
|
|
226
231
|
| 3 | Model routing | 用 node `complexity` + `executorModels`;Pi MED(`glm-5.2`)quota 耗尽时提高 Pi node 到 `complexity: HIGH`(`gpt-5.5`)— 勿 mutate canonical model matrix |
|
|
227
232
|
| 4 | Read-only output | read-only / Pi node 在 **node output** 返回发现;runner 归档于 `.harness/dag-runs/<run-id>/<node-id>/` |
|
|
228
|
-
| 5 | Root `artifacts/**` | 非 read-only handoff target;持久记录去 `
|
|
233
|
+
| 5 | Root `artifacts/**` | 非 read-only handoff target;持久记录去 `ai_workspace/loop-agent/reports/`、`ai_workspace/loop-agent/progress/`,或 narrow exclusive `writeSet` 写 legacy 摘要并记录迁移计划 |
|
|
229
234
|
| 6 | DAG Cursor artifacts | 写入 `.harness/dag-runs/<state>/<run-id>/artifacts/<node-id>/`;不得写入 `./artifacts/**` |
|
|
230
235
|
| 7 | Completed facts | `.harness/dag-runs/completed/**` 仅可读 evidence — 归档后永不 mutate 历史 run 目录、`run.json`、`state.json` 或 `artifacts/**` |
|
|
231
236
|
| 8 | Verdict gate | review/supervisor 应以 `VERDICT: pass` 或 `VERDICT: request-revision` 开头以利阅读;用 current-run `<fromNodeId>.json`(`$HARNESS_DAG_RUN_DIR`)上 `shell.verdictGate` block,exact-match `accept[]`;默认 `lineMode=first-non-empty`,supervised template 用 `first-verdict-line` 容忍 preamble 或第一条 normalized `VERDICT:` 前的常见整行 Markdown emphasis |
|
|
@@ -51,4 +51,4 @@ delegate --auto-run → Pi DAG 跑 contract/scout/plan/implement/verify → comp
|
|
|
51
51
|
|
|
52
52
|
Agent DAG 是默认 autonomous path;`delegate`/`harvest` 提供 worktree 隔离与收口,`--auto-run` 仍只运行 Pi-only DAG。需要人工 Cursor 介入时使用独立的 `cursor-prompt` sidecar,不进入 delegate 或 DAG runtime。多 task 并行时,每个 task 独立 `delegate`,完成后分别 `harvest`。
|
|
53
53
|
|
|
54
|
-
详见 `
|
|
54
|
+
详见 `ai_workspace/loop-agent/cursor-prompt-sidecar.md` 与 `ai_workspace/loop-agent/loop-agent-harness.md`。
|
|
@@ -59,7 +59,7 @@ sidecar intervention 是一次性 Pi 或 Cursor prompt,用于 unblock 主 work
|
|
|
59
59
|
|
|
60
60
|
- 同一 issue 不应反复 sidecar。若需要,pause 并 replan。
|
|
61
61
|
- 可写 sidecar 须在 edit 后跑 targeted verification。
|
|
62
|
-
- sidecar 发现须写入 task artifacts、DAG node artifacts、`
|
|
62
|
+
- sidecar 发现须写入 task artifacts、DAG node artifacts、`ai_workspace/loop-agent/progress` 或 report 后再 resume。
|
|
63
63
|
- sidecar 输出为 advisory,直到 deterministic command 验证或并入 canonical workflow state。
|
|
64
64
|
|
|
65
65
|
### Agent DAG read-only artifact boundary
|
|
@@ -74,9 +74,9 @@ Agent DAG read-only node **不得**写 root `artifacts/`。
|
|
|
74
74
|
|
|
75
75
|
**Linked skill-reference writeSet candidates**:DAG task 变更 workflow 语义(artifact boundary、verdict gate、evidence summary、intervention policy)时,scout node 应提议 `./skill/references/**` 下链接文件为 **writeSet expansion candidates**,而非仅 primary docs。P2 表明 implementer writeSet 遗漏 `hybrid-dag.md` 时,虽 scout 已发现 drift,仍须 post-DAG main-session patch。
|
|
76
76
|
|
|
77
|
-
**Bounded main-session patch 须记录**:DAG run 中或之后任何可接受的 surgical patch(scope、变更文件、verification、rationale)应写入 `
|
|
77
|
+
**Bounded main-session patch 须记录**:DAG run 中或之后任何可接受的 surgical patch(scope、变更文件、verification、rationale)应写入 `ai_workspace/loop-agent/reports/`、`ai_workspace/loop-agent/progress/` 或 active exec plan — 不可静默应用且无 audit trail。
|
|
78
78
|
|
|
79
|
-
**勿把 root `artifacts/**` 当 read-only DAG handoff**(P3/P5):即使 task 文本、scout 或 supervisor 讨论 `artifacts/修改记录.md` / `artifacts/验证结果.md`,read-only DAG node 只能在 node output 返回发现。root `artifacts/` 是 legacy / explicit-write 摘要区,不是 in-flight DAG node 的共享 scratchpad,也不是新工作流默认 handoff。post-DAG 持久 handoff 用 `
|
|
79
|
+
**勿把 root `artifacts/**` 当 read-only DAG handoff**(P3/P5):即使 task 文本、scout 或 supervisor 讨论 `artifacts/修改记录.md` / `artifacts/验证结果.md`,read-only DAG node 只能在 node output 返回发现。root `artifacts/` 是 legacy / explicit-write 摘要区,不是 in-flight DAG node 的共享 scratchpad,也不是新工作流默认 handoff。post-DAG 持久 handoff 用 `ai_workspace/loop-agent/reports/`、`ai_workspace/loop-agent/progress/`、exec-plan 索引与 `.harness/dag-runs/completed/<run-id>/` node artifacts。
|
|
80
80
|
|
|
81
81
|
### Completed run facts boundary(P3/P5)
|
|
82
82
|
|
|
@@ -97,10 +97,10 @@ main session 编排;不是默认 implementer。in-flight run 期间:
|
|
|
97
97
|
|--------|------|----------|
|
|
98
98
|
| Inspect status / node artifacts | 始终允许 | progress 或 sidecar output 中的 notes |
|
|
99
99
|
| Sidecar read-only Pi/Cursor prompt | 诊断、plan critique、log 解读 | resume 前的 findings |
|
|
100
|
-
| Surgical patch | small、obvious、可 verify;无 active `writeSet` 冲突 | `
|
|
100
|
+
| Surgical patch | small、obvious、可 verify;无 active `writeSet` 冲突 | `ai_workspace/loop-agent/reports/` 或 exec plan,含 scope + verification |
|
|
101
101
|
| DAG/source repair | topology、writeSet 或 prompt contract 错误 | 编辑平台临时目录中的 DAG 或 plan;re-validate;rerun |
|
|
102
102
|
| Approve/reject/resume | Decision Gate `pause-on-human` | 仅 CLI artifacts |
|
|
103
|
-
| Post-DAG closeout | promotion、report、plan archive、indexes | `promote-run`、`closeout task`、`
|
|
103
|
+
| Post-DAG closeout | promotion、report、plan archive、indexes | `promote-run`、`closeout task`、`ai_workspace/loop-agent/reports/`、`ai_workspace/loop-agent/progress`、exec-plan indexes — 非 root `artifacts/`,除非 explicit narrow writeSet |
|
|
104
104
|
|
|
105
105
|
**Verdict 与 Decision Gate 提醒**(authoring guidance,非 runtime 变更):
|
|
106
106
|
|
|
@@ -108,7 +108,7 @@ main session 编排;不是默认 implementer。in-flight run 期间:
|
|
|
108
108
|
- Decision Gate node:恰好一个 `DECISION_ENVELOPE_JSON` block;`audit.runId` 须为 **当前** run id(P4 misbind 教训;P5 fix)。
|
|
109
109
|
- Pi MED quota 耗尽:提高 Pi node `complexity` 到 `HIGH`,而非改 `executorModels` 或加 auto-retry(P4)。
|
|
110
110
|
|
|
111
|
-
完整 authoring checklist:`
|
|
111
|
+
完整 authoring checklist:`ai_workspace/loop-agent/agent-dag-runner.md` §「Agent DAG authoring checklist」与 `hybrid-dag.md` § Authoring checklist。
|
|
112
112
|
|
|
113
113
|
## Main-session surgical patch policy
|
|
114
114
|
|
|
@@ -165,5 +165,5 @@ Run DAG workflow
|
|
|
165
165
|
|
|
166
166
|
每次 intervention 须留可恢复 trail:
|
|
167
167
|
|
|
168
|
-
- Agent DAG:优先 node artifacts 于 `.harness/dag-runs/<state>/<run-id>/<node-id>/`;长期结论写入 `
|
|
169
|
-
- Repo
|
|
168
|
+
- Agent DAG:优先 node artifacts 于 `.harness/dag-runs/<state>/<run-id>/<node-id>/`;长期结论写入 `ai_workspace/loop-agent/progress`、`ai_workspace/loop-agent/reports` 或 `ai_workspace/loop-agent/exec-plans`。read-only node 不得写 root `artifacts/`。
|
|
169
|
+
- Repo ai_workspace/loop-agent/skill workflow 变更:以 governance checks 结束,practice 变更时更新本 skill。
|
|
@@ -36,7 +36,7 @@ loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
|
|
|
36
36
|
- 用户原始 PRD 用 `loop-agent import-prd <task-id> --file <prd>` 归档到 `source/references/`,禁止 AI 改写。
|
|
37
37
|
- `需求.md` 是派生执行契约:写清目标、验收标准、非目标,并用 REQ/AC 或原文锚点映射回 references。
|
|
38
38
|
- `执行约束.md` 写清允许文件、禁止改动、硬约束和验证命令。
|
|
39
|
-
- 若 `
|
|
39
|
+
- 若 `ai_workspace/loop-agent/` 已有权威 plan/spec/PRD,优先 `import-prd` 复制,再在 `需求.md` 引用;避免把长 PRD 直接改写成唯一 source。
|
|
40
40
|
- Worker / TaskSpec materialize 路径会把 `source_docs` 复制到 `source/references/`,并在派生 `需求.md` 顶部声明“冲突以 references 为准”;`acceptance_refs` 应展开为短摘要而不只写 ID。
|
|
41
41
|
- review 节点必须三方对照:`source/references/*`(尤其 requirement/acceptance)、派生 `需求.md`、以及实现/验证证据。
|
|
42
42
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Verification 与失败处理
|
|
2
2
|
|
|
3
|
-
选择 verify strategy knobs、解读 verify 结果、决定失败后是否继续,或 closeout workflow/runtime/
|
|
3
|
+
选择 verify strategy knobs、解读 verify 结果、决定失败后是否继续,或 closeout workflow/runtime/ai_workspace/loop-agent/skill 变更时使用本文。
|
|
4
4
|
|
|
5
5
|
## Verify strategy 与 completion audit
|
|
6
6
|
|
|
7
7
|
## Production Readiness v0.1
|
|
8
8
|
|
|
9
|
-
低/中风险单 repo DAG 任务如果声明 production-ready v0.1,必须按 `
|
|
9
|
+
低/中风险单 repo DAG 任务如果声明 production-ready v0.1,必须按 `ai_workspace/loop-agent/production-readiness.md` 和 `ai_workspace/loop-agent/templates/production-readiness-checklist.md` 收口。
|
|
10
10
|
|
|
11
11
|
支持范围:
|
|
12
12
|
|
|
@@ -36,7 +36,7 @@ product_line_failure_category
|
|
|
36
36
|
recommended_follow_up
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
product-line taxonomy 的事实源是 `
|
|
39
|
+
product-line taxonomy 的事实源是 `ai_workspace/loop-agent/design/state-and-failure-taxonomy.md`。
|
|
40
40
|
|
|
41
41
|
### Verify 始终在本地跑
|
|
42
42
|
`verify` step 跑确定性命令(check-repo.sh + tests + typecheck)。**不**调用 pi。因此快且可靠。
|
|
@@ -75,6 +75,8 @@ product-line taxonomy 的事实源是 `docs/design/state-and-failure-taxonomy.md
|
|
|
75
75
|
### supervised repair gate 与 runtime contract 失败
|
|
76
76
|
|
|
77
77
|
- `repair artifact gate failed: ... no unique governed Pi writer` / `declares repairNodeId "..." but no task with that id exists`:DagSpec 的 `shell.repairArtifactGate` 未声明 `repairNodeId`,或声明的修复节点缺失、不是 gate 直接下游、不是受治理 Pi writer(`executor: pi`、`toolProfile: write`、`writePolicy: exclusive`、`allowedPaths`/`writeSet` 非空且不与 `forbiddenPaths` 冲突)。用当前 controller 重新生成 supervised DAG,或按上述契约补齐修复节点,不要靠改节点名绕过。
|
|
78
|
+
- `repair artifact field "rootCause" must be a non-empty string`:`request-revision` 的 `REPAIR_ARTIFACT_JSON.rootCause` 为空时 parser 不再容错,诊断必须明确根因。只有 `verdict: "pass"` 且 `rootCause` 为空白时才会被确定性规范化为 `No repair required.`,其余字段(fixScope、verdict mismatch、writer 边界)保持 fail-closed。
|
|
79
|
+
- `missing DECISION_ENVELOPE_JSON fenced block` / `decision-envelope-invalid`:`DECISION_ENVELOPE_JSON` info string 的 Markdown 围栏必须存在且唯一。Parser 接受三反引号及更长围栏,但 opening/closing fence 必须同长度,closing 同行只能有空白;不匹配围栏、裸 JSON、多个围栏、malformed JSON、schema-invalid 与 semantic-invalid 仍 fail-closed。若错误 payload 含 `taskId`、`gate`、`verdict`、`summary` 或 `decision: proceed-to-closeout`,说明 decision prompt/schema 漂移;用包含 canonical schema 示例的当前 controller 重新生成 DAG,不要放宽 parser 接受 legacy 结构。
|
|
78
80
|
- `incompatible DAG runtime contract` / `runtime contract requires ...`:DagSpec 的 `runtimeContract` 要求的能力超出当前 controller。升级 controller 或用当前 controller 重新生成 DAG;该 preflight 在任何节点执行前失败,不会留下半执行的 run。
|
|
79
81
|
- `controller identity drifted` / `artifact was tampered with`:resume 时的 controller 与 run 创建时冻结的 identity 不一致(package 内容、binary 或 fingerprint 变化),或 `controller-identity.json` 被篡改。启动新 run,而不是在漂移后 resume;completed run facts 保持只读。
|
|
80
82
|
|
|
@@ -128,7 +130,7 @@ child agent 失败时:
|
|
|
128
130
|
- **意外残留**(tmp 文件、探索性 mock、scratch 输出):handoff 前删除
|
|
129
131
|
|
|
130
132
|
### Closeout 规则
|
|
131
|
-
workflow/runtime/
|
|
133
|
+
workflow/runtime/ai_workspace/loop-agent/skill 变更结束时:
|
|
132
134
|
```bash
|
|
133
135
|
loop-agent docs audit
|
|
134
136
|
loop-agent handoff check <task-id>
|
|
@@ -55,7 +55,7 @@ HEAD_SHA=$(git rev-parse HEAD)
|
|
|
55
55
|
|
|
56
56
|
[Dispatch code reviewer subagent]
|
|
57
57
|
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
|
|
58
|
-
PLAN_OR_REQUIREMENTS: Task 2 from
|
|
58
|
+
PLAN_OR_REQUIREMENTS: Task 2 from ai_workspace/loop-agent/exec-plans/active/deployment-plan.md
|
|
59
59
|
BASE_SHA: a7981ec
|
|
60
60
|
HEAD_SHA: 3df7661
|
|
61
61
|
|
|
@@ -54,7 +54,7 @@ Framework 设计以 resist rationalization under pressure:
|
|
|
54
54
|
|
|
55
55
|
## Testing Approach
|
|
56
56
|
|
|
57
|
-
按 skills/meta/testing-skills-with-subagents 创建 4 个 validation tests:
|
|
57
|
+
按 .agents/skills/meta/testing-skills-with-subagents 创建 4 个 validation tests:
|
|
58
58
|
|
|
59
59
|
### Test 1: Academic Context (No Pressure)
|
|
60
60
|
- Simple bug,无 time pressure
|
|
@@ -82,7 +82,7 @@ Framework 设计以 resist rationalization under pressure:
|
|
|
82
82
|
- Flowchart for "fix failed" decision
|
|
83
83
|
|
|
84
84
|
### Enhancement 1: TDD Reference
|
|
85
|
-
- Added link to skills/testing/test-driven-development
|
|
85
|
+
- Added link to .agents/skills/testing/test-driven-development
|
|
86
86
|
- Note explaining TDD's "simplest code" ≠ debugging's "root cause"
|
|
87
87
|
- Prevents confusion between methodologies
|
|
88
88
|
|
|
@@ -104,7 +104,7 @@ Bulletproof skill that:
|
|
|
104
104
|
## Usage Example
|
|
105
105
|
|
|
106
106
|
遇到 bug 时:
|
|
107
|
-
1. Load skill: skills/debugging/systematic-debugging
|
|
107
|
+
1. Load skill: .agents/skills/debugging/systematic-debugging
|
|
108
108
|
2. Read overview (10 sec) — reminded of mandate
|
|
109
109
|
3. Follow Phase 1 checklist — forced investigation
|
|
110
110
|
4. If tempted to skip — see anti-pattern,stop
|
|
@@ -284,7 +284,7 @@ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
|
|
|
284
284
|
- **`condition-based-waiting.md`** — 用 condition polling 替代 arbitrary timeouts
|
|
285
285
|
|
|
286
286
|
**Related principles:**
|
|
287
|
-
- **RED-GREEN-REFACTOR**(见 `
|
|
287
|
+
- **RED-GREEN-REFACTOR**(见 `ai_workspace/loop-agent/harness-methodology-tdd.md`)— 用于 creating failing test case(Phase 4, Step 1)
|
|
288
288
|
- **Verification discipline** — 宣称 success 前 verify fix worked。Run verification command,读 output,THEN claim result。
|
|
289
289
|
|
|
290
290
|
## Real-World Impact
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Academic Test: Systematic Debugging Skill
|
|
2
2
|
|
|
3
|
-
You have access to the systematic debugging skill at skills/debugging/systematic-debugging
|
|
3
|
+
You have access to the systematic debugging skill at .agents/skills/debugging/systematic-debugging
|
|
4
4
|
|
|
5
5
|
Read the skill and answer these questions based SOLELY on what the skill says:
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
|
|
4
4
|
|
|
5
|
-
You have access to: skills/debugging/systematic-debugging
|
|
5
|
+
You have access to: .agents/skills/debugging/systematic-debugging
|
|
6
6
|
|
|
7
7
|
## Scenario
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
|
|
4
4
|
|
|
5
|
-
You have access to: skills/debugging/systematic-debugging
|
|
5
|
+
You have access to: .agents/skills/debugging/systematic-debugging
|
|
6
6
|
|
|
7
7
|
## Scenario
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
|
|
4
4
|
|
|
5
|
-
You have access to: skills/debugging/systematic-debugging
|
|
5
|
+
You have access to: .agents/skills/debugging/systematic-debugging
|
|
6
6
|
|
|
7
7
|
## Scenario
|
|
8
8
|
|
|
@@ -118,7 +118,7 @@ Skip any step = lying, not verifying
|
|
|
118
118
|
- **Contract changes** → 验证 contract docs 已更新 + tests 对齐
|
|
119
119
|
- **Handoff** → 宣称 complete 前运行 `handoff check`
|
|
120
120
|
|
|
121
|
-
完整 command 选择见项目 `
|
|
121
|
+
完整 command 选择见项目 `ai_workspace/loop-agent/verification-matrix.md`。
|
|
122
122
|
|
|
123
123
|
## Why This Matters
|
|
124
124
|
|