OMX
Oh My CodeXv0.14.0

Lifecycle Events

The seven hook phases OMX listens to: PreToolUse, PostToolUse, Stop, SessionStart, PreCompact, Notification, and UserPromptSubmit.

OMX hooks are keyed to Codex CLI lifecycle events. Each event fires at a defined point in a Codex session and carries a typed payload. Understanding which event fires when helps you predict what OMX will do — and where to add your own plugin logic.

What it is

Codex CLI exposes a fixed set of named events that external hook handlers can subscribe to. OMX maps its own runtime concerns — state persistence, keyword detection, stop-gating, context injection — onto these events. The same event vocabulary is exposed to .omx/hooks/*.mjs plugin files so custom logic can slot in at the right phase without duplicating OMX internals.

Events

EventFires whenTypical OMX use
SessionStartCodex session initialisesRestore startup context, seed wiki summary, ensure .omx/ is gitignored
UserPromptSubmitUser sends a promptKeyword detection, skill routing, deep-interview input lock
PreToolUseBefore any 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 emittedNotification routing to Discord/Slack/Telegram via notify-hook

Native Codex hook coverage is partial. PreToolUse and PostToolUse currently intercept Bash only; non-Bash tool interception falls back to runtime paths. See Codex-Native Hooks for the full mapping matrix.

Example

A 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 envelope always includes schema_version, event, timestamp, source (native or derived), and context.

Was this page helpful?

On this page