Custodian Guard for Codex
(OpenAI Build Week, July 2026)
A capability firewall for coding agents. Codex can inspect, test, and edit inside an approved workspace; credential use, network operations, destructive commands, production changes, money movement, and governance changes stop at a human-approval boundary. Every decision produces a value-free HMAC hash-chained receipt. Classification is deterministic — typed action-kind rules over the tool name and arguments, not a model call — so a mislabeled or adversarial proposal can't talk its way past the boundary by re-describing itself.
This is the Build Week contribution specifically: the Codex-facing MCP server,
the policy bridge, the receipts CLI, and the governance skill. It depends on
custodian-kernel — the
policy engine, adapter pipeline, and approval/filesystem/ledger-access
policies — which is agent-agnostic and predates this Build Week.
This plugin is generic. It does not know about any particular website, IDE, or operator. A site or IDE is a client of the MCP boundary, never part of the kernel.
How Codex and GPT-5.6 were used
Codex (running GPT-5.6) implemented the MCP server and the typed action
bridge, adversarially tested its own classifier against deliberately
mislabeled and disguised commands, found and fixed relative-workspace
resolution edge cases, and built the deterministic judge demo
(scripts/codex-guard-demo.py) and regression tests. GPT-5.6 does not run
inside the enforcement path itself — classification is deterministic, typed
rules over the tool name and arguments, checked on every request — so there
is nothing here a model could talk its way around. That is a deliberate
design choice made with Codex during development, not a limitation.
Install for judging
Python 3.11 or later:
# Linux/macOS
python3 -m venv .venv
. .venv/bin/activate
# Windows PowerShell
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -e .
custodian-codex setup
custodian-codex doctor
pip install -e . pulls in custodian-kernel (pinned to the exact commit
this was built and verified against — see pyproject.toml; 0.4.0 isn't on
PyPI yet) automatically, nothing else to install first. Start a new Codex
thread after setup so it loads the plugin. The plugin manifest is at
plugins/custodian-codex-guard/.codex-plugin/plugin.json; its governance
skill is at plugins/custodian-codex-guard/skills/govern-codex/SKILL.md.
If the integration itself is broken, the operator — not the model — can run
custodian-codex disable. This removes the Codex plugin while deliberately
preserving receipts and approvals for diagnosis; custodian-codex setup
restores it. Start a new Codex thread after either change.
Sixty-second proof
python scripts/codex-guard-demo.py
pytest -q tests/
The demo performs no network calls and changes no external state. It shows a
safe test and workspace edit passing, .env access being denied, deliberately
misclassified delete/deploy commands being independently upgraded to human
escalation, a valid receipt chain, and rejection after receipt tampering.
106 tests cover the full threat model.
Enforcement contract
guard_action returns autonomous, escalation_required, approved, or
denied. An escalation is never permission. The model can create a pending
request but cannot approve it; the operator runs the returned
custodian-codex approve ID --digest DIGEST outside the model tool boundary.
Approval binds the exact tool, effective risk class, arguments, resolved
workspace, requester, and policy version — any change requires a fresh
request, never a reused approval ID.
No harness — including Codex itself — can read the receipt ledger by default, not even its own history. Visibility is only ever an explicit operator grant. The agent being governed is exactly the party a denial log exists to constrain; letting it read its own denial history would turn the ledger into an oracle it could probe to learn the enforcement boundary and route around it.
What's in this repo vs. the kernel
- Here:
custodian/codex_guard/(MCP server, risk classification, receipts, approvals, CLI),plugins/custodian-codex-guard/(Codex plugin manifest + governance skill), tests, judge demo script. - In
custodian-kernel: the adapter pipeline (workspace/secret/prompt- injection/egress guards),ApprovalPolicy,FilesystemPolicy,LedgerAccessPolicy— the policy engine every action is actually checked against.
See docs/CODEX_GUARD.md for the full judge guide.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file custodian_codex_guard-0.1.1.tar.gz.
File metadata
- Download URL: custodian_codex_guard-0.1.1.tar.gz
- Upload date:
- Size: 37.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67901ece8b17ec5b6de245f0b98e44c679701b3bb8a5f809d6c9381b98a0ade7
|
|
| MD5 |
47b054733e57eca96698120eafcceabe
|
|
| BLAKE2b-256 |
45d08750954f13e844ce5131a5c64fee248b72da957dfc640257bd0aca231af9
|
File details
Details for the file custodian_codex_guard-0.1.1-py3-none-any.whl.
File metadata
- Download URL: custodian_codex_guard-0.1.1-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
551ce6d71d1ee766e1ff95c59f8a97bd19c783af791136a0bdf7f9b9a346d834
|
|
| MD5 |
ac98f7fd7bbb525d0a7ba1b483b0dc53
|
|
| BLAKE2b-256 |
039e5e5c0a1a10d0274e92caa10ae5ce7b116c1024bd6d31570d7d0354c08dca
|