OMX
Oh My CodeXv0.18.14

Lifecycle Events

The seven events Codex CLI emits and what OMX does at each point.

Codex CLI emits events at fixed points in a session. OMX hooks attach to these events to do their work. Knowing which event fires when lets you trace why OMX intervened at a given moment and slot your own .omx/hooks/*.mjs plugins into the right place.

Events

EventFires whenWhat OMX does
SessionStartCodex session initialisesRestore state, seed wiki summary, verify .omx/ is gitignored
UserPromptSubmitUser sends a promptKeyword detection, skill routing, deep-interview input lock
PreToolUseBefore a tool call executesBash safety checks, inline git commit format guard
PostToolUseAfter a tool call completesCommand-not-found guidance, non-zero output review
StopModel finishes a turnRalph / autopilot / ultrawork / ultraqa continuation, auto-nudge on stalls
PreCompactContext window nears limitReserved — wiki compaction deferred to v2
NotificationSystem notification emittedRouting to Discord / Slack / Telegram via notify-hook

PreToolUse and PostToolUse currently intercept Bash only. Non-Bash tool interception falls back to runtime paths. See Codex-Native Hooks for the full coverage matrix.

Subscribing to events in a plugin

An example plugin that reacts to post-tool-use events:

// .omx/hooks/my-plugin.mjs
export async function onHookEvent(event, sdk) {
  if (event.event !== 'post-tool-use') return;
  sdk.log.info('tool finished', event.context);
}

The event envelope always includes schema_version, event, timestamp, source (native or derived), and context.

On this page