Hooks & Lifecycle
Lifecycle hooks for rules, bootstrap, diagnostics, and continuation.
LazyCodex (LZX) ships the OmO plugin with lifecycle hooks that fire at fixed points in a Codex session. They keep project rules loaded, check install state, and run feedback and diagnostics after edits. This page reflects the latest 4.12.1 plugin manifest and hook files.
Trigger Matrix
| Event | What runs |
|---|---|
SessionStart | Project rules loading, telemetry, auto update check, bootstrap provisioning, CodeGraph bootstrap. |
UserPromptSubmit | Re-injects project rules, checks the ultrawork trigger, and checks $ulw-loop steering. |
PreToolUse | Gives Git Bash MCP guidance for Bash calls and preserves $ulw-loop goal budget constraints. |
PostToolUse | Runs comment checks, LSP diagnostics, CodeGraph init guidance, apply_patch rule matching, and thread title hygiene. |
Stop / SubagentStop | Runs $start-work continuation and LazyCodex executor evidence verification. |
PostCompact | Resets Git Bash reminders, project rules, and LSP diagnostic cache. |
SessionStart
When a Codex session starts, hooks align the baseline state.
- Rules:
rules hook session-startloads OMO project rules so agents begin with supported rules and instruction files already in context. - Telemetry:
telemetry hook session-startrecords session start. - Auto update: checks plugin update state.
- Bootstrap provisioning: checks LazyCodex bootstrap state such as plugin cache, config blocks, and bin links.
- CodeGraph bootstrap: checks CodeGraph component initialization.
UserPromptSubmit
Three hooks run each time a prompt is submitted.
- Rules:
rules hook user-prompt-submitre-injects OMO project rules so they survive long conversations. - Ultrawork trigger: detects
ultrawork/ulwflows in the prompt. - ulw-loop steering: checks steering state while
$ulw-loopis continuing.
PreToolUse
Two helper hooks run before tool calls.
- Git Bash MCP guidance: provides Windows/Git Bash MCP guidance when Bash tools are called.
- Goal budget protection: preserves the budget constraints
$ulw-loopneeds when goal creation tools are called.
PostToolUse
After edit-like tools run, OmO inspects the result. The matcher targets edit families:
^(apply_patch|write|Write|edit|Edit|multi_edit|multiedit|MultiEdit)$When it matches, two hooks run.
- comment-checker:
comment-checker hook post-tool-usegives feedback on comments just written or changed. See comment-checker. - LSP:
lsp hook post-tool-useruns language-server diagnostics on edited code. See lsp.
A narrower second matcher (^apply_patch$) also runs rules hook post-tool-use to match project rules against the patch.
Even non-edit tools can trigger follow-up work. CodeGraph-related tool calls can run CodeGraph init guidance, and thread creation can trigger team mode thread title hygiene.
Stop / SubagentStop
Continuation hooks also run when a response or child agent stops.
- start-work continuation: checks the next state when
$start-workmust continue until the plan is done. - executor evidence verification: checks whether a finished
lazycodex-executorchild agent provided enough evidence.
PostCompact
When Codex compacts context, manually or automatically, OmO resets Git Bash MCP reminders, project rules, and the LSP diagnostic cache. After old context is summarized, the next turn gets fresh guidance and diagnostic state.
Installed Components
These hooks are thin entry points into installed components.
| Component | Responsibility |
|---|---|
rules | Project rules at session start, prompt submit, apply_patch, and after compact. |
bootstrap | LazyCodex install state and provisioning checks. |
telemetry | Session start recording. |
comment-checker | Comment feedback after edit-like tools. |
lsp | Language-server diagnostics after edit-like tools and cache reset after compact. |
ultrawork | Ultrawork trigger detection at prompt time. |
ulw-loop | Loop steering and goal budget protection. |
start-work-continuation | $start-work execution continuation. |
git-bash | Git Bash MCP guidance for Bash calls and after compact. |
codegraph | CodeGraph bootstrap and init guidance. |
teammode | Thread title hygiene. |
lazycodex-executor-verify | Child-agent evidence verification. |