Every decision lands in Activity with
consumer_id prefixed codex:, so
you also get a per-developer audit trail; start in Report policy mode to
observe before enforcing. With allow_managed_hooks_only, developers cannot
switch the hooks off.
Under the hood the plugin uses Codex lifecycle hooks (not Codex External
guardrails, which is a different extension point) calling
POST /v1/evaluate. One org collector API key is
shared across the company. Codex has no “import plugin from GitHub”
marketplace flow like Cursor: you install from the repo (local) or IT deploys
hooks + config (enterprise).
Coverage
Ask — Codex has no dialog: an
ask gate is allowed, plus a warning
injected as context the agent sees. Treat it as advisory here.
Use it when your developers use Codex and you can deploy the hook scripts by
MDM alongside the config. Not when your policy leans on ask gates — Codex
does not honour them.
Limits. Codex collapses ask to allow plus injected context, so treat ask
as report-only here and use block where you need a stop. Config alone is not
enough: without the bootstraps on disk the collector is inert. No redaction, no
coverage of the model’s response, and tool declarations are not evaluated.
Full comparison: Coverage.
Console setup
- Create a Codex collector (Catalog → IDE & coding agents).
- Mint a
tgk_…API key on the Auth tab (shown once — store it). - Assign a default policy on the Policies tab.
Local / pilot
make install-local:
- Builds
trustguard-codexand installs it under~/.trustguard/bin - Copies the plugin to
~/.codex/plugins/trustguard - Writes
~/.codex/hooks.jsonwith absolute paths to the bootstrap scripts
(Codex runs hooks from the session cwd, so relative paths are unreliable)
/hooks, trust the TrustGuard definitions, and send a test prompt.
Enterprise
IT deploys more than the API key file. Codex does not pull hooks from a marketplace; managed hooks must already exist on disk.1. Managed API key config
When this file includes
api_key, that key, data_url, and fail_mode are locked
(user ~/.trustguard/codex.json and env cannot override them). Soft prefs
(timeout_ms, transform_action, events, consumer_id) still layer from the user file.
2. Enforce hooks (requirements.toml)
Example (see the full file in the plugin repo):
docs/enterprise-requirements.toml
in the plugin repo. Exact keys can vary by Codex version — confirm against
Codex hooks docs.
With allow_managed_hooks_only = true, developers cannot disable managed hooks from
/hooks.
Codex has no Ask permission dialog. A gate Ask (and transform-as-ask)
becomes allow plus additionalContext:
A TrustGuard policy needs your approval to continue. Use Block when you
need a hard stop.
Verify
- In Codex run
/hooksand confirm TrustGuard hooks are listed (and managed under enterprise policy). - Send a test prompt.
- Confirm the event in TrustGuard Activity (
consumer_idis typicallycodex:<user>orcodex:<email>when the payload includes email).
What is evaluated
Attributes
attributes.collector.type = "ide"attributes.source.application = "codex-plugin"attributes.codex.event, cwd, model, turnconsumer_idprefixedcodex:(email from payload when present, else configured / OS fallback)
tool.name from payload.params.name for MCP. Ask is context-only (see above).