Skip to content

robertoecf/agentic-coding-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claude-code-notify

macOS notifications with sound and voice alerts for agent CLIs.

The repository still ships the original Claude Code plugin, and now also includes a dedicated Codex adapter. They live in one repo, but each environment keeps its own entrypoint and installation flow.

Adapters

Adapter Entry point Installation model
Claude Code hooks/scripts/notify.sh Claude plugin
Codex adapters/codex/notify.sh ~/.codex/config.toml notify command

What you get

When the adapter fires, you get:

  1. Desktop notification via terminal-notifier (with Submarine sound) when available
  2. Audio alert with Basso
  3. Voice announcement with the session label

The spoken label is environment-specific. For Codex, the voice says Codex terminou em {label} (or Codex terminou no app for the Codex macOS App). For Claude, the existing Claude Code {label} behavior is preserved.

Requirements

brew install terminal-notifier

Claude Code

The Claude adapter stays backward-compatible with the existing plugin layout.

Install

From a local directory:

claude plugin install /path/to/claude-code-notify

From GitHub:

claude plugin install github:robertoecf/claude-code-iterm-notify

Restart Claude Code after installing or updating. Claude loads hooks at session start.

Claude hooks

The plugin registers two Notification hooks:

  • permission_prompt
  • idle_prompt

Both still call hooks/scripts/notify.sh. That path is now a shim that delegates to adapters/claude/notify.sh, so older setups do not break.

Claude test

echo '{"message":"test","title":"Claude Code"}' | bash hooks/scripts/notify.sh

Codex

Codex does not use the Claude plugin system. The supported integration point is the notify command in ~/.codex/config.toml.

Install script only

Copy the adapter to your Codex bin directory:

bash adapters/codex/install.sh --install-script ~/.codex/bin/codex-notify.sh

Print the config snippet

bash adapters/codex/install.sh --print-config ~/.codex/bin/codex-notify.sh

Expected output:

notify = ["/Users/you/.codex/bin/codex-notify.sh"]

Then add that line to ~/.codex/config.toml.

Codex self-test

Run the adapter in dry-run mode:

bash adapters/codex/install.sh --self-test ~/.codex/bin/codex-notify.sh

Or invoke the repository script directly:

NOTIFY_TEST_MODE=1 bash adapters/codex/notify.sh \
  '{"type":"agent-turn-complete","cwd":"/tmp/example","last-assistant-message":"notifier pronto"}'

What the Codex adapter does (and what it cannot do)

Codex exposes exactly one event to the notify hook: agent-turn-complete. Approval requests, input requests, exec-approval, and patch-approval events all travel on different channels and never reach this script — see openai/codex#11808 and protocol source.

So the adapter is deliberately minimal:

  • On every agent-turn-complete, it fires a short voice announcement Codex terminou em <label> (or Codex terminou no app for the Codex macOS App).
  • The desktop notification shows the first ~160 characters of the last assistant message as a preview.
  • Identical events within 30 s (same label+message) are suppressed via a cooldown file.
  • The adapter does not read the assistant response aloud — that was the source of noise. Glance at the notification or the terminal/app for the actual content.

Getting alerts for approval / input (not notify)

Because Codex does not send those signals to the notify hook, use the right layer for each environment:

Codex macOS App — enable approval-request notifications in the app preferences. The app delivers them natively through macOS notifications.

Codex CLI (TUI) — add to ~/.codex/config.toml:

[tui]
notifications = ["agent-turn-complete", "approval-requested"]
notification_method = "osc9"

The terminal (iTerm2, Ghostty, Terminal.app) then emits native desktop notifications via OSC 9 when Codex asks for approval. See Advanced configuration.

Fully custom behavior — the only way to react to every EventMsg in the adapter itself is to consume Codex as an MCP server (codex mcp) instead of via the one-shot notify hook. That is out of scope for this repo today.

Tunables

Environment variable Default Purpose
CODEX_NOTIFY_LOG /tmp/codex-notify-debug.log Debug log path
CODEX_NOTIFY_COOLDOWN_FILE /tmp/codex-notify-last.json Dedup state file
CODEX_NOTIFY_COOLDOWN_SECONDS 30 Window for suppressing identical events
CODEX_NOTIFY_PREVIEW_CHARS 160 Desktop notification preview length

Session label strategy

The Codex adapter resolves the label in this order:

  1. iTerm2 profile name when ITERM_SESSION_ID is available
  2. Codex App process ancestry when the script is launched from the macOS app
  3. normalized terminal name from TERM_PROGRAM
  4. basename of the cwd in the Codex payload
  5. Codex

This keeps multiple tabs distinguishable without hardcoding agent names into the voice message.

Supported Codex environments

The adapter now resolves these environments explicitly:

  • GhosttyGhostty
  • iTerm2 → profile name when available, otherwise iTerm2
  • Apple_TerminalTerminal.app
  • vscodeVS Code
  • Codex macOS App process tree → Codex App

iTerm2 multi-session setup

If you run multiple Claude or Codex sessions in iTerm2, create named profiles such as 1, 2, api, or review.

When a session needs attention, the voice will use the profile name when it can be resolved. That is the cleanest way to identify parallel sessions.

Repository layout

.
├── adapters
│   ├── claude
│   │   └── notify.sh
│   └── codex
│       ├── install.sh
│       └── notify.sh
├── hooks
│   ├── hooks.json
│   └── scripts
│       └── notify.sh
└── tests
    └── codex_notify_test.sh

Development

Run the Codex adapter regression test:

./tests/codex_notify_test.sh

Troubleshooting

Claude plugin stopped firing

  • Restart Claude Code
  • Check ~/.claude/settings.json for invalid configuration
  • Test hooks/scripts/notify.sh manually

Codex notifications are generic

  • Confirm notify in ~/.codex/config.toml points to the right script
  • Confirm the script receives the payload as an argument
  • Use NOTIFY_TEST_MODE=1 to inspect parsed output without sending desktop notifications

Codex does not expose the same events as Claude

That is expected. Codex notify is configured through config.toml, and the current documented external notification event is agent-turn-complete. This repository keeps adapters separate so each environment can use the signals it actually exposes.

License

MIT — see LICENSE.

About

macOS notification plugin for Claude Code + iTerm2. Sound alerts with session identification by profile name.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages