Skip to main content

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.toml
  • hooks.json in ~/.codex and <workspace>/.codex
  • skills under ~/.codex/skills and .agents/skills

From config.toml Guard records one artifact per entry in mcp_servers and keeps the scope clear:

  • global when the config comes from your home directory
  • project when 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, and PostToolUse
  • 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 PreToolUse hook is the enforcement point for complete shell commands
  • the PermissionRequest hook 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 approvals resolves 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:

  1. Guard snapshots the configured server
  2. compares it against the last stored state
  3. resolves the effective policy action
  4. records a receipt and optional diff
  5. 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 codex refuses to launch when the managed PreToolUse and PermissionRequest hooks are missing or disabled. Run hol-guard install codex again to restore them.
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.

Next guidesDirect link to Next guides​