@kylecheng3146/agent-ops 0.1.19 → 0.1.21

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.
Files changed (53) hide show
  1. package/README.md +38 -12
  2. package/dist/packages/cli/src/agy-headless.js +18 -0
  3. package/dist/packages/cli/src/args.js +29 -3
  4. package/dist/packages/cli/src/bin.js +113 -12
  5. package/dist/packages/cli/src/cli.js +4 -1
  6. package/dist/packages/cli/src/commands/allow-stop.js +11 -0
  7. package/dist/packages/cli/src/commands/hook.js +12 -1
  8. package/dist/packages/cli/src/commands/init.js +43 -10
  9. package/dist/packages/cli/src/commands/review.js +3 -0
  10. package/dist/packages/cli/src/commands/task.js +5 -2
  11. package/dist/packages/cli/src/commands/uninstall.js +20 -3
  12. package/dist/packages/cli/src/context.js +4 -1
  13. package/dist/packages/cli/src/hook-process.js +59 -5
  14. package/dist/packages/cli/src/ui.js +3 -1
  15. package/dist/packages/cli/src/wizard.js +36 -6
  16. package/dist/runtime/src/adapters/agy/config.js +115 -0
  17. package/dist/runtime/src/adapters/agy/events.js +35 -0
  18. package/dist/runtime/src/adapters/agy/input.js +48 -0
  19. package/dist/runtime/src/adapters/agy/output.js +28 -0
  20. package/dist/runtime/src/adapters/agy/surfaces.js +9 -0
  21. package/dist/runtime/src/config/explain.js +5 -0
  22. package/dist/runtime/src/config/migrate.js +15 -1
  23. package/dist/runtime/src/contracts.js +1 -1
  24. package/dist/runtime/src/hooks/completion-gate.js +209 -0
  25. package/dist/runtime/src/hooks/dispatch.js +6 -0
  26. package/dist/runtime/src/install/codex-loop.js +6 -2
  27. package/dist/runtime/src/install/doctor.js +17 -0
  28. package/dist/runtime/src/install/harness.js +56 -1
  29. package/dist/runtime/src/install/hooks.js +6 -1
  30. package/dist/runtime/src/install/ownership.js +15 -4
  31. package/dist/runtime/src/install/plan.js +21 -6
  32. package/dist/runtime/src/install/probes.js +61 -0
  33. package/dist/runtime/src/install/profiles.js +3 -0
  34. package/dist/runtime/src/install/surface-inspection.js +10 -1
  35. package/dist/runtime/src/install/uninstall.js +337 -6
  36. package/dist/runtime/src/review/execute.js +23 -20
  37. package/dist/runtime/src/review/extract.js +5 -11
  38. package/dist/runtime/src/review/render.js +6 -1
  39. package/dist/runtime/src/review/roles.js +4 -0
  40. package/dist/runtime/src/review/runner.js +7 -0
  41. package/dist/runtime/src/schema/validate.js +13 -3
  42. package/dist/runtime/src/task/service.js +17 -0
  43. package/docs/en/guides/configuration.md +46 -12
  44. package/docs/en/spec/README.md +7 -4
  45. package/docs/en/spec/harness-adapters.md +24 -9
  46. package/docs/en/spec/review.md +6 -0
  47. package/docs/zh-TW/guides/configuration.md +41 -11
  48. package/docs/zh-TW/spec/README.md +6 -4
  49. package/docs/zh-TW/spec/harness-adapters.md +21 -10
  50. package/docs/zh-TW/spec/review.md +5 -0
  51. package/package.json +2 -2
  52. package/schemas/config.schema.json +12 -2
  53. package/schemas/manifest.schema.json +2 -2
@@ -2,21 +2,24 @@
2
2
 
3
3
  Keep project configuration explicit and layered. Choose scope, harness, and profile deliberately; do not infer trust or security exceptions from `--yes`.
4
4
 
5
- Use `--harness all` to select Codex, Claude Code, and opencode, or pass a
5
+ Use `--harness all` to select agy, Codex, Claude Code, and opencode, or pass a
6
6
  comma-separated subset such as `codex,opencode`. `both` remains an input alias
7
7
  for the legacy Codex plus Claude selection.
8
8
 
