LazyCodex
LazyCodexv4.12.1

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

EventWhat runs
SessionStartProject rules loading, telemetry, auto update check, bootstrap provisioning, CodeGraph bootstrap.
UserPromptSubmitRe-injects project rules, checks the ultrawork trigger, and checks $ulw-loop steering.
PreToolUseGives Git Bash MCP guidance for Bash calls and preserves $ulw-loop goal budget constraints.
PostToolUseRuns comment checks, LSP diagnostics, CodeGraph init guidance, apply_patch rule matching, and thread title hygiene.
Stop / SubagentStopRuns $start-work continuation and LazyCodex executor evidence verification.
PostCompactResets Git Bash reminders, project rules, and LSP diagnostic cache.

SessionStart

When a Codex session starts, hooks align the baseline state.

  • Rules: rules hook session-start loads OMO project rules so agents begin with supported rules and instruction files already in context.
  • Telemetry: telemetry hook session-start records 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-submit re-injects OMO project rules so they survive long conversations.
  • Ultrawork trigger: detects ultrawork / ulw flows in the prompt.
  • ulw-loop steering: checks steering state while $ulw-loop is 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-loop needs 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-use gives feedback on comments just written or changed. See comment-checker.
  • LSP: lsp hook post-tool-use runs 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-work must continue until the plan is done.
  • executor evidence verification: checks whether a finished lazycodex-executor child 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.

ComponentResponsibility
rulesProject rules at session start, prompt submit, apply_patch, and after compact.
bootstrapLazyCodex install state and provisioning checks.
telemetrySession start recording.
comment-checkerComment feedback after edit-like tools.
lspLanguage-server diagnostics after edit-like tools and cache reset after compact.
ultraworkUltrawork trigger detection at prompt time.
ulw-loopLoop steering and goal budget protection.
start-work-continuation$start-work execution continuation.
git-bashGit Bash MCP guidance for Bash calls and after compact.
codegraphCodeGraph bootstrap and init guidance.
teammodeThread title hygiene.
lazycodex-executor-verifyChild-agent evidence verification.

On this page