@tea-agent/loop-agent 0.7.5 → 0.9.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 +145 -142
- package/CHANGELOG.md +161 -158
- package/README.md +206 -204
- package/bin/agent-worker.js +22 -22
- package/bin/loop-agent.js +21 -21
- package/dist/application/dag/args.js +9 -2
- package/dist/commands/init.js +518 -488
- package/dist/commands/loop-benchmark.js +11 -11
- package/dist/commands/pi-reuse-benchmark.js +16 -16
- package/dist/executors/cursor-executor.js +1 -1
- package/dist/executors/shell-executor.js +74 -8
- package/dist/governance/manifest-types.js +1 -1
- package/dist/shared/reference-context.js +48 -22
- package/dist/task/config-types.js +1 -1
- package/dist/task/runtime.js +28 -28
- package/dist/worker/cli.js +3 -3
- package/dist/worker/loop-agent/loop-agent-client.js +51 -10
- package/dist/worker/observability/event-store.js +2 -1
- package/dist/worker/observability/read-model.js +13 -11
- package/dist/worker/observe/paths.js +2 -2
- package/dist/worker/observe/routes.js +82 -23
- package/dist/worker/observe/server.js +8 -6
- package/dist/worker/observe/static/app.js +1965 -1480
- package/dist/worker/observe/static/dag-layout.d.ts +31 -31
- package/dist/worker/observe/static/dag-layout.js +83 -83
- package/dist/worker/observe/static/index.html +88 -63
- package/dist/worker/observe/static/styles.css +598 -722
- package/dist/worker/pool/run-store.js +7 -8
- package/dist/worker/run-task/run-task.js +11 -2
- package/dist/worker/runner/run-ready.js +1 -1
- package/dist/workflows/dag/canvas-observer.js +275 -275
- package/docs/README.md +84 -79
- package/docs/agent-dag-recovery-playbook.md +184 -184
- package/docs/agent-dag-runner.md +42 -42
- package/docs/architecture/runtime-boundaries.md +162 -162
- package/docs/cursor-executor-usage.md +25 -25
- package/docs/decisions/README.md +3 -3
- package/docs/design/README.md +49 -49
- package/docs/development-principles.md +73 -73
- package/docs/dynamic-workflow-dag-engine-roadmap.md +1749 -1749
- package/docs/exec-plans/README.md +6 -6
- package/docs/exec-plans/active/README.md +11 -11
- package/docs/exec-plans/completed/README.md +43 -34
- package/docs/feature-workflow.md +187 -187
- package/docs/harness-methodology-debugging.md +153 -153
- package/docs/harness-methodology-tdd.md +130 -130
- package/docs/harness-methodology-verification.md +27 -27
- package/docs/init-surface.manifest.json +245 -241
- package/docs/loop-agent-harness.md +63 -55
- package/docs/production-readiness.md +96 -96
- package/docs/progress/README.md +3 -3
- package/docs/reports/README.md +12 -9
- package/docs/skills/README.md +6 -6
- package/docs/skills/vetted-skill-registry.md +26 -26
- package/docs/templates/adr.md +60 -60
- package/docs/templates/agent-dag-authority-surface-audit.prompt.md +94 -94
- package/docs/templates/agent-dag-decision-envelope.schema.json +213 -213
- package/docs/templates/agent-dag-decision-gate-dogfood-report.md +117 -117
- package/docs/templates/agent-dag-decision-gate.prompt.md +246 -246
- package/docs/templates/agent-dag-process-supervisor.prompt.md +98 -98
- package/docs/templates/agent-dag-report.schema.json +454 -454
- package/docs/templates/agent-dag-review-verdict.prompt.md +68 -68
- package/docs/templates/agent-dag.base.json +195 -195
- package/docs/templates/agent-dag.final-verification.json +190 -190
- package/docs/templates/agent-dag.schema.json +316 -316
- package/docs/templates/agent-dag.supervised-implementation.json +500 -500
- package/docs/templates/exec-plan.md +64 -64
- package/docs/templates/feature-spec.md +53 -53
- package/docs/templates/harness.schema.json +218 -0
- package/docs/templates/hybrid-dag.json +193 -193
- package/docs/templates/init-evolution-review.md +33 -33
- package/docs/templates/interactive-ui-round2-experiment.md +66 -66
- package/docs/templates/product-line/AGENTS.md +8 -8
- package/docs/templates/product-line/README.md +9 -9
- package/docs/templates/product-line/acceptance.yaml +14 -14
- package/docs/templates/product-line/closeout.yaml +9 -9
- package/docs/templates/product-line/design.md +13 -13
- package/docs/templates/product-line/links.md +10 -10
- package/docs/templates/product-line/requirement.md +17 -17
- package/docs/templates/product-line/task-graph.yaml +15 -15
- package/docs/templates/product-line/task.yaml +65 -65
- package/docs/templates/product-line/test-plan.md +7 -7
- package/docs/templates/production-readiness-checklist.md +57 -57
- package/docs/templates/progress-log.md +17 -17
- package/docs/templates/project-start-checklist.md +9 -9
- package/docs/templates/qa-report.md +48 -48
- package/docs/templates/sprint-contract.md +29 -29
- package/docs/templates/worker-dogfood-evidence.md +52 -52
- package/docs/templates/worker-dogfood-setup.md +48 -48
- package/docs/verification-matrix.md +49 -49
- package/examples/decision-gate-agent-dag.json +123 -123
- package/examples/example-dag.json +51 -51
- package/examples/hybrid-loop-agent-dag.json +194 -194
- package/harness.json +73 -71
- package/package.json +68 -67
- package/scripts/check-product-line-docs.sh +22 -22
- package/scripts/check-task-pool-root.sh +32 -0
- package/skills/ai-engineering-context/SKILL.md +48 -48
- package/skills/code-review-core/SKILL.md +20 -20
- package/skills/codebase-scout/SKILL.md +19 -19
- package/skills/init-capability-evolution/SKILL.md +69 -69
- package/skills/loop-agent/SKILL.md +149 -149
- package/skills/loop-agent/references/README.md +67 -67
- package/skills/loop-agent/references/command-reference.md +432 -412
- package/skills/loop-agent/references/harness-policy.md +263 -263
- package/skills/loop-agent/references/hybrid-dag.md +216 -216
- package/skills/loop-agent/references/learned/README.md +21 -21
- package/skills/loop-agent/references/long-running-loop.md +59 -59
- package/skills/loop-agent/references/model-routing.md +36 -36
- package/skills/loop-agent/references/multi-worktree.md +54 -54
- package/skills/loop-agent/references/one-shot-runs.md +85 -85
- package/skills/loop-agent/references/orchestrator-and-interventions.md +169 -169
- package/skills/loop-agent/references/pi-prompt.md +23 -23
- package/skills/loop-agent/references/pi-subagent-assisted-mode.md +81 -81
- package/skills/loop-agent/references/post-implementation-and-patterns.md +44 -44
- package/skills/loop-agent/references/task-workflow.md +89 -89
- package/skills/loop-agent/references/verification-and-failure-handling.md +133 -128
- package/skills/requesting-code-review/SKILL.md +101 -101
- package/skills/requesting-code-review/code-reviewer.md +168 -168
- package/skills/systematic-debugging/CREATION-LOG.md +119 -119
- package/skills/systematic-debugging/SKILL.md +296 -296
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
- package/skills/systematic-debugging/condition-based-waiting.md +115 -115
- package/skills/systematic-debugging/defense-in-depth.md +122 -122
- package/skills/systematic-debugging/find-polluter.sh +63 -63
- package/skills/systematic-debugging/root-cause-tracing.md +169 -169
- package/skills/systematic-debugging/test-academic.md +14 -14
- package/skills/systematic-debugging/test-pressure-1.md +58 -58
- package/skills/systematic-debugging/test-pressure-2.md +68 -68
- package/skills/systematic-debugging/test-pressure-3.md +69 -69
- package/skills/test-driven-development/SKILL.md +20 -20
- package/skills/verification-before-completion/SKILL.md +154 -154
- package/skills/webapp-testing/SKILL.md +19 -19
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
# 实现后处理与常见模式
|
|
2
|
-
|
|
3
|
-
用于 post-verify handoff、多 item PRD 处理、fast bounded task、快速 status 检查与 Pi timeout 处理。
|
|
4
|
-
|
|
5
|
-
## 实现后处理
|
|
6
|
-
|
|
7
|
-
DAG run、promotion、closeout 和最终验证完成后:
|
|
8
|
-
1. 检查 git diff 确认预期变更
|
|
9
|
-
2. 用 git commit 并 push
|
|
10
|
-
3. 用户说「继续」时,跑 `status` 看 task 是否 `completed`,再创建下一个 task
|
|
11
|
-
|
|
12
|
-
## 常见模式
|
|
13
|
-
|
|
14
|
-
### 处理多 item PRD
|
|
15
|
-
```
|
|
16
|
-
1. new-task <id>-r1 → 准备 source → dag run-task → dag validate → run-dag → promote/closeout
|
|
17
|
-
2. new-task <id>-r2 → 重复
|
|
18
|
-
3. ...
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Bounded task 路径
|
|
22
|
-
```
|
|
23
|
-
1. new-task <id>
|
|
24
|
-
2. 写 source/需求.md + source/执行约束.md
|
|
25
|
-
3. dag run-task <id> --profile auto --strict-models --output <temp-dir>/<id>-dag.json
|
|
26
|
-
4. dag validate --dag <temp-dir>/<id>-dag.json --strict-models --strict-governance
|
|
27
|
-
5. run-dag --dag <temp-dir>/<id>-dag.json --cwd <repo-root>
|
|
28
|
-
6. promote-run / closeout / final verification
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
`<temp-dir>` 表示平台原生临时目录;实际命令中使用 macOS/Windows 本机路径。
|
|
32
|
-
|
|
33
|
-
**关键**:实现 work 由 DAG node 和 executor 执行;main session 负责审 DAG、审 writeSet、跑验证和 handoff。
|
|
34
|
-
|
|
35
|
-
### 跨所有 task 快速 status
|
|
36
|
-
```bash
|
|
37
|
-
loop-agent stats
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### 处理 pi timeout
|
|
41
|
-
- 默认每 step timeout 现为 30 分钟 — 通常足够
|
|
42
|
-
- pi step 仍 timeout 时,用 `stats` 看 duration 分布
|
|
43
|
-
- Bash tool call 应用宽松 timeout:analyze/plan 300s,implement 480s+,verify/retrospective 240s+
|
|
44
|
-
- 失败时优先读 `dag report` / `dag doctor`,再决定 repair DAG、bounded Cursor fix 或暂停
|
|
1
|
+
# 实现后处理与常见模式
|
|
2
|
+
|
|
3
|
+
用于 post-verify handoff、多 item PRD 处理、fast bounded task、快速 status 检查与 Pi timeout 处理。
|
|
4
|
+
|
|
5
|
+
## 实现后处理
|
|
6
|
+
|
|
7
|
+
DAG run、promotion、closeout 和最终验证完成后:
|
|
8
|
+
1. 检查 git diff 确认预期变更
|
|
9
|
+
2. 用 git commit 并 push
|
|
10
|
+
3. 用户说「继续」时,跑 `status` 看 task 是否 `completed`,再创建下一个 task
|
|
11
|
+
|
|
12
|
+
## 常见模式
|
|
13
|
+
|
|
14
|
+
### 处理多 item PRD
|
|
15
|
+
```
|
|
16
|
+
1. new-task <id>-r1 → 准备 source → dag run-task → dag validate → run-dag → promote/closeout
|
|
17
|
+
2. new-task <id>-r2 → 重复
|
|
18
|
+
3. ...
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Bounded task 路径
|
|
22
|
+
```
|
|
23
|
+
1. new-task <id>
|
|
24
|
+
2. 写 source/需求.md + source/执行约束.md
|
|
25
|
+
3. dag run-task <id> --profile auto --strict-models --output <temp-dir>/<id>-dag.json
|
|
26
|
+
4. dag validate --dag <temp-dir>/<id>-dag.json --strict-models --strict-governance
|
|
27
|
+
5. run-dag --dag <temp-dir>/<id>-dag.json --cwd <repo-root>
|
|
28
|
+
6. promote-run / closeout / final verification
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`<temp-dir>` 表示平台原生临时目录;实际命令中使用 macOS/Windows 本机路径。
|
|
32
|
+
|
|
33
|
+
**关键**:实现 work 由 DAG node 和 executor 执行;main session 负责审 DAG、审 writeSet、跑验证和 handoff。
|
|
34
|
+
|
|
35
|
+
### 跨所有 task 快速 status
|
|
36
|
+
```bash
|
|
37
|
+
loop-agent stats
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 处理 pi timeout
|
|
41
|
+
- 默认每 step timeout 现为 30 分钟 — 通常足够
|
|
42
|
+
- pi step 仍 timeout 时,用 `stats` 看 duration 分布
|
|
43
|
+
- Bash tool call 应用宽松 timeout:analyze/plan 300s,implement 480s+,verify/retrospective 240s+
|
|
44
|
+
- 失败时优先读 `dag report` / `dag doctor`,再决定 repair DAG、bounded Cursor fix 或暂停
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
# Task Workflow 规则
|
|
2
|
-
|
|
3
|
-
本文只保留 legacy task 目录和 source material 的读取规则。历史顺序式 `run analyze|plan|spec|implement|verify|auto|loop|continue` 工作流已经移除,不再作为 micro、fallback 或 compatibility 执行路径。
|
|
4
|
-
|
|
5
|
-
## 当前执行入口
|
|
6
|
-
|
|
7
|
-
所有需要可恢复、可验证、可交接的实现工作都走 DAG 路径:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
loop-agent new-task <task-id> "Task Title"
|
|
11
|
-
loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
|
|
12
|
-
loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
|
|
13
|
-
loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
`<temp-dir>` 表示平台原生临时目录。实际文件路径必须兼容 macOS 和 Windows;只有 repo refs、JSON/Markdown 证据 refs 和 glob 约定默认使用 `/`。
|
|
17
|
-
|
|
18
|
-
当目标仓库是 loop-agent 本仓库时,`loop-agent` 命令必须来自 npm 上已发布的安装包。首次安装或有意升级可用 `@tea-agent/loop-agent@latest`,但一次自举任务启动后不要中途升级控制器,并记录 `npm list -g @tea-agent/loop-agent --depth=0` 显示的实际版本。不要用当前工作区的 `npm link` 或 `npm run dev` 控制会改动 CLI、DAG runtime、executor、package metadata 或 build output 的任务;源码开发和 focused debugging 才使用 `npm run dev -- <args>`。
|
|
19
|
-
|
|
20
|
-
低风险的一行修正文档或配置时,可以由 main session 做 surgical patch,但仍必须记录 scope 并运行对应验证命令。
|
|
21
|
-
|
|
22
|
-
## Source Materials
|
|
23
|
-
|
|
24
|
-
`new-task` 后至少维护:
|
|
25
|
-
|
|
26
|
-
```text
|
|
27
|
-
.harness/tasks/<task-id>/
|
|
28
|
-
source/
|
|
29
|
-
references/ # 原始 PRD / design / acceptance(不可变)
|
|
30
|
-
source-manifest.json # import-prd 写入的 hash 清单
|
|
31
|
-
需求.md # 派生执行契约
|
|
32
|
-
执行约束.md
|
|
33
|
-
task.json
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
- 用户原始 PRD 用 `loop-agent import-prd <task-id> --file <prd>` 归档到 `source/references/`,禁止 AI 改写。
|
|
37
|
-
- `需求.md` 是派生执行契约:写清目标、验收标准、非目标,并用 REQ/AC 或原文锚点映射回 references。
|
|
38
|
-
- `执行约束.md` 写清允许文件、禁止改动、硬约束和验证命令。
|
|
39
|
-
- 若 `docs/` 已有权威 plan/spec/PRD,优先 `import-prd` 复制,再在 `需求.md` 引用;避免把长 PRD 直接改写成唯一 source。
|
|
40
|
-
- Worker / TaskSpec materialize 路径会把 `source_docs` 复制到 `source/references/`,并在派生 `需求.md` 顶部声明“冲突以 references 为准”;`acceptance_refs` 应展开为短摘要而不只写 ID。
|
|
41
|
-
- review 节点必须三方对照:`source/references/*`(尤其 requirement/acceptance)、派生 `需求.md`、以及实现/验证证据。
|
|
42
|
-
|
|
43
|
-
## Task State
|
|
44
|
-
|
|
45
|
-
当前 task 状态由 DAG-oriented read model 推导:
|
|
46
|
-
|
|
47
|
-
- source readiness
|
|
48
|
-
- DAG draft
|
|
49
|
-
- latest DAG run
|
|
50
|
-
- promotion
|
|
51
|
-
- closeout
|
|
52
|
-
- loop state
|
|
53
|
-
- legacy workflow snapshot
|
|
54
|
-
|
|
55
|
-
旧 `.workflow_state.json` 只能作为兼容读取输入,不是新任务 next action 或完成状态的权威来源。
|
|
56
|
-
|
|
57
|
-
## Repo Adapters
|
|
58
|
-
|
|
59
|
-
loop-agent 自动检测所在 repo,并按目标 repo 的 `harness.json` 与治理根目录选择验证入口。跨目录操作时显式传入目标仓库:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
loop-agent --repo-root /path/to/target-repo <command>
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Task Config
|
|
66
|
-
|
|
67
|
-
新任务不应写入旧 `flow` 字段。常用字段是:
|
|
68
|
-
|
|
69
|
-
- `taskId`
|
|
70
|
-
- `title`
|
|
71
|
-
- `complexity`
|
|
72
|
-
- `allowedPaths`
|
|
73
|
-
- `forbiddenPaths`
|
|
74
|
-
- `hardConstraints`
|
|
75
|
-
- `verifyCommands` / adapter verification settings
|
|
76
|
-
- `dagFallbackReason`,仅用于记录为何某个长期 loop 缺少 DAG round evidence
|
|
77
|
-
|
|
78
|
-
## Verification
|
|
79
|
-
|
|
80
|
-
完成声明必须来自新鲜验证证据。按目标 repo 的 `docs/verification-matrix.md` 选择最小证明命令;loop-agent 自身常用:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
npm run typecheck
|
|
84
|
-
npm test
|
|
85
|
-
bash scripts/check-repo.sh
|
|
86
|
-
bash scripts/ci.sh
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Windows 上通过 Git Bash 或配置好的兼容 Bash 运行 `scripts/*.sh`;不要把 POSIX 路径假设写入 CLI、模板或 task source。
|
|
1
|
+
# Task Workflow 规则
|
|
2
|
+
|
|
3
|
+
本文只保留 legacy task 目录和 source material 的读取规则。历史顺序式 `run analyze|plan|spec|implement|verify|auto|loop|continue` 工作流已经移除,不再作为 micro、fallback 或 compatibility 执行路径。
|
|
4
|
+
|
|
5
|
+
## 当前执行入口
|
|
6
|
+
|
|
7
|
+
所有需要可恢复、可验证、可交接的实现工作都走 DAG 路径:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
loop-agent new-task <task-id> "Task Title"
|
|
11
|
+
loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
|
|
12
|
+
loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
|
|
13
|
+
loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`<temp-dir>` 表示平台原生临时目录。实际文件路径必须兼容 macOS 和 Windows;只有 repo refs、JSON/Markdown 证据 refs 和 glob 约定默认使用 `/`。
|
|
17
|
+
|
|
18
|
+
当目标仓库是 loop-agent 本仓库时,`loop-agent` 命令必须来自 npm 上已发布的安装包。首次安装或有意升级可用 `@tea-agent/loop-agent@latest`,但一次自举任务启动后不要中途升级控制器,并记录 `npm list -g @tea-agent/loop-agent --depth=0` 显示的实际版本。不要用当前工作区的 `npm link` 或 `npm run dev` 控制会改动 CLI、DAG runtime、executor、package metadata 或 build output 的任务;源码开发和 focused debugging 才使用 `npm run dev -- <args>`。
|
|
19
|
+
|
|
20
|
+
低风险的一行修正文档或配置时,可以由 main session 做 surgical patch,但仍必须记录 scope 并运行对应验证命令。
|
|
21
|
+
|
|
22
|
+
## Source Materials
|
|
23
|
+
|
|
24
|
+
`new-task` 后至少维护:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
.harness/tasks/<task-id>/
|
|
28
|
+
source/
|
|
29
|
+
references/ # 原始 PRD / design / acceptance(不可变)
|
|
30
|
+
source-manifest.json # import-prd 写入的 hash 清单
|
|
31
|
+
需求.md # 派生执行契约
|
|
32
|
+
执行约束.md
|
|
33
|
+
task.json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- 用户原始 PRD 用 `loop-agent import-prd <task-id> --file <prd>` 归档到 `source/references/`,禁止 AI 改写。
|
|
37
|
+
- `需求.md` 是派生执行契约:写清目标、验收标准、非目标,并用 REQ/AC 或原文锚点映射回 references。
|
|
38
|
+
- `执行约束.md` 写清允许文件、禁止改动、硬约束和验证命令。
|
|
39
|
+
- 若 `docs/` 已有权威 plan/spec/PRD,优先 `import-prd` 复制,再在 `需求.md` 引用;避免把长 PRD 直接改写成唯一 source。
|
|
40
|
+
- Worker / TaskSpec materialize 路径会把 `source_docs` 复制到 `source/references/`,并在派生 `需求.md` 顶部声明“冲突以 references 为准”;`acceptance_refs` 应展开为短摘要而不只写 ID。
|
|
41
|
+
- review 节点必须三方对照:`source/references/*`(尤其 requirement/acceptance)、派生 `需求.md`、以及实现/验证证据。
|
|
42
|
+
|
|
43
|
+
## Task State
|
|
44
|
+
|
|
45
|
+
当前 task 状态由 DAG-oriented read model 推导:
|
|
46
|
+
|
|
47
|
+
- source readiness
|
|
48
|
+
- DAG draft
|
|
49
|
+
- latest DAG run
|
|
50
|
+
- promotion
|
|
51
|
+
- closeout
|
|
52
|
+
- loop state
|
|
53
|
+
- legacy workflow snapshot
|
|
54
|
+
|
|
55
|
+
旧 `.workflow_state.json` 只能作为兼容读取输入,不是新任务 next action 或完成状态的权威来源。
|
|
56
|
+
|
|
57
|
+
## Repo Adapters
|
|
58
|
+
|
|
59
|
+
loop-agent 自动检测所在 repo,并按目标 repo 的 `harness.json` 与治理根目录选择验证入口。跨目录操作时显式传入目标仓库:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
loop-agent --repo-root /path/to/target-repo <command>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Task Config
|
|
66
|
+
|
|
67
|
+
新任务不应写入旧 `flow` 字段。常用字段是:
|
|
68
|
+
|
|
69
|
+
- `taskId`
|
|
70
|
+
- `title`
|
|
71
|
+
- `complexity`
|
|
72
|
+
- `allowedPaths`
|
|
73
|
+
- `forbiddenPaths`
|
|
74
|
+
- `hardConstraints`
|
|
75
|
+
- `verifyCommands` / adapter verification settings
|
|
76
|
+
- `dagFallbackReason`,仅用于记录为何某个长期 loop 缺少 DAG round evidence
|
|
77
|
+
|
|
78
|
+
## Verification
|
|
79
|
+
|
|
80
|
+
完成声明必须来自新鲜验证证据。按目标 repo 的 `docs/verification-matrix.md` 选择最小证明命令;loop-agent 自身常用:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm run typecheck
|
|
84
|
+
npm test
|
|
85
|
+
bash scripts/check-repo.sh
|
|
86
|
+
bash scripts/ci.sh
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Windows 上通过 Git Bash 或配置好的兼容 Bash 运行 `scripts/*.sh`;不要把 POSIX 路径假设写入 CLI、模板或 task source。
|
|
@@ -1,128 +1,133 @@
|
|
|
1
|
-
# Verification 与失败处理
|
|
2
|
-
|
|
3
|
-
选择 verify strategy knobs、解读 verify 结果、决定失败后是否继续,或 closeout workflow/runtime/docs/skill 变更时使用本文。
|
|
4
|
-
|
|
5
|
-
## Verify strategy 与 completion audit
|
|
6
|
-
|
|
7
|
-
## Production Readiness v0.1
|
|
8
|
-
|
|
9
|
-
低/中风险单 repo DAG 任务如果声明 production-ready v0.1,必须按 `docs/production-readiness.md` 和 `docs/templates/production-readiness-checklist.md` 收口。
|
|
10
|
-
|
|
11
|
-
支持范围:
|
|
12
|
-
|
|
13
|
-
- single repo
|
|
14
|
-
- bounded task
|
|
15
|
-
- explicit task source
|
|
16
|
-
- explicit `allowedPaths` / `forbiddenPaths` / write scope
|
|
17
|
-
- shell verification
|
|
18
|
-
- report / doctor / closeout handoff
|
|
19
|
-
|
|
20
|
-
非目标:
|
|
21
|
-
|
|
22
|
-
- automatic merge
|
|
23
|
-
- automatic release
|
|
24
|
-
- production secrets
|
|
25
|
-
- production database
|
|
26
|
-
- high-risk migration
|
|
27
|
-
- online Worker Pool
|
|
28
|
-
- writable Dynamic Workflow sharded migration
|
|
29
|
-
|
|
30
|
-
失败分类是路由字段,不是主状态;不要覆盖 `.harness/dag-runs/completed/**` 的原始事实。报告和 handoff 应保留:
|
|
31
|
-
|
|
32
|
-
```text
|
|
33
|
-
raw_failure_category
|
|
34
|
-
dag_normalized_failure_category
|
|
35
|
-
product_line_failure_category
|
|
36
|
-
recommended_follow_up
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
product-line taxonomy 的事实源是 `docs/design/state-and-failure-taxonomy.md`。
|
|
40
|
-
|
|
41
|
-
### Verify 始终在本地跑
|
|
42
|
-
`verify` step 跑确定性命令(check-repo.sh + tests + typecheck)。**不**调用 pi。因此快且可靠。
|
|
43
|
-
|
|
44
|
-
### Verify strategy knobs
|
|
45
|
-
需要更紧的 verify 控制时,用 task-level config:
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"verifyPreset": "auto",
|
|
49
|
-
"verifyMode": "
|
|
50
|
-
"verifyRetryCount": 0,
|
|
51
|
-
"verifyFailFast": false
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
- `verifyPreset`:`auto | quick | standard | full`
|
|
56
|
-
- `auto`:`small -> quick`,`medium -> standard`,`large -> full`
|
|
57
|
-
- 默认 `
|
|
58
|
-
-
|
|
59
|
-
- `verifyFailFast` 仅在 `serial` mode 有意义
|
|
60
|
-
- retry 保持小;用于 flaky 环境问题,不要掩盖真实失败
|
|
61
|
-
|
|
62
|
-
###
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
`
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
1
|
+
# Verification 与失败处理
|
|
2
|
+
|
|
3
|
+
选择 verify strategy knobs、解读 verify 结果、决定失败后是否继续,或 closeout workflow/runtime/docs/skill 变更时使用本文。
|
|
4
|
+
|
|
5
|
+
## Verify strategy 与 completion audit
|
|
6
|
+
|
|
7
|
+
## Production Readiness v0.1
|
|
8
|
+
|
|
9
|
+
低/中风险单 repo DAG 任务如果声明 production-ready v0.1,必须按 `docs/production-readiness.md` 和 `docs/templates/production-readiness-checklist.md` 收口。
|
|
10
|
+
|
|
11
|
+
支持范围:
|
|
12
|
+
|
|
13
|
+
- single repo
|
|
14
|
+
- bounded task
|
|
15
|
+
- explicit task source
|
|
16
|
+
- explicit `allowedPaths` / `forbiddenPaths` / write scope
|
|
17
|
+
- shell verification
|
|
18
|
+
- report / doctor / closeout handoff
|
|
19
|
+
|
|
20
|
+
非目标:
|
|
21
|
+
|
|
22
|
+
- automatic merge
|
|
23
|
+
- automatic release
|
|
24
|
+
- production secrets
|
|
25
|
+
- production database
|
|
26
|
+
- high-risk migration
|
|
27
|
+
- online Worker Pool
|
|
28
|
+
- writable Dynamic Workflow sharded migration
|
|
29
|
+
|
|
30
|
+
失败分类是路由字段,不是主状态;不要覆盖 `.harness/dag-runs/completed/**` 的原始事实。报告和 handoff 应保留:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
raw_failure_category
|
|
34
|
+
dag_normalized_failure_category
|
|
35
|
+
product_line_failure_category
|
|
36
|
+
recommended_follow_up
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
product-line taxonomy 的事实源是 `docs/design/state-and-failure-taxonomy.md`。
|
|
40
|
+
|
|
41
|
+
### Verify 始终在本地跑
|
|
42
|
+
`verify` step 跑确定性命令(check-repo.sh + tests + typecheck)。**不**调用 pi。因此快且可靠。
|
|
43
|
+
|
|
44
|
+
### Verify strategy knobs
|
|
45
|
+
需要更紧的 verify 控制时,用 task-level config:
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"verifyPreset": "auto",
|
|
49
|
+
"verifyMode": "serial",
|
|
50
|
+
"verifyRetryCount": 0,
|
|
51
|
+
"verifyFailFast": false
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- `verifyPreset`:`auto | quick | standard | full`
|
|
56
|
+
- `auto`:`small -> quick`,`medium -> standard`,`large -> full`
|
|
57
|
+
- 默认 `serial`,优先避免本机测试、构建和治理检查互相争抢资源
|
|
58
|
+
- 确认命令互不影响且机器资源充足时,才显式使用 `parallel`
|
|
59
|
+
- `verifyFailFast` 仅在 `serial` mode 有意义
|
|
60
|
+
- retry 保持小;用于 flaky 环境问题,不要掩盖真实失败
|
|
61
|
+
|
|
62
|
+
### 长输出处理
|
|
63
|
+
|
|
64
|
+
- DAG shell 命令和 Worker 子进程只在内存中保留最近一段 stdout/stderr,并在结果中标明是否截断及原始字节数。
|
|
65
|
+
- 需要完整日志时读取运行 artifact 中的 `stdout.txt`、`stderr.txt` 或 DAG 节点的 `commands/*.stdout.txt`、`commands/*.stderr.txt`;不要依赖页面摘要还原全部输出。
|
|
66
|
+
|
|
67
|
+
### Verify 后的 goal completion audit
|
|
68
|
+
- 有 active task goal 且 `verify` 通过时,loop-agent 跑 goal completion audit。
|
|
69
|
+
- 若 `source/需求.md` 仍有未勾 checklist(`- [ ]`),task **不会**以 completed 结束。
|
|
70
|
+
- 若确定性 requirement coverage audit 发现未覆盖需求,task **不会**以 completed 结束。
|
|
71
|
+
- `explicitly_out_of_scope` 需求(如 `## 非目标` 下)**不算** coverage gap。
|
|
72
|
+
- 独立 audit 报告用 `handoff coverage <task-id> [--json|--markdown]`。
|
|
73
|
+
- task status、source/artifacts、DAG outcome、verification 记录可能 drift 时用 `dag reconcile-tasks --glob '<pattern>' [--json|--markdown]`。默认仅报告;`--patch` 不能伪造 verification evidence。
|
|
74
|
+
|
|
75
|
+
### Verify 默认保存进度
|
|
76
|
+
`verify` 成功后,loop-agent 默认:
|
|
77
|
+
|
|
78
|
+
1. 在当前 task scope 内选文件
|
|
79
|
+
2. 跑 `git add`
|
|
80
|
+
3. 创建 commit 保存已验证进度
|
|
81
|
+
|
|
82
|
+
默认行为:
|
|
83
|
+
|
|
84
|
+
- `autoCommitAfterVerify: true`
|
|
85
|
+
- commit message:`chore(task): save verified progress for <taskId>`
|
|
86
|
+
|
|
87
|
+
`task.json` 可选覆盖:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"autoCommitAfterVerify": false,
|
|
92
|
+
"autoCommitMessage": "docs(workflow): save verified progress"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
最佳实践:保持 `allowedPaths` 准确。auto-commit 用 task path 约束,避免把无关 dirty 文件扫进 progress commit。
|
|
97
|
+
|
|
98
|
+
### Cursor bounded write 后的独立复核
|
|
99
|
+
|
|
100
|
+
Cursor bounded execution 完成后,主会话必须独立执行:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git status --short
|
|
104
|
+
git diff --stat
|
|
105
|
+
bash scripts/check-repo.sh
|
|
106
|
+
npm run lint
|
|
107
|
+
npm test
|
|
108
|
+
npm run typecheck
|
|
109
|
+
loop-agent inspect
|
|
110
|
+
loop-agent docs audit
|
|
111
|
+
loop-agent handoff check <task-id>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Cursor 自己报告的完成不算 verification fact;以上命令的 exit code 与输出才是完成声明的证据。
|
|
115
|
+
|
|
116
|
+
### 失败处理
|
|
117
|
+
|
|
118
|
+
child agent 失败时:
|
|
119
|
+
|
|
120
|
+
- **业务/测试失败**:让 child agent 在同一 task bounds 内修复
|
|
121
|
+
- **Workflow runtime 失败**(如 `loop-agent` runtime 问题、部分 artifact 生成、输出聚合 crash):保持 task contract,但允许 main agent 或 child agent 在同一 scoped implementation 内手动完成,仍跑 `verify`
|
|
122
|
+
- **意外残留**(tmp 文件、探索性 mock、scratch 输出):handoff 前删除
|
|
123
|
+
|
|
124
|
+
### Closeout 规则
|
|
125
|
+
workflow/runtime/docs/skill 变更结束时:
|
|
126
|
+
```bash
|
|
127
|
+
loop-agent docs audit
|
|
128
|
+
loop-agent handoff check <task-id>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
active exec plan 实质完成时,用 `docs archive` 归档并更新 active/completed 索引,勿留 stale active status。
|
|
132
|
+
|
|
133
|
+
failed DAG run 不应生成成功式 closeout。它应该生成 failure handoff,至少包含 what failed、evidence、classification、recommended follow-up、safe retry conditions 和 human decision needed。
|