Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,24 @@ Kimi) with no mbx call for 10 minutes becomes claimable; a dedicated session is

Restart your agent sessions and they have the `mbx_*` tools. `agentmbx setup --dry-run` previews, `--only codex` limits it, `--uninstall` undoes it. What it writes for each CLI (and how to do it by hand): [docs/INSTALL.md](docs/INSTALL.md).

### Review and enroll Codex hooks

After setup, trust the hooks in Codex's native UI or use the explicit enrollment command with Codex 0.172.0. Setup and `setup --yes` leave native trust decisions to you. Run both commands from the same directory with the same `CODEX_HOME` (default `~/.codex`).

```sh
(umask 077; agentmbx codex-hooks inspect > codex-hooks.review.json)
cat codex-hooks.review.json
shasum -a 256 codex-hooks.review.json
agentmbx codex-hooks enroll --manifest codex-hooks.review.json --sha256 "PASTE_REVIEWED_DIGEST_HERE"
```

Review the four commands, source, timeout, and native hashes before passing the printed 64-character digest. Inspection starts a short-lived Codex app-server and lists hook metadata without starting a thread. The manifest includes the Codex and AgentMBX versions and omits unrelated hook commands and config values. Native hashes cover hook definitions, including the command string. They do not attest to the executable bytes at that path.

Enrollment requires the same definitions and a manifest inspected within 30 minutes for changes to trust. It uses the reviewed user config version to guard the write, then starts a fresh app-server to verify trust and check preservation. If the reviewed hooks are already trusted, enrollment returns a verified no-op even after unrelated config changes. `manualReviewRequired` flags outstanding review. Foreign hook trust stays as configured. If Codex would migrate existing hook state during the write, use its native UI. Avoid editing Codex config during enrollment. A report of concurrent drift means the fresh read differed from the expected config or other hook inventory. Enrollment verifies native hook trust only. Idle wake and delegated actions have separate requirements.

Private receipts are stored in `$CODEX_HOME/agentmbx-hook-enrollment` with config and hook digests. If a write might have happened and verification could not finish, rerun the same enrollment command with the original manifest and digest. With `pending.json` present this is a read-only reconciliation, even if trust is still missing. The pending receipt stays in place to prevent automatic retries. After confirming the original process has stopped and reviewing the outcome, keep the receipt private and move it out of the way before starting a new review. For unsupported Codex versions, review hooks in the native UI. When native hooks are unavailable, use the MCP tools `mbx_whoami` and `mbx_catchup`.


Pair a second machine:

```sh
Expand Down
20 changes: 20 additions & 0 deletions dist/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ import { isSlotName } from "./project-slot.js";
const HELP = `agentmbx (AgentMBX) — signed messages between AI coding agents, on this machine and across paired machines

Start here
agentmbx codex-hooks inspect print a redacted native hook review manifest
agentmbx codex-hooks enroll --manifest <file> --sha256 <digest> enroll four reviewed AgentMBX hooks
agentmbx setup [--yes] [--dry-run] [--only claude,codex,opencode,kimi,hermes,grok,skill,daemon,owner] [--host <name>] [--no-owner] [--policy ask|collaborate|autonomous|yolo] [--uninstall]
init this host, install the daemon, wire every detected agent CLI (MCP + hooks + skill), create the owner key
agentmbx doctor [--fix] [--processes] checklist; --processes lists MCP/watch pid, ppid, birth, client liveness and RSS (read-only; excludes --fix)
Expand Down Expand Up @@ -384,6 +386,24 @@ async function run(argv) {
const [cmd, ...rest] = argv;
if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h")
return console.log(HELP);
if (cmd === "codex-hooks") {
const { values, positionals } = parseArgs({ args: rest, allowPositionals: true, options: {
help: { type: "boolean", short: "h" }, manifest: { type: "string" }, sha256: { type: "string" },
} });
if (values.help)
return console.log(commandHelp(cmd));
const { codexHooks } = await import("./codex-hook-trust.js");
if (positionals.length === 1 && positionals[0] === "inspect" && !values.manifest && !values.sha256)
return console.log(JSON.stringify(await codexHooks({ inspect: true }), null, 2));
if (positionals.length !== 1 || positionals[0] !== "enroll" || !values.manifest || !values.sha256)
return die("Use codex-hooks inspect or codex-hooks enroll --manifest <file> --sha256 <digest>");
const result = await codexHooks({ manifest: values.manifest, sha256: values.sha256 });
console.log(JSON.stringify(result, null, 2));
if ("status" in result && (result.status !== "verified" ||
("concurrentDrift" in result && result.concurrentDrift)))
process.exitCode = 1;
return;
}
if (cmd === "claude")
return launchClaude(rest); // every argument belongs to Claude Code: parse nothing here
const { values: o, positionals: pos } = parseArgs({ args: rest, allowPositionals: true, strict: cmd !== "hook" && cmd !== "mcp", options: {
Expand Down
Loading
Loading