Codex harness
Use this guide when Codex is your main local harness and you want Guard to review shell commands, prompts, MCP tool calls, and changed MCP servers before they run.
What Guard detectsDirect link to What Guard detects
The Codex adapter reads:
~/.codex/config.toml<workspace>/.codex/config.tomlhooks.jsonin~/.codexand<workspace>/.codex- skills under
~/.codex/skillsand.agents/skills
From config.toml Guard records one artifact per entry in mcp_servers and keeps the scope clear:
globalwhen the config comes from your home directoryprojectwhen the config lives inside the current workspace
Guard preserves the configured transport: stdio when the server declares a command, http when it declares a url.
How protection attachesDirect link to How protection attaches
hol-guard install codex changes the global ~/.codex/config.toml:
- sets
features.hooks = true - registers four Guard hooks:
PreToolUse,PermissionRequest,UserPromptSubmit, andPostToolUse - routes eligible stdio MCP servers through Guard MCP proxies
It also writes a launcher shim at ~/.hol-guard/bin/guard-codex. Before it edits config.toml, Guard saves the original under ~/.hol-guard/managed/codex. Uninstall restores config.toml from that backup, removes the Guard hooks and proxies, and removes the shim.
With the hooks active, Guard sees shell commands, prompts, MCP tool calls, file reads, and tool results while Codex runs, not only at launch.
Approval modelDirect link to Approval model
Codex uses the native-or-center tier:
- the
PreToolUsehook is the enforcement point for complete shell commands - the
PermissionRequesthook answers Codex's own approval prompts, and managed MCP tool calls keep their same-chat approval - requests Codex cannot render or answer go to the local approval center
hol-guard approvalsresolves the same requests from the terminal
Install and launch flowDirect link to Install and launch flow
hol-guard detect codex --json
hol-guard install codex --dry-run
hol-guard install codex
hol-guard run codex --dry-run
hol-guard run codex
hol-guard approvals
Start a new Codex session after install so it loads the hooks. To check or repair the install:
hol-guard apps test codex --json
hol-guard apps repair codex
To remove Guard:
hol-guard uninstall codex
What a blocked change looks likeDirect link to What a blocked change looks like
When Codex config changes introduce a new or changed MCP server:
- Guard snapshots the configured server
- compares it against the last stored state
- resolves the effective policy action
- records a receipt and optional diff
- pauses the action and routes approval through Codex or the local approval center when policy blocks
Known limitsDirect link to Known limits
- Inline file edits that the model applies without a tool call are not visible to Guard.
hol-guard run codexrefuses to launch when the managedPreToolUseandPermissionRequesthooks are missing or disabled. Runhol-guard install codexagain to restore them.
Recommended validation loopDirect link to Recommended validation loop
hol-guard detect codex --json
hol-guard install codex
hol-guard status
hol-guard run codex --dry-run
hol-guard receipts
hol-guard diff codex
Add or change an MCP server in ~/.codex/config.toml or <workspace>/.codex/config.toml, then run hol-guard diff codex to see it reported as a new or changed artifact.