@tea-agent/loop-agent 0.16.25 → 0.17.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/CHANGELOG.md +46 -0
- package/README.md +14 -3
- package/dist/cli/command-definitions.js +43 -0
- package/dist/cli/program.js +26 -0
- package/dist/commands/dag-approve.js +4 -0
- package/dist/commands/dag-resume.js +1 -0
- package/dist/commands/dag-validate.js +6 -0
- package/dist/commands/operator.js +44 -0
- package/dist/commands/task-contract.js +271 -0
- package/dist/executors/dag-pi-executor.js +118 -16
- package/dist/executors/pi-executor.js +206 -13
- package/dist/executors/pi-sdk-executor.js +21 -6
- package/dist/executors/shell-executor.js +85 -8
- package/dist/executors/shell-presets.js +16 -3
- package/dist/executors/shell-write-guard.js +64 -2
- package/dist/shared/operator/capabilities.js +255 -0
- package/dist/shared/operator/envelope.js +59 -0
- package/dist/shared/operator/index.js +4 -0
- package/dist/shared/operator/registry.js +38 -0
- package/dist/shared/operator/types.js +5 -0
- package/dist/task/contract/adopt.js +166 -0
- package/dist/task/contract/apply.js +326 -0
- package/dist/task/contract/canonicalize.js +60 -0
- package/dist/task/contract/constants.js +29 -0
- package/dist/task/contract/diff.js +177 -0
- package/dist/task/contract/hash.js +42 -0
- package/dist/task/contract/import-revision.js +96 -0
- package/dist/task/contract/index.js +17 -0
- package/dist/task/contract/journal.js +155 -0
- package/dist/task/contract/lock.js +153 -0
- package/dist/task/contract/observe.js +296 -0
- package/dist/task/contract/paths.js +19 -0
- package/dist/task/contract/project.js +170 -0
- package/dist/task/contract/recover.js +312 -0
- package/dist/task/contract/request-ledger.js +37 -0
- package/dist/task/contract/schema.js +151 -0
- package/dist/task/contract/transaction.js +160 -0
- package/dist/task/contract/types.js +1 -0
- package/dist/task/contract/validate-draft.js +106 -0
- package/dist/task/index.js +3 -0
- package/dist/task/operator/capabilities.js +6 -0
- package/dist/task/operator/envelope.js +2 -0
- package/dist/task/operator/index.js +5 -0
- package/dist/task/operator/registry.js +2 -0
- package/dist/task/operator/types.js +1 -0
- package/dist/task/runtime.js +5 -1
- package/dist/task/source-references.js +7 -0
- package/dist/worker/cli.js +150 -32
- package/dist/worker/console/app-data.js +185 -0
- package/dist/worker/console/dag-confirmation.js +313 -0
- package/dist/worker/console/doctor.js +169 -0
- package/dist/worker/console/draft-store.js +80 -0
- package/dist/worker/console/index.js +15 -0
- package/dist/worker/console/interview/assessment.js +67 -0
- package/dist/worker/console/interview/session.js +100 -0
- package/dist/worker/console/interview/tools.js +109 -0
- package/dist/worker/console/loopback.js +16 -0
- package/dist/worker/console/observe-health-match.js +174 -0
- package/dist/worker/console/observe-link.js +33 -0
- package/dist/worker/console/operation-runner.js +166 -0
- package/dist/worker/console/operation-sse.js +158 -0
- package/dist/worker/console/operation-store.js +147 -0
- package/dist/worker/console/operator-actions.js +769 -0
- package/dist/worker/console/pi-readiness.js +94 -0
- package/dist/worker/console/recovery-cta.js +133 -0
- package/dist/worker/console/repo-fingerprint.js +29 -0
- package/dist/worker/console/resource-loader.js +95 -0
- package/dist/worker/console/routes.js +368 -0
- package/dist/worker/console/security.js +126 -0
- package/dist/worker/console/server.js +149 -0
- package/dist/worker/console/sibling-controller.js +28 -0
- package/dist/worker/console/static/assets/index-CbnMgdWa.js +9 -0
- package/dist/worker/console/static/assets/index-Dnj0RVs8.css +1 -0
- package/dist/worker/console/static/index.html +13 -0
- package/dist/worker/console/vite.config.js +27 -0
- package/dist/worker/delivery/git-transaction.js +43 -8
- package/dist/worker/observe/health.js +57 -0
- package/dist/worker/observe/paths.js +81 -0
- package/dist/worker/observe/routes.js +142 -27
- package/dist/worker/observe/spec-evidence.js +84 -0
- package/dist/worker/observe/static/api.js +23 -0
- package/dist/worker/observe/static/state.js +26 -0
- package/dist/worker/observe/static/styles.css +10 -0
- package/dist/worker/observe/static/views/dag-inspector.js +173 -6
- package/dist/workflows/dag/backend-test-analysis-contract.js +34 -9
- package/dist/workflows/dag/dynamic-runtime/shared.js +1 -0
- package/dist/workflows/dag/frontend-repair.js +1 -10
- package/dist/workflows/dag/init-hybrid.js +372 -115
- package/dist/workflows/dag/node-execution.js +57 -6
- package/dist/workflows/dag/project-governance-context.js +508 -0
- package/dist/workflows/dag/prompt.js +46 -1
- package/dist/workflows/dag/retry-policy.js +16 -1
- package/dist/workflows/dag/runner.js +9 -0
- package/dist/workflows/dag/skill-snapshot.js +1 -0
- package/dist/workflows/dag/task-contract-binding.js +138 -0
- package/dist/workflows/dag/types.js +84 -10
- package/dist/workflows/dag/validate.js +53 -7
- package/docs/README.md +2 -0
- package/docs/architecture/evolution.md +2 -0
- package/docs/architecture/system-overview.md +6 -0
- package/docs/architecture/worker-and-feature.md +7 -0
- package/docs/templates/agent-dag.schema.json +64 -2
- package/docs/templates/agent-dag.supervised-implementation.json +1 -0
- package/docs/templates/backend-test-dag.classify.prompt.md +1 -1
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +5 -5
- package/docs/templates/backend-test-dag.json +26 -154
- package/docs/templates/backend-test-dag.retrospect.prompt.md +1 -1
- package/docs/templates/backend-test-dag.review-cases.prompt.md +2 -2
- package/package.json +8 -2
- package/skills/agent-worker/SKILL.md +1 -0
- package/skills/agent-worker/references/agent-worker-operator.md +3 -2
- package/skills/frontend-design-review/SKILL.md +25 -16
- package/skills/frontend-implementation/references/node-contracts.md +5 -5
- package/skills/loop-agent/references/command-reference.md +48 -1
- package/skills/loop-agent/references/hybrid-dag.md +4 -4
|
@@ -9,19 +9,29 @@ references:
|
|
|
9
9
|
|
|
10
10
|
# Frontend Design Review
|
|
11
11
|
|
|
12
|
-
For
|
|
13
|
-
|
|
14
|
-
base connector is TODO: never invent results. If
|
|
15
|
-
`<repoRoot>/openspec/**` search/read evidence before
|
|
12
|
+
For frontend design review nodes. Read the checklist; audit contract, scout, Mock
|
|
13
|
+
strategy, effective plan, task bounds, and traceable design evidence. The knowledge-
|
|
14
|
+
base connector is TODO: never invent results. If unavailable or unmatched, require
|
|
15
|
+
`<repoRoot>/openspec/**` search/read evidence before repository conventions.
|
|
16
16
|
|
|
17
17
|
## Verdict Contract
|
|
18
18
|
|
|
19
19
|
First non-empty line: exactly `VERDICT: pass` or `VERDICT: request-revision`.
|
|
20
|
-
Any blocker requires request-revision
|
|
20
|
+
Any blocker requires request-revision. An initial pass is the effective verdict;
|
|
21
|
+
there is no intermediate first-design shell gate.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
`
|
|
24
|
-
remaining, incomplete, or
|
|
23
|
+
In standard/full topology, revision and final review run only after initial
|
|
24
|
+
`VERDICT: request-revision`. Verify every Required Plan Correction against the
|
|
25
|
+
complete revision; reject remaining, incomplete, or new gaps. An initial pass uses
|
|
26
|
+
the original plan and skips both conditional nodes.
|
|
27
|
+
|
|
28
|
+
Small-risk topology instead removes initial review and revision, then runs
|
|
29
|
+
`frontend-final-design-review-pi` as the sole review of the original plan. Do not
|
|
30
|
+
expect initial findings or a revision there.
|
|
31
|
+
|
|
32
|
+
The deterministic gate prefers final-review output and falls back to initial review
|
|
33
|
+
only when no current-run final output exists. Existing malformed/non-pass primary
|
|
34
|
+
output fails closed.
|
|
25
35
|
|
|
26
36
|
## Blocking Conditions
|
|
27
37
|
|
|
@@ -35,20 +45,19 @@ remaining, incomplete, or newly introduced gaps.
|
|
|
35
45
|
inline fake data; commented real requests; Mock-on production defaults; test-only
|
|
36
46
|
production imports; or Mock evidence reported as real integration.
|
|
37
47
|
|
|
38
|
-
Knowledge-base absence is advisory if relevant `openspec/` rules were
|
|
39
|
-
|
|
48
|
+
Knowledge-base absence is advisory if relevant `openspec/` rules were read and
|
|
49
|
+
applied. Block skipped fallback, unresolved conflict, or unresolved UI decisions.
|
|
40
50
|
|
|
41
51
|
## Method And Output
|
|
42
52
|
|
|
43
|
-
Map criteria to steps/files/states/checks, audit paths/evidence, classify Blocking
|
|
44
|
-
Advisory, and never edit files.
|
|
53
|
+
Map criteria to steps/files/states/checks, audit paths/evidence, classify Blocking
|
|
54
|
+
or Advisory, and never edit files.
|
|
45
55
|
|
|
46
56
|
### Spec Evidence Rules
|
|
47
57
|
|
|
48
|
-
Run `grep`/`find`, then explicit `read` calls for applicable specs
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
`openspec/` before accepting repository conventions.
|
|
58
|
+
Run `grep`/`find`, then explicit `read` calls for applicable specs/checklist. Only
|
|
59
|
+
successful paired reads count as “已读取规范文件”; summaries do not. List each path/
|
|
60
|
+
section in `Checked Items`; search/read `openspec/` before accepting conventions.
|
|
52
61
|
|
|
53
62
|
```markdown
|
|
54
63
|
VERDICT: pass
|
|
@@ -8,20 +8,20 @@ Pre-write nodes are read-only. Preserve IDs, labels, commands, language, require
|
|
|
8
8
|
- **`frontend-scout-pi`**: routes, components, tokens, data/API/Mock, scripts, tests, assets. Fact vs inference vs gap. Knowledge base first; else search+read `<repoRoot>/openspec/**` before repo fallback. Output stack, routes, components, styling, conventions, state/data, test entry points, reuse, risks.
|
|
9
9
|
- **`frontend-mock-assess-pi` + gate**: declares `firstProtocolLine: "MOCK_STRATEGY:"`; canonical output first line
|
|
10
10
|
`MOCK_STRATEGY: native|browser-intercept|request-adapter|not-needed|blocked`
|
|
11
|
-
Pi output mapping promotes the first
|
|
12
|
-
- **`frontend-plan-pi` + design loop**: AC → steps, in-bound files, UI states, reuse, deps, activation/rollback, frozen verify entrypoints, real-integration gap.
|
|
11
|
+
Pi output mapping promotes the first explicitly labeled Mock strategy line ahead of any preamble, including common bullet, quote, inline-code, fullwidth-colon, `Mock strategy`, and split label/value drift, without inventing or replacing its value; missing, unlabeled, malformed, or blocked strategies still fail closed. Prefer native Mock; browser intercept only with existing e2e; request-adapter only for reversible local preview. Default `auto` may select `not-needed` when contract/scout evidence confirms no project Mock capability, without adding Mock files/deps, while keeping real requests default and recording the Real Integration Gap. Other `not-needed` cases need positive no-remote/stable-backend evidence; invalid when `frontendMock.policy=required`. `blocked` for missing/conflicting contracts, unsafe paths/deps, unread specs, production-default-on, unverifiable entrypoints. Output Mock Decision, API/spec/service evidence, backend readiness, selection evidence, endpoint/fixture matrix, activation, targets, production safety, verification plan, real-integration gap, blocking issues. Never invent fields, store secrets, comment real requests, import test mocks into production, or treat Mock as real integration. Gate uses `first-non-empty` only; never authorizes writes. Unsafe required contracts → no writer.
|
|
12
|
+
- **`frontend-plan-pi` + conditional design loop**: AC → steps, in-bound files, UI states, reuse, deps, activation/rollback, frozen verify entrypoints, real-integration gap. Initial `VERDICT: pass` uses the original plan directly. Only exact `VERDICT: request-revision` runs read-only plan revision plus final review; there is no `frontend-first-design-gate-shell` or pass-path `PASS_NO_REVISION_NEEDED` node. The effective final gate prefers final review when present, otherwise initial review, and only exact pass authorizes writes; malformed/missing/request-revision fails closed → replan/rerun (not dev-fix). The plan-pi prompt includes the complete `frontend-implementation-contract-v1` JSON Schema loaded from the loop-agent package `docs/templates/` path, plus deterministic source binding, risk level, and allowed implementation targets. The model does not need to search or guess contract fields; `schemaId`, `targetFiles`, `requirementCoverage` are explicitly forbidden.
|
|
13
13
|
- **`frontend-implement-pi`**: sole exclusive writer. Stay in `writeSet`; real requests default-on; Mock reversible, dev/test-only, production-off. Atomic handler/intercept/adapter with consumer+tests. Stop on forbidden paths or guesses. Output changed files, behavior, UI states, styling notes, verification attempted, residual risks. Optional mock-verify when frozen; static+behavior always; behavior must prove page consumption. Skipped-Mock `not-needed` keeps real integration pending unless the real backend path has fresh evidence.
|
|
14
14
|
|
|
15
15
|
## Contract / trace / stages (M1–M2)
|
|
16
16
|
|
|
17
|
-
- Contract shell: `jsonArtifactGate` → `contracts/frontend-implementation-contract.json` from
|
|
17
|
+
- Contract shell: `jsonArtifactGate` → `contracts/frontend-implementation-contract.json` from the effective plan (one fenced JSON or pure JSON); schemaId `frontend-implementation-contract-v1`. Revision is primary and original plan is fallback only when the conditional revision output is absent. Requirement coverage uses the same primary/fallback rule. An existing malformed/schema-invalid/incomplete primary fails closed; fallback never masks it. Final design + implement depend on the artifact; `MOCK_STRATEGY: blocked` not implementable.
|
|
18
18
|
- Trace shell: `frontend-verification-trace-gate` binds contract `verificationTargets` to static/behavior records (`commandLabels`, file exists, optional symbol). Assess `MOCK_STRATEGY:` must match `mockApi.strategy` when present. Writes `contracts/frontend-verification-trace.json`. Browser/visual always `not-run`.
|
|
19
19
|
- Implement stages: (1) contract confirm (2) tests sync (3) component/UI (4) API/Mock (5) frozen checks (6) diff cleanup. Summary: Contract Ref, Changed Files, Requirements, UI States, Tests, Verification Attempts, Deviations, Residual Risks.
|
|
20
20
|
|
|
21
21
|
## Repair (M3)
|
|
22
22
|
|
|
23
|
-
static/behavior/trace may `nonZeroExitPolicy: record`. Assess
|
|
23
|
+
static/behavior/trace may `nonZeroExitPolicy: record`. Assess emits pure JSON and writes `contracts/frontend-repair-assessment.json`. Only `eligible=true` runs `frontend-repair-pi` (same writeSet as implement; no re-spec; max 1 attempt), reverify, and retrace. No-failure condition-skips that branch, while diff/review/read-only `frontend-closeout-pi` continue on initial evidence. Repair-contract fails closed on non-repairable (contract/path/dependency/credential/deploy/spec-unclear), writeSet expansion, ERROR, or hard skip; `all-or-condition-skip` never softens those failures.
|
|
24
24
|
|
|
25
25
|
## Risk & capability (M4–M6)
|
|
26
26
|
|
|
27
|
-
Deterministic risk (no model); high-risk beats small; supervised never small. Small may drop
|
|
27
|
+
Deterministic risk (no model); high-risk beats small; supervised never small. Small may drop the initial design review + conditional revision branch; its retained final review audits `frontend-plan-pi`, and contract shell retargets to that plan without fallback. Capability seed injects adapters; openspec/task sources outrank. A11y: static/component tools only when present; Browser a11y always not-run.
|
|
@@ -34,14 +34,17 @@ loop-agent doctor
|
|
|
34
34
|
选择命令时按以下优先级:
|
|
35
35
|
|
|
36
36
|
1. **主路径 DAG**,用于常规 autonomous work:
|
|
37
|
+
|
|
37
38
|
```bash
|
|
38
39
|
loop-agent new-task <task-id> "Task Title"
|
|
39
40
|
loop-agent dag run-task <task-id> --profile auto --strict-models --output <temp-dir>/<task-id>-dag.json
|
|
40
41
|
loop-agent dag validate --dag <temp-dir>/<task-id>-dag.json --strict-models --strict-governance
|
|
41
42
|
loop-agent run-dag --dag <temp-dir>/<task-id>-dag.json --cwd <repo-root>
|
|
42
43
|
```
|
|
44
|
+
|
|
43
45
|
`<temp-dir>` 表示平台原生临时目录;也可以省略 `--output`,再使用命令 JSON 输出里的 `outputPath`。主路径 JSON 输出含稳定 summary:`dag run-task` 的 `message` 为 `DAG draft created`,`dag validate` 的 `message` 为 `DAG validation passed` 且含 `checks.writeSets` / `checks.decisionGates`,`run-dag` 的 `message` 为 `DAG run finished`。
|
|
44
46
|
2. **Operator 工具**,用于 recovery、诊断、评测重放与 closeout:
|
|
47
|
+
|
|
45
48
|
```bash
|
|
46
49
|
loop-agent eval replay --spec <path> --json
|
|
47
50
|
loop-agent eval report --replay-id <id> --markdown
|
|
@@ -64,7 +67,9 @@ loop-agent doctor
|
|
|
64
67
|
loop-agent knowledge curate --markdown --output ai_workspace/loop-agent/reports/<task-id>-learned-proposal.md
|
|
65
68
|
loop-agent loop-benchmark --markdown
|
|
66
69
|
```
|
|
70
|
+
|
|
67
71
|
3. **Escape hatch**,仅用于 worktree 隔离委派、executor 调试或 one-shot 诊断:
|
|
72
|
+
|
|
68
73
|
```bash
|
|
69
74
|
loop-agent delegate <task-id> --auto-run
|
|
70
75
|
loop-agent harvest <task-id>
|
|
@@ -73,6 +78,7 @@ loop-agent doctor
|
|
|
73
78
|
```
|
|
74
79
|
|
|
75
80
|
### Setup(首次)
|
|
81
|
+
|
|
76
82
|
```bash
|
|
77
83
|
npm install -g @tea-agent/loop-agent@latest
|
|
78
84
|
loop-agent --version
|
|
@@ -80,12 +86,14 @@ loop-agent --help
|
|
|
80
86
|
```
|
|
81
87
|
|
|
82
88
|
### 检查 repo harness
|
|
89
|
+
|
|
83
90
|
```bash
|
|
84
91
|
loop-agent inspect # 当前 repo(自动检测)
|
|
85
92
|
loop-agent --repo-root /path/to/target-repo inspect # 指定 repo
|
|
86
93
|
```
|
|
87
94
|
|
|
88
95
|
### 健康检查
|
|
96
|
+
|
|
89
97
|
```bash
|
|
90
98
|
loop-agent doctor
|
|
91
99
|
```
|
|
@@ -104,7 +112,7 @@ SDK 回归或 SDK 可选依赖不可用时用 `cli-only` 诊断。CLI fallback
|
|
|
104
112
|
用户中文表达到命令的映射(与目标项目 `AGENTS.md` 的“自然语言入口路由”保持一致):
|
|
105
113
|
|
|
106
114
|
| 用户表达 | 命令 |
|
|
107
|
-
|
|
115
|
+
| --- | --- |
|
|
108
116
|
| loop-agent 初始化 / loop agent 初始化 / loop agent初始化 / 初始化 loop-agent | 先运行 `loop-agent init instructions --repo-root .`,再运行 `loop-agent init --repo-root . --profile full --merge`,随后补全 README/验证矩阵并复查 doctor/inspect/docs audit |
|
|
109
117
|
| 初始化更新校验 / loop agent初始化更新校验 / 检查初始化更新 | `loop-agent init check-update --repo-root . --markdown`(只读,不得隐含 `apply-safe`) |
|
|
110
118
|
| 初始化安全更新 / loop agent初始化安全更新 / 应用初始化更新 | 先 `loop-agent init check-update --repo-root . --markdown`,再 `loop-agent init update --repo-root . --apply-safe`(surface 缺失时先 `--bootstrap-surface`;human decisions 存在时停下等用户) |
|
|
@@ -128,6 +136,7 @@ loop-agent init reconcile --repo-root <target-repo> [--json|--markdown]
|
|
|
128
136
|
`init reconcile` 是升级后对齐入口:surface 缺失返回 `needs-baseline` 且零写入,存在 human decisions 返回 `needs-human-decision` 且零写入,活跃 DAG/Worker 或 Worker 状态无法确认时返回 `blocked-active-runtime` 且零写入;其余情况复用 `--apply-safe` 的安全动作并复查返回 `clean`/`needs-model-merge`/`needs-safe-update`。控制器升级成功后,普通安全仓库命令结束时会自动检测目标项目是否需要 reconcile;非 TTY 只向 stderr 输出 `loop-agent init reconcile --repo-root ...` 提示且不写入目标,TTY 且无 human decisions、无活跃运行时可经明确 `y/yes` 同意后应用 deterministic safe actions。
|
|
129
137
|
|
|
130
138
|
### 查看或复制内置示例
|
|
139
|
+
|
|
131
140
|
```bash
|
|
132
141
|
loop-agent examples list
|
|
133
142
|
loop-agent examples show <name>
|
|
@@ -137,6 +146,7 @@ loop-agent examples copy <name> --output examples/<name>
|
|
|
137
146
|
`examples` 只读取或复制包内示例,不会自动写入目标项目。省略 `--output` 时,`copy` 会写到目标项目的 `examples/<name>`。
|
|
138
147
|
|
|
139
148
|
### 创建新 task
|
|
149
|
+
|
|
140
150
|
```bash
|
|
141
151
|
loop-agent new-task <task-id> "Task Title"
|
|
142
152
|
```
|
|
@@ -144,13 +154,30 @@ loop-agent new-task <task-id> "Task Title"
|
|
|
144
154
|
创建 `.harness/tasks/<task-id>/`,含 `source/`、`artifacts/`、`logs/` 及初始 state。`artifacts/` 默认只预种 `修改记录.md` 与 `验证结果.md`(供后续 `promote-run` / `closeout` 使用);不再预种 L1 的 `分析报告.md`、`实现计划.md`、`复盘报告.md`。
|
|
145
155
|
|
|
146
156
|
### 导入原始 PRD(不可变事实源)
|
|
157
|
+
|
|
147
158
|
```bash
|
|
148
159
|
loop-agent import-prd <task-id> --file ai_workspace/loop-agent/path/to-prd.md [--name requirement] [--json]
|
|
149
160
|
```
|
|
150
161
|
|
|
151
162
|
把用户原始 PRD **原样复制** 到 `.harness/tasks/<task-id>/source/references/`,并写入 `source/source-manifest.json`(含 SHA-256)与 `task.json.referenceDocs`。此步骤不调用模型、不改写内容。随后再写派生的 `source/需求.md` 执行契约;冲突时以 `source/references/*` 为准。
|
|
152
163
|
|
|
164
|
+
### Task Contract / operator machine surface
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
loop-agent task contract show <task-id> [--json]
|
|
168
|
+
loop-agent task contract validate --task <task-id> --input <path> --json
|
|
169
|
+
loop-agent task contract diff --task <task-id> --input <path> --json
|
|
170
|
+
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
|
|
171
|
+
loop-agent task contract adopt --task <task-id> --expected-revision <n> --expected-observed-hash <sha256> --request-id <id> --request-payload-sha256 <sha256> --json
|
|
172
|
+
loop-agent task contract doctor --task <task-id> --json
|
|
173
|
+
loop-agent task contract recover --task <task-id> --json
|
|
174
|
+
loop-agent operator capabilities [--json]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`task` 是 Task Contract 边界(show/validate/diff/apply/adopt/doctor/recover)。`operator` 返回 Operator machine envelope capabilities,供 Console/控制面做能力协商。
|
|
178
|
+
|
|
153
179
|
### Task action context / artifact instructions
|
|
180
|
+
|
|
154
181
|
```bash
|
|
155
182
|
loop-agent status <task-id> --json
|
|
156
183
|
loop-agent instructions source --task <task-id> --json
|
|
@@ -163,6 +190,7 @@ loop-agent instructions closeout --task <task-id> --json
|
|
|
163
190
|
`status` 是 agent 行动上下文入口,返回 `artifactPaths`、`runRefs`、`actionContext` 与 `nextActions`。`instructions` 在写入 source、DAG draft、task artifacts、promotion 或 closeout 前返回目标路径、依赖、模板、写策略与完成标准;blocked artifact 会列出 `missingDependencies`。`instructions task-artifacts` 只要求 promote 桥接的 `修改记录.md` / `验证结果.md`,不要求手写分析/计划/复盘三份 L1 报告。
|
|
164
191
|
|
|
165
192
|
### Promotion / closeout
|
|
193
|
+
|
|
166
194
|
```bash
|
|
167
195
|
loop-agent promote-run <task-id> --run-id <run-id>
|
|
168
196
|
loop-agent closeout task <task-id>
|
|
@@ -173,21 +201,26 @@ loop-agent closeout task <task-id>
|
|
|
173
201
|
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`。
|
|
174
202
|
|
|
175
203
|
### 运行任何 step 前:准备 source materials
|
|
204
|
+
|
|
176
205
|
`new-task` 之后,先归档原始 PRD,再写派生执行契约:
|
|
206
|
+
|
|
177
207
|
```bash
|
|
178
208
|
loop-agent import-prd <task-id> --file <path-to-original-prd.md>
|
|
179
209
|
# then write derived contract:
|
|
180
210
|
mkdir -p <repo-root>/.harness/tasks/<task-id>/source
|
|
181
211
|
cat > <repo-root>/.harness/tasks/<task-id>/source/需求.md
|
|
182
212
|
```
|
|
213
|
+
|
|
183
214
|
`需求.md` 写目标、范围、非目标与验收标准,并映射回 `source/references/*`;不要让 AI 直接改写原始 PRD。
|
|
184
215
|
|
|
185
216
|
若 task 有硬约束(仅允许特定文件、禁止改动),另加:
|
|
217
|
+
|
|
186
218
|
```bash
|
|
187
219
|
cat > <repo-root>/.harness/tasks/<task-id>/source/执行约束.md
|
|
188
220
|
```
|
|
189
221
|
|
|
190
222
|
### Feature-study workflow(参考代码 → 轻量实现)
|
|
223
|
+
|
|
191
224
|
例如「分析参考仓库的一项功能,并在目标仓库实现轻量版本」:
|
|
192
225
|
|
|
193
226
|
```bash
|
|
@@ -209,6 +242,7 @@ loop-agent --repo-root <target-repo> run-dag --dag <temp-dir>/<task-id>-dag.json
|
|
|
209
242
|
历史顺序式 `run analyze|plan|spec|implement|verify|retrospective|auto|loop|continue|study` 已移除。新任务不要使用这些命令,也不要在 prompt、skill 或 docs 中把它们描述为 fallback。
|
|
210
243
|
|
|
211
244
|
### Reference helpers(compatibility)
|
|
245
|
+
|
|
212
246
|
```bash
|
|
213
247
|
loop-agent reference index <task-id>
|
|
214
248
|
```
|
|
@@ -216,6 +250,7 @@ loop-agent reference index <task-id>
|
|
|
216
250
|
`reference` 是 compatibility / feature-study 辅助入口,用于维护或检查参考资料索引。常规实现任务不要从 `reference` 起步;按 `new-task` + DAG 路径执行。
|
|
217
251
|
|
|
218
252
|
### Task goal lifecycle(compatibility-only / deprecated-candidate)
|
|
253
|
+
|
|
219
254
|
```bash
|
|
220
255
|
loop-agent goal set <task-id> "Objective text" [--token-budget <number|null>]
|
|
221
256
|
loop-agent goal set <task-id> "Replacement objective" --force
|
|
@@ -238,6 +273,7 @@ loop-agent goal clear <task-id>
|
|
|
238
273
|
- preflight 含 state/mode guard + 启动前 goal 一致性复检
|
|
239
274
|
|
|
240
275
|
### Agent DAG validation 与 execution
|
|
276
|
+
|
|
241
277
|
```bash
|
|
242
278
|
loop-agent dag validate --dag <temp-dir>/hybrid-dag.json # 常规 validation;无 .harness/dag-runs 副作用
|
|
243
279
|
loop-agent dag validate --dag <temp-dir>/hybrid-dag.json --strict-models # 非 canonical executorModels 时失败
|
|
@@ -300,6 +336,7 @@ loop-agent dag resume --run-id <run-id> # approve 后继续
|
|
|
300
336
|
- 显式专用 `taskKind` 保持兼容并优先于任务源分类,也不扩充 governance profile:`frontend-implementation` 可有意覆盖为带 Mock 规范评估、contract gate、design gate 和验证链的前端模板;可选 `frontendMock` 配置 auto/required/disabled、既有服务目录和专项验证命令,required 合同不完整时不会生成 writer。`backend-test` 显式选择需求分析 → 功能用例 → 评审 → pytest 生成/执行 → 复盘的后端测试工程模板。
|
|
301
337
|
|
|
302
338
|
### Saved Dynamic Workflow operator UX
|
|
339
|
+
|
|
303
340
|
```bash
|
|
304
341
|
loop-agent workflow list
|
|
305
342
|
loop-agent workflow inspect <name>
|
|
@@ -360,11 +397,13 @@ Replay spec 最小结构:
|
|
|
360
397
|
```
|
|
361
398
|
|
|
362
399
|
### 检查 task status
|
|
400
|
+
|
|
363
401
|
```bash
|
|
364
402
|
loop-agent status <task-id>
|
|
365
403
|
```
|
|
366
404
|
|
|
367
405
|
### Docs governance helpers
|
|
406
|
+
|
|
368
407
|
```bash
|
|
369
408
|
loop-agent docs audit
|
|
370
409
|
loop-agent docs archive ai_workspace/loop-agent/exec-plans/active/<plan>.md
|
|
@@ -387,6 +426,7 @@ loop-agent coverage report --language python|java --input <coverage.json|jacoco.
|
|
|
387
426
|
- `handoff coverage`:从 `source/需求.md` 抽取 checklist / numbered / `REQ-*` 项并输出 coverage audit;未覆盖项 exit 1;`explicitly_out_of_scope` 不计为缺口
|
|
388
427
|
|
|
389
428
|
### Pi runtime reuse benchmark / decision(无 live call)
|
|
429
|
+
|
|
390
430
|
```bash
|
|
391
431
|
loop-agent pi-reuse-benchmark \
|
|
392
432
|
--report ai_workspace/loop-agent/reports/<benchmark-report>.md \
|
|
@@ -403,6 +443,7 @@ loop-agent pi-reuse-benchmark \
|
|
|
403
443
|
对已有 benchmark plan/report 文件及可选 `executor.jsonl` evidence 做确定性摘要。**不**跑 live Pi call、不创建 task、不改 `CODE_AGENT_PI_REUSE_RUNTIME`(默认仍为 `off`)。输出 `defer`、`maintain-opt-in` 或 `eligible-for-human-review` — 永不 default-on。
|
|
404
444
|
|
|
405
445
|
### Loop convergence benchmark baseline(无 live call)
|
|
446
|
+
|
|
406
447
|
```bash
|
|
407
448
|
loop-agent loop-benchmark --markdown
|
|
408
449
|
loop-agent loop-benchmark --markdown --output ai_workspace/loop-agent/reports/2026-06-30-loop-agent-loop-benchmark.md
|
|
@@ -411,6 +452,7 @@ loop-agent loop-benchmark --markdown --output ai_workspace/loop-agent/reports/20
|
|
|
411
452
|
生成 M0 deterministic baseline,对照 `single-repair`、`3-pass-convergence`、`3-pass-convergence+quota`。**不**跑 live Pi/Cursor call、不创建 task、不改 `convergence.enabled` 默认值。live dogfood 证据缺失时输出 `blocked` 并建议保持 opt-in。
|
|
412
453
|
|
|
413
454
|
### Long-running loop outer state(experimental)
|
|
455
|
+
|
|
414
456
|
```bash
|
|
415
457
|
loop-agent loop init <task-id>
|
|
416
458
|
loop-agent loop status <task-id>
|
|
@@ -426,6 +468,7 @@ loop-agent loop closeout <task-id>
|
|
|
426
468
|
`loop` 是 Agent DAG 之上的长程状态和 evidence layer,记录 rounds、signals、verification summaries 和 closeout draft。它不是替代 `dag run-task` / `run-dag` 的实现路径;medium/large work 仍需要 DAG evidence 或明确 fallback reason。
|
|
427
469
|
|
|
428
470
|
### Minimal spec spine audit
|
|
471
|
+
|
|
429
472
|
```bash
|
|
430
473
|
loop-agent spine audit <task-id> --json
|
|
431
474
|
loop-agent spine audit <task-id> --markdown
|
|
@@ -434,6 +477,7 @@ loop-agent spine audit <task-id> --markdown
|
|
|
434
477
|
检查 task 的 `source/需求.md`、`source/执行约束.md`、`task.json.allowedPaths` / `forbiddenPaths`、需求覆盖与 final verification command labels。`medium` / `large` task 的空 `allowedPaths`、allowed/forbidden overlap、未覆盖验收项、无 final verify command 都会让 audit 非零退出。
|
|
435
478
|
|
|
436
479
|
### Knowledge curator proposal
|
|
480
|
+
|
|
437
481
|
```bash
|
|
438
482
|
loop-agent knowledge curate --markdown
|
|
439
483
|
loop-agent knowledge curate --markdown --output ai_workspace/loop-agent/reports/<task-id>-learned-proposal.md
|
|
@@ -442,6 +486,7 @@ loop-agent knowledge curate --markdown --output ai_workspace/loop-agent/reports/
|
|
|
442
486
|
读取 `.harness/knowledge/patterns.jsonl` 中 completed convergence repair pattern,按 `failureClass + fixScope shape + invariant` 去重,生成 human-gated learned guidance proposal。命令只生成 proposal,不直接修改 `./skill/references/learned/*.md`;输出会先通过 skill safety audit。
|
|
443
487
|
|
|
444
488
|
### Knowledge graph / query CLI
|
|
489
|
+
|
|
445
490
|
```bash
|
|
446
491
|
loop-agent knowledge graph-init --product-name <name>
|
|
447
492
|
loop-agent knowledge graph-materialize
|
|
@@ -511,6 +556,7 @@ agent-worker observe snapshot --repo <repo-root> # 输出 GlobalSnapshot JSON
|
|
|
511
556
|
- 当前 Worker 仍是 v0(库 + CLI + dogfood),未接入定时/CI 驱动;`report morning` 只能从已有 Task Pool runs 汇总。
|
|
512
557
|
|
|
513
558
|
### 查看 duration statistics
|
|
559
|
+
|
|
514
560
|
```bash
|
|
515
561
|
loop-agent stats
|
|
516
562
|
```
|
|
@@ -526,6 +572,7 @@ loop-agent worktree create|list|remove ...
|
|
|
526
572
|
用于 worktree 隔离以及可选的 Pi-only DAG 执行与 merge 收口。常规 autonomous work 应优先 Agent DAG;详见 `multi-worktree.md` 与 `ai_workspace/loop-agent/cursor-prompt-sidecar.md`。
|
|
527
573
|
|
|
528
574
|
### One-shot Cursor sidecar(escape hatch)
|
|
575
|
+
|
|
529
576
|
```bash
|
|
530
577
|
loop-agent cursor-prompt --cwd <repo-root> "Review this task without editing files."
|
|
531
578
|
loop-agent cursor-prompt --cwd <repo-root> --file /tmp/bounded-cursor-task.md
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
对于默认 `standard` 任务,生成器根据标题、`source/需求.md` 和结构化 `allowedPaths` 做保守、确定性的需求分类。只有高置信的前端实现需求自动选择 `frontend-implementation` DAG;后端、前后端混合、明确排除前端或证据不足的需求继续使用 governance profile 选出的模板。分类不会把普通后端实现路由到 `backend-test`,也不会替换由显式 profile、`workflowPolicy` 或 supervised quality gate 选中的 supervised 模板。
|
|
18
18
|
|
|
19
|
-
前端专用链在 `frontend-scout-pi` 后加入只读 `frontend-mock-assess-pi` 和确定性 contract gate,根据接口契约、后端就绪度、生成期能力 seed 与固化验证入口选择 `native|browser-intercept|request-adapter|not-needed|blocked`。策略直接传给 plan
|
|
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;真实请求保持默认,缺少契约、生产隔离、注释真实请求或显式 required 合同不完整时 gate 阻塞。standard/full 拓扑的 initial design pass 直接使用 original plan,只有 request-revision 才运行 plan revision 和 final review;small-risk 拓扑保留 final review 作为对 original plan 的单一审查。已删除 `frontend-first-design-gate-shell`,保留的 final gate 只接受生效 initial/final verdict 的 pass。可选 `frontendMock` 配置声明 `auto|required|disabled`、既有服务目录与专项命令;默认 `auto` 下没有已确认 Mock 能力时跳过 Mock 继续实现并保留真实联调缺口,不安全或不完整的显式 required 合同只生成无 writer 的评估链,有可信命令时才增加 `frontend-mock-verify-shell`。Mock-backed 证据只证明前端状态;跳过 Mock 且未调用后端时 closeout 报告 `Frontend status: locally-validated` 与 `Real integration: pending`。初始验证后的 assessment 输出 JSON,只有 `eligible=true` 才运行 repair/reverify/retrace;绿色路径跳过该分支后仍继续 diff/review/只读 `frontend-closeout-pi`,non-repairable 或 `ERROR` 仍硬阻断。
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
> Backend-test
|
|
22
|
+
> Backend-test report-first:Analysis v2 明确 responseBody shape、ordering、field comparison/precision 与 sourceRefs,并兼容归一化 v1 及窄范围 evidence gap alias;Manifest 后直接生成 pytest,case review 作为 advisory evidence 进入 canonical context。pytest 生成后由确定性 traceability 校验真实 file/symbol/case 映射,再执行唯一一次 pytest。exit 0/1 且 JUnit 有效都继续 Result、classification、retrospective 与最终 L-5;Observe 对新 run 投影 initial/canonical、classification 与 coverage,历史 repair/final evidence 仍兼容读取。
|
|
23
23
|
|
|
24
|
-
显式专用 `taskKind` 保持兼容并优先于任务源分类。`backend-test` 选择固定 **
|
|
24
|
+
显式专用 `taskKind` 保持兼容并优先于任务源分类。`backend-test` 选择固定 **12 个真实顶层节点**的报告优先 DAG:intake 双合同、cases+manifest、advisory case review、pytest 生成、确定性 traceability gate、单次 execute+parse、classification、包含 review/traceability 的 canonical context、retrospective 与最终 L-5。case review 不授权或阻断 writer;pytest assertion failure 是 Result testOutcome,不再由最终 outcome shell gate 将报告流水线判失败。`knowledge-sync` 与 `knowledge-graph-bootstrap` 继续通过各自显式 taskKind 选择知识回写/图谱开荒 DAG。治理等级仍由 `minimal|standard|reviewed|supervised` 推断。
|
|
25
25
|
|
|
26
26
|
### DAG workflow 层级
|
|
27
27
|
|
|
@@ -82,7 +82,7 @@ loop-agent run-dag --dag <temp-dir>/hybrid-dag.json --init-only --canvas-path <t
|
|
|
82
82
|
- **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`。
|
|
83
83
|
- **默认无**跨 node Pi runtime reuse;各 Pi node 是独立 `executePiStep()` call。
|
|
84
84
|
- **Prompt source**:每个 task 仅用一种 prompt source。v1-compatible DAG 用 inline `subtask_prompt`;markdown-backed prompt 用 canonical `subtask_prompt_markdown`。同时提供两字段、皆不提供、或用连字符 alias `subtask_prompt-markdown` 均 fail fast。
|
|
85
|
-
- **Source binding / recovery**:新生成 DAG 在顶层冻结 `sourceBinding`(任务源相对路径、SHA-256、显式 `REQ/BR/AC`)。前端计划在存在显式编号时经过 `frontend-requirement-coverage-shell
|
|
85
|
+
- **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 拒绝。
|
|
86
86
|
- **勿宣称 live smoke 已通过**,除非真实 `run-dag` execution 中 Pi read-only、Pi writer、显式 Cursor 或 shell node 均按 DAG 完成。
|
|
87
87
|
|
|
88
88
|
可复用 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`。
|