Skip to content
Merged
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
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# codex-acp-plugin

Identity, governance, and audit for [Codex CLI](https://developers.openai.com/codex) tool calls, via the [Agentic Control Plane](https://agenticcontrolplane.com).
Checks every shell command [Codex CLI](https://developers.openai.com/codex) runs against your [Agentic Control Plane](https://agenticcontrolplane.com) rules before it executes, and logs it with who ran it and from which session.

- **Audit** — every shell command Codex runs is logged with identity + session attribution.
- **Control** — server-side policy denies or requires human approval on individual commands before they execute, including a hardline floor for catastrophic patterns (`rm -rf /`, `mkfs`, fork bombs) that no configuration can allow.
- **Understand** — the bundled ACP MCP server gives Codex your workspace's own cost and audit data (`acp_cost`, `acp_audit`, `acp_optimize`, …), so agents can report on — and optimize — their own economics.
- **Log.** Each command is recorded with identity and session.
- **Control.** Server-side policy can deny a command or hold it for your approval. A hardline floor refuses catastrophic commands (`rm -rf /`, `mkfs`, fork bombs) and no configuration can allow them.
- **Read your own numbers.** The bundled ACP MCP server gives Codex your workspace's cost and audit data (`acp_cost`, `acp_audit`, `acp_optimize` and others), so an agent can report on its own spend.

Companion to the [Claude Code plugin](https://github.com/agentic-control-plane/claude-code-acp-plugin) and the [Hermes plugin](https://github.com/agentic-control-plane/hermes-acp-plugin). Same backend, same dashboard, same policies across all three harnesses.
Companion to the [Claude Code plugin](https://github.com/agentic-control-plane/claude-code-acp-plugin) and the [Hermes plugin](https://github.com/agentic-control-plane/hermes-acp-plugin). Same backend, dashboard and rule keys, across every harness ACP supports ([coverage matrix](https://agenticcontrolplane.com/coverage)).

If you just want Codex set up, `curl -sf https://agenticcontrolplane.com/install.sh | bash` does the hook, the MCP entry and the cost wrapper in one go. The steps below are the manual plugin route.

## Install

Expand All @@ -15,37 +17,37 @@ Companion to the [Claude Code plugin](https://github.com/agentic-control-plane/c
/plugins install agentic-control-plane
```

Then connect (2 minutes):
Then connect (about 2 minutes):

```
$acp-connect
```

…or manually: get a token at [cloud.agenticcontrolplane.com/plugin/authorize](https://cloud.agenticcontrolplane.com/plugin/authorize) and write it to `~/.acp/credentials` (`chmod 600`).
Or by hand: get a token at [cloud.agenticcontrolplane.com/plugin/authorize](https://cloud.agenticcontrolplane.com/plugin/authorize) and write it to `~/.acp/credentials` (`chmod 600`).

**Trust the hooks.** Codex deliberately skips plugin-bundled hooks until you review them — when prompted, review and trust the two `govern.mjs` hook entries. Until you do, nothing is governed.
**Trust the hooks.** Codex skips plugin-bundled hooks until you review them. When prompted, review and trust the two `govern.mjs` entries. Until you do, nothing is checked.

## How it works

| Component | Behavior |
|---|---|
| `PreToolUse` hook | POSTs the command to `/govern/tool-use` before execution. `deny` blocks it with the policy reason. An `ask` policy blocks with an approval deep link — approve on the dashboard (or from the notification email), re-run, and the standing grant admits it. |
| `PostToolUse` hook | POSTs the result to `/govern/tool-output` for audit, redaction logging, and DLP scanning. |
| MCP server (`acp`) | Streamable HTTP at `api.agenticcontrolplane.com/mcp`. Sign-in uses MCP OAuth — Codex opens the browser, you approve, and calls are attributed to your user. 9 governance tools — 8 read-only introspection tools plus `acp_propose_rule`, which drafts a policy rule for a human to confirm in the console (it never applies policy itself). |
| Skills | `acp` (how governance works), `acp-connect` (setup), `cost-xray` (read your own spend). |
| `PreToolUse` hook | POSTs the command to `/govern/tool-use` before it runs. `deny` blocks it with the policy reason. An `ask` blocks with an approval link: approve on the dashboard (or from the notification email), re-run, and the grant admits it. |
| `PostToolUse` hook | POSTs the result to `/govern/tool-output` for audit, redaction logging and DLP scanning. |
| MCP server (`acp`) | Streamable HTTP at `api.agenticcontrolplane.com/mcp`. Sign-in is MCP OAuth: Codex opens the browser, you approve, and calls are attributed to you. Mostly read-only tools. `acp_propose_rule` drafts a rule for you to confirm in the console and never applies policy itself. |
| Skills | `acp` (how it works), `acp-connect` (setup), `cost-xray` (read your own spend). |

### Codex-specific behavior (honest notes)
## What Codex limits

- **Coverage**: Codex fires `PreToolUse` for shell commands only — file edits, web fetches, and MCP calls don't hit hooks yet. Shell is where the blast radius lives, but this is narrower than the Claude Code plugin's full-surface coverage. ([Codex hooks docs](https://developers.openai.com/codex/hooks))
- **Approvals**: Codex's hook parser acts on `deny` only — there is no inline `ask` prompt like Claude Code's. ACP maps `ask` to a deny that carries the approval link; after a human approves, the identical re-run passes under the grant.
- **No token injection**: Codex rejects `updatedInput`, so ACP's scoped vendor-token injection (GitHub etc.) is disabled under Codex; your local credentials are used as before.
- **Fail-safe, never-brick** (#385): gateway unreachable / gateway error → interactive sessions proceed with a loud `⚠ UNGOVERNED` warning and a lapse record in `~/.acp/lapse.log` (a human is present to read it); unattended tiers (subagent/background) stay blocked with a clear message. Configure `ACP_API_BASE`/`ACP_GOVERN_BASE` for self-hosted.
- **Coverage.** On current Codex builds the hook fires for shell commands, `apply_patch` edits, MCP calls and other local tools. Older builds fire it for shell only. Hosted tools such as web search never reach a hook; the MCP connector's `acp_check` is the route for those. See the [Codex hooks docs](https://developers.openai.com/codex/hooks) and the [coverage matrix](https://agenticcontrolplane.com/coverage).
- **Approvals.** Codex's hook parser acts on `deny` only. There's no inline `ask` prompt like Claude Code's. ACP turns an `ask` into a deny that carries the approval link. After you approve, the identical re-run passes.
- **No token injection.** Codex rejects `updatedInput`, so ACP's scoped vendor-token injection (GitHub and others) is off under Codex. Your local credentials work as before.
- **If the gateway is unreachable.** Interactive sessions proceed with a loud `UNGOVERNED` warning, and a record goes to `~/.acp/lapse.log`. The plugin has no offline floor, so nothing is applied during that window. Sessions in `bypassPermissions` or `auto` mode count as unattended and stay blocked, with a message saying why. This is the plugin's behavior; the `install.sh` route uses the shared hook, which fails open in every tier unless `ACP_FAIL_MODE=closed` or `~/.acp/failmode` is set. For a self-hosted gateway, set `ACP_API_BASE` and `ACP_GOVERN_BASE`.

## Enterprise

Codex's `requirements.toml` — from a system file, a macOS MDM profile, or the ChatGPT Enterprise workspace's managed configuration — can carry this hook to every seat as a managed `PreToolUse`/`PostToolUse` hook that users can't remove (`allow_managed_hooks_only`), plus an `[mcp_servers.acp]` allowlist entry by URL. Codex enforces the hook config but doesn't ship the script, so your MDM copies `govern.mjs` and a two-line wrapper into the `managed_dir` the config names. Set `ACP_REQUIRE_ENROLLMENT=1` in that wrapper and an unenrolled seat blocks each shell command with the enrollment step instead of running it ungoverned; each person enrolls once by signing in at the ACP console and writing their own key to `~/.acp/credentials`, so every call stays attributed to a person.
Codex's `requirements.toml` can carry this hook to every seat as a managed `PreToolUse`/`PostToolUse` hook that users can't remove (`allow_managed_hooks_only`), plus an `[mcp_servers.acp]` allowlist entry by URL. The source can be a system file, a macOS MDM profile, or the ChatGPT Enterprise workspace's managed configuration. Codex enforces the hook config but doesn't ship the script, so your MDM copies `govern.mjs` and a two-line wrapper into the `managed_dir` the config names. Each person enrolls once by signing in at the ACP console and writing their own key to `~/.acp/credentials`, so every call is attributed to a person.

The complete file and the MDM drop: https://agenticcontrolplane.com/docs/enterprise/codex
The enrollment-blocking option and the full file are in the guide: https://agenticcontrolplane.com/docs/enterprise/codex

## License

Expand Down
Loading