Get notified when your AI agent finishes or needs your approval
Notification settings and hooks for Claude Code, Codex and Cursor on a Mac, with working config for a desktop alert when an agent stops or asks.
Each agent has its own way. Claude Code fires a Notification hook when it needs permission or goes idle, and a Stop hook when it finishes. Codex has a notify program for finished turns, built-in terminal notifications, and PermissionRequest and Stop hooks. Cursor has a stop hook, and its docs describe no built-in desktop notification. The simplest pattern on a Mac is a hook that calls osascript to show a notification.
Claude Code
Add this to ~/.claude/settings.json to get an alert when Claude asks permission or sits idle. The Notification matcher filters by type, and the docs list permission_prompt, idle_prompt, agent_needs_input and agent_completed among the values. Exit codes are ignored for this event, so a failed alert cannot change what Claude does.
{
"hooks": {
"Notification": [
{
"matcher": "permission_prompt|idle_prompt",
"hooks": [
{
"type": "command",
"command": "osascript -e 'display notification \"Claude Code needs you\" with title \"Claude Code\"'"
}
]
}
]
}
}For a finished turn, add a Stop hook the same way. Stop has no matcher and fires every time Claude stops. Claude Code reloads settings while running, so edits apply to the open session. The docs show the shape of these hooks but no osascript example, so treat the command above as ours, and test it by running the osascript line alone first.
If you use background sessions, claude agents opens agent view. The docs say that while it is open, Claude Code sends a notification through your terminal notification channel when a background session needs input, finishes or fails, and fires the Notification hook with agent_needs_input or agent_completed. Claude Code hooks
Codex
Three options, from simplest.
- Built-in terminal notifications. In the
[tui]table of~/.codex/config.toml,notificationsturns them on or off or limits them to event types,notification_methodtakesauto,osc9orbel, andnotification_conditiontakesunfocusedoralways. notify. An array that runs a program when an event fires. Today onlyagent-turn-completeis supported, and the program gets one JSON argument with fields such ascwdandlast-assistant-message.
notify = ["python3", "/Users/you/bin/notify.py"]- Hooks.
Stopruns at the end of a turn.PermissionRequestruns when Codex is about to ask for approval, and if your hook declines to decide, the normal prompt continues. Hooks live in$CODEX_HOME/hooks.json(default~/.codex) or.codex/hooks.jsonin a trusted project, and a hook you have not reviewed and trusted is skipped. The docs include no notification example, so write a command hook that reads the JSON on stdin and callsosascript. Codex hooks
Cursor
Cursor’s agent docs say nothing about notifications, so use a hook. The stop event fires when the agent loop ends, with a status of completed, aborted or error. Define it in ~/.cursor/hooks.json:
{
"version": 1,
"hooks": {
"stop": [{ "command": "/Users/you/.cursor/hooks/notify.sh" }]
}
}The script can read the JSON and run osascript. Cursor’s docs describe no hook that fires when an approval prompt opens, so for approvals watch the app. Cursor hooks
Side by side
| Finished | Needs approval | Needs a script | |
|---|---|---|---|
| Claude Code | Stop hook, agent view | Notification with permission_prompt | Yes, for a desktop alert |
| Codex | notify, [tui] notifications, Stop hook | PermissionRequest hook | Only for custom alerts |
| Cursor | stop hook | No documented hook | Yes |
Where Excellent fits
Excellent for Mac asks once to send you notifications. With Pro, it alerts you when an agent sends your email to a website, deletes a never-delete folder, force pushes main or leaves a key in a log, and when its check blocks or asks. It does not announce that an agent finished. Pro is US-only for now. Pricing · Agent coverage · Run the free scan
Checklist
- Hook added for permission prompts in Claude Code.
-
notifyor[tui]notifications set in Codex, and any hook trusted. -
stophook added in Cursor. - macOS notifications allowed for the app that runs
osascript. - Triggered each alert once on purpose.
Checked against vendor documentation on November 25, 2026. Claude Code hooks · Claude Code agent view · Codex advanced config · Codex hooks · Cursor hooks



