You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Play a sound when Codex finishes a prompt / task #3962
Summary
Please add an optional, clearly audible completion sound that plays when Codex finishes executing a prompt/task (useful when prompts run longer and the user switches focus).
Why
Helps when Codex works in background and I’m in another window/tab.
Terminal bell \a is too short/quiet and easy to miss.
Use case / Motivation
Most of my prompts take Codex quite a long time to execute — often more than a minute. It’s frustrating that I have to sit and stare at the screen just to know when it’s done. Since I work remotely, I could easily use that waiting time to do something else, as long as Codex informs me when it finishes.
Yes, I can (and already did) hack together my own workaround, but it would be much nicer if this were a built-in feature of the extension. For example, after finishing a prompt Codex could simply play a clear sound notification.
Minor change to notify.py to use the terminal bell instead:
#!/usr/bin/env python3
"""
Minimal notifier for Codex "notify" hook.
Plays a short sound when an agent turn completes.
Usage: Codex runs this script with a single JSON argument.
"""
import sys
import json
def main():
if len(sys.argv) != 2:
return 0
try:
event = json.loads(sys.argv[1])
except Exception:
return 0
if event.get("type") != "agent-turn-complete":
return 0
# Print BEL character -> terminal bell
sys.stdout.write("\a")
sys.stdout.flush()
return 0
if __name__ == "__main__":
raise SystemExit(main())
To test once it's all set up run: python3 ~/.codex/notify.py '{"type":"agent-turn-complete"}'
Windows → SystemSounds.Asterisk (success), SystemSounds.Hand (error)
Linux → canberra id complete (success), dialog-error (error)
Fallback: terminal bell (\a) if no backend available
Fires only on finalagent-turn-complete
Why
Improves the UX for long-running tasks without requiring custom notify hook scripts
Only system sounds → zero new binary assets
Safe defaults, fully optional, and configurable via ~/.codex/config.toml
Increasingly relevant as model time horizons grow longer — Codex runs already take tens of minutes in some cases. An audible success/failure cue makes it possible to safely multitask while waiting.
"I tried many times, but the notification failed every time. Finally, I moved the line notify = ["python3", "/Users/wang/.codex/notify.py"] right after disable_response_storage = true, and it worked! (It's strange because it kept failing when I had it after trust_level = "trusted".)"
For macOS users, I found a simple way to play sounds or notifications using the Shortcuts app, which has higher permissions. I configured the TOML file accordingly.
hi, glad to see there 2 nice "hooks"-related solutions for (also) sound notifications; I was totally new to codex 3 weeks ago, so only now understanding the architecture (btw, is codex-CLI used under the hood of codex-APP ?), but as I understood reading related issues here, "hooks" are still in development to be in parity to claude code, but this is probably something I didn't knew - sure; so I as a one of first codex test projects implemented "out of the box sound notifier" based on visual screen watching of PET badge parked into left-bottom screen corner (tested on win/mac, hidpi aware etc); sure IT IS hack, but is reliable and is fast/immediate - system notifications on windows are always quite weird and not instant - thanks for the new workarounds/hooks here too;
(this was hidden originally as off-topic, but it isn't, excuse me, I am writing here mostly because "system notifications" at least on windows is something which didn't worked for me well, so i was immediately forced to TRY something simple the "other way"...) https://github.com/apws/260504-codex-pet-screen-sounds
Please also support custom notification sounds in the Codex desktop app.
Suggested settings:
Choose from built-in sounds
Import a local WAV/MP3 file
Preview the selected sound
Configure separate sounds for task completion, user input required, approval required, and failure
Restore the default sound easily
Currently, the macOS app bundles a fixed notification sound. Replacing that file manually invalidates the app code signature and may prevent the app from launching, so this needs an officially supported setting.
This would be especially useful for long-running tasks and for users who work with several agent applications simultaneously.
For anyone who wants this outside the editor: Bellows, a desktop app for Windows, macOS and Linux, runs Codex (alongside Claude, Gemini CLI and any ACP agent) and tells you the moment a turn finishes or the agent stops to ask permission. It's a proper system notification with sound, not a terminal bell, and clicking it takes you straight to the session that raised it. While a session is waiting on you, its taskbar button flashes until you answer.
It works across every session at once, so you can leave three Codex tasks running in different worktrees and get on with something else. If you're away from the desk entirely, you can answer the permission prompts from your phone.
For the extension-side gap specifically, here is what works today with zero dependencies — plus the four things that silently break it. I re-checked every detail below against the current hooks reference today (2026-10-15), because a few of the recipes earlier in this thread have gone stale.
Two distinct sounds, one for "waiting on you" and one for "done", in ~/.codex/hooks.json:
PermissionRequest runs when Codex is about to ask for approval (it does not run for commands that need no approval); Stop runs at the turn boundary. Both hooks here return no output, so the normal approval prompt is untouched — this only notifies, it never auto-approves or denies anything. afplay and osascript are both built into macOS, so there is nothing to install.
The four traps
Hooks must be trusted before they run. Codex records trust against the hook's hash, so a new or edited hook is flagged for review and skipped until trusted. Run /hooks to review and trust it. This is the most likely reason a perfectly correct config does nothing — and it bites again every time you tweak the command.
Stop rejects plain stdout. For Stop, output must be empty or JSON; plain text is invalid for that event. That is what the >/dev/null 2>&1 is doing — without it, any command that prints a line gets the hook run marked as failed.
The older notify key cannot do this. It only ever receives type: agent-turn-complete, so there is no way to get a separate "needs you" sound out of it — which is exactly why tput bel never fires on permission requests (@nialse's observation). Also worth knowing: notify is ignored in project-local .codex/config.toml and must live in your user-level ~/.codex/config.toml.
codex_hooks = true is stale. Hooks are enabled by default now; the feature key is [features].hooks, with codex_hooks kept only as a deprecated alias. If you copied an older snippet from this thread, you do not need that flag at all.
If you would rather keep one file, the inline config.toml form needs a TOML triple-quoted literal, because a single-quoted literal cannot contain the quotes osascript needs (a silent parse error otherwise):
[[hooks.Stop]]
[[hooks.Stop.hooks]]
type = "command"command = '''afplay /System/Library/Sounds/Glass.aiff >/dev/null 2>&1 & osascript -e 'display notification "Turn complete" with title "Codex"' >/dev/null 2>&1'''timeout = 5
To confirm hooks actually fire on your extension build, don't take my word for it — the docs describe hook discovery from the ~/.codex config layer but do not spell out IDE-extension coverage. Probe it: temporarily set the Stop command to printf '%s stop\n' "$(date +%T)" >> ~/codex-hook-probe.log, trust it via /hooks, run one turn from the extension, then cat ~/codex-hook-probe.log. Lines appearing means the sound hooks will work there too; nothing appearing means it is engine-side and no config will fix it.
(CLI readers: this is already built in — tui.notifications can filter by event type including approval-requested, and tui.notification_condition can restrict it to when the terminal is unfocused. See config-advanced. Per @etraut-openai, CLI behaviour is tracked separately from this thread.)
Disclosure: I build Sleepwing (free, macOS), so season that part to taste. It is a watcher rather than a notifier: it connects to 7 coding agents (Codex is one of the three I have verified end to end), shows distinct waiting-on-you / done / failed states instead of one undifferentiated ping, and clicking a session jumps back to it — exact tab routing on Terminal.app and iTerm2, other terminals just get the app activated. It also nudges you to take the break while the agent works, which was the OP's actual goal. Zero outbound network, everything stays local. It uses the same hook events shown above, so if the probe above comes back empty, it would not help you either.
If a sound isn't enough and you want to actually hear what finished: voicehook is a remote MCP server (https://voicehook.ai/mcp) that works with Codex. The agent opens a voice call in your browser, tells you out loud when a long task is done or when it needs a decision, and you can answer by voice from another window or the couch. A status board shows what it's doing in between.
Activity
robin-liquidium commentedon Sep 20, 2025
you can already do that by setting up a notification hook for it in your .codex config.toml.
just add this to your config.toml
notify = ["python3", "~/.codex/notify.py"]and setup a notify.py file
markgrover commentedon Sep 25, 2025
I had to a make a few tweaks (iterm2 on macOS):
~/.codex/config.toml, I had to use absolute path to my home dirnotify = ["python3", "/Users/YOUR_USER_NAME/.codex/notify.py"]python3 ~/.codex/notify.py '{"type":"agent-turn-complete"}'samlouiscohen commentedon Sep 27, 2025
Love this ask. I implemented a cross-platform MVP that’s opt-in and uses system sounds (no bundled assets).
Proposal
notifications.sound = true|false(defaultfalse)notifications.only_on_long_runs_ms = 0notifications.success_tone = "default"/notifications.error_tone = "default"complete(success),dialog-error(error)\a) if no backend availableagent-turn-completeWhy
notifyhook scripts~/.codex/config.tomlExample Config
Opened a PR to implement this: #4329
It adds:
notifications.sound(default off)notifications.only_on_long_runs_mssuccess_tone/error_tonewith sensible per-OS defaultsCross-platform mappings:
complete/dialog-erroratreeon commentedon Oct 1, 2025
Would this proposal result in the cli playing a sound if the task pauses asking for approval?
jsh9 commentedon Oct 5, 2025
Hi @samlouiscohen , does your code change work for the VS Code extension as well? Or only the CLI version of Codex?
budingkak12 commentedon Oct 18, 2025
我尝试了很多次,都通知失败,最后,我把notify = ["python3", "/Users/wang/.codex/notify.py"]
放到disable_response_storage = true的后面一行 成功了,(我之前一直放在
trust_level = "trusted"
后面,导致一直失败,很神奇)
budingkak12 commentedon Oct 18, 2025
"I tried many times, but the notification failed every time. Finally, I moved the line notify = ["python3", "/Users/wang/.codex/notify.py"] right after disable_response_storage = true, and it worked! (It's strange because it kept failing when I had it after trust_level = "trusted".)"
rijieli commentedon Oct 19, 2025
For macOS users, I found a simple way to play sounds or notifications using the Shortcuts app, which has higher permissions. I configured the TOML file accordingly.
jsh9 commentedon Oct 21, 2025
The following worked for me on macOS, simple and easy to maintain, without the hassle of creating a Python script (notify.py) or a Shortcut.
In
~/.codex/config.toml, add this line:model = "gpt-5-codex" model_reasoning_effort = "low" + notify = ["bash", "-lc", "afplay /System/Library/Sounds/Bottle.aiff"]/System/Library/Soundshas many different ringtones for you to choose. You don't have to use my choice.(Inspired by #4998 (comment))
[-]Play a long sound when Codex finishes a prompt/task[/-][+]Play a sound when Codex finishes a prompt / task[/+]40 remaining items
apws commentedon May 4, 2026
constansino commentedon May 6, 2026
I published a small hook-based workaround for macOS users who want a clearer "Codex needs attention" signal, not just turn-complete notifications:
https://github.com/constansino/codex-attention-notifier
It sends a native macOS notification for
PermissionRequesthook events. It does not approve/deny anything; it only notifies and logs locally.I also wrote a short discussion post with usage details here:
#21354
PhilChen-6765 commentedon May 14, 2026
etraut-openai commentedon May 14, 2026
PhilChen-6765 commentedon May 14, 2026
etraut-openai commentedon May 14, 2026
AminDhouib commentedon May 15, 2026
For anyone here using custom
notify.pyscripts or one-offafplaycommands, we built a small cross-platform notifier for Codex and other AI coding agents: https://github.com/DevinoSolutions/ai-agent-notifierJust run
npx ai-agent-notifier setup, reset your current sessions, and you are good to go!Desktop.Notifications.for.Claude.Codex.Cursor.and.Gemini.-.AI.Agent.Notifier.Demo.mp4
Watch on YouTube
apws commentedon May 23, 2026
hi, glad to see there 2 nice "hooks"-related solutions for (also) sound notifications; I was totally new to codex 3 weeks ago, so only now understanding the architecture (btw, is codex-CLI used under the hood of codex-APP ?), but as I understood reading related issues here, "hooks" are still in development to be in parity to claude code, but this is probably something I didn't knew - sure; so I as a one of first codex test projects implemented "out of the box sound notifier" based on visual screen watching of PET badge parked into left-bottom screen corner (tested on win/mac, hidpi aware etc); sure IT IS hack, but is reliable and is fast/immediate - system notifications on windows are always quite weird and not instant - thanks for the new workarounds/hooks here too;
(this was hidden originally as off-topic, but it isn't, excuse me, I am writing here mostly because "system notifications" at least on windows is something which didn't worked for me well, so i was immediately forced to TRY something simple the "other way"...)
https://github.com/apws/260504-codex-pet-screen-sounds
alsotang commentedon Jun 10, 2026
any update here? i dont need the sound. i need visual notification.
pal03377 commentedon Jun 22, 2026
Someone built an additional plugin that can do this (but it does not work via the Remote SSH extension :()
https://marketplace.visualstudio.com/items?itemName=zis3c.codex-notifier
finebyme99 commentedon Jul 11, 2026
Please also support custom notification sounds in the Codex desktop app.
Suggested settings:
Currently, the macOS app bundles a fixed notification sound. Replacing that file manually invalidates the app code signature and may prevent the app from launching, so this needs an officially supported setting.
This would be especially useful for long-running tasks and for users who work with several agent applications simultaneously.
bellowsai commentedon Oct 13, 2026
Disclosure: I'm Rob, and I built this.
For anyone who wants this outside the editor: Bellows, a desktop app for Windows, macOS and Linux, runs Codex (alongside Claude, Gemini CLI and any ACP agent) and tells you the moment a turn finishes or the agent stops to ask permission. It's a proper system notification with sound, not a terminal bell, and clicking it takes you straight to the session that raised it. While a session is waiting on you, its taskbar button flashes until you answer.
It works across every session at once, so you can leave three Codex tasks running in different worktrees and get on with something else. If you're away from the desk entirely, you can answer the permission prompts from your phone.
Download: https://bellowsai.app/downloads?utm_source=github&utm_medium=reply
Give it a try, and tell me what would make it better for your workflow. We act fast on feedback.
lttxzmj commentedon Oct 15, 2026
For the extension-side gap specifically, here is what works today with zero dependencies — plus the four things that silently break it. I re-checked every detail below against the current hooks reference today (2026-10-15), because a few of the recipes earlier in this thread have gone stale.
Two distinct sounds, one for "waiting on you" and one for "done", in
~/.codex/hooks.json:{ "hooks": { "PermissionRequest": [ { "hooks": [ { "type": "command", "command": "afplay /System/Library/Sounds/Sosumi.aiff >/dev/null 2>&1 & osascript -e 'display notification \"Codex is waiting for you\" with title \"Codex\"' >/dev/null 2>&1", "timeout": 5 } ] } ], "Stop": [ { "hooks": [ { "type": "command", "command": "afplay /System/Library/Sounds/Glass.aiff >/dev/null 2>&1 & osascript -e 'display notification \"Turn complete\" with title \"Codex\"' >/dev/null 2>&1", "timeout": 5 } ] } ] } }PermissionRequestruns when Codex is about to ask for approval (it does not run for commands that need no approval);Stopruns at the turn boundary. Both hooks here return no output, so the normal approval prompt is untouched — this only notifies, it never auto-approves or denies anything.afplayandosascriptare both built into macOS, so there is nothing to install.The four traps
/hooksto review and trust it. This is the most likely reason a perfectly correct config does nothing — and it bites again every time you tweak the command.Stoprejects plain stdout. ForStop, output must be empty or JSON; plain text is invalid for that event. That is what the>/dev/null 2>&1is doing — without it, any command that prints a line gets the hook run marked as failed.notifykey cannot do this. It only ever receivestype: agent-turn-complete, so there is no way to get a separate "needs you" sound out of it — which is exactly whytput belnever fires on permission requests (@nialse's observation). Also worth knowing:notifyis ignored in project-local.codex/config.tomland must live in your user-level~/.codex/config.toml.codex_hooks = trueis stale. Hooks are enabled by default now; the feature key is[features].hooks, withcodex_hookskept only as a deprecated alias. If you copied an older snippet from this thread, you do not need that flag at all.If you would rather keep one file, the inline
config.tomlform needs a TOML triple-quoted literal, because a single-quoted literal cannot contain the quotesosascriptneeds (a silent parse error otherwise):To confirm hooks actually fire on your extension build, don't take my word for it — the docs describe hook discovery from the
~/.codexconfig layer but do not spell out IDE-extension coverage. Probe it: temporarily set theStopcommand toprintf '%s stop\n' "$(date +%T)" >> ~/codex-hook-probe.log, trust it via/hooks, run one turn from the extension, thencat ~/codex-hook-probe.log. Lines appearing means the sound hooks will work there too; nothing appearing means it is engine-side and no config will fix it.(CLI readers: this is already built in —
tui.notificationscan filter by event type includingapproval-requested, andtui.notification_conditioncan restrict it to when the terminal is unfocused. See config-advanced. Per @etraut-openai, CLI behaviour is tracked separately from this thread.)Disclosure: I build Sleepwing (free, macOS), so season that part to taste. It is a watcher rather than a notifier: it connects to 7 coding agents (Codex is one of the three I have verified end to end), shows distinct waiting-on-you / done / failed states instead of one undifferentiated ping, and clicking a session jumps back to it — exact tab routing on Terminal.app and iTerm2, other terminals just get the app activated. It also nudges you to take the break while the agent works, which was the OP's actual goal. Zero outbound network, everything stays local. It uses the same hook events shown above, so if the probe above comes back empty, it would not help you either.
Silverstar187 commentedon Oct 18, 2026
Disclosure: I built this.
If a sound isn't enough and you want to actually hear what finished: voicehook is a remote MCP server (
https://voicehook.ai/mcp) that works with Codex. The agent opens a voice call in your browser, tells you out loud when a long task is done or when it needs a decision, and you can answer by voice from another window or the couch. A status board shows what it's doing in between.Free minutes, no signup: https://voicehook.ai/?utm_source=github&utm_medium=comment&utm_campaign=codex-3962