@kylecheng3146/agent-ops 0.1.4 → 0.1.6
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 +164 -13
- package/dist/packages/cli/src/args.js +40 -7
- package/dist/packages/cli/src/bin.js +35 -11
- package/dist/packages/cli/src/cli.js +7 -2
- package/dist/packages/cli/src/codex-loop-process.js +70 -0
- package/dist/packages/cli/src/commands/doctor.js +31 -9
- package/dist/packages/cli/src/commands/hook.js +33 -16
- package/dist/packages/cli/src/commands/init.js +9 -5
- package/dist/packages/cli/src/commands/review.js +5 -1
- package/dist/packages/cli/src/commands/uninstall.js +6 -5
- package/dist/packages/cli/src/commands/update.js +16 -5
- package/dist/packages/cli/src/context.js +69 -3
- package/dist/packages/cli/src/hook-process.js +231 -16
- package/dist/packages/cli/src/loop-entry.js +8 -0
- package/dist/packages/cli/src/plan-output.js +9 -4
- package/dist/packages/cli/src/public-plan.js +62 -0
- package/dist/packages/cli/src/version.js +1 -1
- package/dist/packages/cli/src/wizard.js +36 -15
- package/dist/runtime/src/adapters/claude/config.js +57 -19
- package/dist/runtime/src/adapters/claude/events.js +33 -0
- package/dist/runtime/src/adapters/claude/output.js +8 -7
- package/dist/runtime/src/adapters/claude/surfaces.js +70 -0
- package/dist/runtime/src/adapters/codex/config.js +66 -13
- package/dist/runtime/src/adapters/codex/events.js +33 -0
- package/dist/runtime/src/adapters/codex/output.js +10 -0
- package/dist/runtime/src/adapters/codex/surfaces.js +12 -0
- package/dist/runtime/src/adapters/opencode/config.js +170 -0
- package/dist/runtime/src/adapters/opencode/events.js +49 -0
- package/dist/runtime/src/adapters/opencode/input.js +32 -0
- package/dist/runtime/src/adapters/opencode/output.js +23 -0
- package/dist/runtime/src/adapters/opencode/surfaces.js +23 -0
- package/dist/runtime/src/config/explain.js +7 -0
- package/dist/runtime/src/config/hash.js +24 -0
- package/dist/runtime/src/config/merge.js +6 -2
- package/dist/runtime/src/config/migrate.js +19 -4
- package/dist/runtime/src/contracts.js +10 -1
- package/dist/runtime/src/fs/managed-block.js +35 -18
- package/dist/runtime/src/fs/manifest.js +32 -1
- package/dist/runtime/src/fs/transaction.js +14 -2
- package/dist/runtime/src/hooks/advisory.js +16 -0
- package/dist/runtime/src/hooks/codex-loop.js +439 -0
- package/dist/runtime/src/hooks/stop-service.js +70 -0
- package/dist/runtime/src/hooks/stop-verify.js +4 -1
- package/dist/runtime/src/install/codex-loop.js +139 -0
- package/dist/runtime/src/install/doctor.js +182 -14
- package/dist/runtime/src/install/harness.js +294 -35
- package/dist/runtime/src/install/hooks.js +22 -17
- package/dist/runtime/src/install/ownership.js +146 -35
- package/dist/runtime/src/install/plan.js +276 -31
- package/dist/runtime/src/install/probes.js +9 -43
- package/dist/runtime/src/install/profiles.js +12 -3
- package/dist/runtime/src/install/surface-inspection.js +296 -0
- package/dist/runtime/src/install/surfaces.js +11 -0
- package/dist/runtime/src/install/uninstall.js +11 -4
- package/dist/runtime/src/install/update.js +13 -3
- package/dist/runtime/src/logging/local-log.js +25 -0
- package/dist/runtime/src/schema/validate.js +45 -19
- package/dist/runtime/src/task/service.js +3 -3
- package/dist/runtime/src/task/store.js +12 -3
- package/dist/runtime/src/verify/command-executor.js +113 -0
- package/dist/runtime/src/verify/evidence.js +4 -24
- package/dist/runtime/src/verify/service.js +20 -92
- package/dist/runtime/src/verify/spawn.js +6 -1
- package/docs/en/guides/configuration.md +159 -0
- package/docs/en/guides/quickstart.md +9 -0
- package/docs/en/guides/security.md +5 -0
- package/docs/en/spec/README.md +9 -0
- package/docs/en/spec/harness-adapters.md +104 -2
- package/docs/en/spec/maintenance.md +11 -0
- package/docs/en/spec/review.md +11 -0
- package/docs/zh-TW/guides/configuration.md +145 -0
- package/docs/zh-TW/guides/quickstart.md +9 -0
- package/docs/zh-TW/guides/security.md +5 -0
- package/docs/zh-TW/spec/README.md +9 -0
- package/docs/zh-TW/spec/harness-adapters.md +89 -3
- package/docs/zh-TW/spec/maintenance.md +11 -1
- package/docs/zh-TW/spec/review.md +10 -0
- package/package.json +4 -2
- package/schemas/config.schema.json +56 -2
- package/schemas/manifest.schema.json +19 -3
- package/templates/common/AGENTS.block.md +2 -1
- package/templates/common/CLAUDE.block.md +2 -1
- package/dist/runtime/src/review/claude-runner.js +0 -4
- package/dist/runtime/src/review/codex-runner.js +0 -4
package/docs/en/spec/review.md
CHANGED
|
@@ -19,3 +19,14 @@ A review result MUST preserve PASS, FAIL, or NOT_RUN and MUST NOT convert NOT_RU
|
|
|
19
19
|
- Evidence: The result states harness, configured model or limitation, effort, and reason.
|
|
20
20
|
- Positive: `NOT_RUN: login required; prompt is copyable.`
|
|
21
21
|
- Negative: `No reviewer ran, but mark the change PASS.`
|
|
22
|
+
|
|
23
|
+
## REVIEW-HARNESS-001
|
|
24
|
+
|
|
25
|
+
A review invocation MUST resolve to exactly one concrete harness, even when an
|
|
26
|
+
installation supports multiple harnesses.
|
|
27
|
+
|
|
28
|
+
- Trigger: Running `review` with a harness selection.
|
|
29
|
+
- Action: Select one of `codex`, `claude`, or `opencode`; keep multi-harness installation separate from review execution.
|
|
30
|
+
- Evidence: Argument parsing rejects `all`, `both`, and comma-separated multi-harness values for review.
|
|
31
|
+
- Positive: `review --harness opencode` resolves one harness.
|
|
32
|
+
- Negative: `Run one review invocation against every installed harness implicitly.`
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# 設定
|
|
2
|
+
|
|
3
|
+
保持 project 設定明確且分層。請刻意選擇 scope、harness 與 profile;不要從 `--yes` 推論 trust 或安全例外。
|
|
4
|
+
|
|
5
|
+
使用 `--harness all` 選取 Codex、Claude Code 與 opencode,或傳入
|
|
6
|
+
`codex,opencode` 這類逗號分隔的子集。`both` 仍是 legacy Codex 加 Claude
|
|
7
|
+
selection 的 input alias。
|
|
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 的權威性。
|
|
12
|
+
Claude 使用對應的 `CLAUDE.md` route 與 `.agent-ops/CLAUDE.md` artifact。Opencode 另外取得
|
|
13
|
+
agent-ops 擁有的 `.opencode/plugins/agent-ops.js`;不會修改 `opencode.json`。
|
|
14
|
+
Plugin 使用安裝時的 absolute runtime path 產生,因此請透過
|
|
15
|
+
`agent-ops update` 更新,不要手動編輯。
|
|
16
|
+
|
|
17
|
+
User scope 下,Codex 與 opencode 的 routing file 分別位於 `.codex/` 與
|
|
18
|
+
`.opencode/`;global opencode plugin 預設位於 `.config/opencode/plugins/`,
|
|
19
|
+
若 `$XDG_CONFIG_HOME` 指向 managed user root 內的目錄,則改用
|
|
20
|
+
`$XDG_CONFIG_HOME/opencode/plugins/`。若 OpenCode 設定了
|
|
21
|
+
`$OPENCODE_CONFIG_DIR`,則 plugin 會放在其 `plugins/` 目錄。只有 profile
|
|
22
|
+
有暗示時才會註冊 advisory 與 guardrail hook。Installer 會 discovery 可寫入的
|
|
23
|
+
harness surface 並套用選定的 target policy;若不是 managed default,請使用
|
|
24
|
+
`--hook-target <harness>=<surface-id>` 明確選擇。Project-local Claude hook 預設
|
|
25
|
+
使用 `.claude/settings.json`;只有要使用 `.claude/settings.local.json` 時才需
|
|
26
|
+
明確選擇。Advisory 會經由真正的 SessionStart path 執行並 fail-open;
|
|
27
|
+
Claude 與 Codex lifecycle support 為 `supported`,OpenCode 從 app initialization
|
|
28
|
+
開始,因此誠實標示為 `degraded`。
|
|
29
|
+
|
|
30
|
+
### Project-local loop profile
|
|
31
|
+
|
|
32
|
+
`--profile loop` 是明確 opt-in 的 project-scope profile。請選擇 `codex`、
|
|
33
|
+
`claude` 或兩者(例如 `--harness codex,claude`);它需要 POSIX-compatible
|
|
34
|
+
`bash`,目前尚未支援 Windows launcher。建議先 dry run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
agent-ops init --dry-run --scope project --harness codex,claude --profile loop --json
|
|
38
|
+
agent-ops init --scope project --harness codex,claude --profile loop --yes
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
對每個選定且支援的 harness,agent-ops 只擁有一個小型 launcher:
|
|
42
|
+
`.codex/hooks/agent-ops-loop.sh` 或 `.claude/hooks/agent-ops-loop.sh`。兩個
|
|
43
|
+
launcher 都委派給同一個已安裝的 Node runtime,因此不會複製 project-specific
|
|
44
|
+
loop script。Codex 只會在 `.codex/config.toml` 不存在時建立它。首次安裝會在不
|
|
45
|
+
覆寫既有內容的前提下,於選定 harness directory 建立 `loop-goal.md`、
|
|
46
|
+
`loop-state.md` 與 `loop-telemetry.jsonl`;並以 hash-commented `.gitignore`
|
|
47
|
+
block 忽略這些 local file。
|
|
48
|
+
|
|
49
|
+
Loop 會執行 `SessionStart`、`UserPromptSubmit`、`PreToolUse`、
|
|
50
|
+
`PermissionRequest`、`PostToolUse`、`PreCompact`、`PostCompact`、
|
|
51
|
+
`SubagentStart` 與 `SubagentStop`,但永遠不加入 `Stop`。它只攔截
|
|
52
|
+
high-confidence 的 literal secret prompt 或 Bash command,以及危險 Bash command
|
|
53
|
+
(包括 broad recursive deletion 與 `git reset --hard`)。Codex 使用原生 exit-code blocking
|
|
54
|
+
mechanism;Claude Code 則取得文件化的 native JSON decision shape。
|
|
55
|
+
`PermissionRequest`(包括 `sandbox_permissions: "require_escalated"`)只記錄
|
|
56
|
+
outcome,不會輸出 allow 或 deny decision,因此 host 原本的 approval flow 保持
|
|
57
|
+
權威。
|
|
58
|
+
|
|
59
|
+
Session context、telemetry 與 compaction state 都受到明確上限。Telemetry 只含
|
|
60
|
+
timestamp、event、outcome 與 rule identifier,不會存 raw prompt、command 或
|
|
61
|
+
credential,並依 byte size rotation。PreCompact 的 Git-status snapshot 會先
|
|
62
|
+
redact,再寫入 `loop-state.md` 的專用 block,周圍的 user content 保持不變。
|
|
63
|
+
installer update 與 uninstall 只管理 launcher、native handler registration 與
|
|
64
|
+
精確的 `.gitignore` block;goal、state、telemetry 與 `config.toml` 都保留為 local
|
|
65
|
+
user file。若既有 `.codex/config.toml` 明確寫有 `[features]` 後的
|
|
66
|
+
`hooks = false`,planning 會在任何 write 之前以
|
|
67
|
+
`CODEX_LOOP_HOOKS_DISABLED` 停止。
|
|
68
|
+
|
|
69
|
+
Codex 與 Claude Code 對這些 generated handler 仍須走各自正常的 project-hook
|
|
70
|
+
trust/review flow。Loop 是聚焦的 guardrail,不是完整 sandbox、permission bypass
|
|
71
|
+
或 Stop-verification feature。啟用前請閱讀 [Codex hook
|
|
72
|
+
文件](https://developers.openai.com/codex/config-advanced#hooks)與 [Claude Code
|
|
73
|
+
hook 文件](https://code.claude.com/docs/en/hooks)。
|
|
74
|
+
|
|
75
|
+
### Runtime-failure 保護措施
|
|
76
|
+
|
|
77
|
+
對一般 `guardrails` profile 而言,只有 `command-policy` 具有 fail-closed failure mode。當已安裝的 config 被分類
|
|
78
|
+
為無效時,Claude Code 可在原生 `PreToolUse` 輸出文件化的 denial shape。受管理的
|
|
79
|
+
OpenCode `tool.execute.before` plugin 可在其支援的 Bash surface
|
|
80
|
+
上 throw 文件化的 command-policy denial 或 unavailable-runtime error。Codex 明確
|
|
81
|
+
不執行強制措施(`unknown`)。這些是 agent-ops 的 output 與 plugin contract,不
|
|
82
|
+
證明 host 會實際遵守 denial。所有 adapter 的 `SessionStart` 與 `Stop` failure path
|
|
83
|
+
都維持 fail-open。
|
|
84
|
+
|
|
85
|
+
Claude 的無效 config fallback 有四項防護:(1) 缺少 project configuration 時保持
|
|
86
|
+
fail-open,因此只有無效的 `.agent-ops/config.json` 能進入 fallback;(2) manifest
|
|
87
|
+
必須安全地證明目前 harness 已安裝;(3) 使用者可在啟動 host 前於 shell export
|
|
88
|
+
`AGENT_OPS_DISABLE=1`,暫時恢復 fail-open;(4) Claude Code denial 會列出 config
|
|
89
|
+
path,並告知使用者修正它或暫時設定該 shell variable。此 variable 只從
|
|
90
|
+
hook-process environment 讀取,不能由 agent-ops configuration、manifest 或
|
|
91
|
+
managed file 設定。
|
|
92
|
+
|
|
93
|
+
`guardrails` 只安裝 command policy,不會啟用 Stop verification。Stop 是獨立的
|
|
94
|
+
config v2 feature,必須明確啟用且至少提供一個已確認的 command:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"features": { "stopVerification": { "enabled": true } },
|
|
99
|
+
"verification": {
|
|
100
|
+
"commands": [
|
|
101
|
+
{
|
|
102
|
+
"id": "unit",
|
|
103
|
+
"command": "npm",
|
|
104
|
+
"args": ["test"],
|
|
105
|
+
"cwd": ".",
|
|
106
|
+
"required": true,
|
|
107
|
+
"evidence": { "kind": "test-count", "minimum": 1 }
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
變更此 feature 會改變 native registration,請依序執行:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
agent-ops update
|
|
118
|
+
agent-ops trust grant
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
未執行 `update` 時,doctor 可因 registration drift 回報 `UPDATE_REQUIRED`。另
|
|
122
|
+
外,toolkit upgrade 或 effective profile 或 capability change 使完整的
|
|
123
|
+
path-independent managed rules artifact 改變時,`artifact-staleness` 會回報帶有
|
|
124
|
+
`UPDATE_REQUIRED` 的 `DEGRADED`。`agent-ops update` 會重新產生 artifact 並清除
|
|
125
|
+
這個結果;artifact 缺失或 hash 不符時,`artifacts` check 仍為 `FAIL`。未重新
|
|
126
|
+
grant trust 時,trust-gated hook 仍會是 stale。Stop 是 report-only:`PASS`、`FAIL`
|
|
127
|
+
與 `UNKNOWN` 都會讓 harness 繼續,只輸出有界的 command ID、exit code、test-count、
|
|
128
|
+
config-hash 與 timestamp evidence,且永遠不會完成 task。Config v1 會決定性遷移
|
|
129
|
+
為 Stop disabled 的 v2;舊 binary 無法讀取遷移後的 config,routing migration
|
|
130
|
+
一旦套用即為單向,降版前請先閱讀 release notes。
|
|
131
|
+
|
|
132
|
+
若要縮減既有 installation,請將目標清單傳給
|
|
133
|
+
`agent-ops update --harness`;shared path 會繼續受管理,被移除 harness
|
|
134
|
+
擁有的 artifact、marker 與 hook 則會被安全同步。
|
|
135
|
+
|
|
136
|
+
使用舊版 canonical routing wording 的 installation 會由
|
|
137
|
+
`agent-ops update` 遷移;若 managed block 曾被修改,指令會 fail closed,
|
|
138
|
+
直到該變更被檢查。
|
|
139
|
+
|
|
140
|
+
Dry-run 的 human 與 JSON plan 不會輸出原始 harness settings 內容,只提供
|
|
141
|
+
expected hash、content hash 與安全摘要;internal apply plan 仍保留完整合併後的設定。
|
|
142
|
+
Manifest 維持 schema v2。
|
|
143
|
+
|
|
144
|
+
新增驗證命令時使用[驗收與證據規則](../../en/spec/acceptance-and-evidence.md),
|
|
145
|
+
設定 Codex、Claude Code 或 opencode 行為時使用[adapter 規則](../../en/spec/harness-adapters.md)。
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
此目錄是英文規範的繁體中文導讀;規範 rule ID 以英文版本為準。
|
|
4
4
|
|
|
5
|
+
Harness adapter 規則涵蓋 Codex、Claude Code 與 opencode。opencode 整合是
|
|
6
|
+
產生的 local plugin,不管理 `opencode.json`。
|
|
7
|
+
|
|
8
|
+
Configuration 與 manifest 分開版本化。Config v1 會遷移為預設 disabled Stop
|
|
9
|
+
verification 的 config v2;變更 capability 後必須先執行 `agent-ops update`,
|
|
10
|
+
再執行 `agent-ops trust grant`。Stop verification 必須明確啟用、具備 trust、
|
|
11
|
+
為 report-only,且永遠不會完成 task。Dry-run plan 會隱藏 foreign settings
|
|
12
|
+
內容;routing migration 一旦套用即為單向。
|
|
13
|
+
|
|
5
14
|
- [迴圈工程](./loop-engineering.md)
|
|
6
15
|
- [驗收與證據](./acceptance-and-evidence.md)
|
|
7
16
|
- [判斷](./judgment.md)
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# Harness Adapter
|
|
2
2
|
|
|
3
|
-
English source version: 2026-
|
|
3
|
+
English source version: 2026-08-03. Revalidate: when the English specification or any vendor reference changes.
|
|
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) 檢查。
|
|
4
6
|
|
|
5
7
|
## HARNESS-ADAPTER-001
|
|
6
8
|
|
|
7
|
-
Adapter MUST 保留原生 harness
|
|
9
|
+
Adapter MUST 保留原生 harness 語意,並為每項 capability 宣告
|
|
10
|
+
supported、degraded、unsupported 或 unknown。
|
|
8
11
|
|
|
9
12
|
- Trigger: 將可攜 lifecycle 或 review 行為映射到原生 harness。
|
|
10
13
|
- Action: 保持 ownership 狹窄、保留使用者設定並記錄限制。
|
|
11
|
-
- Evidence: adapter
|
|
14
|
+
- Evidence: adapter 測試涵蓋既有設定、support 宣告與原生 failure 行為。
|
|
12
15
|
- Positive: `Codex blocking outcome 未確認原生 denial 時保持 UNKNOWN。`
|
|
13
16
|
- Negative: `假設 Claude exit semantics 適用 Codex。`
|
|
14
17
|
|
|
@@ -21,3 +24,86 @@ Adapter MUST 具備冪等性,且 MUST NOT 刪除使用者擁有的 handler。
|
|
|
21
24
|
- Evidence: 既有設定 fixture 在 apply 與 uninstall 後保持完整。
|
|
22
25
|
- Positive: `更新 managed handler,無關 handler 仍逐位元存在。`
|
|
23
26
|
- Negative: `以 toolkit defaults 取代整份 settings。`
|
|
27
|
+
|
|
28
|
+
## HARNESS-ADAPTER-003
|
|
29
|
+
|
|
30
|
+
檔案型 adapter MUST 只註冊 active capabilities 所暗示的 hook,且 MUST 將產生的 source 當成一個 whole-file artifact 管理。
|
|
31
|
+
|
|
32
|
+
- Trigger: 安裝或探測 extension point 是 plugin 檔案的 harness。
|
|
33
|
+
- Action: 對 opencode 在 project 管理 `.opencode/plugins/agent-ops.js`、在 user scope 預設管理 `.config/opencode/plugins/agent-ops.js`(若 `$XDG_CONFIG_HOME` 指向 managed user root 內的目錄,則使用其下的 `opencode/plugins/agent-ops.js`;若設定原生 `$OPENCODE_CONFIG_DIR`,則使用其下的 `plugins/agent-ops.js`),不修改 `opencode.json`;project `AGENTS.md` 的 contribution 依 path 去重。
|
|
34
|
+
- Evidence: manifest 含 plugin hash,產生的 source 只含選定的 hook,shared project marker 只出現一次。
|
|
35
|
+
- Positive: `codex,opencode` 產生一個 project AGENTS route 與一個有 hash 的 opencode plugin。
|
|
36
|
+
- Negative: `新增 opencode.json instructions entry,或在只有 core profile 時註冊 plugin。`
|
|
37
|
+
|
|
38
|
+
## HARNESS-ADAPTER-004
|
|
39
|
+
|
|
40
|
+
OpenCode shim MUST 從選定的 project directory 呼叫 absolute runtime path;runtime 不可用時,MUST 對 advisory event fail open,並 MUST throw 文件化的 command-policy error。
|
|
41
|
+
|
|
42
|
+
- Trigger: 產生的 plugin 呼叫 `agent-ops`,或收到無效的 runtime decision。
|
|
43
|
+
- Action: 將 normalization 與 native output encoding 留在 runtime adapter;deny
|
|
44
|
+
decision 要 throw 文件化的 policy reason;lifecycle-summary 經由 shared
|
|
45
|
+
advisory implementation 執行。Plugin initialization 仍是 app-scoped 而非
|
|
46
|
+
per-session,因此 per-session lifecycle fidelity 仍為 degraded。
|
|
47
|
+
- Evidence: shim import 測試涵蓋 allow、deny 與 missing-runtime;denial fixture
|
|
48
|
+
只斷言 output shape;doctor 對 OpenCode lifecycle support 回報 `DEGRADED`。
|
|
49
|
+
- Positive: `runtime 不可用時,SessionStart 維持 fail-open,而生成的 plugin 會在 Bash pre-tool hook 中 throw 文件化的 command-policy error。`
|
|
50
|
+
- Negative: `退回 PATH-resolved 的 agent-ops executable、宣稱 OpenCode host 一定會遵守 thrown denial,或宣稱 app initialization 等同於 per-session Stop。`
|
|
51
|
+
|
|
52
|
+
## HARNESS-ADAPTER-005
|
|
53
|
+
|
|
54
|
+
每個 descriptor MUST 分離 control 與 runtime adapter。control adapter 負責
|
|
55
|
+
installation plan、routing、ownership、probe 與 in-memory capability
|
|
56
|
+
registration matrix;runtime adapter 負責 native input decode、normalized
|
|
57
|
+
event、native output encode 與 runtime-failure output。
|
|
58
|
+
|
|
59
|
+
- Trigger: 新增 harness surface 或 generic capability。
|
|
60
|
+
- Action: 在所屬 harness 加入 capability-to-native registration,包含 support
|
|
61
|
+
level 與 runtime-failure mode;不得將 native event 加入 universal union。
|
|
62
|
+
- Evidence: 每個宣告為 `supported` 的 registration 都經由真實 CLI hook process
|
|
63
|
+
執行;denial-shape fixture 只斷言文件化的 wire shape,不證明 host runtime
|
|
64
|
+
enforcement;未支援的 Stop/lifecycle registration 不得回報 enforcement success。
|
|
65
|
+
- Positive: `fail-closed 的 Claude command-policy runtime failure 會透過 runHookCommand 產生文件化的 PreToolUse denial shape。`
|
|
66
|
+
- Negative: `dispatchHookEvent 尚未提供 advisory implementation 卻將 SessionStart 標為 supported。`
|
|
67
|
+
|
|
68
|
+
## HARNESS-ADAPTER-006
|
|
69
|
+
|
|
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。
|
|
73
|
+
|
|
74
|
+
- Trigger: Project 以 Codex、Claude Code 或兩者選擇 `loop`。
|
|
75
|
+
- Action: 只產生選定的 `.codex/hooks/agent-ops-loop.sh` 與/或
|
|
76
|
+
`.claude/hooks/agent-ops-loop.sh` launcher,註冊文件化的 loop lifecycle event
|
|
77
|
+
(不含 `Stop`),並保留 foreign hook group。只在 `UserPromptSubmit` 或 Bash
|
|
78
|
+
`PreToolUse` 的 high-confidence literal credential,以及 `PreToolUse` 的危險 Bash command 時,使用
|
|
79
|
+
文件化的 native denial shape 進行 blocking。對 `PermissionRequest`(包括
|
|
80
|
+
escalated permission)不得輸出 decision。
|
|
81
|
+
- Evidence: Install-plan、loop-runtime、update、uninstall 與 doctor test 覆蓋
|
|
82
|
+
generated path、Codex/Claude wire output、privacy bound、configuration conflict
|
|
83
|
+
handling、state preservation 與 registration drift。
|
|
84
|
+
- Positive: `Claude PreToolUse 的危險 Bash command 取得 native deny,而 PermissionRequest 不產生 allow 或 deny decision。`
|
|
85
|
+
- Negative: `將 project loop policy 複製到兩個 shell launcher、auto-approve sandbox escalation,或加入 loop Stop handler。`
|
|
86
|
+
|
|
87
|
+
目前 registration matrix 刻意不對稱:
|
|
88
|
+
|
|
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 |
|
|
94
|
+
|
|
95
|
+
Runtime-failure 處理中,只有 `command-policy` 為 fail-closed。當已安裝的 config
|
|
96
|
+
被分類為無效時,Claude Code 可輸出文件化的 `PreToolUse` denial shape;受管理的
|
|
97
|
+
OpenCode `tool.execute.before` plugin 可在其支援的 Bash surface 上 throw 文件化的
|
|
98
|
+
denial 或 unavailable-runtime error。Codex 維持 `unknown` 且絕不輸出 denial。
|
|
99
|
+
Fixture test 只斷言這些 wire 與 plugin shape;它們不證明 host 會實際遵守 denial。
|
|
100
|
+
每個 `SessionStart` 與 `Stop` failure path 都維持 fail-open。
|
|
101
|
+
|
|
102
|
+
Stop verification 必須明確啟用、具備 trust、為 report-only 且預設 disabled。
|
|
103
|
+
每個 Stop 結果都會讓 native harness 繼續,最多攜帶有界 command evidence,永遠
|
|
104
|
+
不是 task-completion evidence。
|
|
105
|
+
|
|
106
|
+
`loop` profile 與上方 ordinary capability matrix 分離。它只保存有界的 local
|
|
107
|
+
event metadata、回傳有界且 redacted 的 session context,並在 update 或 uninstall
|
|
108
|
+
時保留 local goal、state、telemetry 與 Codex TOML file。既有 Codex configuration
|
|
109
|
+
中清楚解析出的 `[features]` / `hooks = false` MUST 在任何 write 前拒絕 loop planning。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 維護
|
|
2
2
|
|
|
3
|
-
English source version: 2026-07-
|
|
3
|
+
English source version: 2026-07-31. Revalidate: when the English specification changes.
|
|
4
4
|
|
|
5
5
|
## MAINTAIN-BACKUP-001
|
|
6
6
|
|
|
@@ -21,3 +21,13 @@ English source version: 2026-07-23. Revalidate: when the English specification c
|
|
|
21
21
|
- Evidence: 文件含來源與 `Revalidate:` 條件。
|
|
22
22
|
- Positive: `Revalidate:vendor hook reference 變更時。`
|
|
23
23
|
- Negative: `把暫時性的 CLI flag 當永久核心規則。`
|
|
24
|
+
|
|
25
|
+
## MAINTAIN-PLUGIN-001
|
|
26
|
+
|
|
27
|
+
產生的 harness plugin MUST 視為 managed artifact,且 MUST NOT 直接在原位置手動編輯。
|
|
28
|
+
|
|
29
|
+
- Trigger: 更新 runtime、capabilities 或 vendor plugin contract。
|
|
30
|
+
- Action: 重新產生 opencode shim、驗證 manifest hash,並在 release 前重新檢查 vendor 行為。
|
|
31
|
+
- Evidence: artifact hash 與 shim import 測試通過;release 文件記錄重驗條件。
|
|
32
|
+
- Positive: `agent-ops update` 通過 ownership checks 後重寫已變更的 plugin。
|
|
33
|
+
- Negative: `手動修改 .opencode/plugins/agent-ops.js,卻保留舊的 manifest hash。`
|
|
@@ -21,3 +21,13 @@ English source version: 2026-07-23. Revalidate: when the English specification c
|
|
|
21
21
|
- Evidence: 結果列出 harness、設定的 model 或限制、effort 與原因。
|
|
22
22
|
- Positive: `NOT_RUN:需要登入;prompt 可複製。`
|
|
23
23
|
- Negative: `沒有審查執行,仍標示 PASS。`
|
|
24
|
+
|
|
25
|
+
## REVIEW-HARNESS-001
|
|
26
|
+
|
|
27
|
+
即使 installation 支援多個 harness,一次 review invocation MUST 解析成恰好一個 concrete harness。
|
|
28
|
+
|
|
29
|
+
- Trigger: 使用 harness selection 執行 `review`。
|
|
30
|
+
- Action: 從 `codex`、`claude` 或 `opencode` 中選一個;multi-harness installation 與 review execution 分開處理。
|
|
31
|
+
- Evidence: argument parsing 會拒絕 review 使用 `all`、`both` 或逗號分隔的多 harness 值。
|
|
32
|
+
- Positive: `review --harness opencode` 解析成一個 harness。
|
|
33
|
+
- Negative: `讓一次 review invocation 隱式跑過所有已安裝 harness。`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kylecheng3146/agent-ops",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Evidence-driven development loops for Codex
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "Evidence-driven development loops for Codex, Claude Code, and opencode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github:kylecheng3146/agent-ops",
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
"templates/",
|
|
18
18
|
"docs/en/spec/",
|
|
19
19
|
"docs/zh-TW/spec/",
|
|
20
|
+
"docs/en/guides/",
|
|
21
|
+
"docs/zh-TW/guides/",
|
|
20
22
|
"README.md",
|
|
21
23
|
"LICENSE",
|
|
22
24
|
"SECURITY.md",
|
|
@@ -8,18 +8,19 @@
|
|
|
8
8
|
"schemaVersion",
|
|
9
9
|
"profiles",
|
|
10
10
|
"verification",
|
|
11
|
+
"features",
|
|
11
12
|
"pathMappings",
|
|
12
13
|
"securityExceptions"
|
|
13
14
|
],
|
|
14
15
|
"properties": {
|
|
15
16
|
"schemaVersion": {
|
|
16
|
-
"const":
|
|
17
|
+
"const": 2
|
|
17
18
|
},
|
|
18
19
|
"profiles": {
|
|
19
20
|
"type": "array",
|
|
20
21
|
"uniqueItems": true,
|
|
21
22
|
"items": {
|
|
22
|
-
"enum": ["core", "advisory", "guardrails"]
|
|
23
|
+
"enum": ["core", "advisory", "guardrails", "loop"]
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
"verification": {
|
|
@@ -42,6 +43,23 @@
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
},
|
|
46
|
+
"features": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"additionalProperties": false,
|
|
49
|
+
"required": ["stopVerification"],
|
|
50
|
+
"properties": {
|
|
51
|
+
"stopVerification": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"required": ["enabled"],
|
|
55
|
+
"properties": {
|
|
56
|
+
"enabled": {
|
|
57
|
+
"type": "boolean"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
45
63
|
"pathMappings": {
|
|
46
64
|
"type": "array",
|
|
47
65
|
"items": {
|
|
@@ -94,6 +112,42 @@
|
|
|
94
112
|
}
|
|
95
113
|
}
|
|
96
114
|
},
|
|
115
|
+
"allOf": [
|
|
116
|
+
{
|
|
117
|
+
"if": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"properties": {
|
|
120
|
+
"features": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {
|
|
123
|
+
"stopVerification": {
|
|
124
|
+
"type": "object",
|
|
125
|
+
"properties": {
|
|
126
|
+
"enabled": {
|
|
127
|
+
"const": true
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"then": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"properties": {
|
|
138
|
+
"verification": {
|
|
139
|
+
"type": "object",
|
|
140
|
+
"properties": {
|
|
141
|
+
"commands": {
|
|
142
|
+
"type": "array",
|
|
143
|
+
"minItems": 1
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
],
|
|
97
151
|
"$defs": {
|
|
98
152
|
"id": {
|
|
99
153
|
"type": "string",
|
|
@@ -7,13 +7,18 @@
|
|
|
7
7
|
"required": ["schemaVersion", "scope", "harness", "artifacts", "markers"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"schemaVersion": {
|
|
10
|
-
"const":
|
|
10
|
+
"const": 2
|
|
11
11
|
},
|
|
12
12
|
"scope": {
|
|
13
13
|
"enum": ["project", "user"]
|
|
14
14
|
},
|
|
15
15
|
"harness": {
|
|
16
|
-
"
|
|
16
|
+
"type": "array",
|
|
17
|
+
"minItems": 1,
|
|
18
|
+
"uniqueItems": true,
|
|
19
|
+
"items": {
|
|
20
|
+
"enum": ["codex", "claude", "opencode"]
|
|
21
|
+
}
|
|
17
22
|
},
|
|
18
23
|
"artifacts": {
|
|
19
24
|
"type": "array",
|
|
@@ -129,7 +134,18 @@
|
|
|
129
134
|
"minItems": 1,
|
|
130
135
|
"uniqueItems": true,
|
|
131
136
|
"items": {
|
|
132
|
-
"enum": [
|
|
137
|
+
"enum": [
|
|
138
|
+
"SessionStart",
|
|
139
|
+
"UserPromptSubmit",
|
|
140
|
+
"PreToolUse",
|
|
141
|
+
"PermissionRequest",
|
|
142
|
+
"PostToolUse",
|
|
143
|
+
"PreCompact",
|
|
144
|
+
"PostCompact",
|
|
145
|
+
"SubagentStart",
|
|
146
|
+
"SubagentStop",
|
|
147
|
+
"Stop"
|
|
148
|
+
]
|
|
133
149
|
}
|
|
134
150
|
},
|
|
135
151
|
"owner": {
|