OMC
Oh My ClaudeCodev4.12.0

Hook System Overview

Explains how the OMC hook system works and its overall structure.

What are Hooks?

Hooks are scripts that run automatically in response to Claude Code lifecycle events. oh-my-claudecode uses multiple hooks to extend Claude Code's default behavior.

When a user submits a prompt, a tool is executed, or a session starts/ends, hooks run automatically to inject additional context, activate modes, or manage state.

How It Works

Hooks are defined in a hooks.json file, and each hook follows this structure:

{
  "eventName": [
    {
      "matcher": "*",
      "hooks": [
        {
          "type": "command",
          "command": "node scripts/hook-script.mjs",
          "timeout": 5
        }
      ]
    }
  ]
}
  • eventName: The lifecycle event the hook responds to
  • matcher: The condition for running the hook (* means all cases)
  • command: The Node.js script to execute
  • timeout: Maximum execution time (in seconds)

Hook output is injected into Claude via <system-reminder> tags. Additional context is passed through hookSpecificOutput.additionalContext.

Hook Categories

OMC hooks are divided into 4 major categories.

Execution Mode Hooks

Manages execution modes such as autonomous execution, parallel processing, and persistence.

HookDescription
autopilotFully autonomous execution from idea to working code
ralphPersistent execution until verification is complete
ultraworkMaximum parallel agent execution
ultraqaRepeated QA cycles until goals are met
persistent-modeMaintains mode state across sessions

Core Hooks

Handles core functionality including orchestration and keyword detection.

HookDescription
keyword-detectorDetects magic keywords (ultrawork, ralph, etc.)
skill-injectorInjects skill prompts
pre-tool-enforcerValidates rules before tool use
post-tool-verifierVerifies tool use results

Context Management Hooks

Manages memory, project state, and compaction.

HookDescription
notepadCompaction-resistant memory system
project-memoryProject memory management
pre-compactProcessing before compaction

Quality/Verification Hooks

Handles code quality, permission management, and subagent tracking.

HookDescription
permission-handlerPermission requests and validation
subagent-trackerTracks subagent spawn/completion
code-simplifierAuto-simplifies recently modified files on Stop (opt-in)

Disabling Hooks

Disable All

export DISABLE_OMC=1

Selective Disable

export OMC_SKIP_HOOKS="keyword-detector,notepad"

Separate with commas to skip only specific hooks.

Detail Pages

On this page