OMX
Oh My CodeXv0.18.9

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

Coverage isn't uniform yet. Today PreToolUse and PostToolUse intercept Bash only, and every non-Bash tool falls back to the runtime paths instead. The full matrix is in Codex-Native Hooks.

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