Hooks & Lifecycle
The lifecycle hooks the OmO plugin registers in Codex — rules injection, telemetry, comment checks, and LSP diagnostics.
LazyCodex (LZX) ships the OmO plugin with lifecycle hooks that fire at well-defined points in a Codex session. They keep your project rules loaded, surface feedback after edits, and run diagnostics — without you invoking anything by hand. Everything below is registered in the plugin's hooks.json.
What fires, when
| Event | What fires |
|---|---|
SessionStart | Loads OMO project rules (the rules component), then records telemetry. |
UserPromptSubmit | Re-injects OMO project rules, runs the ultrawork detector, and checks ultragoal steering. |
PostToolUse (edit-like tools) | Runs the comment-checker feedback pass and LSP diagnostics; for apply_patch, also matches project rules. |
PostCompact (manual or auto) | Resets the OMO project rule cache so injected rules survive context compaction. |
SessionStart
When a Codex session begins, two hooks run:
- Rules —
rules hook session-startloads OMO project rules so the agent starts with yourAGENTS.md, rules, and instruction files already in context. - Telemetry —
telemetry hook session-startrecords that the session started.
UserPromptSubmit
Every time you submit a prompt, three hooks run in order:
- Rules —
rules hook user-prompt-submitre-injects OMO project rules so they stay present as the conversation grows. - Ultrawork detector — a Python hook (
ultrawork/hooks/ultrawork-detector.py) that detects theultraworktrigger in your prompt. - Ultragoal —
ultragoal hook user-prompt-submitchecks ultragoal steering.
PostToolUse
After edit-like tools run, OmO inspects the result. The matcher targets the edit family:
^(apply_patch|write|Write|edit|Edit|multi_edit|multiedit|MultiEdit)$For any match, two hooks run:
- comment-checker —
comment-checker hook post-tool-usegives feedback on comments you just wrote or changed. See comment-checker. - LSP —
lsp hook post-tool-useruns language-server diagnostics on the edited code. See lsp.
A second, narrower matcher (^apply_patch$) additionally runs rules hook post-tool-use to match project rules against the patch.
PostCompact
When Codex compacts context — manual or auto — rules hook post-compact resets the OMO project rule cache. This is what lets injected rules survive compaction instead of being lost when older context is summarized away.
Installed components
The hooks above are thin entry points into installed components:
| Component | Powers |
|---|---|
rules | Project-rule injection at session start, on every prompt, on apply_patch, and after compaction. |
telemetry | Session-start recording. |
comment-checker | Comment feedback after edit-like tools. |
lsp | Language-server diagnostics after edit-like tools. |
ultrawork | The prompt-time ultrawork detector. |
ultragoal | Ultragoal steering checks on each prompt. |