If you are running Codex CLI in the background and want to know when it finishes or needs your input, you have three configuration options. However, a recent deep dive by developer agentyak clarifies that only one of these methods can notify your phone about pending approvals. The other two are limited to desktop alerts or simple completion pings, which creates a significant gap for developers who need to respond to security prompts remotely.
Desktop Alerts and Simple Completion Pings
The most basic method is tui.notifications, which is built directly into the terminal UI. Configured in ~/.codex/config.toml, it covers events like "agent-turn-complete" and "approval-requested," but it only reaches your local terminal or desktop via OSC 9 escape sequences or BEL characters. It is ideal for developers working at their desk with multiple windows, but it cannot push notifications to a mobile device. For phone notifications, the notify command in config.toml offers a slightly more flexible route. It runs a shell command upon turn completion, passing a JSON payload that includes the last assistant message. This allows you to pipe the output to services like ntfy, Slack, or custom webhooks. However, this method has a critical limitation: it only triggers on agent-turn-complete. It does not fire when Codex is waiting for approval, meaning you could miss urgent security prompts if you rely solely on this setting. Additionally, users must ensure notify is placed in the user-level config, as Codex ignores it in project-specific files.
Hooks: The Only Path for Remote Approvals
If you need to know when Codex is waiting for your approval, you must use hooks defined in ~/.codex/hooks.json. Hooks can trigger on events such as Stop and PermissionRequest, sending the event data as JSON to stdin. This is the only configuration that allows a phone notification for both task completion and pending approvals. The source article highlights that while notify and tui.notifications are easier to set up, they fail to cover the PermissionRequest event on mobile devices.
Key Takeaways
tui.notificationsis desktop-only and cannot reach phones.- The
notifycommand can reach phones but only signals turn completion, missing approval requests. - Hooks in
~/.codex/hooks.jsonare the only method that notifies phones about both completions and pending approvals. notifymust be configured in the user-level config, not project-level.
The Bottom Line
For serious Codex CLI users who step away from their desks, hooks are non-negotiable. The other methods are fine for casual monitoring, but they leave you blind to approval requests when you are away from your keyboard.