@kylecheng3146/agent-ops 0.5.2 → 0.6.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/README.md +64 -0
- package/dist/packages/cli/src/args.js +214 -10
- package/dist/packages/cli/src/bin.js +77 -17
- package/dist/packages/cli/src/cli.js +42 -10
- package/dist/packages/cli/src/commands/advance.js +173 -0
- package/dist/packages/cli/src/commands/review-show.js +189 -0
- package/dist/packages/cli/src/commands/review.js +201 -34
- package/dist/packages/cli/src/commands/run.js +111 -0
- package/dist/packages/cli/src/commands/task.js +62 -17
- package/dist/packages/cli/src/commands/verify.js +1 -0
- package/dist/packages/cli/src/context.js +63 -1
- package/dist/packages/cli/src/hook-process.js +31 -1
- package/dist/packages/cli/src/owned-run-step.js +65 -0
- package/dist/packages/cli/src/parallel-deps.js +18 -5
- package/dist/packages/cli/src/run-deps.js +314 -0
- package/dist/packages/cli/src/run-entry.js +943 -0
- package/dist/packages/cli/src/run-setup-entry.js +32 -0
- package/dist/packages/cli/src/run-step-entry.js +58 -0
- package/dist/runtime/src/config/explain.js +6 -0
- package/dist/runtime/src/config/hash.js +1 -1
- package/dist/runtime/src/config/merge.js +9 -1
- package/dist/runtime/src/contracts.js +2 -2
- package/dist/runtime/src/hooks/completion-gate.js +8 -2
- package/dist/runtime/src/install/doctor.js +2 -0
- package/dist/runtime/src/install/harness.js +1 -1
- package/dist/runtime/src/install/preauth.js +10 -1
- package/dist/runtime/src/parallel/finish.js +217 -39
- package/dist/runtime/src/parallel/guard.js +5 -1
- package/dist/runtime/src/parallel/integrate.js +416 -0
- package/dist/runtime/src/parallel/manage.js +4 -1
- package/dist/runtime/src/parallel/receipt.js +153 -0
- package/dist/runtime/src/parallel/service.js +45 -3
- package/dist/runtime/src/review/attestation.js +60 -11
- package/dist/runtime/src/review/execute.js +24 -1
- package/dist/runtime/src/review/packet.js +35 -1
- package/dist/runtime/src/review/render.js +71 -0
- package/dist/runtime/src/review/runner.js +12 -1
- package/dist/runtime/src/review/scope.js +18 -1
- package/dist/runtime/src/review/slots.js +35 -10
- package/dist/runtime/src/run/authorization.js +60 -0
- package/dist/runtime/src/run/budget.js +30 -0
- package/dist/runtime/src/run/controls.js +139 -0
- package/dist/runtime/src/run/convergence.js +177 -0
- package/dist/runtime/src/run/hosts/claude.js +180 -0
- package/dist/runtime/src/run/hosts/codex.js +279 -0
- package/dist/runtime/src/run/hosts/index.js +4 -0
- package/dist/runtime/src/run/hosts/protocol.js +254 -0
- package/dist/runtime/src/run/hosts/types.js +1 -0
- package/dist/runtime/src/run/hosts/util.js +136 -0
- package/dist/runtime/src/run/integration.js +204 -0
- package/dist/runtime/src/run/macOS.js +189 -0
- package/dist/runtime/src/run/ownership.js +22 -0
- package/dist/runtime/src/run/planning.js +25 -0
- package/dist/runtime/src/run/policy-transition.js +1076 -0
- package/dist/runtime/src/run/policy.js +176 -0
- package/dist/runtime/src/run/ratchet.js +71 -0
- package/dist/runtime/src/run/scheduler.js +260 -0
- package/dist/runtime/src/run/service.js +425 -0
- package/dist/runtime/src/run/supervisor.js +635 -0
- package/dist/runtime/src/run/transport.js +159 -0
- package/dist/runtime/src/run/types.js +1 -0
- package/dist/runtime/src/run/usage.js +81 -0
- package/dist/runtime/src/run/verification.js +64 -0
- package/dist/runtime/src/run/worker-gate.js +48 -0
- package/dist/runtime/src/schema/acceptance.js +91 -0
- package/dist/runtime/src/schema/validate.js +72 -7
- package/dist/runtime/src/task/completion.js +26 -6
- package/dist/runtime/src/task/contract.js +17 -0
- package/dist/runtime/src/task/pin-finding.js +81 -0
- package/dist/runtime/src/task/render.js +3 -0
- package/dist/runtime/src/task/service.js +361 -10
- package/dist/runtime/src/task/store.js +57 -7
- package/dist/runtime/src/verify/acceptance-coverage.js +85 -0
- package/dist/runtime/src/verify/acceptance-protocol.js +252 -0
- package/dist/runtime/src/verify/acceptance-replay.js +239 -0
- package/dist/runtime/src/verify/adapters/index.js +5 -0
- package/dist/runtime/src/verify/adapters/jest.js +142 -0
- package/dist/runtime/src/verify/adapters/node-reporter.js +20 -0
- package/dist/runtime/src/verify/adapters/node.js +254 -0
- package/dist/runtime/src/verify/adapters/pytest.js +188 -0
- package/dist/runtime/src/verify/adapters/rust.js +84 -0
- package/dist/runtime/src/verify/adapters/shared.js +82 -0
- package/dist/runtime/src/verify/adapters/vitest.js +218 -0
- package/dist/runtime/src/verify/evidence.js +5 -2
- package/dist/runtime/src/verify/service.js +24 -8
- package/dist/runtime/src/verify/source-fingerprint.js +1 -1
- package/dist/runtime/src/verify/spawn.js +13 -2
- package/docs/en/guides/configuration.md +10 -0
- package/docs/en/spec/acceptance-and-evidence.md +58 -0
- package/docs/en/spec/delegation.md +4 -4
- package/docs/en/spec/loop-engineering.md +49 -0
- package/docs/en/spec/review.md +24 -2
- package/docs/zh-TW/guides/configuration.md +9 -0
- package/docs/zh-TW/spec/acceptance-and-evidence.md +31 -1
- package/docs/zh-TW/spec/delegation.md +4 -4
- package/docs/zh-TW/spec/loop-engineering.md +22 -0
- package/docs/zh-TW/spec/review.md +24 -2
- package/package.json +1 -1
- package/schemas/config.schema.json +221 -19
- package/schemas/evidence.schema.json +129 -6
- package/schemas/task.schema.json +268 -6
- package/templates/acceptance/agent_ops_acceptance.rs +36 -0
- package/templates/acceptance/agent_ops_pytest.py +46 -0
|
@@ -42,10 +42,10 @@ Parallel editing conversations in one repository MUST each work in their own age
|
|
|
42
42
|
|
|
43
43
|
## DELEGATE-ISOLATION-003
|
|
44
44
|
|
|
45
|
-
Subagents that write files in one session MUST each work in their own agent-ops worktree, with their own task,
|
|
45
|
+
Subagents that write files in one session MUST each work in their own agent-ops worktree, with their own task, pre-work modification intent and local verification.
|
|
46
46
|
|
|
47
47
|
- Trigger: `worktree.mode` is `auto` and a subagent writes a file. Hook calls made inside a subagent carry its `agent_id` under the parent's `session_id`; a payload without `agent_id` is treated as the session's main thread.
|
|
48
|
-
- Action: The first blocked write allocates a worktree owned by that session and agent; edit there using absolute paths, because the hook's `cwd` does not follow a `cd`.
|
|
49
|
-
- Evidence: `agent-ops worktree list` shows an `agent:` line for each
|
|
50
|
-
- Positive: `Two subagents
|
|
48
|
+
- Action: The first blocked write allocates a worktree owned by that session and agent; edit there using absolute paths, because the hook's `cwd` does not follow a `cd`. Each subagent records `task create --intent` before editing, then commits and runs `agent-ops verify --task` locally. The coordinator runs `agent-ops task advance --task <parent-id> --session <id> --yes` from the main checkout. It integrates every child into the session candidate, verifies all criteria on that candidate, reviews the whole tree in two fresh sessions, archives proof locally and finishes. A direct finish of one child while siblings exist is refused.
|
|
49
|
+
- Evidence: `agent-ops worktree list` shows an `agent:` line for each child; the final receipt under `.git/agent-ops/receipts/` contains the integrated task tree, intents, verifier evidence and review reports.
|
|
50
|
+
- Positive: `Two subagents commit and verify separate worktrees; one task advance integrates them and completes the final gate before finish.`
|
|
51
51
|
- Negative: `A subagent edits the coordinator's worktree, or two subagents edit one worktree, so one review covers two tasks' changes.`
|
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Loop Engineering
|
|
2
2
|
|
|
3
|
+
## LOOP-RUN-001
|
|
4
|
+
|
|
5
|
+
`run` MUST preserve the original user goal and require current agent-ops proof.
|
|
6
|
+
|
|
7
|
+
- Trigger: Starting, repairing or recovering a native goal run.
|
|
8
|
+
- Action: Bind writers to current leases and require final verification, dual review and receipt proof.
|
|
9
|
+
- Evidence: The run ledger and sealed receipt bind the current candidate and original goal.
|
|
10
|
+
- Positive: Recovering interrupted cleanup preserves the target and saved final proof.
|
|
11
|
+
- Negative: Native goal completion alone changes run state to complete.
|
|
12
|
+
|
|
13
|
+
- The macOS supervisor registers Claude/Codex native identities before activating
|
|
14
|
+
goals. Same-host writers use isolated worktrees and current generation leases;
|
|
15
|
+
the coordinator counts toward the maximum two writers. Dependencies become
|
|
16
|
+
available only through frozen deliveries; child baselines follow those commits.
|
|
17
|
+
- The default 60-minute budget counts the union of active intervals, including
|
|
18
|
+
setup, proof, review and integration. Resume keeps elapsed time and usage epochs.
|
|
19
|
+
Missing counters remain UNKNOWN; partial usage is not a complete cost estimate.
|
|
20
|
+
- Questions pause work and require an explicit answer. Repair preserves the goal
|
|
21
|
+
and records failures; two identical rounds without progress stop that worker
|
|
22
|
+
and its dependents. Independent tasks remain eligible. Review findings require
|
|
23
|
+
regression pins or recorded review-only fallback before another final gate.
|
|
24
|
+
- Native completion is observational. Finalization requires mandatory verification,
|
|
25
|
+
both fresh reviews, completed task state and a receipt bound to the target.
|
|
26
|
+
Integration seals the candidate before moving the target and records task,
|
|
27
|
+
receipt, note and cleanup progress. Recovery validates that seal and does not
|
|
28
|
+
repeat a successful target mutation. Inconsistent targets remain blocked.
|
|
29
|
+
- Stop persists disabled continuation before confirming registered process-group
|
|
30
|
+
death. Crash recovery cannot replace a live or unidentified writer. Dirty
|
|
31
|
+
checkouts, version drift and restart storms preserve the scene for diagnosis.
|
|
32
|
+
Reboot/login changes require explicit resume; no global host policy is changed.
|
|
33
|
+
Startup process identities are saved before the native handshake; a stopped,
|
|
34
|
+
unopened Codex session may initialize afresh only after process death is proved.
|
|
35
|
+
|
|
36
|
+
- Setup and native-issued local proof commands MUST register dormant process
|
|
37
|
+
groups before execution; Stop also reconciles their descendants. Interrupted
|
|
38
|
+
setup requires explicit resume and retains its checkout and failure artifact.
|
|
39
|
+
- A coordinator may assess additional fixed non-dangerous capabilities only under
|
|
40
|
+
a run-scoped policy bound to the original repository trust, executable runtime
|
|
41
|
+
and remaining budget. Explicit native or organization denial cannot be bypassed.
|
|
42
|
+
Policy changes fence all writers, preserve frozen deliveries and journal contract
|
|
43
|
+
synchronization before new generations acquire leases. This never grants global
|
|
44
|
+
repository trust. Native decisions retain redacted command scope and rationale;
|
|
45
|
+
absent provider evidence remains UNKNOWN.
|
|
46
|
+
Explicit resume renews expired authorization from the remaining budget and
|
|
47
|
+
reconciles immutable renewal lineage before policy synchronization. An answer
|
|
48
|
+
uses the same recovery checks; neither action can revive an explicit denial.
|
|
49
|
+
- Convergence compares actual per-check statuses and outstanding finding pins.
|
|
50
|
+
Source fingerprints, timing and diagnostics alone cannot establish progress.
|
|
51
|
+
|
|
3
52
|
This module defines the bounded loop used to plan, implement, verify, and hand off work.
|
|
4
53
|
|
|
5
54
|
## LOOP-START-001
|
package/docs/en/spec/review.md
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
An independent reviewer MUST receive a minimal packet containing the request, criteria, artifact references, and evidence requirements.
|
|
6
6
|
|
|
7
7
|
- Trigger: A multi-step change reaches a review checkpoint.
|
|
8
|
-
- Action:
|
|
8
|
+
- Action: Include user-approved task intent in the request when recorded; omit hidden reasoning, raw logs, and credentials.
|
|
9
9
|
- Evidence: The packet keys and artifact references are visible without sensitive content.
|
|
10
|
-
- Positive: `Packet contains criteria, files, and evidence requirements
|
|
10
|
+
- Positive: `Packet contains recorded task intent, criteria, files, and evidence requirements.`
|
|
11
11
|
- Negative: `Forward the complete session transcript and environment.`
|
|
12
12
|
|
|
13
13
|
## REVIEW-RESULT-001
|
|
@@ -126,6 +126,28 @@ FAIL.
|
|
|
126
126
|
- Positive: `NOT_RUN: unparseable-output; one criterion was missing.`
|
|
127
127
|
- Negative: `Record a failed review because the model's JSON was malformed.`
|
|
128
128
|
|
|
129
|
+
## REVIEW-TREE-001
|
|
130
|
+
|
|
131
|
+
`task advance` MUST prove one integrated candidate against every parent and descendant criterion before it calls finish.
|
|
132
|
+
|
|
133
|
+
- Trigger: A session has a parent task and one or more agent-owned child worktrees.
|
|
134
|
+
- Action: Import each child task's pre-work intent and committed code into the coordinator candidate. Run every task's required verifier against the same final base and source fingerprint. Run `review --task <parent-id> --tree --base <final-base> --yes`, which sends all uniquely qualified criteria and intents through the existing two fresh reviewer sessions. Save a task-bound alias for every task, all pointing to that complete tree report.
|
|
135
|
+
- Evidence: The final receipt contains the complete task tree, intents, source fingerprint, verifier evidence, two reviewer reports, review mode, and residual risks.
|
|
136
|
+
- Positive: `Two child worktrees with three criteria each and a parent with two criteria receive one two-round final review covering all eight criteria.`
|
|
137
|
+
- Negative: `Review the parent alone, then finish children whose criteria were never checked against the integrated code.`
|
|
138
|
+
|
|
139
|
+
Only `NOT_RUN / scope-too-large` may fall back to a separate complete two-round review for each task. A substantive FAIL, missing verifier evidence, reviewer unavailability, or any other NOT_RUN blocks finish. `task advance` may rebase onto a moved target and repeat the entire final gate once. The receipt is written under the main checkout's `.git/agent-ops/receipts/` before the target branch moves; failure to write or read it back blocks the merge. A late target move rejects the merge so final proof can be repeated. A post-merge cleanup failure is reported as partial, not as successful finish.
|
|
140
|
+
|
|
141
|
+
## REVIEW-SHOW-001
|
|
142
|
+
|
|
143
|
+
The user MUST be able to inspect both recorded reviewer reports for the latest candidate from the main checkout without starting another review.
|
|
144
|
+
|
|
145
|
+
- Trigger: `review show --task <id>` for an active or finished task.
|
|
146
|
+
- Action: Display the full redacted structured primary and adversarial reports, including every criterion, finding, inspected file, and residual risk. For a successful tree review, display the shared report once; for a per-task fallback, group both rounds by task. Validate a finished receipt against its Git note digest. If the candidate changed since review, state that the current candidate has no review instead of showing an old verdict. A failed or unavailable round names the missing report explicitly. `task advance` summarizes concrete nonblocking findings and risks on PASS and shows available report details on failure.
|
|
147
|
+
- Evidence: The read-only command invokes no reviewer and its output is bound to the active fingerprint or the finished receipt.
|
|
148
|
+
- Positive: `After finish, review show from main displays both full reports and residual risks for the final candidate.`
|
|
149
|
+
- Negative: `A new commit still displays the preceding candidate's PASS as current.`
|
|
150
|
+
|
|
129
151
|
## REVIEW-BATCH-001
|
|
130
152
|
|
|
131
153
|
A batch review MUST cover exactly the active subtasks of the named parent and the parent itself.
|
|
@@ -228,6 +228,15 @@ fingerprint,因此兩個對話修改同一個 checkout 會互相作廢對方
|
|
|
228
228
|
任一 task 無法完成時不會合併,錯誤訊息會指出是哪個 task。建立 subtask 時 session
|
|
229
229
|
維持附著在 task 樹最上層,且每個 task 各自保留 review 紀錄,所以在同一份原始碼上
|
|
230
230
|
review 的 parent 與 subtask 不會互相覆蓋。
|
|
231
|
+
- 多個寫入型 subagent 各自在獨立 worktree 工作時,每個子 task 在編輯前以
|
|
232
|
+
`--intent` 記錄完整修改意圖,提交後進行局部 verify。協調者從主 checkout
|
|
233
|
+
經由與 review 相同的可信外層 host runner 執行
|
|
234
|
+
`agent-ops task advance --task <parent-id> --session <id> --yes`。
|
|
235
|
+
Advance 整合所有子 worktree 的程式與意圖,在同一候選版本重跑全部必要
|
|
236
|
+
verifier,並進行一次兩輪全樹 review。只有明確的 `NOT_RUN / scope-too-large`
|
|
237
|
+
會退回逐 task 雙輪 review;PASS 後在 `.git/agent-ops/receipts/` 保存完整
|
|
238
|
+
收據並呼叫 finish。Target 移動時最多重做一次最終門檻。仍有兄弟子 worktree
|
|
239
|
+
時,直接 finish 單一子 worktree 會被拒絕。
|
|
231
240
|
- `agent-ops worktree finish <name>` 只以 fast-forward 合併,一次只執行一個
|
|
232
241
|
finish。主 checkout 就在 target branch 上時,合併會更新它的檔案,所以那裡有未
|
|
233
242
|
commit 的變更會擋住合併;主 checkout 在其他 branch 或 detached 時,只移動
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
# 驗收與證據
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## EVIDENCE-CONTRACT-001
|
|
4
|
+
|
|
5
|
+
可執行驗收 MUST 將目前契約綁定到不可變的 replay 證據。
|
|
6
|
+
|
|
7
|
+
- Trigger: 驗證或完成 typed 驗收契約。
|
|
8
|
+
- Action: 在固定 baseline 與目前 candidate replay 授權 checks,再取得 fresh review。
|
|
9
|
+
- Evidence: 綁定摘要的 phase results 與目前 coverage 進入兩輪 reviewer packet。
|
|
10
|
+
- Positive: baseline 斷言 FAIL、candidate PASS 證明 behavioral check。
|
|
11
|
+
- Negative: 把 fixture error 算 red,或用舊 review 證明修訂後 criteria。
|
|
12
|
+
|
|
13
|
+
- `behavioral`:指定 red checks 在 baseline 都因斷言失敗,candidate 的必要 checks 全部通過。`invariant`:candidate 的必要 checks 通過,baseline 原本 PASS 有效。`review-only`:兩輪 fresh review 對照原始目標驗收,不宣稱機械證明。
|
|
14
|
+
- repo 授權的 `verification.acceptanceRunners` 定義 argv、setup、產品與 test build。task 提供穩定 check IDs 與明列且已 commit 的 test/fixture/helper;兩側各自安裝並 build 其版本,再覆蓋 candidate 材料。task 不能改 runner 命令。
|
|
15
|
+
- fixture、collection、build、timeout、取消、輸出截斷、缺少或重複 ID、retry、skip MUST NOT 算 red 或 green。完整 execution artifacts 以摘要綁定契約、材料與 commits。
|
|
16
|
+
- 原生 Jest JSON 與 Vitest task errors 無法完整區分 test-call 斷言與 hook/fixture cleanup。除非已 review 的 repo collector 提供明確斷言分類,失敗列 MUST 保持 UNKNOWN;AssertionError 名稱、matcher 資料與 pass 的 hook 狀態都不足。green 需要明確的單次 attempt 證據:attempts、Jest invocations,或 Vitest retryCount 與 repeatCount 兩者。原生 Vitest JSON 省略這些 counters,不能單獨提供機械證明。pytest 每個 nodeid 必須有一組依序的 setup/call/teardown;Rust protocol 必須提供 attempts。缺 metadata MUST NOT 預設為一次成功。
|
|
17
|
+
- baseline 固定為建立 commit;finding pin 使用被 FAIL 的 candidate。revise/replan 保留原始目標、全部映射要求與先前契約/證據。新契約必須重新取證並取得兩輪 fresh review。
|
|
18
|
+
- `task pin-finding` 驗證已保存 report 的 digest/index 來源。recurrence 明確引用既有 pin。第六條回傳 replan 義務且不修改狀態;映射後必須保留 pin 與全部要求。
|
|
19
|
+
- reviewer packet 包含原始目標、修訂歷史、coverage 與 verifier 材料,審查斷言本身與明確的 fallback 理由。機械 green 不會省略必要 policy commands 或任一 fresh review。
|
|
20
|
+
|
|
21
|
+
task state 寫入 version 2、讀取 version 1;evidence version 4 讀取舊證據,attestation version 3 綁定契約與 coverage。legacy criteria 維持下列 verifier 規則;typed/revised 契約不能沿用舊 review。coverage 分列機械證明、review-only、legacy;runner 綁定本身不算證明。明確 no-change proof 列出固定 candidate 上已 commit 的 regular source files;整合時重新解析支持路徑。一般 empty-diff review 與 empty-branch direct finish 仍拒絕。
|
|
22
|
+
|
|
23
|
+
English source version: 2026-10-06. Revalidate: when the English specification changes.
|
|
4
24
|
|
|
5
25
|
## EVIDENCE-CRITERION-001
|
|
6
26
|
|
|
@@ -12,6 +32,16 @@ English source version: 2026-09-27. Revalidate: when the English specification c
|
|
|
12
32
|
- Positive: `tests → npm test(354 個測試通過)`。
|
|
13
33
|
- Negative: `看起來正確,所以不需要證據。`
|
|
14
34
|
|
|
35
|
+
## EVIDENCE-INTENT-001
|
|
36
|
+
|
|
37
|
+
每個子 worktree MUST 在編輯前記錄完整程式修改意圖。
|
|
38
|
+
|
|
39
|
+
- Trigger: 子 agent 即將在自己的 worktree 編輯。
|
|
40
|
+
- Action: 使用 `task create --intent <text>` 記錄使用者同意的行為、限制與整合點;協調者連同子 task 匯入意圖,並在整合候選版本重跑驗證。
|
|
41
|
+
- Evidence: 子 task 與最終完成紀錄保留意圖,最終 verifier 證據綁定整合候選版本。
|
|
42
|
+
- Positive: `子 agent 先記錄預定 API 修改、提交程式碼,最後完成紀錄包含該意圖與整合後驗證。`
|
|
43
|
+
- Negative: `先修改程式碼,交付時才補寫一行事後意圖。`
|
|
44
|
+
|
|
15
45
|
## EVIDENCE-AGGREGATE-001
|
|
16
46
|
|
|
17
47
|
驗證器 MUST 在條件缺少、重複、未知或證據為空時回傳 FAIL。
|
|
@@ -44,10 +44,10 @@ English source version: 2026-09-24. Revalidate: when the English specification c
|
|
|
44
44
|
|
|
45
45
|
## DELEGATE-ISOLATION-003
|
|
46
46
|
|
|
47
|
-
同一個 session 中會寫入檔案的 subagent MUST 各自在自己的 agent-ops worktree 中工作,並各自擁有 task
|
|
47
|
+
同一個 session 中會寫入檔案的 subagent MUST 各自在自己的 agent-ops worktree 中工作,並各自擁有 task、開工前修改意圖與局部驗證。
|
|
48
48
|
|
|
49
49
|
- Trigger: `worktree.mode` 為 `auto`,且 subagent 寫入檔案。subagent 內的 hook 呼叫會在父對話的 `session_id` 之下帶有自己的 `agent_id`;沒有 `agent_id` 的 payload 視為該 session 的主執行緒。
|
|
50
|
-
- Action: 第一次被擋下的寫入會配發一個屬於該 session 與該 agent 的 worktree;之後用絕對路徑在那裡編輯,因為 hook 的 `cwd` 不會跟著 `cd`
|
|
51
|
-
- Evidence: `agent-ops worktree list`
|
|
52
|
-
- Positive: `兩個 subagent
|
|
50
|
+
- Action: 第一次被擋下的寫入會配發一個屬於該 session 與該 agent 的 worktree;之後用絕對路徑在那裡編輯,因為 hook 的 `cwd` 不會跟著 `cd` 改變。每個 subagent 編輯前用 `task create --intent` 記錄意圖,提交後在自己的 worktree 執行 `agent-ops verify --task`。協調者從主 checkout 執行 `agent-ops task advance --task <parent-id> --session <id> --yes`:整合子 worktree,在同一候選版本驗證所有 criteria、完成兩輪全樹 review、保存本地證據,再執行 finish。存在兄弟子 worktree 時,直接 finish 單一子 worktree 會被拒絕。
|
|
51
|
+
- Evidence: `agent-ops worktree list` 為每個子 worktree 顯示 `agent:`;`.git/agent-ops/receipts/` 的最終收據保存整合後 task tree、意圖、驗證證據與 review 報告。
|
|
52
|
+
- Positive: `兩個 subagent 各自提交並驗證;一次 task advance 整合兩者並完成最終證據門檻後 finish。`
|
|
53
53
|
- Negative: `subagent 修改協調者的 worktree,或兩個 subagent 修改同一個 worktree,導致一次 review 涵蓋兩個 task 的變更。`
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# 迴圈工程
|
|
2
2
|
|
|
3
|
+
## LOOP-RUN-001
|
|
4
|
+
|
|
5
|
+
`run` MUST 保留原始使用者目標,並要求目前有效的 agent-ops 證據。
|
|
6
|
+
|
|
7
|
+
- Trigger: 啟動、修復或恢復 native goal run。
|
|
8
|
+
- Action: writer 綁定目前 lease,並要求最終 verify、雙 review 與 receipt 證據。
|
|
9
|
+
- Evidence: run ledger 與封存 receipt 綁定目前 candidate 及原始目標。
|
|
10
|
+
- Positive: 恢復未完成清理時,保留 target 與已保存的 final proof。
|
|
11
|
+
- Negative: 只因 native goal completion 就把 run 標為 complete。
|
|
12
|
+
|
|
13
|
+
- macOS supervisor 在啟動 goal 前保存 Claude/Codex native 身份。同 host writers 使用獨立 worktrees 與目前 generation lease;coordinator 計入最多兩個 writer。依賴以固定交付提供,child baseline 在依賴 commits 進入 checkout 後建立。
|
|
14
|
+
- 預設 60 分鐘預算計算 active intervals 聯集,包含 setup、verify、review、整合。resume 保留時間與 usage epochs;缺少計數維持 UNKNOWN,partial usage 不算完整成本。
|
|
15
|
+
- 實質疑問暫停並要求明確回答。修復保留目標與失敗紀錄;連續兩次相同失敗且無進展停止該 worker 及其依賴,獨立 task 仍可執行。review findings 在下次 final gate 前必須有回歸 pin 或記錄 review-only fallback。
|
|
16
|
+
- native completion 僅是觀察。完成必須有必要驗證、兩輪 fresh review、完成的 task state、綁定 target 的 receipt。整合在移動 target 前封存 candidate,記錄 task、receipt、note、cleanup 進度;恢復驗證封存證據,不重做成功的 target mutation。不一致的 target 維持 blocked。
|
|
17
|
+
- Stop 先保存禁止續跑,再確認受管 process group 死亡。crash recovery 不得取代仍存活或身份不明的 writer。dirty checkout、版本漂移、restart storm 保留現場。重開機/login 改變必須明確 resume;不修改全域 host policy。
|
|
18
|
+
- Native handshake 前先保存啟動程序身份;尚未開啟的 Codex session 必須證明程序死亡,才可在新 lease 重新初始化。
|
|
19
|
+
|
|
20
|
+
- Setup 與 native agent 發起的 local proof MUST 先登記 dormant process group 再執行;Stop 也要取消子程序。中斷的 setup 必須明確 resume,保留 checkout 與失敗 artifact。
|
|
21
|
+
- Coordinator 只能在綁定原始 repository trust、可執行 runtime、剩餘預算的 run-scoped policy 下,評估新增固定且非危險的能力。不得繞過 native 或組織的明確拒絕。Policy 變更先停止所有 writer,保留固定交付,以 journal 記錄 contract 同步,再啟動新 generation;不授予永久 repository trust。Native decision 保存遮罩後的命令範圍與理由,provider 未提供的證據維持 UNKNOWN。
|
|
22
|
+
- 明確 resume 從剩餘預算續期過期授權,並先核對不可變 renewal lineage,再同步 policy。回答問題也沿用相同恢復檢查;兩者皆不得復活已被明確拒絕的工作。
|
|
23
|
+
- 收斂判斷比較實際 per-check 狀態及未解除的 finding pins;source fingerprint、時間或診斷文字本身不能算進展。
|
|
24
|
+
|
|
3
25
|
English source version: 2026-07-23. Revalidate: when the English specification changes.
|
|
4
26
|
|
|
5
27
|
## LOOP-START-001
|
|
@@ -7,9 +7,9 @@ English source version: 2026-09-30. Revalidate: when the English specification c
|
|
|
7
7
|
獨立審查者 MUST 只收到包含請求、條件、產物參照與證據要求的最小 packet。
|
|
8
8
|
|
|
9
9
|
- Trigger: 多步驟變更到達審查 checkpoint。
|
|
10
|
-
- Action:
|
|
10
|
+
- Action: 有記錄時在 request 帶入使用者同意的 task 意圖;排除隱藏推理、原始 log 與憑證。
|
|
11
11
|
- Evidence: 可見 packet keys 與產物參照,且不含敏感內容。
|
|
12
|
-
- Positive: `Packet
|
|
12
|
+
- Positive: `Packet 包含已記錄的 task 意圖、條件、檔案與證據要求。`
|
|
13
13
|
- Negative: `轉送完整 session transcript 與環境。`
|
|
14
14
|
|
|
15
15
|
## REVIEW-RESULT-001
|
|
@@ -117,6 +117,28 @@ permission bypass。外部 host runner 不可用時,結果 MUST 保持 NOT_RUN
|
|
|
117
117
|
- Positive: `NOT_RUN:unparseable-output;缺少一條 criterion。`
|
|
118
118
|
- Negative: `因為模型的 JSON 格式錯誤就記錄一次失敗的審查。`
|
|
119
119
|
|
|
120
|
+
## REVIEW-TREE-001
|
|
121
|
+
|
|
122
|
+
`task advance` MUST 在呼叫 finish 前,讓同一個整合後候選版本通過 parent 與所有子 task 的 criteria。
|
|
123
|
+
|
|
124
|
+
- Trigger: session 有 parent task 與一個以上由 subagent 擁有的子 worktree。
|
|
125
|
+
- Action: 將各子 task 的開工前意圖及已提交程式碼匯入協調者候選 worktree。所有 task 的必要 verifier 使用相同最終 base 與 source fingerprint。執行 `review --task <parent-id> --tree --base <final-base> --yes`,把唯一化的 criteria 與意圖交給現有兩輪獨立 reviewer;每個 task 都保存指向完整全樹報告的 task-bound 證明。
|
|
126
|
+
- Evidence: 最終收據包含完整 task tree、意圖、source fingerprint、驗證證據、兩份 reviewer 報告、review 模式與剩餘風險。
|
|
127
|
+
- Positive: `parent 兩項、兩個子 task 各三項 criteria,在整合候選版本上由同一組兩輪 review 覆蓋全部八項。`
|
|
128
|
+
- Negative: `只 review parent,就 finish 尚未在整合版本檢查 criteria 的子 worktree。`
|
|
129
|
+
|
|
130
|
+
只有 `NOT_RUN / scope-too-large` 可以退回各 task 各自完整的兩輪 review。實質 FAIL、缺少驗證證據、reviewer 無法使用或其他 NOT_RUN 都阻擋 finish。Target 移動時,`task advance` 最多 rebase 並重做整套最終門檻一次。收據在目標分支移動前寫入主 checkout 的 `.git/agent-ops/receipts/` 並讀回檢查;保存失敗禁止合併。合併前晚到的 target 移動會被拒絕,以便重做最終證據。合併後清理失敗則回報為部分完成,不宣稱 finish 成功。
|
|
131
|
+
|
|
132
|
+
## REVIEW-SHOW-001
|
|
133
|
+
|
|
134
|
+
使用者 MUST 能從主 checkout 檢視最新候選版本已保存的兩輪 reviewer 報告,而不啟動新審查。
|
|
135
|
+
|
|
136
|
+
- Trigger: 對 active 或 finished task 執行 `review show --task <id>`。
|
|
137
|
+
- Action: 顯示完整、已遮蔽敏感資訊的結構化第一輪與第二輪報告,包括每項 criterion、finding、已檢查檔案與剩餘風險。全樹審查成功時只顯示一次共用報告;逐 task 退回時依 task 分組。Finished 收據必須對照 Git note digest 驗證。候選版本改變後,應明示目前版本尚未審查,不得顯示舊 verdict。失敗或未執行的輪次需明確指出缺少的報告。`task advance` 通過時摘要具體非阻擋發現與風險,失敗時顯示可取得的報告細節。
|
|
138
|
+
- Evidence: 唯讀指令不呼叫 reviewer,輸出綁定 active fingerprint 或 finished 收據。
|
|
139
|
+
- Positive: `finish 後從主 checkout 執行 review show,可看到最終候選版本的兩份完整報告與剩餘風險。`
|
|
140
|
+
- Negative: `新增 commit 後仍將上一個候選版本的 PASS 顯示為目前結果。`
|
|
141
|
+
|
|
120
142
|
## REVIEW-BATCH-001
|
|
121
143
|
|
|
122
144
|
批次審查 MUST 只涵蓋指定 parent 的 active 子 task 以及 parent 本身。
|
package/package.json
CHANGED
|
@@ -20,7 +20,12 @@
|
|
|
20
20
|
"type": "array",
|
|
21
21
|
"uniqueItems": true,
|
|
22
22
|
"items": {
|
|
23
|
-
"enum": [
|
|
23
|
+
"enum": [
|
|
24
|
+
"core",
|
|
25
|
+
"advisory",
|
|
26
|
+
"guardrails",
|
|
27
|
+
"loop"
|
|
28
|
+
]
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"reviewRoles": {
|
|
@@ -28,7 +33,10 @@
|
|
|
28
33
|
"items": {
|
|
29
34
|
"type": "object",
|
|
30
35
|
"additionalProperties": false,
|
|
31
|
-
"required": [
|
|
36
|
+
"required": [
|
|
37
|
+
"role",
|
|
38
|
+
"targets"
|
|
39
|
+
],
|
|
32
40
|
"properties": {
|
|
33
41
|
"role": {
|
|
34
42
|
"enum": [
|
|
@@ -43,19 +51,34 @@
|
|
|
43
51
|
"minItems": 1,
|
|
44
52
|
"uniqueItems": true,
|
|
45
53
|
"items": {
|
|
46
|
-
"enum": [
|
|
54
|
+
"enum": [
|
|
55
|
+
"codex",
|
|
56
|
+
"agy",
|
|
57
|
+
"claude"
|
|
58
|
+
]
|
|
47
59
|
}
|
|
48
60
|
},
|
|
49
|
-
"model": {
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
"model": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"minLength": 1
|
|
64
|
+
},
|
|
65
|
+
"effort": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"minLength": 1
|
|
68
|
+
},
|
|
69
|
+
"timeoutMs": {
|
|
70
|
+
"type": "integer",
|
|
71
|
+
"minimum": 1
|
|
72
|
+
}
|
|
52
73
|
}
|
|
53
74
|
}
|
|
54
75
|
},
|
|
55
76
|
"verification": {
|
|
56
77
|
"type": "object",
|
|
57
78
|
"additionalProperties": false,
|
|
58
|
-
"required": [
|
|
79
|
+
"required": [
|
|
80
|
+
"commands"
|
|
81
|
+
],
|
|
59
82
|
"properties": {
|
|
60
83
|
"commands": {
|
|
61
84
|
"type": "array",
|
|
@@ -69,18 +92,163 @@
|
|
|
69
92
|
}
|
|
70
93
|
]
|
|
71
94
|
}
|
|
95
|
+
},
|
|
96
|
+
"acceptanceRunners": {
|
|
97
|
+
"type": "array",
|
|
98
|
+
"maxItems": 128,
|
|
99
|
+
"items": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"additionalProperties": false,
|
|
102
|
+
"required": [
|
|
103
|
+
"id",
|
|
104
|
+
"command",
|
|
105
|
+
"args",
|
|
106
|
+
"cwd",
|
|
107
|
+
"adapter"
|
|
108
|
+
],
|
|
109
|
+
"properties": {
|
|
110
|
+
"id": {
|
|
111
|
+
"$ref": "#/$defs/id"
|
|
112
|
+
},
|
|
113
|
+
"command": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"minLength": 1
|
|
116
|
+
},
|
|
117
|
+
"args": {
|
|
118
|
+
"type": "array",
|
|
119
|
+
"maxItems": 512,
|
|
120
|
+
"items": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"cwd": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"minLength": 1
|
|
127
|
+
},
|
|
128
|
+
"adapter": {
|
|
129
|
+
"enum": [
|
|
130
|
+
"generic",
|
|
131
|
+
"node",
|
|
132
|
+
"jest",
|
|
133
|
+
"vitest",
|
|
134
|
+
"pytest",
|
|
135
|
+
"rust"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"timeoutMs": {
|
|
139
|
+
"type": "integer",
|
|
140
|
+
"minimum": 1,
|
|
141
|
+
"maximum": 3600000
|
|
142
|
+
},
|
|
143
|
+
"setup": {
|
|
144
|
+
"type": "array",
|
|
145
|
+
"maxItems": 64,
|
|
146
|
+
"items": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"additionalProperties": false,
|
|
149
|
+
"required": [
|
|
150
|
+
"command",
|
|
151
|
+
"args"
|
|
152
|
+
],
|
|
153
|
+
"properties": {
|
|
154
|
+
"command": {
|
|
155
|
+
"type": "string",
|
|
156
|
+
"minLength": 1
|
|
157
|
+
},
|
|
158
|
+
"args": {
|
|
159
|
+
"type": "array",
|
|
160
|
+
"maxItems": 512,
|
|
161
|
+
"items": {
|
|
162
|
+
"type": "string"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"timeoutMs": {
|
|
166
|
+
"type": "integer",
|
|
167
|
+
"minimum": 1,
|
|
168
|
+
"maximum": 3600000
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"build": {
|
|
174
|
+
"type": "array",
|
|
175
|
+
"maxItems": 64,
|
|
176
|
+
"items": {
|
|
177
|
+
"type": "object",
|
|
178
|
+
"additionalProperties": false,
|
|
179
|
+
"required": [
|
|
180
|
+
"command",
|
|
181
|
+
"args"
|
|
182
|
+
],
|
|
183
|
+
"properties": {
|
|
184
|
+
"command": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"minLength": 1
|
|
187
|
+
},
|
|
188
|
+
"args": {
|
|
189
|
+
"type": "array",
|
|
190
|
+
"maxItems": 512,
|
|
191
|
+
"items": {
|
|
192
|
+
"type": "string"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"timeoutMs": {
|
|
196
|
+
"type": "integer",
|
|
197
|
+
"minimum": 1,
|
|
198
|
+
"maximum": 3600000
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"testBuild": {
|
|
204
|
+
"type": "array",
|
|
205
|
+
"maxItems": 64,
|
|
206
|
+
"items": {
|
|
207
|
+
"type": "object",
|
|
208
|
+
"additionalProperties": false,
|
|
209
|
+
"required": [
|
|
210
|
+
"command",
|
|
211
|
+
"args"
|
|
212
|
+
],
|
|
213
|
+
"properties": {
|
|
214
|
+
"command": {
|
|
215
|
+
"type": "string",
|
|
216
|
+
"minLength": 1
|
|
217
|
+
},
|
|
218
|
+
"args": {
|
|
219
|
+
"type": "array",
|
|
220
|
+
"maxItems": 512,
|
|
221
|
+
"items": {
|
|
222
|
+
"type": "string"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"timeoutMs": {
|
|
226
|
+
"type": "integer",
|
|
227
|
+
"minimum": 1,
|
|
228
|
+
"maximum": 3600000
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
72
235
|
}
|
|
73
236
|
}
|
|
74
237
|
},
|
|
75
238
|
"features": {
|
|
76
239
|
"type": "object",
|
|
77
240
|
"additionalProperties": false,
|
|
78
|
-
"required": [
|
|
241
|
+
"required": [
|
|
242
|
+
"completionGate",
|
|
243
|
+
"stopVerification"
|
|
244
|
+
],
|
|
79
245
|
"properties": {
|
|
80
246
|
"completionGate": {
|
|
81
247
|
"type": "object",
|
|
82
248
|
"additionalProperties": false,
|
|
83
|
-
"required": [
|
|
249
|
+
"required": [
|
|
250
|
+
"enabled"
|
|
251
|
+
],
|
|
84
252
|
"properties": {
|
|
85
253
|
"enabled": {
|
|
86
254
|
"type": "boolean"
|
|
@@ -90,7 +258,9 @@
|
|
|
90
258
|
"stopVerification": {
|
|
91
259
|
"type": "object",
|
|
92
260
|
"additionalProperties": false,
|
|
93
|
-
"required": [
|
|
261
|
+
"required": [
|
|
262
|
+
"enabled"
|
|
263
|
+
],
|
|
94
264
|
"properties": {
|
|
95
265
|
"enabled": {
|
|
96
266
|
"type": "boolean"
|
|
@@ -104,7 +274,10 @@
|
|
|
104
274
|
"items": {
|
|
105
275
|
"type": "object",
|
|
106
276
|
"additionalProperties": false,
|
|
107
|
-
"required": [
|
|
277
|
+
"required": [
|
|
278
|
+
"path",
|
|
279
|
+
"verifierIds"
|
|
280
|
+
],
|
|
108
281
|
"properties": {
|
|
109
282
|
"path": {
|
|
110
283
|
"$ref": "#/$defs/relativePath"
|
|
@@ -122,17 +295,25 @@
|
|
|
122
295
|
"worktree": {
|
|
123
296
|
"type": "object",
|
|
124
297
|
"additionalProperties": false,
|
|
125
|
-
"required": [
|
|
298
|
+
"required": [
|
|
299
|
+
"mode"
|
|
300
|
+
],
|
|
126
301
|
"properties": {
|
|
127
302
|
"mode": {
|
|
128
|
-
"enum": [
|
|
303
|
+
"enum": [
|
|
304
|
+
"auto",
|
|
305
|
+
"off"
|
|
306
|
+
]
|
|
129
307
|
},
|
|
130
308
|
"setup": {
|
|
131
309
|
"type": "array",
|
|
132
310
|
"items": {
|
|
133
311
|
"type": "object",
|
|
134
312
|
"additionalProperties": false,
|
|
135
|
-
"required": [
|
|
313
|
+
"required": [
|
|
314
|
+
"command",
|
|
315
|
+
"args"
|
|
316
|
+
],
|
|
136
317
|
"properties": {
|
|
137
318
|
"command": {
|
|
138
319
|
"$ref": "#/$defs/nonEmptyString"
|
|
@@ -159,7 +340,12 @@
|
|
|
159
340
|
"items": {
|
|
160
341
|
"type": "object",
|
|
161
342
|
"additionalProperties": false,
|
|
162
|
-
"required": [
|
|
343
|
+
"required": [
|
|
344
|
+
"ruleId",
|
|
345
|
+
"scope",
|
|
346
|
+
"expiresAt",
|
|
347
|
+
"reason"
|
|
348
|
+
],
|
|
163
349
|
"properties": {
|
|
164
350
|
"ruleId": {
|
|
165
351
|
"$ref": "#/$defs/id"
|
|
@@ -259,10 +445,16 @@
|
|
|
259
445
|
"evidence": {
|
|
260
446
|
"type": "object",
|
|
261
447
|
"additionalProperties": false,
|
|
262
|
-
"required": [
|
|
448
|
+
"required": [
|
|
449
|
+
"kind"
|
|
450
|
+
],
|
|
263
451
|
"properties": {
|
|
264
452
|
"kind": {
|
|
265
|
-
"enum": [
|
|
453
|
+
"enum": [
|
|
454
|
+
"exit-code",
|
|
455
|
+
"test-count",
|
|
456
|
+
"file"
|
|
457
|
+
]
|
|
266
458
|
},
|
|
267
459
|
"minimum": {
|
|
268
460
|
"type": "integer",
|
|
@@ -273,7 +465,14 @@
|
|
|
273
465
|
},
|
|
274
466
|
"commandFields": {
|
|
275
467
|
"type": "object",
|
|
276
|
-
"required": [
|
|
468
|
+
"required": [
|
|
469
|
+
"id",
|
|
470
|
+
"command",
|
|
471
|
+
"args",
|
|
472
|
+
"cwd",
|
|
473
|
+
"required",
|
|
474
|
+
"evidence"
|
|
475
|
+
],
|
|
277
476
|
"properties": {
|
|
278
477
|
"id": {
|
|
279
478
|
"$ref": "#/$defs/id"
|
|
@@ -335,7 +534,10 @@
|
|
|
335
534
|
{
|
|
336
535
|
"type": "object",
|
|
337
536
|
"additionalProperties": false,
|
|
338
|
-
"required": [
|
|
537
|
+
"required": [
|
|
538
|
+
"shell",
|
|
539
|
+
"acknowledgeRisk"
|
|
540
|
+
],
|
|
339
541
|
"properties": {
|
|
340
542
|
"id": true,
|
|
341
543
|
"command": true,
|