9
- Project Codex and opencode installations share the managed supplemental
10
- `AGENTS.md` routing block and the `.agent-ops/AGENTS.md` rules artifact. The
11
- block loads the managed baseline while project-specific instructions remain
12
- authoritative. Claude uses the corresponding `CLAUDE.md` route and
9
+ Project agy uses a managed supplemental `GEMINI.md` routing block and
10
+ `.agent-ops/GEMINI.md` baseline. This follows the official agy CLI rule that a
11
+ workspace-root `GEMINI.md` or `AGENTS.md` is loaded at startup. Codex and
12
+ opencode share the corresponding `AGENTS.md` route and `.agent-ops/AGENTS.md`
13
+ artifact. Each block loads the managed baseline while project-specific
14
+ instructions remain authoritative. Claude uses the corresponding `CLAUDE.md` route and
13
15
  `.agent-ops/CLAUDE.md` artifact. Opencode additionally gets
14
16
  the agent-ops-owned `.opencode/plugins/agent-ops.js` file; `opencode.json` is
15
17
  never modified. The plugin is generated with the installed absolute runtime
16
18
  path, so update it through `agent-ops update` rather than editing it manually.
17
19
 
18
- At user scope, Codex and opencode keep separate routing files under `.codex/`
19
- and `.opencode/`; the global opencode plugin is placed under
20
+ At user scope, agy uses `.agent-ops/GEMINI.md` and the shared Gemini surface
21
+ `.gemini/GEMINI.md`; Codex and opencode keep separate routing files under
22
+ `.codex/` and `.opencode/`. The global opencode plugin is placed under
20
23
  `.config/opencode/plugins/`, or under `$XDG_CONFIG_HOME/opencode/plugins/`
21
24
  when that variable points inside the managed user root. If OpenCode is
22
25
  configured with `$OPENCODE_CONFIG_DIR`, the plugin is placed under its
@@ -52,7 +55,8 @@ A bare review uses the built-in `change-quality` criterion; `--task` uses the
52
55
  task criteria and requires fresh PASS evidence for required checks. The full
53
56
  report is printed, and PASS persists only a source-fingerprint attestation.
54
57
 
55
- Every attempt starts from a fresh temporary cwd and native read-only mode.
58
+ Every attempt starts from a fresh session and disposable repository clone with
59
+ native read-only mode.
56
60
  Claude uses complete safe-mode isolation. Codex and Agy preserve their existing
57
61
  login environment to support normal OAuth sessions, so they provide weaker
58
62
  context isolation. Agy receives a disposable clone and cannot modify the source
@@ -64,6 +68,10 @@ repository even if sandboxed plan mode writes to its cwd:
64
68
  | `agy` | `agy --print <prompt>` | `--sandbox --mode plan` |
65
69
  | `claude` | `claude -p` | `--permission-mode plan --safe-mode` |
66
70
 
71
+ The chain prefers a target different from the hosting CLI. If no other target
72
+ is usable, a fresh same-target session is allowed but is reported as
73
+ `DEGRADED: isolated self-review`; a development session is never resumed.
74
+
67
75
  `opencode` is **not** a review target even though it is a supported harness.
68
76
  Its `--agent plan` is rejected as a subagent and silently falls back to a
69
77
  writable agent, so it cannot satisfy the read-only precondition. A target with
@@ -135,7 +143,28 @@ Claude's generated settings select the PowerShell launcher. Codex also gets
135
143
  harness directory. A hash-commented `.gitignore` block ignores those local
136
144
  files.
137
145
 
