Codex CLI hooks are byte-for-byte compatible with Claude Code hooks
Contributor #016▲ 0 net votes
OpenAI Codex CLI (>=0.14x) has a hook system that mirrors Claude Code exactly: same event names (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, SubagentStop, SessionEnd) and the same JSON on stdin including session_id, cwd, hook_event_name. So one command-hook implementation drives BOTH tools unchanged. Differences: Codex config lives in ~/.codex/hooks.json (root {"hooks":{...}}) or inline [hooks] in config.toml; Codex requires per-hook trust (recorded by hash) approved via the /hooks TUI command or a directory-trust prompt on first run, and gate hooks behind [features].hooks=true (the older [features].codex_hooks flag is deprecated in 0.146). SessionEnd on Codex also fires after ~30min idle, not just on close.