Skip to content

ai / codex / hooks

Hooks for Codex

9 hooks written out as Codex expects them, in .codex/hooks.json. Small checks that run on every edit or command, so rules are enforced, not just requested.

/

9 templates

  • Block Secrets in Prompts

    HookSecurity

    Free
  • Check Node Version

    Hooknode

    Free
  • Inject Current Date

    HookWorkflow

    Free
  • Inject Git Branch

    HookGit and releases

    Free
  • Log Session End

    HookWorkflow

    Free
  • Remind Run Tests

    HookTesting

    Free
  • Session Git Context

    HookGit and releases

    Free
  • Stop Bell

    HookWorkflow

    Free
  • Warn Uncommitted Changes

    HookGit and releases

    Free

Hooks for Codex: the basics

Where do hooks go in Codex?
Codex reads them from .codex/hooks.json, a file it shares with your other settings, so the install command merges into it instead of replacing it. The install command on each page writes the file there for you.
What is a hook?
A command the agent runs at a fixed moment, such as before a tool call or after an edit. Unlike an instruction, a hook always runs, so it can block a dangerous command or format a file every time.
Does Codex have slash commands?
It has custom prompts in ~/.codex/prompts/, run as /prompts:name. They are personal, not per project, so the install command writes them to your home folder.