← Prompts
Reference / Understand Claude Code Best Practice
HOOKS-README
# HOOKS-README Contains all the details, scripts, and instructions for the Codex CLI hooks. ## Hook Events Overview Codex CLI provides **8 hooks** via hooks.json: | # | Hook | Event Type | Config F
# HOOKS-README Contains all the details, scripts, and instructions for the Codex CLI hooks. ## Hook Events Overview Codex CLI provides **8 hooks** via hooks.json: | # | Hook | Event Type | Config File | Description | |:-:|------|------------|-------------|-------------| | 1 | `SessionStart` | `SessionStart` | `hooks.json` | Runs once at session start — injects context + plays sound | | 2 | `PreToolUse` | `PreToolUse` | `hooks.json` | Runs before a tool executes — plays sound | | 3 | `PermissionRequest` | `PermissionRequest` | `hooks.json` | Runs when Codex requests approval for a sensitive op — plays sound | | 4 | `PostToolUse` | `PostToolUse` | `hooks.json` | Runs after a tool completes — plays sound | | 5 | `Stop` | `stop` | `hooks.json` | Runs when the session ends — plays sound | | 6 | `UserPromptSubmit` | `UserPromptSubmit` | `hooks.json` | Runs when the user submits a prompt — plays sound | | 7 | `PreCompact` | `PreCompact` | `hooks.json` | Runs before context compaction — plays sound | | 8 | `PostCompact` | `PostCompact` | `hooks.json` | Runs after context compaction — plays sound | ### How Hooks Are Called All hooks (hooks.json) are called with `--hook` flag: ``` python3 .codex/hooks/scripts/hooks.py --hook SessionStart python3 .codex/hooks/scripts/hooks.py --hook PreToolUse python3 .codex/hooks/scripts/hooks.py --hook PermissionRequest
Sign in to view the full prompt.
Sign InClassification
Reference Documentation, cheatsheets, setup guides
Reference Understand
Explain or analyzeScope Project
This codebase Reactive Fires on agent lifecycle events -- hooks, guardrails, interceptors