Codex CLI notifications: get alerted when a task is done
Updated 2026-12-04
Codex CLI can run an external program when it finishes a turn. You point the notify setting at a script, and the script shows a popup, plays a sound or pushes to your phone. This page shows the setup and a script you can copy.
How the notify setting works
Add notify to your user-level ~/.codex/config.toml. It is an array: the program followed by its arguments. According to the Codex documentation, Codex calls it with a single JSON argument describing the event, and the only supported event is agent-turn-complete. The JSON includes fields such as type, cwd and last-assistant-message. The setting is read from your user config, not from a project-local .codex/config.toml.
notify = ["python3", "/home/you/.codex/notify.py"]
A script that works on macOS and Linux
#!/usr/bin/env python3
import json, platform, subprocess, sys
event = json.loads(sys.argv[1])
if event.get("type") != "agent-turn-complete":
sys.exit(0)
msg = (event.get("last-assistant-message") or "Codex is done")[:120]
system = platform.system()
if system == "Darwin":
subprocess.run(["osascript", "-e", f'display notification {json.dumps(msg)} with title "Codex"'])
elif system == "Linux":
subprocess.run(["notify-send", "Codex", msg])
Make the script executable (chmod +x) if you call it directly. On Windows, replace the last branch with a PowerShell toast or a beep.
Built-in terminal notifications
Codex's terminal UI also has its own notification settings under [tui] (notifications, notification_condition and notification_method), which can alert you when the terminal is not focused. Check the current Codex configuration reference for the exact values, because they may change between versions.
Notifications on your phone
Add one line to the script to push to your phone, for example subprocess.run(["curl", "-s", "-d", msg, "ntfy.sh/YOUR-SECRET-TOPIC"]) with the free ntfy app. InstantPing is built for Claude Code today and does not support Codex yet. If you use both agents, see phone notifications for Claude Code.
Frequently asked questions
How do I get a notification when Codex CLI finishes?
Set notify in ~/.codex/config.toml to a program that shows a popup or sends a push. Codex passes it a JSON argument for the agent-turn-complete event.
Does InstantPing support Codex?
Not yet. InstantPing is built for Claude Code today.