Bash / exec_command, apply_patch, read_file, update_plan, view_image, web_search, and mcp__<server>__<tool>) through its PreToolUse lifecycle hook. Dmint integrates with Codex CLI via both pre-execution hooks (.codex/hooks.json and .codex/dmint-hook.sh) and the dmint-mcp gateway, provisioning a dedicated .dmint/policies/codex.policy.json tailored to Codex CLI's built-in tools.dmint init)dmint init --harness codex
.dmint/policies/codex.policy.json — Dedicated policy covering all built-in Codex CLI tools (Bash, exec_command, shell, apply_patch, read_file, view_image, list_dir, grep_files, update_plan, web_search, spawn_agent)..dmint/signing.key & .dmint/integrity.key (0600) — Local Ed25519 signing and HMAC integrity keys..codex/hooks.json & .codex/dmint-hook.sh — Official PreToolUse hook configuration pointing directly to .dmint/policies/codex.policy.json.{ "version": 1, "hooks": { "PreToolUse": [ { "matcher": "Bash|apply_patch|mcp__.*", "hooks": [ { "type": "command", "command": "dmint hook run --harness codex --policy \"/abs/path/.dmint/policies/codex.policy.json\" --db-path \"/abs/path/.dmint/approvals.sqlite3\"" } ] } ] } }
dmint hook run --harness codex handles every Codex CLI tool surface:Bash / exec_command): Extracts commands whether passed as {"command": "git status"} or ["bash", "-lc", "git status"] and evaluates them against both Bash and shell.execute rules in codex.policy.json.apply_patch): Parses every *** Add File:, *** Update File:, *** Delete File:, and *** Move to: header in the patch envelope. If a single patch touches both src/app.py and .env, Dmint evaluates every path and blocks the call with DENY.PreToolUse Output: Because Codex CLI PreToolUse enforces "allow" and "deny" (and does not enforce "ask"), Dmint returns permissionDecision: "deny" with exit code 2 whenever a call is DENY or APPROVAL_REQUIRED, ensuring unapproved commands never execute silently.# Simulate a Codex Bash call: dmint hook run --harness codex --policy .dmint/policies/codex.policy.json \ --input '{"tool_name": "Bash", "tool_input": {"command": "git status"}}'
approval_required (such as git push origin main, apply_patch on src/app.py, or docker compose up):dmint hook run exits with code 2, blocking execution, and records a PENDING request (apr_...) in .dmint/approvals.sqlite3.dmint pending dmint approve apr_... --by dev@company.com
CONSUMED, and lets the command run once.