Cmd. /hooks
Review lifecycle hooks and manage trust or disabled state.
Key takeaways
- Review lifecycle hooks and manage trust or disabled state.
- Check the input surface and availability before using the examples below.
Purpose
Review lifecycle hooks and manage trust or disabled state.
/hooksAvailability
| Field | Value |
|---|---|
| Input surface | Running CLI prompt |
| Kind | Built-in |
| Status | Current reference |
| Aliases | — |
| Documented minimum | Not specified |
| Reviewed against | 2026-09-22 · Codex CLI 0.155.1 |
The installed command menu and account or organization settings determine availability.
Examples
/hooksWhen to use it
- Run
/hooksafter adding.codex/hooks.jsonor inline[hooks]config to verify source and trust state. - Before enabling plugin-bundled hooks, check
/pluginsfor plugin state and/hooksfor actual hook behavior. - Record which hooks are managed by policy and which are local project hooks.
Choosing related commands
| Command | Difference | Choose It When |
|---|---|---|
/hooks | Reviews hook sources and trust state | Hooks may run before, during, or after turns |
/plugins | Shows plugin inventory and bundled hooks | You need to know where a hook came from |
/debug-config | Explains config layers | You need precedence and policy diagnostics |
Effects and persistence
Shows configured hooks and their triggers. Editing a hook changes what runs when its event occurs.
/hooks opens the hook browser so you can inspect configured lifecycle hooks, trust new or changed
hooks, and disable individual non-managed hooks before they run.
to 0.150.0 Update
- Hook commands can run asynchronously and invoke MCP tools.
- The 0.150.0 changelog says
Interruptfires when the active top-level turn is interrupted and can run command or MCP handlers. It is narrower than “any child task stopped” and distinct from a normalStopevent.
Do not invent an Interrupt schema yet
The current Hooks reference still omits Interrupt from its supported-event tables. Track it as a
0.150.0 release feature, but do not publish a copied JSON/TOML event shape until the reference adds
the contract. Use /hooks to review the exact hook loaded by the installed build.
Cautions
Core events to inspect include PreToolUse, PermissionRequest, PostToolUse, UserPromptSubmit, and Stop, configured through .codex/hooks.json or inline [hooks]. Managed hooks and hooks from an untrusted project have different controls.
- Managed hooks are trusted by policy and cannot be disabled from the user hook browser.
- Project-local hooks load only when the project
.codex/layer is trusted. - User approval of a project hook is tied to the exact content hash; review and trust it again after a change.
- MCP hook handlers reuse an existing connection, run synchronously, cannot request approval, and do not trigger other hooks. Treat auth and availability failures as a separate failure path.
- Hooks are guardrails, but they are not a complete enforcement boundary for every shell or tool path.
Official sources
Complete command list · Verification scope · History for this command