@tea-agent/loop-agent 0.26.5-beta.1 → 0.27.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 -2
- package/CHANGELOG.md +29 -0
- package/README.md +13 -23
- package/dist/application/dag/args.js +7 -7
- package/dist/application/dag/generate-task-dag.js +2 -2
- package/dist/application/dag/run-dag.js +3 -4
- package/dist/application/dag/validate-dag.js +1 -1
- package/dist/application/task-lifecycle/advance.js +845 -0
- package/dist/application/task-lifecycle/gates.js +80 -0
- package/dist/application/task-lifecycle/index.js +7 -0
- package/dist/application/task-lifecycle/observe.js +395 -0
- package/dist/application/task-lifecycle/plan-transitions.js +224 -0
- package/dist/application/task-lifecycle/recommendations.js +180 -0
- package/dist/application/task-lifecycle/record.js +73 -0
- package/dist/application/task-lifecycle/types.js +1 -0
- package/dist/cli/command-definitions.js +14 -111
- package/dist/cli/help.js +6 -7
- package/dist/cli/program.js +26 -90
- package/dist/cli/update/policy.js +0 -1
- package/dist/commands/dag-final-verification.js +1 -1
- package/dist/commands/dag-init-hybrid.js +1 -1
- package/dist/commands/delegate.js +2 -2
- package/dist/commands/init.js +21 -19
- package/dist/commands/run-dag-progress.js +1 -1
- package/dist/commands/status.js +18 -17
- package/dist/commands/study-init.js +2 -2
- package/dist/commands/task-advance.js +335 -0
- package/dist/commands/task-contract.js +3 -5
- package/dist/commands/task-source-prepare.js +9 -4
- package/dist/commands/task-status.js +133 -0
- package/dist/governance/manifest-types.js +2 -2
- package/dist/shared/operator/capabilities.js +1358 -243
- package/dist/task/contract/adopt.js +1 -1
- package/dist/task/contract/apply.js +1 -1
- package/dist/task/contract/import-revision.js +1 -1
- package/dist/task/contract/recover.js +2 -2
- package/dist/task/read-model.js +18 -23
- package/dist/task/runtime.js +1 -1
- package/dist/task/source-prepare/completeness.js +1 -1
- package/dist/task/source-prepare/parse-intent.js +6 -1
- package/dist/task/source-prepare/prepare.js +23 -20
- package/dist/worker/console/operator-actions.js +288 -95
- package/dist/worker/console/recovery-cta.js +4 -4
- package/dist/worker/console/static/assets/{index-CSRIhuzh.js → index-CNO7n6qB.js} +1 -1
- package/dist/worker/console/static/index.html +1 -1
- package/dist/worker/materialize/harness-task-materializer.js +6 -5
- package/dist/worker/run-task/run-task.js +204 -112
- package/dist/worker/runner/run-ready.js +1 -1
- package/dist/workflows/dag/frontend-implementation-contract.js +5 -57
- package/dist/workflows/dag/frontend-prewrite-gate.js +1 -6
- package/dist/workflows/dag/init-hybrid.js +11 -42
- package/docs/templates/evaluation/agents-map-slim-v1.md +1 -1
- package/docs/templates/evaluation/agents-map-verbose-v0.md +3 -3
- package/docs/templates/harness.schema.json +2 -2
- package/docs/templates/init-managed-agents.md +13 -16
- package/docs/templates/production-readiness-checklist.md +3 -3
- package/harness.json +4 -4
- package/package.json +1 -1
- package/scripts/kb-bootstrap-init-skeleton.sh +2 -1
- package/scripts/kb-graph-incremental-prepare.mjs +2 -2
- package/skills/loop-agent/SKILL.md +18 -13
- package/skills/loop-agent/references/README.md +1 -1
- package/skills/loop-agent/references/command-reference.md +55 -84
- package/skills/loop-agent/references/harness-policy.md +19 -23
- package/skills/loop-agent/references/hybrid-dag.md +31 -33
- package/skills/loop-agent/references/long-running-loop.md +2 -2
- package/skills/loop-agent/references/one-shot-runs.md +4 -5
- package/skills/loop-agent/references/orchestrator-and-interventions.md +3 -3
- package/skills/loop-agent/references/post-implementation-and-patterns.md +4 -4
- package/skills/loop-agent/references/source-and-plan-practice.md +45 -51
- package/skills/loop-agent/references/task-workflow.md +14 -15
|
@@ -33,30 +33,25 @@ loop-agent doctor
|
|
|
33
33
|
|
|
34
34
|
选择命令时按以下优先级:
|
|
35
35
|
|
|
36
|
-
1. **主路径
|
|
36
|
+
1. **主路径 lifecycle**,用于常规 autonomous work:
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
loop-agent
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
--allowed-path "<glob>" \
|
|
39
|
+
# 非微小 / 跨会话(推荐默认):loop-agent plan create <plan-id> "<title>"
|
|
40
|
+
loop-agent task advance <task-id> "Task Title" \
|
|
41
|
+
--prd <path-to-prd.md> \
|
|
42
|
+
--accept-recommendations <digest> # optional P1
|
|
43
|
+
--allowed-path "<glob>" \
|
|
45
44
|
--forbidden-path ".harness/**" \
|
|
46
45
|
--verify "typecheck:npm run typecheck" \
|
|
47
|
-
--
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
loop-agent
|
|
51
|
-
loop-agent dag validate --dag .harness/tasks/<task-id>/dag.json --strict-models --strict-governance
|
|
52
|
-
loop-agent run-dag --dag .harness/tasks/<task-id>/dag.json --cwd <repo-root>
|
|
46
|
+
--json
|
|
47
|
+
# 审查 gate.writeSet / gate.digest 后:
|
|
48
|
+
loop-agent task advance <task-id> --approve-gate "write-set-review:<digest>" --json
|
|
49
|
+
loop-agent task status <task-id> --json
|
|
53
50
|
# 有 plan 时收尾:loop-agent plan complete <plan-id> --summary "..."
|
|
54
51
|
```
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
**`import-prd` / `plan create` 不是 `dag run-task` 的硬依赖**,但有 PRD 文件或非微小实现时应默认使用;决策表、反模式与案例见 `source-and-plan-practice.md`。
|
|
59
|
-
2. **Operator 工具**,用于 recovery、诊断、评测重放与 closeout:
|
|
53
|
+
首次 `task advance` 内部完成 create、PRD 归档、managed contract 投影、DAG 生成与 strict validate,并停在 writeSet gate;批准后同一命令长跑到稳定终态并做确定性 promotion/closeout。决策表与反模式见 `source-and-plan-practice.md`。
|
|
54
|
+
2. **Operator 工具**,用于 recovery、诊断、评测重放:
|
|
60
55
|
|
|
61
56
|
```bash
|
|
62
57
|
loop-agent eval replay --spec <path> --json
|
|
@@ -65,17 +60,10 @@ loop-agent doctor
|
|
|
65
60
|
loop-agent eval candidate show --candidate-id <id> --json
|
|
66
61
|
loop-agent eval candidate list --json
|
|
67
62
|
loop-agent eval candidate transition --candidate-id <id> --to <state> --reason <text> --json
|
|
68
|
-
loop-agent
|
|
69
|
-
loop-agent
|
|
70
|
-
loop-agent dag report --latest --markdown
|
|
71
|
-
loop-agent dag closeout-draft --run-id <run-id>
|
|
72
|
-
loop-agent dag reconcile-run --run-id <run-id>
|
|
73
|
-
loop-agent dag reconcile-tasks --glob '<pattern>' --markdown
|
|
74
|
-
loop-agent dag final-verification <task-id> --output <temp-dir>/<task-id>-final-verification-dag.json
|
|
75
|
-
loop-agent status <task-id> --json
|
|
76
|
-
loop-agent instructions task-artifacts --task <task-id> --json
|
|
77
|
-
loop-agent promote-run <task-id> --run-id <run-id>
|
|
78
|
-
loop-agent closeout task <task-id>
|
|
63
|
+
loop-agent task status <task-id> --json
|
|
64
|
+
loop-agent task advance <task-id> --json # 失败后重跑同一 lifecycle 入口
|
|
65
|
+
loop-agent dag report --latest --markdown # advanced forensic
|
|
66
|
+
loop-agent dag closeout-draft --run-id <run-id> # advanced forensic handoff draft
|
|
79
67
|
loop-agent spine audit <task-id> --markdown
|
|
80
68
|
loop-agent knowledge curate --markdown --output ai_workspace/loop-agent/reports/<task-id>-learned-proposal.md
|
|
81
69
|
loop-agent loop-benchmark --markdown
|
|
@@ -130,7 +118,7 @@ SDK 回归或 SDK 可选依赖不可用时用 `cli-only` 诊断。CLI fallback
|
|
|
130
118
|
| 初始化更新校验 / loop agent初始化更新校验 / 检查初始化更新 | `loop-agent init check-update --repo-root . --markdown`(只读,不得隐含 `apply-safe`) |
|
|
131
119
|
| 初始化安全更新 / loop agent初始化安全更新 / 应用初始化更新 | 先 `loop-agent init check-update --repo-root . --markdown`,再 `loop-agent init update --repo-root . --apply-safe`(surface 缺失时先 `--bootstrap-surface`;human decisions 存在时停下等用户) |
|
|
132
120
|
| 初始化对齐 / 升级后对齐 / init reconcile / 控制器升级后对齐目标项目 | `loop-agent init reconcile --repo-root .`(统一入口:surface 缺失返回 `needs-baseline` 零写入;human decisions 返回 `needs-human-decision` 零写入;活跃 DAG/Worker 或 Worker 状态无法确认时返回 `blocked-active-runtime` 零写入;其余执行 safe actions 后复查) |
|
|
133
|
-
| loop-agent 帮我完成 / 帮我实现 / 帮我修复 / 帮我开发 <需求>;使用 loop-agent 完成 <X>;按 loop-agent 流程处理 <X> | 先 `loop-agent
|
|
121
|
+
| loop-agent 帮我完成 / 帮我实现 / 帮我修复 / 帮我开发 <需求>;使用 loop-agent 完成 <X>;按 loop-agent 流程处理 <X> | 先 `loop-agent task advance <task-id> "任务标题" --prd <prd.md> --allowed-path "<glob>" --json`,审查 writeSet gate 后 `task advance --approve-gate write-set-review:<digest> --json`;主会话编排而不直接写业务实现 |
|
|
134
122
|
|
|
135
123
|
```bash
|
|
136
124
|
loop-agent init instructions --repo-root <target-repo>
|
|
@@ -159,43 +147,36 @@ loop-agent examples copy <name> --output examples/<name>
|
|
|
159
147
|
|
|
160
148
|
`examples` 只读取或复制包内示例,不会自动写入目标项目。省略 `--output` 时,`copy` 会写到目标项目的 `examples/<name>`。
|
|
161
149
|
|
|
162
|
-
###
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
loop-agent new-task <task-id> "Task Title"
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
创建 `.harness/tasks/<task-id>/`,含 `source/`、`artifacts/`、`logs/` 及初始 state。`artifacts/` 默认只预种 `修改记录.md` 与 `验证结果.md`(供后续 `promote-run` / `closeout` 使用);不再预种 L1 的 `分析报告.md`、`实现计划.md`、`复盘报告.md`。
|
|
169
|
-
|
|
170
|
-
### 导入原始 PRD(不可变事实源)
|
|
150
|
+
### 创建 / 推进 task(标准入口)
|
|
171
151
|
|
|
172
152
|
```bash
|
|
173
|
-
loop-agent
|
|
153
|
+
loop-agent task advance <task-id> "Task Title" \
|
|
154
|
+
--prd path/to-prd.md \
|
|
155
|
+
--allowed-path "src/**" \
|
|
156
|
+
--verify "typecheck:npm run typecheck" \
|
|
157
|
+
--json
|
|
158
|
+
loop-agent task advance <task-id> --approve-gate "write-set-review:<digest>" --json
|
|
159
|
+
loop-agent task status <task-id> --json
|
|
174
160
|
```
|
|
175
161
|
|
|
176
|
-
|
|
162
|
+
首次 advance 可 create `.harness/tasks/<task-id>/`(含 `source/`、`artifacts/`、`logs/`),归档 PRD 到 `source/references/`,派生 managed `需求.md` / `执行约束.md`,生成并 strict validate DAG,停在 writeSet gate。批准后同一命令长跑并确定性 promotion/closeout。
|
|
177
163
|
|
|
178
|
-
`referenceDocs` 是 `{ path, name? }[]`
|
|
164
|
+
PRD 原文 **不改写**;冲突时以 `source/references/*` 为准。`referenceDocs` 是 `{ path, name? }[]` 对象数组。
|
|
179
165
|
|
|
180
166
|
### Task Contract / operator machine surface
|
|
181
167
|
|
|
182
168
|
```bash
|
|
183
|
-
loop-agent task
|
|
184
|
-
loop-agent task
|
|
185
|
-
loop-agent task contract diff --task <task-id> --input <path> --json
|
|
186
|
-
loop-agent task contract apply --task <task-id> --input <path> --expected-revision <n> --expected-observed-hash <sha256> --request-id <id> --request-payload-sha256 <sha256> --json
|
|
187
|
-
loop-agent task contract adopt --task <task-id> --expected-revision <n> --expected-observed-hash <sha256> --request-id <id> --request-payload-sha256 <sha256> --json
|
|
188
|
-
loop-agent task contract doctor --task <task-id> --json
|
|
189
|
-
loop-agent task contract recover --task <task-id> --json
|
|
169
|
+
loop-agent task status <task-id> --json
|
|
170
|
+
loop-agent task advance <task-id> --from-draft <path> --json
|
|
190
171
|
loop-agent operator capabilities [--json]
|
|
191
172
|
```
|
|
192
173
|
|
|
193
|
-
`task`
|
|
174
|
+
`task` 标准面是 advance/status;managed contract 经 `task advance`/`task status`;Console Interview validate/diff 走 in-process application API,无公开 CLI。`operator` 返回 Operator machine envelope capabilities,供 Console/控制面做能力协商。
|
|
194
175
|
|
|
195
176
|
### Task action context / artifact instructions
|
|
196
177
|
|
|
197
178
|
```bash
|
|
198
|
-
loop-agent status <task-id> --json
|
|
179
|
+
loop-agent task status <task-id> --json
|
|
199
180
|
loop-agent instructions source --task <task-id> --json
|
|
200
181
|
loop-agent instructions dag-draft --task <task-id> --json
|
|
201
182
|
loop-agent instructions task-artifacts --task <task-id> --json
|
|
@@ -203,34 +184,32 @@ loop-agent instructions promotion --task <task-id> --json
|
|
|
203
184
|
loop-agent instructions closeout --task <task-id> --json
|
|
204
185
|
```
|
|
205
186
|
|
|
206
|
-
`status`
|
|
187
|
+
`task status` 是只读 lifecycle 入口,返回 `lifecycleState`、`gate`、`blockers` 与单一 `next`。`instructions` 在写入 source、DAG draft、task artifacts、promotion 或 closeout 前返回目标路径、依赖、模板、写策略与完成标准;blocked artifact 会列出 `missingDependencies`。`instructions task-artifacts` 只要求 promote 桥接的 `修改记录.md` / `验证结果.md`,不要求手写分析/计划/复盘三份 L1 报告。
|
|
207
188
|
|
|
208
189
|
### Promotion / closeout
|
|
209
190
|
|
|
210
191
|
```bash
|
|
211
|
-
loop-agent
|
|
212
|
-
loop-agent closeout task <task-id>
|
|
192
|
+
loop-agent task advance <task-id> --json
|
|
213
193
|
```
|
|
214
194
|
|
|
215
|
-
`
|
|
195
|
+
成功路径由 `task advance` 内部从 completed DAG facts 生成 task `修改记录.md` / `验证结果.md` 与 progress handoff,不调用 LLM、不修改 completed run facts。
|
|
216
196
|
|
|
217
197
|
one-shot run evidence 位于 `.harness/runs/{active,completed,failed}/<run-id>/`。`cursor-prompt` 与 Pi `cursor` tool 会创建这类 run evidence;当前 `pi-prompt` 不创建 `.harness/runs/`。active 目录只应保留 live one-shot run,残留或 `.DS_Store` 等系统文件应清理。详见 `one-shot-runs.md`。
|
|
218
198
|
|
|
219
199
|
### 运行任何 step 前:准备 source materials
|
|
220
200
|
|
|
221
|
-
`
|
|
201
|
+
标准路径用 `task advance` 一次完成 create、归档 PRD、派生 managed contract:
|
|
222
202
|
|
|
223
203
|
```bash
|
|
224
|
-
loop-agent
|
|
225
|
-
|
|
226
|
-
--use-imported-prd \
|
|
204
|
+
loop-agent task advance <task-id> "标题" \
|
|
205
|
+
--prd <path-to-original-prd.md> \
|
|
227
206
|
--allowed-path "<glob>" \
|
|
228
207
|
--forbidden-path ".harness/**" \
|
|
229
208
|
--verify "typecheck:npm run typecheck" \
|
|
230
|
-
--
|
|
209
|
+
--json
|
|
231
210
|
```
|
|
232
211
|
|
|
233
|
-
默认无 LLM 写 source;工程边界用 flags 显式给出。不要让 AI 直接改写 `source/references/*`。高级用户仍可手工编辑后 `task
|
|
212
|
+
默认无 LLM 写 source;工程边界用 flags 显式给出。不要让 AI 直接改写 `source/references/*`。高级用户仍可手工编辑后 `task advance --from-draft`。
|
|
234
213
|
|
|
235
214
|
### Feature-study workflow(参考代码 → 轻量实现)
|
|
236
215
|
|
|
@@ -243,9 +222,9 @@ loop-agent --repo-root /path/to/target-repo study init <task-id> "Title" \
|
|
|
243
222
|
--reference-glob "codex-rs/**/goal*.rs"
|
|
244
223
|
|
|
245
224
|
# 编辑 source/需求.md + source/执行约束.md,然后走 DAG 路径:
|
|
246
|
-
loop-agent --repo-root <target-repo>
|
|
225
|
+
loop-agent --repo-root <target-repo> task advance <task-id> --profile auto --dag-output .harness/tasks/<task-id>/dag.json --json
|
|
247
226
|
loop-agent --repo-root <target-repo> dag validate --dag .harness/tasks/<task-id>/dag.json --strict-models --strict-governance
|
|
248
|
-
loop-agent --repo-root <target-repo>
|
|
227
|
+
loop-agent --repo-root <target-repo> dag execute --dag .harness/tasks/<task-id>/dag.json --cwd <target-repo>
|
|
249
228
|
```
|
|
250
229
|
|
|
251
230
|
目标 repo 需有 `.harness/prompts/feature-study-analyze.md` 与 `feature-study-plan.md`(缺失时从 loop-agent 复制)。
|
|
@@ -296,23 +275,15 @@ loop-agent dag validate --dag <temp-dir>/hybrid-dag.json --strict-governance --s
|
|
|
296
275
|
loop-agent dag validate --dag ai_workspace/loop-agent/templates/agent-dag.supervised-implementation.json --strict-models --strict-governance # role=supervisor + write-set-gate topology
|
|
297
276
|
cp ai_workspace/loop-agent/templates/agent-dag.supervised-implementation.json <temp-dir>/supervised-dag.json
|
|
298
277
|
(npx vitest run test/dag-supervised-template.test.ts test/dag-validate.test.ts test/dag-shell-executor.test.ts --reporter=dot) # supervised template + shell.verdictGate runtime
|
|
299
|
-
loop-agent
|
|
300
|
-
loop-agent
|
|
301
|
-
loop-agent
|
|
302
|
-
bash scripts/
|
|
278
|
+
loop-agent dag execute --dag <temp-dir>/hybrid-dag.json --cwd <repo-root> # advanced arbitrary DagSpec;stderr 默认输出节点进度与 30s 心跳,stdout 保持最终 JSON
|
|
279
|
+
loop-agent dag execute --dag <temp-dir>/hybrid-dag.json --cwd <repo-root> --progress-interval-ms 60000 # 调整心跳;--quiet 可禁用
|
|
280
|
+
loop-agent dag execute --dag <temp-dir>/hybrid-dag.json --init-only --canvas-path <temp-dir>/hybrid-dag.canvas.tsx # 可选 derived Canvas view
|
|
281
|
+
bash scripts/dag execute-safe.sh --dag <temp-dir>/hybrid-dag.json --cwd <repo-root> [--timeout-secs 7200] # 后台运行 + 轮询,避免外层 bash timeout 杀进程(见 agent-dag-runner.md §Adaptive liveness)
|
|
303
282
|
loop-agent dag init-hybrid <task-id> # 生成可审阅的 DAG draft
|
|
304
|
-
loop-agent dag run-task <task-id> # generate + validate(安全默认;无 dag-runs;standard-compatible)
|
|
305
283
|
loop-agent dag workflow-plan <task-id> --profile pr-review --output .harness/tasks/<task-id>/workflows/planned/<name>.workflow.json
|
|
306
284
|
loop-agent dag workflow-validate --workflow .harness/tasks/<task-id>/workflows/planned/<name>.workflow.json --strict-governance
|
|
307
285
|
loop-agent dag workflow-compile --workflow .harness/tasks/<task-id>/workflows/planned/<name>.workflow.json --output .harness/tasks/<task-id>/workflows/compiled/<name>.dag.json --manifest .harness/tasks/<task-id>/workflows/compiled/<name>.compile-manifest.json
|
|
308
286
|
# compiled workflow DAGs stay explicit; they do not implicitly replace task root dag.json
|
|
309
|
-
loop-agent dag run-task <task-id> --profile auto # 推断 governanceProfile,经 workflowPolicy.dag.profileRouting 路由
|
|
310
|
-
loop-agent dag run-task <task-id> --profile minimal # 选择 minimal 通用路由;standard 前端任务仍可自动使用前端 DAG
|
|
311
|
-
loop-agent dag run-task <task-id> --profile standard # 选择 standard 通用路由;standard 前端任务仍可自动使用前端 DAG
|
|
312
|
-
loop-agent dag run-task <task-id> --profile reviewed # 选择 reviewed 通用路由;standard 前端任务仍可自动使用前端 DAG
|
|
313
|
-
loop-agent dag run-task <task-id> --profile supervised # 选择 supervised implementation DAG;自动前端分类不会降级它
|
|
314
|
-
loop-agent dag run-task <task-id> --execute --cwd <repo-root> # generate + validate + execute(先 narrow writeSet)
|
|
315
|
-
loop-agent dag run-task <task-id> --dry-run --cwd <repo-root> # generate + validate + active dry-run snapshot
|
|
316
287
|
loop-agent dag status --run-id <run-id> # 单次 run JSON 摘要(approvalFlow, healthIssues)
|
|
317
288
|
loop-agent dag doctor # 扫描 active/paused/completed runs;advisoryOnly health report
|
|
318
289
|
loop-agent dag report [--run-id <run-id>] [--lifecycle active|paused|completed|all] [--json|--markdown] [--failed-only] [--latest] [--paused-latest] [--action <recovery-action>] # derived per-node 聚合(只读);JSON 锁定于 ai_workspace/loop-agent/templates/agent-dag-report.schema.json;--paused-latest 聚焦最新 paused run;playbook: ai_workspace/loop-agent/agent-dag-recovery-playbook.md
|
|
@@ -343,17 +314,17 @@ loop-agent dag resume --run-id <run-id> # approve 后继续
|
|
|
343
314
|
- 需 operator 关注的 run 用 `dag report --failed-only`、`--latest`、`--action <recovery-action>` 收窄。category→action 映射见 `ai_workspace/loop-agent/agent-dag-recovery-playbook.md`。
|
|
344
315
|
- 只读扫描 `.harness/dag-runs/` 下所有 run 的生命周期 health issue 与建议 action 用 `dag doctor`(`advisoryOnly: true`;不 mutate facts)。
|
|
345
316
|
- `dag status` / `dag doctor` 的 runner heartbeat 只表示 lease;Pi meaningful progress 由 Provider/tool/output 活动决定。节点可显示 `quiet`、`suspected-stall`、`probing` 或 `needs-attention`,不要仅凭运行时长手工结束。
|
|
346
|
-
- Pi 默认 4h absolute max,`agent-worker` 默认不设置外层 `
|
|
317
|
+
- Pi 默认 4h absolute max,`agent-worker` 默认不设置外层 `dag execute` wall-clock;显式 `worker.timeout_ms` 仍是 hard timeout。`termination-unconfirmed` 表示旧 attempt 的退出无法确认,禁止自动 retry,先保留现场并完成 operator 对账。
|
|
347
318
|
- approve/resume 前用 `dag status --run-id <id>` 看单次 lifecycle、`approvalFlow`、`hasHumanApproval`。
|
|
348
319
|
- lifecycle、raw status 与 liveness 冲突时先用 `dag reconcile-run --run-id <id>` 只读检查。只有 runner 已证明停止且 operator 明确给出 `supersede|abandon` 与 reason 时才允许收口;它保存原始 state,不把未执行节点标成成功。
|
|
349
320
|
- task status、source/artifacts、DAG outcome、verification 记录可能 drift 时用 `dag reconcile-tasks --glob '<pattern>'`。默认仅报告;`--patch` 显式且不能伪造 verification evidence。
|
|
350
321
|
- 大型 PRD closeout 用 `dag final-verification <task-id>` 生成确定性 DAG,final verification 在 closeout artifact 创建之后。
|
|
351
322
|
- 从 run facts dry-run envelope 解析用 `dag decision inspect|validate`;`validate` 在无效 envelope 时 exit 1;永不自动 resume/retry。
|
|
352
323
|
- Decision Gate prompt 可用 `buildDagDecisionGateEvidence()`(`src/workflows/dag/decision-evidence.ts`)做与 `dag report --json`、`ai_workspace/loop-agent/templates/agent-dag-report.schema.json` 对齐的只读摘要;不 mutate run state,不执行 retry/resume。
|
|
353
|
-
- 仅当有意在 `.harness/dag-runs/active/` 下要 active run snapshot 时用 `
|
|
354
|
-
- task source 应从 `harness.json.workflowPolicy.dag.profileRouting` 与确定性 candidate `governanceProfile` 选择治理强度时用 `
|
|
324
|
+
- 仅当有意在 `.harness/dag-runs/active/` 下要 active run snapshot 时用 `dag execute --dry-run`。
|
|
325
|
+
- task source 应从 `harness.json.workflowPolicy.dag.profileRouting` 与确定性 candidate `governanceProfile` 选择治理强度时用 `task advance --profile auto`。无 `--profile` 仅用于旧 standard-compatible 输出;`--profile minimal|standard|reviewed|supervised` 记录治理强度,不替换已识别的专用业务 workflow。
|
|
355
326
|
- 默认 `standard` 任务先读取 `source/需求.md` 中的结构化任务类型,再结合 `allowedPaths` 与 React/Next/Vue 项目能力做确定性分类。确认是前端项目且任务不是明确后端、混合、排除前端或仅文档/测试范围时,自动选择 `frontend-implementation`,不依赖需求关键词;普通后端实现绝不自动进入 `backend-test`。
|
|
356
|
-
- 新生成 DAG 会冻结任务源路径、SHA-256 和显式 `REQ/BR/AC` 到 `sourceBinding`。前端计划漏号时 `frontend-requirement-coverage-shell` 在 writer 前阻断。中断恢复应修复 task source 后重新运行 `
|
|
327
|
+
- 新生成 DAG 会冻结任务源路径、SHA-256 和显式 `REQ/BR/AC` 到 `sourceBinding`。前端计划漏号时 `frontend-requirement-coverage-shell` 在 writer 前阻断。中断恢复应修复 task source 后重新运行 `task advance`,不要生成只携带上游摘要的 impl-only DAG;strict governance 会拒绝无来源绑定且无只读 planner 上游的 v3 孤立 writer。
|
|
357
328
|
- 显式专用 `taskKind` 保持兼容并优先于任务源分类,也不扩充 governance profile:`frontend-implementation` 可有意覆盖为带 Mock 规范评估、contract gate、design gate 和验证链的前端模板;可选 `frontendMock` 配置 auto/required/disabled、既有服务目录和专项验证命令,required 合同不完整时不会生成 writer。`backend-test` 显式选择需求分析 → 功能用例 → 评审 → pytest 生成/执行 → 复盘的后端测试工程模板。
|
|
358
329
|
|
|
359
330
|
### Saved Dynamic Workflow operator UX
|
|
@@ -367,7 +338,7 @@ loop-agent workflow diff <name> --against /tmp/<task-id>.workflow.json
|
|
|
367
338
|
loop-agent workflow replay <run-id>
|
|
368
339
|
```
|
|
369
340
|
|
|
370
|
-
`workflow` 是 Dynamic Workflow 的 saved/operator surface。它读取 `WorkflowSpec`,编译为 DAG,再进入同一套 `
|
|
341
|
+
`workflow` 是 Dynamic Workflow 的 saved/operator surface。它读取 `WorkflowSpec`,编译为 DAG,再进入同一套 `dag execute` runtime;不会新增 executor 能力或绕过 DAG governance。真实写入任务仍应检查 compiled DAG 的 executor、writeSet、shell gates 和 completed facts 边界。
|
|
371
342
|
|
|
372
343
|
### Cursor sidecar
|
|
373
344
|
|
|
@@ -420,7 +391,7 @@ Replay spec 最小结构:
|
|
|
420
391
|
### 检查 task status
|
|
421
392
|
|
|
422
393
|
```bash
|
|
423
|
-
loop-agent status <task-id>
|
|
394
|
+
loop-agent task status <task-id>
|
|
424
395
|
```
|
|
425
396
|
|
|
426
397
|
### Docs governance helpers
|
|
@@ -486,7 +457,7 @@ loop-agent loop add-signal <task-id> --type human_followup --message "..."
|
|
|
486
457
|
loop-agent loop closeout <task-id>
|
|
487
458
|
```
|
|
488
459
|
|
|
489
|
-
`loop` 是 Agent DAG 之上的长程状态和 evidence layer,记录 rounds、signals、verification summaries 和 closeout draft。它不是替代 `
|
|
460
|
+
`loop` 是 Agent DAG 之上的长程状态和 evidence layer,记录 rounds、signals、verification summaries 和 closeout draft。它不是替代 `task advance` 的实现路径;advanced 可用 `dag execute`;medium/large work 仍需要 DAG evidence 或明确 fallback reason。
|
|
490
461
|
|
|
491
462
|
### Minimal spec spine audit
|
|
492
463
|
|
|
@@ -569,10 +540,10 @@ agent-worker observe snapshot --repo <repo-root> # 输出 GlobalSnapshot JSON
|
|
|
569
540
|
语义要点:
|
|
570
541
|
|
|
571
542
|
- TaskSpec 声明单个任务的业务上下文、`risk_level`、可选 `capabilities`、验收与 verify 边界;`risk_level` 被确定性映射到 task complexity。`capabilities: [interactive-ui]` 不改变风险或治理 profile,只把 implement/repair writer 路由到 HIGH,并注入禁止 helper-only 逃逸的真实 UI 交付契约。AcceptanceSpec / TaskGraphSpec 声明跨任务验收引用与依赖图,ready queue 决定可运行任务并检测未知依赖/环/文件一致性。
|
|
572
|
-
- 业务 type(`backend-feature`/`frontend-feature`/`qa-testcode` 等)是产品线 profile,不能直接传给 `loop-agent
|
|
573
|
-
- materializer 把 TaskSpec 物化为 `.harness/tasks/<task-id>`:`source_docs` 原样进入 `source/references/`,派生 `需求.md` 带权威声明、Source Docs/hash 追溯,以及 `acceptance_refs` 短摘要;随后 Worker 调用 `
|
|
543
|
+
- 业务 type(`backend-feature`/`frontend-feature`/`qa-testcode` 等)是产品线 profile,不能直接传给 `loop-agent task advance --profile`(Worker 映射后传入);Worker 会映射到 `auto`/`minimal`/`standard`/`reviewed`/`supervised`。
|
|
544
|
+
- materializer 把 TaskSpec 物化为 `.harness/tasks/<task-id>`:`source_docs` 原样进入 `source/references/`,派生 `需求.md` 带权威声明、Source Docs/hash 追溯,以及 `acceptance_refs` 短摘要;随后 Worker 调用 `task advance` / `dag report`(advanced 可 `dag execute`)。review 节点须对照 references + 派生契约 + 实现。成功路径走 `task advance` 自动 promotion/closeout;失败路径收集 `dag doctor` / `dag closeout-draft` evidence,只允许写入 `.harness/task-pool/failure-handoffs/**`,不放宽其他 `.harness/**` 写入边界。
|
|
574
545
|
- Worker runtime state 落在目标 repo 的 `.harness/task-pool/`(artifacts、JSONL/state、晨报、failure handoffs)。自 0.8.0 起该目录是唯一受支持的 Task Pool runtime root;旧路径不读取、不迁移、不合并、不重映射。
|
|
575
|
-
- preflight 在 `
|
|
546
|
+
- preflight 在 `task advance` 前跑 `loop-agent --version`、`inspect`、`docs-audit`、`git status --short --branch`,可选 `--check-repo`。一次夜间批处理期间不升级控制器,记录实际 `loop-agent` 版本。
|
|
576
547
|
- `batch run-ready` 默认在 stderr 输出人类可读进度(批次起止、每个 task 的阶段与耗时、report 决策),stdout 只保留最终 JSON,便于管道取用;加 `--quiet` 可关闭进度。
|
|
577
548
|
- `feature scaffold` 确定性生成 Feature Packet(`backend-only` / `frontend-only` / `fe-with-api`),默认 `profile: generic`,输出到 `<repo>/features/<feature-id>`;写盘前同源 `validate-feature`;`--batch` 全有或全无;不调用模型、不碰 `.harness/**`。
|
|
578
549
|
- `feature review` 只读派生 Feature 状态、required AC 覆盖、阻塞、证据和唯一下一步。默认输出简洁的人类摘要,`--json` 输出 schemaVersion 1 JSON;损坏事实会显式降级,不会写 Feature Packet 或 Task Pool。
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
| Tier | Default purpose | Commands |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| Primary | Normal autonomous implementation(经 CLI) | `
|
|
20
|
-
| Operator | Diagnose, recover, close out, inspect facts | `
|
|
19
|
+
| Primary | Normal autonomous implementation(经 CLI) | `task advance`(到 writeSet gate)→ 审查 digest → `task advance --approve-gate`;只读 `task status` |
|
|
20
|
+
| Operator | Diagnose, recover, close out, inspect facts | `task status`, advanced `dag report` / forensic helpers, `inspect`, `doctor`, `spine audit`, `knowledge curate`, `docs audit`, `handoff check`, `loop-benchmark`;Inspect:`agent-worker console serve`(`/inspect/`)与兼容 `observe serve\|snapshot` |
|
|
21
21
|
| Compatibility (CLI helpers) | Legacy task metadata and feature-study helpers | `goal`, `reference`, `study` |
|
|
22
22
|
| Escape hatch | Isolated delegation, one-shot diagnosis or **显式** bounded repair | `delegate`, `worktree`, `harvest`, `pi-prompt`, `cursor-prompt`(不得作失败默认恢复) |
|
|
23
23
|
| Experimental | Long-running outer task state | `loop init\|status\|run\|record-round\|add-signal\|closeout` |
|
|
@@ -30,15 +30,16 @@ Prompt templates、README snippets、task instructions 应优先呈现 Primary +
|
|
|
30
30
|
|
|
31
31
|
```text
|
|
32
32
|
Is this only status, diagnosis, recovery, or closeout?
|
|
33
|
-
yes -> Operator CLI only (`status` /
|
|
33
|
+
yes -> Operator CLI only (`task status` / advanced `dag report` / Observe / human gate).
|
|
34
|
+
Prefer re-running the same `task advance` after fixing external blockers.
|
|
34
35
|
Never recover by main-session Edit of business implementation.
|
|
35
36
|
no -> Does it need recoverable, reviewable, verifiable implementation state?
|
|
36
37
|
no -> Read-only pi-prompt / inspect only. Do not main-session implement.
|
|
37
|
-
yes ->
|
|
38
|
+
yes -> `task advance` lifecycle via loop-agent CLI (or agent-worker that spawns it).
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
**禁止**:宿主直接改 `src/**`
|
|
41
|
+
失败恢复允许集(主会话):读 `task status`、处理 gate/blocker、worker `task reconcile` / `pool mark-failed`(若适用)、修正 **PRD/边界/外部凭据** 后重跑同一 `task advance`。
|
|
42
|
+
**禁止**:宿主直接改 `src/**` 等业务实现以绕过失败节点;禁止主会话拼 `prepare/run-task/dag execute/promote/closeout` 命令串。
|
|
42
43
|
|
|
43
44
|
在以下任一 signal 适用时用 Agent DAG 而非 broad one-shot execution:
|
|
44
45
|
|
|
@@ -53,25 +54,20 @@ Is this only status, diagnosis, recovery, or closeout?
|
|
|
53
54
|
Minimum governed path:
|
|
54
55
|
|
|
55
56
|
```bash
|
|
56
|
-
loop-agent
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
loop-agent dag run-task <task-id> \
|
|
62
|
-
--profile auto \
|
|
63
|
-
--strict-models \
|
|
64
|
-
--output .harness/tasks/<task-id>/dag.json \
|
|
57
|
+
loop-agent task advance <task-id> "Task Title" \
|
|
58
|
+
--prd <path-to-original-prd.md> \
|
|
59
|
+
--allowed-path "<glob>" \
|
|
60
|
+
--verify "typecheck:npm run typecheck" \
|
|
61
|
+
--json \
|
|
65
62
|
[--repo-root <target-repo>]
|
|
66
63
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
--
|
|
70
|
-
--
|
|
64
|
+
# Review gate.writeSet + gate.digest, then:
|
|
65
|
+
loop-agent task advance <task-id> \
|
|
66
|
+
--approve-gate "write-set-review:<digest>" \
|
|
67
|
+
--json \
|
|
68
|
+
[--repo-root <target-repo>]
|
|
71
69
|
|
|
72
|
-
loop-agent
|
|
73
|
-
--dag .harness/tasks/<task-id>/dag.json \
|
|
74
|
-
--cwd <target-repo>
|
|
70
|
+
loop-agent task status <task-id> --json [--repo-root <target-repo>]
|
|
75
71
|
```
|
|
76
72
|
|
|
77
73
|
`loop-agent` is the preferred global CLI. For self-hosting loop-agent development, the controller must be an installed npm-published package. Use `npm install -g @tea-agent/loop-agent@latest` for first install or intentional upgrades, then treat the installed version as frozen for the current task and record `npm list -g @tea-agent/loop-agent --depth=0`. Do not repeatedly fetch `npx @latest` inside DAG nodes, and do not use the current working tree's `npm link` or `npm run dev` to control tasks that may edit CLI, DAG runtime, executors, package metadata, or build output. Use `npm run dev -- <args>` only for source debugging and focused CLI development.
|
|
@@ -82,7 +78,7 @@ For arbitrary target repositories, DAG skill instructions must not depend on loo
|
|
|
82
78
|
|
|
83
79
|
Default DAG draft: `.harness/tasks/<task-id>/dag.json`. Explicit `--output` to temp remains an escape hatch.
|
|
84
80
|
|
|
85
|
-
Execution 前 review `
|
|
81
|
+
Execution 前 review `task advance` JSON / `reviewPacket`:
|
|
86
82
|
|
|
87
83
|
- `profileRouting`:requested profile、selected profile/template、routing reasons。
|
|
88
84
|
- `governanceProfile`:process、delivery、code-change signals。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Agent DAG Hybrid Workflow(`
|
|
1
|
+
# Agent DAG Hybrid Workflow(`task advance` / advanced `dag execute`)
|
|
2
2
|
|
|
3
3
|
创建或执行 loop-agent 工作的首选 Agent DAG path 时使用本文:Level 2 Agent DAG orchestration、Pi read-only + Pi `toolProfile: "write"` bounded execution、Pi-only writers、write policy、DAG template、task-to-DAG 生成,或基于 governance-profile 的 template 选择。
|
|
4
4
|
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
`harness.json.workflowPolicy` 现声明 Agent DAG 为首选 implementation workflow:
|
|
8
8
|
|
|
9
9
|
- `defaultImplementationWorkflow=agent-dag`
|
|
10
|
-
- `dag.defaultEntry=
|
|
10
|
+
- `dag.defaultEntry=task advance`
|
|
11
11
|
- `dag.outputLanguage=zh-CN`;未配置时也默认中文,显式设为 `en` 可切换英文
|
|
12
12
|
- `dag.profileRouting`:通用候选映射为 `minimal|standard -> standard-dag`、`reviewed -> review-gated-dag`、`supervised -> supervised-implementation`
|
|
13
13
|
- `humanGatePolicy.defaultMode=record-only`;需求不清、架构/公共契约风险、凭据/费用/部署风险、重复 gate failure 或高风险决策时升级人工介入
|
|
14
14
|
|
|
15
|
-
此 policy
|
|
15
|
+
此 policy 驱动标准路径 `task advance --profile auto`:operator 只记 `task advance` / `task status`;advanced arbitrary DagSpec 才用 `dag validate` / `dag execute`。`--profile auto` 在确定性 candidate `governanceProfile` 推断后应用 `workflowPolicy.dag.profileRouting`。生成器还会把 `outputLanguage` 写入 DagSpec,runner 在每个 Pi/Cursor 节点 prompt 中注入语言规则;代码、命令、路径、JSON 字段与 gate token 保持原样。`humanGatePolicy` 是默认人机边界声明;真实暂停仍由 DAG 节点的 `decisionGate.mode: "pause-on-human"` 与 decision envelope 触发。
|
|
16
16
|
|
|
17
17
|
对于默认 `standard` 任务,生成器先读取 `source/需求.md` 中的结构化任务类型,再结合 `allowedPaths` 与 React/Next/Vue 强工程证据做确定性分类。确认是前端项目且任务不是明确后端、前后端混合、排除前端或仅文档/测试范围时,默认选择 `frontend-implementation` DAG,不依赖需求关键词。分类不会把普通后端实现路由到 `backend-test`;显式 profile、`workflowPolicy` 或 supervised quality gate 只记录治理强度,不把已识别的前端业务 workflow 换回通用模板。
|
|
18
18
|
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
|
|
27
27
|
| 优先级 | 入口 | 使用场景 |
|
|
28
28
|
|-------|-------|----------|
|
|
29
|
-
| **Primary / Level 3** | `
|
|
30
|
-
| **
|
|
31
|
-
历史顺序式 `run analyze|plan|implement|verify|auto|loop|continue` 已移除。主会话是 Operator Assist:业务实现走
|
|
29
|
+
| **Primary / Level 3** | `task advance --profile auto` | 从 PRD/managed source 生成 hybrid DAG、strict validate、writeSet gate,批准后长跑 |
|
|
30
|
+
| **Advanced / Level 2** | `dag execute --dag <path>` | 跨 Pi + shell + static executor 执行 arbitrary Agent DAG orchestration |
|
|
31
|
+
历史顺序式 `run analyze|plan|implement|verify|auto|loop|continue` 已移除。主会话是 Operator Assist:业务实现走 `task advance`。极窄的文档/DAG JSON/task-source 元数据修正不是第二套 workflow runtime,也**不得**在 CLI 失败后变成「主会话直接改实现」。
|
|
32
32
|
|
|
33
|
-
**心智模型**:`
|
|
33
|
+
**心智模型**:`task advance` 是标准 task lifecycle;`dag execute` 是 loop-agent 内 advanced Agent DAG orchestration;受治理 Agent leaf executor 只有 Pi。`cursor-prompt` 是独立 sidecar,不是 DAG node executor。不要把 Cursor 重新引入 hybrid schema / `executorModels` / writer 选择。
|
|
34
34
|
|
|
35
|
-
### Level 2 Agent DAG hybrid(`
|
|
35
|
+
### Level 2 advanced Agent DAG hybrid(`dag execute`)
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
cp examples/hybrid-loop-agent-dag.json <temp-dir>/hybrid-dag.json
|
|
39
39
|
loop-agent dag validate --dag <temp-dir>/hybrid-dag.json # 常规 validation + ranks;无 dag-runs 副作用
|
|
40
40
|
loop-agent dag validate --dag <temp-dir>/hybrid-dag.json --strict-models # 非 canonical executorModels 时也失败
|
|
41
41
|
loop-agent dag validate --dag <temp-dir>/hybrid-dag.json --strict-governance # governance warning(如 read-only artifact drift)时失败
|
|
42
|
-
loop-agent
|
|
43
|
-
loop-agent
|
|
42
|
+
loop-agent dag execute --dag <temp-dir>/hybrid-dag.json --cwd <repo-root> # 执行 Pi/shell/static DAG
|
|
43
|
+
loop-agent dag execute --dag <temp-dir>/hybrid-dag.json --init-only --canvas-path <temp-dir>/hybrid-dag.canvas.tsx # 可选 derived Canvas
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
`<temp-dir>` 表示平台原生临时目录;实际命令中 macOS 与 Windows 都使用本机路径。`/` 只作为 repo refs、JSON/Markdown evidence refs 和 glob 约定的稳定分隔符。
|
|
@@ -65,10 +65,10 @@ loop-agent run-dag --dag <temp-dir>/hybrid-dag.json --init-only --canvas-path <t
|
|
|
65
65
|
|
|
66
66
|
**运维 warning**:
|
|
67
67
|
|
|
68
|
-
- **常规 validation**:`dag validate --dag <path>` 做 schema/topology/ranks。JSON 输出含 `governanceProfile`(确定性 `minimal|standard|reviewed|supervised` 推断,含 `process` / `delivery` / `codeChange` signal 与 `reasons`),及 model-matrix drift、governance lint(如 read-only artifact-boundary drift 或 DAG 内 `check-repo.sh` shell env drift)的 warnings。手写临时 DAG spec 执行前用 `dag validate --dag <path> --strict-models`;governance warning 应 fail fast 时加 `--strict-governance`。含 `executor: "cursor"` 的旧 DAG 会在 schema 校验失败;默认生成 DAG 使用 `pi` read-only / Pi write profile / shell。仅当有意在 `.harness/dag-runs/active/` 要 active run snapshot 时用 `
|
|
69
|
-
- **Governance profile 推断与 routing(code vs skill 分工)**:`./src/workflows/dag/governance-profile.ts` 从 DAG 结构与 write scope 做 **硬确定性推断**。JSON 输出 **报告** `process` / `delivery` / `codeChange` signal 与人类可读 `reasons`;`profile` tier(`minimal|standard|reviewed|supervised`)仅由该模块 code rule 选择(如多个 exclusive writer、repair node、review-gate topology、`loop-agent-runtime-paths`、`scripts-ci-harness-paths`、weak post-implementation shell verification、supervised topology)。baseline `forbiddenPaths`(`.harness/**`、`.harness/dag-runs/**`、`artifacts/**`)是默认 governance,**本身不是** process-risk signal。skill prompt 与本 reference **解释** tier 并摘要 profile 选择原因;不替代 code 推断。`
|
|
68
|
+
- **常规 validation**:`dag validate --dag <path>` 做 schema/topology/ranks。JSON 输出含 `governanceProfile`(确定性 `minimal|standard|reviewed|supervised` 推断,含 `process` / `delivery` / `codeChange` signal 与 `reasons`),及 model-matrix drift、governance lint(如 read-only artifact-boundary drift 或 DAG 内 `check-repo.sh` shell env drift)的 warnings。手写临时 DAG spec 执行前用 `dag validate --dag <path> --strict-models`;governance warning 应 fail fast 时加 `--strict-governance`。含 `executor: "cursor"` 的旧 DAG 会在 schema 校验失败;默认生成 DAG 使用 `pi` read-only / Pi write profile / shell。仅当有意在 `.harness/dag-runs/active/` 要 active run snapshot 时用 `dag execute --dry-run`。
|
|
69
|
+
- **Governance profile 推断与 routing(code vs skill 分工)**:`./src/workflows/dag/governance-profile.ts` 从 DAG 结构与 write scope 做 **硬确定性推断**。JSON 输出 **报告** `process` / `delivery` / `codeChange` signal 与人类可读 `reasons`;`profile` tier(`minimal|standard|reviewed|supervised`)仅由该模块 code rule 选择(如多个 exclusive writer、repair node、review-gate topology、`loop-agent-runtime-paths`、`scripts-ci-harness-paths`、weak post-implementation shell verification、supervised topology)。baseline `forbiddenPaths`(`.harness/**`、`.harness/dag-runs/**`、`artifacts/**`)是默认 governance,**本身不是** process-risk signal。skill prompt 与本 reference **解释** tier 并摘要 profile 选择原因;不替代 code 推断。`task advance` 转发 embedded validate step 的同一 candidate `governanceProfile`。`task advance --profile auto` 先将 candidate profile 经 `harness.json.workflowPolicy.dag.profileRouting` 映射,再在 candidate delivery signal 含 `loop-agent-runtime-paths`、`scripts-ci-harness-paths` 或 `public-contract-paths` 时应用 M4 `supervised-quality-gate` promotion;`profileRouting.routingReasons` 记录确定性 reason。无 profile `task advance <task-id>` 仍为 standard-compatible;显式 `--profile minimal|standard|reviewed|supervised` 与自动 promotion 记录治理强度,已识别的前端业务 workflow 仍使用前端专用模板。高风险 task 应用 `--profile auto` 或显式 `--profile supervised`,而非显式 `--profile reviewed`。
|
|
70
70
|
- **Executor model routing**:DAG spec 选 `executor` 与 `complexity`,可通过 `executorModels.pi` 覆盖模型。值写成 `provider/model` 时显式选择 Pi provider(只分割第一个 `/`);裸模型名继续走内置映射或默认 `wizard-local`。默认 routing:Pi LOW=`gpt-5.3-codex-spark`、MED=`gpt-5.5`、HIGH=`gpt-5.5`。`shell` 不用 model,忽略 `executorModels`。
|
|
71
|
-
- **Active visibility**:真实 `
|
|
71
|
+
- **Active visibility**:真实 `dag execute` execution 在 run/node 转换时写 active `state.json`,归档前 core runner 暴露 isolated `DagRunObserver` hook 供 derived view。`.harness/dag-runs/completed/<run-id>/` / `paused/<run-id>/` 仍是 source of truth;observer 输出非 canonical。
|
|
72
72
|
- **可选 Canvas**:传 `--canvas-path <abs-path>` 或 `--canvas <name>` 输出 derived `.canvas.tsx` live view。省略 flag 行为不变。`--init-only` + Canvas 无需 `CURSOR_API_KEY`。
|
|
73
73
|
|
|
74
74
|
- **Shell node**:`executor: "shell"` 串行跑确定性 `shell.commands`,每 command 有 `timeoutMs`;非零 exit / timeout 标 node `ERROR` 并将 command output 归档到 node result 目录。用于 verification fact,非 code repair。
|
|
@@ -77,12 +77,12 @@ loop-agent run-dag --dag <temp-dir>/hybrid-dag.json --init-only --canvas-path <t
|
|
|
77
77
|
- **Upstream output artifacts**:直接 `depends_on` 上游 stdout 超过 2000 字符时,runner 写 `<runDir>/<node-id>/stdout.md` 并在下游 `<upstream_context>` 提供 preview + artifact pointer map(绝对路径、`chars`、`sha256`)。下游 agent 可读 runner evidence,但 read-only node 仍不得编辑 `.harness/dag-runs/**`。
|
|
78
78
|
- **`writePolicy=exclusive`** 要求非空 `writeSet`;same-rank exclusive node 的 `writeSet` 条目须 **disjoint**,否则 validation fail fast。v1 DAG 中声明 `writePolicy` 或 `writeSet` 任一即 opt-in write validation。
|
|
79
79
|
- **`forbiddenPaths` 优先于 `allowedPaths`**(writeSet validation)。
|
|
80
|
-
- **Pi rollback**:SDK path 损坏时在 `
|
|
80
|
+
- **Pi rollback**:SDK path 损坏时在 `dag execute` 前 `export CODE_AGENT_PI_BACKEND=cli-only`。
|
|
81
81
|
- **Defaults caveat**:`defaults.skills` / `defaults.writePolicy` 生效。对 `cursor` / `pi` node,resolved skill 名亦由 DAG runner 映射为有界 inline `SKILL.md` instruction,审计于 `<node>/skills.json`;Pi 仍以 `noSkills` / `--no-skills` 运行,故非 Pi ResourceLoader loading。`defaults.executor`、`defaults.model`、`defaults.piBackend`、`defaults.contextProfile` 接受/保留但尚非 runtime default。runtime execution 用 node `executor` + node `complexity`;各 executor 内部自选 model。live contract 已移除 `models`;executor-specific routing 用 `executorModels`。
|
|
82
82
|
- **默认无**跨 node Pi runtime reuse;各 Pi node 是独立 `executePiStep()` call。
|
|
83
83
|
- **Prompt source**:每个 task 仅用一种 prompt source。v1-compatible DAG 用 inline `subtask_prompt`;markdown-backed prompt 用 canonical `subtask_prompt_markdown`。同时提供两字段、皆不提供、或用连字符 alias `subtask_prompt-markdown` 均 fail fast。
|
|
84
84
|
- **Source binding / recovery**:新生成 DAG 在顶层冻结 `sourceBinding`(任务源相对路径、SHA-256、显式 `REQ/BR/AC`)。前端计划在存在显式编号时经过 `frontend-requirement-coverage-shell`;修订计划为 primary,只在条件分支未产生输出时 fallback 到原计划。主来源存在但缺号时仍在 writer 前 fail closed。中断后重新生成完整 DAG,不要从二手摘要拼接 impl-only DAG;v3 孤立 exclusive writer 若无 `sourceBinding` 且没有只读 planner 上游,会被 strict governance 拒绝。
|
|
85
|
-
- **勿宣称 live smoke 已通过**,除非真实 `
|
|
85
|
+
- **勿宣称 live smoke 已通过**,除非真实 `dag execute` execution 中 Pi read-only、Pi writer、显式 Cursor 或 shell node 均按 DAG 完成。
|
|
86
86
|
|
|
87
87
|
可复用 template:`docs/templates/agent-dag.base.json`(model 生成 DAG 的首选 base template)、`docs/templates/agent-dag.schema.json`(JSON Schema)、`docs/templates/agent-dag.supervised-implementation.json`(supervised implementation:writeSet audit、soft/hard verify、process supervisor、repair、review verdict gate)、`docs/templates/backend-test-dag.json`(后端测试专用模板)、`docs/templates/frontend-test-dag.json`(FE-test RAG:Markdown case manifest、串行 Playwright CLI case 子节点与逐 case 证据)、`docs/templates/agent-dag-process-supervisor.prompt.md`、`docs/templates/agent-dag-review-verdict.prompt.md`、`docs/templates/agent-dag-authority-surface-audit.prompt.md`(可选 authority surface verifier;authority signal 或显式 enablement 匹配时由 `dag init-hybrid` 插入)、`examples/hybrid-loop-agent-dag.json`、`docs/templates/hybrid-dag.json`。
|
|
88
88
|
|
|
@@ -129,29 +129,28 @@ Prompt invariant:`ai_workspace/loop-agent/templates/agent-dag-process-supervis
|
|
|
129
129
|
|
|
130
130
|
**未实现**:`executor: supervisor`、whole-run automatic retry/resume、`executor: human`/`decision`、browser executor,或 read-only node 对 root `artifacts/**` 的 exemption。注:有界只读 Pi 节点重试已实现(见下「只读 Pi 节点安全重试」)。
|
|
131
131
|
|
|
132
|
-
### Level 3 task
|
|
132
|
+
### Level 3 task lifecycle(`task advance` / advanced `dag init-hybrid`)
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
|
+
loop-agent task advance <task-id> "Title" \
|
|
136
|
+
--prd <prd.md> \
|
|
137
|
+
--allowed-path "<glob>" \
|
|
138
|
+
--profile auto \
|
|
139
|
+
--json
|
|
140
|
+
# 审查 writeSet gate digest 后批准并长跑(自动 generate/validate/execute/promote/closeout)
|
|
141
|
+
loop-agent task advance <task-id> --approve-gate "write-set-review:<digest>" --json
|
|
142
|
+
loop-agent task status <task-id> --json
|
|
143
|
+
# advanced authoring only:
|
|
135
144
|
loop-agent dag init-hybrid <task-id> [--output .harness/tasks/<task-id>/dag.json]
|
|
136
|
-
loop-agent dag run-task <task-id> [--output .harness/tasks/<task-id>/dag.json] # 安全默认:仅 generate + validate,standard-compatible
|
|
137
|
-
loop-agent dag run-task <task-id> --profile auto # 推断 candidate governanceProfile,再经 workflowPolicy 路由
|
|
138
|
-
loop-agent dag run-task <task-id> --profile minimal # 选择 minimal 通用路由;standard 前端任务可自动使用前端 DAG
|
|
139
|
-
loop-agent dag run-task <task-id> --profile standard # 选择 standard 通用路由;standard 前端任务可自动使用前端 DAG
|
|
140
|
-
loop-agent dag run-task <task-id> --profile reviewed # 选择 reviewed 通用路由;standard 前端任务可自动使用前端 DAG
|
|
141
|
-
loop-agent dag run-task <task-id> --profile supervised # 选择 supervised DAG;自动前端分类不会降级它
|
|
142
|
-
loop-agent dag run-task <task-id> --strict-models # 非 canonical executorModels 时失败
|
|
143
|
-
loop-agent dag run-task <task-id> --execute --cwd <repo-root> # 要求 narrowed implement writeSet
|
|
144
|
-
loop-agent dag run-task <task-id> --dry-run --cwd <repo-root> # active snapshot 于 .harness/dag-runs/active/
|
|
145
|
-
loop-agent dag run-task <task-id> --init-only --cwd <repo-root> # pending active snapshot,不执行 node
|
|
146
145
|
```
|
|
147
146
|
|
|
148
|
-
|
|
147
|
+
默认首次 `task advance` **不**启动 writer,只推进到 writeSet gate。placeholder / `**` implement writeSet 会在 strict validate / gate 前 fail-closed,直到人工收窄 path。
|
|
149
148
|
|
|
150
|
-
`
|
|
149
|
+
`task advance` JSON 含 `gate` / `next` / lifecycle 事实供执行前 review;advanced `dag validate` 可读 generated DAG JSON 的 `profileRouting`、`governanceProfile`、exclusive writer `writeSet`、`shellGates` 等。
|
|
151
150
|
|
|
152
151
|
### DAG 与 artifacts source-of-truth 规则
|
|
153
152
|
|
|
154
|
-
- Canonical task DAG draft: `.harness/tasks/<task-id>/dag.json` (`
|
|
153
|
+
- Canonical task DAG draft: `.harness/tasks/<task-id>/dag.json` (`task advance` / advanced `init-hybrid` default).
|
|
155
154
|
- Worker per-run snapshot: `artifacts/<workerRunId>-dag.json`; compiled workflows stay under `workflows/compiled/` and need explicit `--dag`.
|
|
156
155
|
- Platform temp is only an explicit `--output` escape hatch. Reusable templates live in `examples/` or `ai_workspace/loop-agent/templates/`.
|
|
157
156
|
- **不要**在 `.harness/dag-runs/active/` root 保留手写 DAG input 副本。
|
|
@@ -160,7 +159,7 @@ loop-agent dag run-task <task-id> --init-only --cwd <repo-root>
|
|
|
160
159
|
- root `artifacts/修改记录.md` 与 `artifacts/验证结果.md` 是 legacy current-work / explicit-write 摘要。不是 per-run 不可变历史,也不是新工作流默认交付路径。
|
|
161
160
|
- Agent DAG read-only node 不得写 root `artifacts/`;若须更新 root artifacts,用显式 `exclusive` write node(经 CLI),不要用主会话直接写实现或 root artifacts 代替节点。
|
|
162
161
|
- DAG Cursor 节点交付物必须写入 `.harness/dag-runs/<state>/<run-id>/artifacts/<node-id>/`;`./artifacts/**` 是错误落点。
|
|
163
|
-
- 长期结论须迁入 `ai_workspace/loop-agent/exec-plans/`、`ai_workspace/loop-agent/reports/` 或 `ai_workspace/loop-agent/progress
|
|
162
|
+
- 长期结论须迁入 `ai_workspace/loop-agent/exec-plans/`、`ai_workspace/loop-agent/reports/` 或 `ai_workspace/loop-agent/progress/`。成功路径由 `task advance` 自动 promotion/closeout;二者 deterministic,且不 mutate completed run facts。
|
|
164
163
|
|
|
165
164
|
**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 并在 DAG 内写入(P2 教训:`hybrid-dag.md` 被 scout 发现但 initial writeSet 遗漏);不要依赖 post-DAG 主会话大段补写。
|
|
166
165
|
|
|
@@ -180,8 +179,7 @@ loop-agent dag status --run-id <run-id>
|
|
|
180
179
|
loop-agent dag report --paused-latest [--json|--markdown] # 最新 paused run;勿与 --lifecycle 并用
|
|
181
180
|
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
|
|
182
181
|
loop-agent dag closeout-draft [--run-id <run-id>] [--output <path>] # M5:从 completed run facts 生成确定性 closeout draft;默认平台临时目录;仅 advisory;不 mutate completed facts
|
|
183
|
-
loop-agent
|
|
184
|
-
loop-agent closeout task <task-id> # 从 task artifacts 生成 ai_workspace/loop-agent/progress closeout
|
|
182
|
+
loop-agent task advance <task-id> --json # 成功路径自动 promotion/closeout;不 mutate completed facts
|
|
185
183
|
loop-agent dag reconcile-tasks --glob '<pattern>' [--json|--markdown] # 仅报告的 task/run/artifact/verify drift audit
|
|
186
184
|
loop-agent dag final-verification <task-id> [--output <path>] # 生成 closeout DAG;final verify 依赖 closeout artifact
|
|
187
185
|
loop-agent dag decision inspect --run-id <run-id> [--node-id <node-id>]
|
|
@@ -191,7 +189,7 @@ loop-agent dag reject --run-id <run-id> --reason "..."
|
|
|
191
189
|
loop-agent dag resume --run-id <run-id> # approve 后继续
|
|
192
190
|
```
|
|
193
191
|
|
|
194
|
-
**Paused operator flow**:`
|
|
192
|
+
**Paused operator flow**:`dag execute` → `paused/` →(`dag status` / 可选 `dag decision validate`)→ `dag approve` → `active/` → `dag resume` → `completed/`;或 `dag reject` → `completed/`(`failed`,`failureCategory=human-rejected`)。
|
|
195
193
|
|
|
196
194
|
**Stale active detection**:`dag doctor` 标 health code 如 `terminal-in-active`(`active/` 保留 terminal run);仅 advisory — 按 playbook 手动 archive/remove,尚无 auto cleanup CLI。
|
|
197
195
|
|
|
@@ -36,8 +36,8 @@ loop-agent loop record-round <task-id> \
|
|
|
36
36
|
- `loop run --action shell-verify` 是 deterministic action;命令 exit code 决定 verification result,输出摘要写入 `loop/verification/round-N.json`。
|
|
37
37
|
- `loop run --action pi-review` 必须保持 read-only;工具 allowlist 固定为 `read,grep,find,ls`,输出必须包含 `findingSummary`、`failureCategory`、`nextHypothesis`、`recommendedAction`、`fixScope`、`rootCause`,其中 `recommendedAction` 只能是 `implement_fix|replan|pause|done`。
|
|
38
38
|
- 自动写入只能通过 `loop run --action dag --execute` / auto DAG execute;须读取 task `allowedPaths` / `forbiddenPaths` 并审查 writer writeSet。
|
|
39
|
-
- `loop run --action dag` 默认是 review mode:调用 `
|
|
40
|
-
- `loop run --action dag --execute` 才会调用 `
|
|
39
|
+
- `loop run --action dag` 默认是 review mode:调用 `task advance <task-id> --profile auto --strict-models` 生成 DAG,再用 `dag validate --strict-models --strict-governance` 校验,并记录 review packet。
|
|
40
|
+
- `loop run --action dag --execute` 才会调用 `dag execute`,随后读取 `dag report --json` 作为 round result;paused DAG 会让 loop 进入 `paused`。
|
|
41
41
|
|
|
42
42
|
## Auto mode 与写入边界
|
|
43
43
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# One-shot Run Evidence(`.harness/runs/`)
|
|
2
2
|
|
|
3
|
-
当你使用 `cursor-prompt`、Pi `cursor` tool、`
|
|
3
|
+
当你使用 `cursor-prompt`、Pi `cursor` tool、`task advance (promotion)`,或在治理检查中看到 `.harness/runs/active` warning 时,读本文。
|
|
4
4
|
|
|
5
5
|
## 目录职责
|
|
6
6
|
|
|
@@ -50,11 +50,10 @@ artifacts/
|
|
|
50
50
|
completed one-shot evidence 若要进入 task artifacts,使用:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
loop-agent
|
|
54
|
-
loop-agent closeout task <task-id>
|
|
53
|
+
loop-agent task advance <task-id> --json
|
|
55
54
|
```
|
|
56
55
|
|
|
57
|
-
`
|
|
56
|
+
`task advance (promotion)` 只读 `.harness/runs/completed/**`,生成或更新 task `artifacts/修改记录.md` / `artifacts/验证结果.md`,不修改 completed run facts。
|
|
58
57
|
|
|
59
58
|
## Active 目录清理
|
|
60
59
|
|
|
@@ -82,4 +81,4 @@ HARNESS_STRICT_ACTIVE_TOOL_RUNS=1 bash scripts/check-harness-runtime-clean.sh
|
|
|
82
81
|
- 不要提交 `.harness/runs/**` 运行态内容。
|
|
83
82
|
- 不要手动改写 `.harness/runs/completed/**` 或 `.harness/runs/failed/**` 事实。
|
|
84
83
|
- 不要把 `.harness/runs/active/**` 当作长期记录。
|
|
85
|
-
- 不要把 one-shot evidence 直接等同于 task artifacts;需要汇总时用 `
|
|
84
|
+
- 不要把 one-shot evidence 直接等同于 task artifacts;需要汇总时用 `task advance (promotion)`。
|