OMX
Oh My CodeXv0.14.0

Codex-Native Hooks

How OMX wires directly into Codex CLI's native hook surface instead of a shell wrapper, and which lifecycle events are covered natively versus via runtime fallback.

Codex CLI exposes a native hook surface: when [features] codex_hooks = true is set in .codex/config.toml, Codex invokes external handlers at defined lifecycle points by reading registrations from .codex/hooks.json. OMX uses this surface directly rather than wrapping the Codex binary in a shell script.

What it is

omx setup writes two files: .codex/config.toml (enabling codex_hooks) and .codex/hooks.json (registering the OMX handler command dist/scripts/codex-native-hook.js). The setup preserves any user-managed hook entries already in .codex/hooks.json. omx uninstall removes only the OMX-managed entries; user hooks stay in place. The alternative — a shell wrapper around the Codex binary — is still supported via omx tmux-hook but is not the primary path for native events.

Native vs. runtime-fallback coverage

OMX concernCodex eventStatus
Session bookkeeping, wiki startup contextSessionStartNative
Keyword detection, skill state seedingUserPromptSubmitNative
Bash safety checks, commit format guardPreToolUse (Bash only)Native-partial
Command-not-found guidance, exit-code reviewPostToolUse (Bash only)Native-partial
Ralph / autopilot / ultrawork / ultraqa continuationStopNative-partial
Auto-nudge on stalled turnsStopNative-partial
Session-end wiki capture, session-idleRuntime-fallback
Non-Bash tool interceptionRuntime-fallback

"Native-partial" means the native path handles the common case; edge cases fall back to the notify-hook or tmux runtime path.

Example

Verify that native hooks are installed and shaped correctly:

omx doctor

Run a smoke test to confirm the native hook path executes end-to-end:

omx exec --skip-git-repo-check -C . "Reply with exactly OMX-EXEC-OK"

Plugin dispatch logs are written to .omx/logs/hooks-YYYY-MM-DD.jsonl.

Was this page helpful?

On this page