Push notifications from your coding agents to your phone, via ntfy - set up in one line.
ntfy-hooks is a tiny, portable shell hook that fires an ntfy
notification when a coding agent needs your attention (a permission/approval
prompt) or finishes a turn. One script understands Claude Code, Codex,
and Hermes Agent hook events today, and anything else that can call a
command with a JSON event on stdin.
No daemon, no binary to build, no wrapper around your agent. Just a hook and a config file.
curl -fsSL https://raw.githubusercontent.com/zbiljic/ntfy-hooks/main/install.sh | shThe installer:
- Drops the hook at
~/.config/ntfy-hooks/ntfy.sh. - Asks for your ntfy server, topic, and optional token, then writes them to
~/.config/ntfy-hooks/config. - Auto-detects and wires Claude Code / Codex when found. For Hermes Agent, it
appends a complete
hooks:block only when your config does not already have one; otherwise it prints the snippet to merge manually. - Sends a test notification so you can confirm it works.
Re-running is safe: it updates the installed hook, checks the agent wiring, and
never duplicates existing hooks. In interactive mode, existing config values are
shown as defaults; press Enter to keep them. In non-interactive mode (-y), the
existing config is reused automatically unless flags or environment variables
override it.
Then subscribe to your topic in the ntfy app (iOS/Android) or at
https://ntfy.sh/<your-topic>. The topic name is the only secret - anyone who knows it can read your notifications, so keep it private.
git clone https://github.com/zbiljic/ntfy-hooks
cd ntfy-hooks
./install.sh # interactive
./install.sh --topic my-topic -y # non-interactive
./install.sh --server https://ntfy.example # self-hosted server--topic <name> ntfy topic
(default: $NTFY_TOPIC, existing config, or random)
--server <url> ntfy server
(default: $NTFY_URL, existing config, or https://ntfy.sh)
--token <token> ntfy token
(default: $NTFY_TOKEN or existing config)
--claude | --no-claude force / skip Claude Code wiring
--codex | --no-codex force / skip Codex wiring
--hermes | --no-hermes force / skip Hermes Agent wiring/snippet
--no-test don't send a test notification
--uninstall remove wiring and the installed hook
-y, --yes non-interactive
-h, --help full help
| Agent | Event | Title | Priority |
|---|---|---|---|
| Claude Code | Stop |
finished responding | default |
Notification |
waiting / idle prompt | high* | |
PermissionRequest |
needs permission | high | |
| Codex | Stop |
turn complete | default |
PermissionRequest |
needs approval | high | |
| Hermes Agent | post_llm_call |
turn complete | default |
pre_approval_request |
needs approval | high |
* high when the notification is a permission prompt.
Titles include the project directory name, e.g. Claude Code (my-repo).
At runtime, the hook reads ~/.config/ntfy-hooks/config (a shell file), and
these environment variables can override it:
| Variable | Default | Meaning |
|---|---|---|
NTFY_TOPIC |
- (required) | the ntfy topic to publish to |
NTFY_URL |
https://ntfy.sh |
ntfy server |
NTFY_TOKEN |
- | token for protected servers |
NTFY_PRIORITY |
- | force a priority for every message |
NTFY_CLICK |
- | URL opened when the notification is tapped |
NTFY_QUIET |
- | set to 1 to mute all notifications |
curl -fsSL https://raw.githubusercontent.com/zbiljic/ntfy-hooks/main/install.sh | sh -s -- --uninstallThis removes the hook and unwires the agents but leaves your config (so you
keep your topic). Delete ~/.config/ntfy-hooks/ to remove that too.
The hook detects which agent called it by where the JSON event arrives:
- Claude Code pipes the event to the hook on stdin.
- Codex pipes lifecycle-hook events to the hook on stdin via
~/.codex/hooks.json. - Hermes Agent pipes shell-hook events to the hook on stdin via the
hooks:block in~/.hermes/config.yaml.
It then maps the event to a title/message/priority and POSTs to ntfy with
curl. The hook is defensive by design: missing topic, missing jq, or a
network error never fails the calling agent (it always exits 0).
For Hermes, the installer edits YAML only in the simple case where
~/.hermes/config.yaml has no existing top-level hooks: block. If you already
have Hermes hooks, merge this snippet manually:
hooks:
pre_approval_request:
- command: "~/.config/ntfy-hooks/ntfy.sh"
timeout: 10
post_llm_call:
- command: "~/.config/ntfy-hooks/ntfy.sh"
timeout: 10Hermes shell hooks use Hermes' consent model: the first run may ask you to
approve the (event, command) pair. For gateway/non-TTY setups, review the
installed command and use Hermes' documented hook allowlist or auto-accept
setting.
--uninstall does not edit Hermes YAML. If the installer added the Hermes
block, remove those two entries from ~/.hermes/config.yaml manually.
curlandjq(jq is used to parse the event payload; without it the hook still sends a generic notification).bash/sh, macOS or Linux.
This repo uses mise for tooling and tasks. Run
mise install once to get shellcheck and shfmt, then:
mise run shellcheck:lint # shellcheck
mise run test # offline test suite (fake curl, throwaway HOME)
mise run shfmt:fmt # shfmt (optional)
mise run check # shfmt:check + shellcheck:lint
mise run validate # check + test
mise tasks # list all tasksMIT © Nemanja Zbiljić