paneherd

Guide

Codex CLI hooks: notify when a turn ends, and why your hook does nothing

By Eren Çolak, who makes Paneherd · Updated 2 December 2026

Codex can run a command at the end of a turn, which is enough to pop up a notification when a long task finishes. The catch that costs people an evening: a hook you just wrote does nothing until you trust it, and the only sign is a warning at startup. This guide follows OpenAI's hooks documentation (checked 2 December 2026).

1. The hook

Hooks are enabled by default. Put this in ~/.codex/hooks.json (on Windows, %USERPROFILE%\.codex\hooks.json; if CODEX_HOME is set, in that directory):

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "notify-send 'Codex' 'Codex finished a turn'",
            "commandWindows": "powershell.exe -NoProfile -Command \"[console]::beep(800,200)\"",
            "timeout": 5
          }
        ]
      }
    ]
  }
}

Notes on that file:

2. Trust it, or it never runs

Before a hook you wrote yourself can run, Codex requires you to review and trust its exact definition. It records trust against the hook's hash, so a new or changed hook is marked for review and skipped until you trust it. If hooks are waiting for review, Codex prints a warning at startup that tells you to open /hooks.

In the CLI, type /hooks. It lists hook sources, shows the ones that need review, and lets you trust them or disable individual hooks. Two consequences follow:

3. The other ways it goes quiet or noisy

4. Which session was it?

Each hook receives one JSON object on stdin, with fields such as session_id, cwd and hook_event_name. A small script can read cwd and put the folder name in the notification. A fixed message tells you that Codex finished, not where, and with four sessions open you still have to look.

Doing it in Paneherd

Paneherd runs Codex in its own pane and listens to the same hook events, Stop and the permission request among them, to show each pane as working, waiting or done in one sidebar and to notify you when a pane needs you. Codex has no per-session settings flag, so Paneherd passes its hooks as -c overrides, and keeps each hook's text identical in every pane so the trust you give it once stays valid. The one-time review in /hooks is still yours to do. The extension is free, with notifications, the optional sound, review, the merge queue and the permission inbox.

Limit: until a Paneherd hook is trusted, Codex skips it, so a pane's status can lag. Treat a Codex pane that never reports its end as "hooks not trusted yet".

Frequently asked questions

Why does my Codex Stop hook never run?

Almost always because it was never trusted. Open /hooks in the CLI and review it. Editing the command resets the trust.

Where does Codex look for hooks?

The user file hooks.json in $CODEX_HOME (~/.codex by default), .codex/hooks.json in a trusted project, and a system file. You can also write hooks inline under [hooks] in config.toml, but keep each hook in one place.

Why two notifications per turn?

The same command is registered in two files, or in hooks.json and config.toml of one layer. Codex can run it twice.

Install Paneherd free