138
- The loop runs `SessionStart`, `UserPromptSubmit`, `PreToolUse`,
146
+ For agy, the loop uses the native `PreInvocation` and `PreToolUse(run_command)`
147
+ subset and is reported as degraded. Project hooks live in `.agents/hooks.json`;
148
+ user hooks live in `.gemini/config/hooks.json`. User-scope rules modify the
149
+ shared Gemini rule surface at `.gemini/GEMINI.md`. agy 1.1.12 or newer is
150
+ required for machine-readable `/hooks` diagnostics.
151
+
152
+ For `agy` plus `loop`, the interactive installer recommends
153
+ `features.completionGate.enabled`; non-interactive installs require the explicit
154
+ `--completion-gate` flag. The gate uses the documented `conversationId`,
155
+ `terminationReason`, and `fullyIdle` Stop fields and returns the documented
156
+ `decision: "continue"` only for a final changed conversation that lacks current
157
+ task, verification, or review proof. Pure Q&A, analysis, read-only diagnostics,
158
+ error stops, max-step stops, and non-idle stops continue normally. It does not
159
+ change Codex, Claude Code, or OpenCode Stop behavior. For headless execution use
160
+ `agent-ops agy-run -- <agy arguments>`; a user-approved one-time escape is
161
+ `agent-ops allow-stop --session <conversationId>` and is guarded by agy's
162
+ documented `force_ask` decision.
163
+
164
+ Official references: [agy CLI workspace rule files](https://www.antigravity.google/docs/cli/best-practices/)
165
+ and [Antigravity hook contracts](https://www.antigravity.google/docs/hooks/).
166
+
167
+ The full Codex/Claude loop runs `SessionStart`, `UserPromptSubmit`, `PreToolUse`,
139
168
  `PermissionRequest`, `PostToolUse`, `PreCompact`, `PostCompact`,
140
169
  `SubagentStart`, and `SubagentStop`, but never adds `Stop`. It blocks only
141
170
  high-confidence literal secrets in prompts or Bash commands, plus dangerous
@@ -171,8 +200,9 @@ classified invalid installed configuration. The managed OpenCode
171
200
  `tool.execute.before` plugin can throw its documented command-policy denial or
172
201
  unavailable-runtime error for its supported Bash surface. Codex is explicitly
173
202
  non-enforcing (`unknown`). These are agent-ops output and plugin contracts, not
174
- proof that a host honors a denial. `SessionStart` and `Stop` failure paths stay
175
- fail-open for every adapter.
203
+ proof that a host honors a denial. `SessionStart` and ordinary Stop verification
204
+ failure paths stay fail-open. Only the explicitly enabled agy completion gate
205
+ fails closed at final Stop.
176
206
 
177
207
  Claude's invalid-config fallback has four safeguards: (1) an absent project
178
208
  configuration stays fail-open, so only an invalid `.agent-ops/config.json` can
@@ -184,7 +214,7 @@ that shell variable. The variable is read only from the hook-process environment
184
214
  and cannot be set in agent-ops configuration, a manifest, or managed files.
185
215
 
186
216
  `guardrails` installs command policy but does not enable Stop verification. Stop
187
- is a separate config-v2 feature and must be explicitly enabled with at least
217
+ is a separate config-v3 feature and must be explicitly enabled with at least
188
218
  one confirmed command:
189
219
 
190
220
  ```json
@@ -237,6 +267,10 @@ To narrow an existing installation, pass the desired list to `agent-ops update
237
267
  --harness`; shared paths remain managed while removed harness-owned artifacts,
238
268
  markers, and hooks are reconciled.
239
269
 
270
+ To remove only one integrated harness, use `agent-ops uninstall --harness agy`
271
+ (or another installed id). The remaining manifest and shared paths stay in
272
+ place; omit `--harness` to remove the complete managed installation.
273
+
240
274
  Installations using the previous canonical routing wording are migrated by
241
275
  `agent-ops update`. If a managed block was edited, the command fails closed
242
276
  until the change is reviewed.
@@ -2,11 +2,14 @@
2
2
 
3
3
  This is the normative English specification for bounded, evidence-driven work.
4
4
 
5
- The harness adapter rules cover Codex, Claude Code, and opencode. The opencode
6
- integration is a generated local plugin; it does not manage `opencode.json`.
5
+ The harness adapter rules cover agy, Codex, Claude Code, and opencode. The
6
+ opencode integration is a generated local plugin; it does not manage
7
+ `opencode.json`. agy uses project `GEMINI.md` routing, uses native hooks, and
8
+ is explicitly degraded where its lifecycle surface is smaller than the full
9
+ loop.
7
10
 
8
- Configuration is versioned independently from the manifest. Config v1 migrates
9
- to config v2 with Stop verification disabled; changing the capability requires
11
+ Configuration is versioned independently from the manifest. Older configs migrate
12
+ to config v3 with Stop verification and the agy completion gate disabled; changing a capability requires
10
13
  a confirmed project `agent-ops update`, which also refreshes trust when
11
14
  verifiers exist. Stop verification is
12
15
  explicit, trusted, report-only, and never completes a task. Dry-run plans keep
@@ -6,7 +6,9 @@ documentation](https://bun.sh/docs/runtime/shell) on 2026-07-31. Codex and
6
6
  Claude Code loop-hook behavior was checked against their [Codex hook
7
7
  documentation](https://developers.openai.com/codex/config-advanced#hooks) and
8
8
  [Claude Code hook documentation](https://code.claude.com/docs/en/hooks) on
9
- 2026-08-03. Revalidate: when any vendor reference changes.
9
+ 2026-08-03. Agy hook behavior was checked against the [official Antigravity
10
+ hook documentation](https://antigravity.google/docs/hooks) on 2026-08-28.
11
+ Revalidate: when any vendor reference changes.
10
12
 
11
13
  ## HARNESS-ADAPTER-001
12
14
 
@@ -80,14 +82,17 @@ decoding, normalized events, native output encoding, and runtime-failure output.
80
82
  ## HARNESS-ADAPTER-006
81
83
 
82
84
  The project-local `loop` profile MUST be opt-in, project scoped, and use one
83
- shared runtime behind minimal Codex and Claude Code launchers. It MUST NOT copy
85
+ shared runtime behind minimal Codex and Claude Code launchers; agy uses its
86
+ native supported lifecycle subset and is reported as degraded. It MUST NOT copy
84
87
  policy into project-specific scripts or alter an ordinary permission request.
85
88
 
86
- - Trigger: A project selects `loop` with Codex, Claude Code, or both.
89
+ - Trigger: A project selects `loop` with agy, Codex, Claude Code, or any combination.
87
90
  - Action: Generate only the selected `.codex/hooks/agent-ops-loop.sh` and/or
88
91
  Claude's `.claude/hooks/agent-ops-loop.sh` plus
89
92
  `.claude/hooks/agent-ops-loop.ps1` launchers, register the documented loop
90
- lifecycle events except `Stop`, and preserve foreign hook groups. Block only
93
+ lifecycle events except `Stop`, and preserve foreign hook groups. For agy,
94
+ register only native `PreInvocation`/`PreToolUse(run_command)` hooks and do
95
+ not generate a shell launcher. Block only
91
96
  high-confidence literal credentials at `UserPromptSubmit` or Bash
92
97
  `PreToolUse`, and dangerous Bash commands at `PreToolUse`, using the documented native denial shape. Emit no
93
98
  decision for `PermissionRequest`, including escalated permissions.
@@ -99,11 +104,12 @@ policy into project-specific scripts or alter an ordinary permission request.
99
104
 
100
105
  The current registration matrix is intentionally asymmetric:
101
106
 
102
- | Capability | Codex | Claude Code | OpenCode |
103
- | --- | --- | --- | --- |
104
- | lifecycle-summary | supported | supported | degraded |
105
- | command-policy | unknown | supported | supported |
106
- | optional-stop-verify | unsupported | supported | degraded |
107
+ | Capability | agy | Codex | Claude Code | OpenCode |
108
+ | --- | --- | --- | --- | --- |
109
+ | lifecycle-summary | degraded | supported | supported | degraded |
110
+ | command-policy | supported | unknown | supported | supported |
111
+ | completion-gate | supported | unsupported | unsupported | unsupported |
112
+ | optional-stop-verify | degraded | unsupported | supported | degraded |
107
113
 
108
114
  For runtime-failure handling, only `command-policy` is fail-closed. Claude
109
115
  Code can emit its documented `PreToolUse` denial shape for a classified invalid
@@ -113,6 +119,15 @@ surface. Codex remains `unknown` and never emits a denial. Fixture tests assert
113
119
  these wire and plugin shapes only; they do not prove that a host honors a
114
120
  denial. Every `SessionStart` and `Stop` failure path remains fail-open.
115
121
 
122
+ The agy adapter uses native project `GEMINI.md` routing to
123
+ `.agent-ops/GEMINI.md`;
124
+ at user scope it manages `.agent-ops/GEMINI.md` and a managed block in the
125
+ shared `.gemini/GEMINI.md` rule surface. Its native hooks use camelCase input,
126
+ return `decision: "deny"` for command-policy blocks, and, only when the
127
+ completion gate is explicitly enabled, return `decision: "continue"` for an
128
+ unproven final changed conversation. Read-only conversations stop normally.
129
+ On Windows the generated command is invoked through `cmd /c`.
130
+
116
131
  Stop verification is explicit, trusted, report-only, and disabled by default.
117
132
  Every Stop result continues the native harness and may carry only bounded
118
133
  command evidence; it is never task-completion evidence.
@@ -42,6 +42,12 @@ without one MUST be skipped rather than run unsandboxed.
42
42
  - Positive: `agy receives sandboxed plan mode; opencode remains ineligible.`
43
43
  - Negative: `Trust the prompt to stop the reviewer from editing files.`
44
44
 
45
+ Every attempted review MUST run in a fresh session (`sessionIsolation:
46
+ "fresh"`) and in a disposable repository clone. The reviewer chain prefers a
47
+ different CLI from the hosting CLI; when no other usable target exists,
48
+ same-target fresh review is allowed but MUST render as `DEGRADED: isolated
49
+ self-review`. A resumed development session is never an independent review.
50
+
45
51
  ## REVIEW-CHAIN-001
46
52
 
47
53
  Configured targets form an ordered fallback chain that MUST advance only when
@@ -2,20 +2,23 @@
2
2
 
3
3
  保持 project 設定明確且分層。請刻意選擇 scope、harness 與 profile;不要從 `--yes` 推論 trust 或安全例外。
4
4
 
5
- 使用 `--harness all` 選取 Codex、Claude Code 與 opencode,或傳入
5
+ 使用 `--harness all` 選取 agy、Codex、Claude Code 與 opencode,或傳入
6
6
  `codex,opencode` 這類逗號分隔的子集。`both` 仍是 legacy Codex 加 Claude
7
7
  selection 的 input alias。
8
8
 
9
- Project Codex opencode installation 共用 managed supplemental
10
- `AGENTS.md` routing block 與 `.agent-ops/AGENTS.md` rules artifact。該 block
11
- 只載入 managed baseline,並保留 project-specific instructions 的權威性。
9
+ Project agy 使用 managed supplemental `GEMINI.md` routing block 與
10
+ `.agent-ops/GEMINI.md` baseline;這符合 agy CLI 官方文件所述,啟動時會讀取
11
+ workspace root `GEMINI.md` `AGENTS.md`。Codex 與 opencode 共用
12
+ `AGENTS.md` route 與 `.agent-ops/AGENTS.md` artifact。這些 block 只載入
13
+ managed baseline,並保留 project-specific instructions 的權威性。
12
14
  Claude 使用對應的 `CLAUDE.md` route 與 `.agent-ops/CLAUDE.md` artifact。Opencode 另外取得
13
15
  agent-ops 擁有的 `.opencode/plugins/agent-ops.js`;不會修改 `opencode.json`。
14
16
  Plugin 使用安裝時的 absolute runtime path 產生,因此請透過
15
17
  `agent-ops update` 更新,不要手動編輯。
16
18
 
17
- User scope 下,Codex opencode routing file 分別位於 `.codex/` 與
18
- `.opencode/`;global opencode plugin 預設位於 `.config/opencode/plugins/`,
19
+ User scope 下,agy 使用 `.agent-ops/GEMINI.md` 與共用 Gemini surface
20
+ `.gemini/GEMINI.md`;Codex opencode routing file 分別位於 `.codex/` 與
21
+ `.opencode/`。Global opencode plugin 預設位於 `.config/opencode/plugins/`,
19
22
  若 `$XDG_CONFIG_HOME` 指向 managed user root 內的目錄,則改用
20
23
  `$XDG_CONFIG_HOME/opencode/plugins/`。若 OpenCode 設定了
21
24
  `$OPENCODE_CONFIG_DIR`,則 plugin 會放在其 `plugins/` 目錄。只有 profile
@@ -46,7 +49,7 @@ Claude 與 Codex lifecycle support 為 `supported`,OpenCode 從 app initializa
46
49
  `--task` 使用 task criteria,並要求必要驗證的最新 PASS evidence。完整 report
47
50
  會顯示給人看,PASS 後只持久化 source-fingerprint attestation。
48
51
 
49
- 每次嘗試都從新的暫存 cwd 與原生唯讀模式啟動。Claude 使用完整 safe-mode
52
+ 每次嘗試都從全新 session、一次性 repository clone 與原生唯讀模式啟動。Claude 使用完整 safe-mode
50
53
  隔離;Codex 與 Agy 為了支援既有 OAuth 登入而保留登入環境,因此 context
51
54
  隔離較弱。Agy 會取得一次性 clone,即使 sandboxed plan mode 寫入 cwd,也無法
52
55
  修改來源 repository:
@@ -57,6 +60,10 @@ Claude 與 Codex lifecycle support 為 `supported`,OpenCode 從 app initializa
57
60
  | `agy` | `agy --print <prompt>` | `--sandbox --mode plan` |
58
61
  | `claude` | `claude -p` | `--permission-mode plan --safe-mode` |
59
62
 
63
+ review chain 優先選擇不同於 hosting CLI 的 target。沒有其他可用 target 時,才允許
64
+ 全新的同 CLI session,但輸出會標示 `DEGRADED: isolated self-review`;不得 resume
65
+ 開發 session。
66
+
60
67
  `opencode` **不是** review 目標,即使它是支援的 harness。它的 `--agent plan`
61
68
  會被判定為 subagent 而遭拒,並靜默退回可寫入的 agent,因此無法滿足唯讀前置
62
69
  條件。沒有唯讀旗標的目標會被跳過,不會在無沙箱狀態下執行。
@@ -121,7 +128,26 @@ launcher。Codex 只會在 `.codex/config.toml` 不存在時建立它。首次
121
128
  `loop-state.md` 與 `loop-telemetry.jsonl`;並以 hash-commented `.gitignore`
122
129
  block 忽略這些 local file。
123
130
 
124
- Loop 會執行 `SessionStart`、`UserPromptSubmit`、`PreToolUse`、
131
+ agy 會安裝原生 `PreInvocation` 與 `PreToolUse(run_command)` 子集,doctor
132
+ 會將 loop 標示為 degraded。Project hook 位於 `.agents/hooks.json`,user hook
133
+ 位於 `.gemini/config/hooks.json`;user scope 會修改共享 Gemini rule surface
134
+ `.gemini/GEMINI.md`。機器可讀的 `/hooks` 診斷要求 agy 1.1.12 以上。
135
+
136
+ `agy` 搭配 `loop` 時,互動式 installer 會建議啟用
137
+ `features.completionGate.enabled`;非互動安裝必須明確傳入
138
+ `--completion-gate`。閘門使用官方定義的 `conversationId`、
139
+ `terminationReason` 與 `fullyIdle` Stop 欄位,只有在本次 conversation 產生
140
+ Git-visible net change 且缺少當前 task、驗證或 review 證據時,才回傳官方定義的
141
+ `decision: "continue"`。純問答、分析、唯讀診斷、錯誤、max-step 與 non-idle Stop
142
+ 都正常結束;本版不改變 Codex、Claude Code 或 OpenCode 的 Stop 行為。Headless
143
+ 請使用 `agent-ops agy-run -- <agy arguments>`;使用者可核准一次
144
+ `agent-ops allow-stop --session <conversationId>`,該命令由官方定義的
145
+ `force_ask` 強制詢問。
146
+
147
+ 官方依據:[agy CLI workspace rule file](https://www.antigravity.google/docs/cli/best-practices/)
148
+ 與 [Antigravity hook contract](https://www.antigravity.google/docs/hooks/)。
149
+
150
+ 完整 Codex/Claude loop 會執行 `SessionStart`、`UserPromptSubmit`、`PreToolUse`、
125
151
  `PermissionRequest`、`PostToolUse`、`PreCompact`、`PostCompact`、
126
152
  `SubagentStart` 與 `SubagentStop`,但永遠不加入 `Stop`。它只攔截
127
153
  high-confidence 的 literal secret prompt 或 Bash command,以及危險 Bash command
@@ -154,8 +180,8 @@ hook 文件](https://code.claude.com/docs/en/hooks)。
154
180
  OpenCode `tool.execute.before` plugin 可在其支援的 Bash surface
155
181
  上 throw 文件化的 command-policy denial 或 unavailable-runtime error。Codex 明確
156
182
  不執行強制措施(`unknown`)。這些是 agent-ops 的 output 與 plugin contract,不
157
- 證明 host 會實際遵守 denial。所有 adapter 的 `SessionStart` `Stop` failure path
158
- 都維持 fail-open。
183
+ 證明 host 會實際遵守 denial。所有 `SessionStart` 與一般 Stop verification failure
184
+ path 都維持 fail-open;只有明確啟用的 agy completion gate 會在 final Stop fail-closed
159
185
 
160
186
  Claude 的無效 config fallback 有四項防護:(1) 缺少 project configuration 時保持
161
187
  fail-open,因此只有無效的 `.agent-ops/config.json` 能進入 fallback;(2) manifest
@@ -166,7 +192,7 @@ hook-process environment 讀取,不能由 agent-ops configuration、manifest
166
192
  managed file 設定。
167
193
 
168
194
  `guardrails` 只安裝 command policy,不會啟用 Stop verification。Stop 是獨立的
169
- config v2 feature,必須明確啟用且至少提供一個已確認的 command:
195
+ config v3 feature,必須明確啟用且至少提供一個已確認的 command:
170
196
 
171
197
  ```json
172
198
  {
@@ -215,6 +241,10 @@ config-hash 與 timestamp evidence,且永遠不會完成 task。Config v1 會
215
241
  `agent-ops update --harness`;shared path 會繼續受管理,被移除 harness
216
242
  擁有的 artifact、marker 與 hook 則會被安全同步。
217
243
 
244
+ 若只要移除單一已整合 harness,可使用
245
+ `agent-ops uninstall --harness agy`(或其他已安裝 id)。剩餘 manifest 與
246
+ shared path 會保留;省略 `--harness` 才會移除整套 managed installation。
247
+
218
248
  使用舊版 canonical routing wording 的 installation 會由
219
249
  `agent-ops update` 遷移;若 managed block 曾被修改,指令會 fail closed,
220
250
  直到該變更被檢查。
@@ -2,11 +2,13 @@
2
2
 
3
3
  此目錄是英文規範的繁體中文導讀;規範 rule ID 以英文版本為準。
4
4
 
5
- Harness adapter 規則涵蓋 Codex、Claude Code 與 opencode。opencode 整合是
6
- 產生的 local plugin,不管理 `opencode.json`。
5
+ Harness adapter 規則涵蓋 agy、Codex、Claude Code 與 opencode。opencode 整合是
6
+ 產生的 local plugin,不管理 `opencode.json`。agy 在 project scope 使用
7
+ `GEMINI.md` routing 與原生 hooks,對不足以完整支援 loop 的 lifecycle
8
+ 能力明確標示 degraded。
7
9
 
8
- Configuration 與 manifest 分開版本化。Config v1 會遷移為預設 disabled Stop
9
- verification 的 config v2;變更 capability 後必須執行經確認的 project
10
+ Configuration 與 manifest 分開版本化。舊 config 會遷移為 Stop verification 與
11
+ agy completion gate 預設 disabled 的 config v3;變更 capability 後必須執行經確認的 project
10
12
  `agent-ops update`,有 verifier 時會一併更新 trust。Stop verification 必須明確啟用、具備 trust、
11
13
  為 report-only,且永遠不會完成 task。Dry-run plan 會隱藏 foreign settings
12
14
  內容;routing migration 一旦套用即為單向。
@@ -2,7 +2,7 @@
2
2
 
3
3
  English source version: 2026-08-03. Revalidate: when the English specification or any vendor reference changes.
4
4
 
5
- 本文件所述 OpenCode plugin 行為已於 2026-07-31 依據[官方 plugin 文件](https://opencode.ai/docs/plugins/)與[Bun shell 文件](https://bun.sh/docs/runtime/shell)檢查;Codex 與 Claude Code loop-hook 行為已於 2026-08-03 依據 [Codex hook 文件](https://developers.openai.com/codex/config-advanced#hooks) 與 [Claude Code hook 文件](https://code.claude.com/docs/en/hooks) 檢查。
5
+ 本文件所述 OpenCode plugin 行為已於 2026-07-31 依據[官方 plugin 文件](https://opencode.ai/docs/plugins/)與[Bun shell 文件](https://bun.sh/docs/runtime/shell)檢查;Codex 與 Claude Code loop-hook 行為已於 2026-08-03 依據 [Codex hook 文件](https://developers.openai.com/codex/config-advanced#hooks) 與 [Claude Code hook 文件](https://code.claude.com/docs/en/hooks) 檢查;agy hook 行為已於 2026-08-28 依據[官方 Antigravity hook 文件](https://antigravity.google/docs/hooks) 檢查。任何 vendor 參考變更時都必須重新驗證。
6
6
 
7
7
  ## HARNESS-ADAPTER-001
8
8
 
@@ -68,13 +68,15 @@ event、native output encode 與 runtime-failure output。
68
68
  ## HARNESS-ADAPTER-006
69
69
 
70
70
  Project-local `loop` profile MUST 是 opt-in、project scoped,並在最小的 Codex 與
71
- Claude Code launcher 後使用同一個 shared runtime。它 MUST NOT 將 policy 複製到
72
- project-specific script,也不得改變一般 permission request。
71
+ Claude Code launcher 後使用同一個 shared runtime;agy 使用原生支援的 lifecycle
72
+ 子集,並明確回報為 degraded。它 MUST NOT 將 policy 複製到 project-specific
73
+ script,也不得改變一般 permission request。
73
74
 
74
- - Trigger: Project 以 Codex、Claude Code 或兩者選擇 `loop`。
75
+ - Trigger: Project 以 agy、Codex、Claude Code 或任意組合選擇 `loop`。
75
76
  - Action: 只產生選定的 `.codex/hooks/agent-ops-loop.sh` 與/或 Claude 的
76
77
  `.claude/hooks/agent-ops-loop.sh`、`.claude/hooks/agent-ops-loop.ps1` launcher,註冊文件化的 loop lifecycle event
77
- (不含 `Stop`),並保留 foreign hook group。只在 `UserPromptSubmit` 或 Bash
78
+ (不含 `Stop`),並保留 foreign hook group。agy 只註冊原生
79
+ `PreInvocation`/`PreToolUse(run_command)` hook,不產生 shell launcher。只在 `UserPromptSubmit` 或 Bash
78
80
  `PreToolUse` 的 high-confidence literal credential,以及 `PreToolUse` 的危險 Bash command 時,使用
79
81
  文件化的 native denial shape 進行 blocking。對 `PermissionRequest`(包括
80
82
  escalated permission)不得輸出 decision。
@@ -86,11 +88,12 @@ project-specific script,也不得改變一般 permission request。
86
88
 
87
89
  目前 registration matrix 刻意不對稱:
88
90
 
89
- | Capability | Codex | Claude Code | OpenCode |
90
- | --- | --- | --- | --- |
91
- | lifecycle-summary | supported | supported | degraded |
92
- | command-policy | unknown | supported | supported |
93
- | optional-stop-verify | unsupported | supported | degraded |
91
+ | Capability | agy | Codex | Claude Code | OpenCode |
92
+ | --- | --- | --- | --- | --- |
93
+ | lifecycle-summary | degraded | supported | supported | degraded |
94
+ | command-policy | supported | unknown | supported | supported |
95
+ | completion-gate | supported | unsupported | unsupported | unsupported |
96
+ | optional-stop-verify | degraded | unsupported | supported | degraded |
94
97
 
95
98
  Runtime-failure 處理中,只有 `command-policy` 為 fail-closed。當已安裝的 config
96
99
  被分類為無效時,Claude Code 可輸出文件化的 `PreToolUse` denial shape;受管理的
@@ -99,6 +102,14 @@ denial 或 unavailable-runtime error。Codex 維持 `unknown` 且絕不輸出 de
99
102
  Fixture test 只斷言這些 wire 與 plugin shape;它們不證明 host 會實際遵守 denial。
100
103
  每個 `SessionStart` 與 `Stop` failure path 都維持 fail-open。
101
104
 
105
+ agy adapter 在 project scope 使用原生 `GEMINI.md` routing 到
106
+ `.agent-ops/GEMINI.md`;user
107
+ scope 管理 `.agent-ops/GEMINI.md` 與 shared `.gemini/GEMINI.md` rule surface。
108
+ 其 native hook 使用 camelCase input,command-policy block 回傳
109
+ `decision: "deny"`。只有明確啟用 completion gate 時,未具完備證據的 final
110
+ changed conversation 才回傳 `decision: "continue"`;唯讀 conversation 正常
111
+ 結束。在 Windows 透過 `cmd /c` 呼叫產生的 command。
112
+
102
113
  Stop verification 必須明確啟用、具備 trust、為 report-only 且預設 disabled。
103
114
  每個 Stop 結果都會讓 native harness 繼續,最多攜帶有界 command evidence,永遠
104
115
  不是 task-completion evidence。
@@ -42,6 +42,11 @@ review target MUST 以其自身的唯讀機制啟動;沒有唯讀機制的 tar
42
42
  - Positive: `agy 使用 sandboxed plan mode;opencode 仍不合格。`
43
43
  - Negative: `信任 prompt 能阻止審查者修改檔案。`
44
44
 
45
+ 每次 review 都 MUST 使用全新 session(`sessionIsolation: "fresh"`)並在
46
+ disposable repository clone 中執行。review chain 優先選擇不同於 hosting CLI 的
47
+ target;沒有其他可用 target 時,才允許同 CLI 的 fresh review,但輸出 MUST 明確
48
+ 標示 `DEGRADED: isolated self-review`。不得 resume 開發 session 作為獨立審查。
49
+
45
50
  ## REVIEW-CHAIN-001
46
51
 
47
52
  已設定的 targets 組成有序後備鏈,MUST 僅在「沒有審到」時換下一家,且 MUST NOT 在取得判定後繼續往下試。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kylecheng3146/agent-ops",
3
- "version": "0.1.19",
4
- "description": "Evidence-driven development loops for Codex, Claude Code, and opencode",
3
+ "version": "0.1.21",
4
+ "description": "Evidence-driven development loops for agy, Codex, Claude Code, and opencode",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": "github:kylecheng3146/agent-ops",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "properties": {
16
16
  "schemaVersion": {
17
- "const": 2
17
+ "const": 3
18
18
  },
19
19
  "profiles": {
20
20
  "type": "array",
@@ -75,8 +75,18 @@
75
75
  "features": {
76
76
  "type": "object",
77
77
  "additionalProperties": false,
78
- "required": ["stopVerification"],
78
+ "required": ["completionGate", "stopVerification"],
79
79
  "properties": {
80
+ "completionGate": {
81
+ "type": "object",
82
+ "additionalProperties": false,
83
+ "required": ["enabled"],
84
+ "properties": {
85
+ "enabled": {
86
+ "type": "boolean"
87
+ }
88
+ }
89
+ },
80
90
  "stopVerification": {
81
91
  "type": "object",
82
92
  "additionalProperties": false,
@@ -17,7 +17,7 @@
17
17
  "minItems": 1,
18
18
  "uniqueItems": true,
19
19
  "items": {
20
- "enum": ["codex", "claude", "opencode"]
20
+ "enum": ["agy", "codex", "claude", "opencode"]
21
21
  }
22
22
  },
23
23
  "artifacts": {
@@ -127,7 +127,7 @@
127
127
  "$ref": "#/$defs/relativePath"
128
128
  },
129
129
  "harness": {
130
- "enum": ["codex", "claude"]
130
+ "enum": ["agy", "codex", "claude"]
131
131
  },
132
132
  "events": {
133
133
  "type": "array",