How to know when Claude Code or Codex needs you
Short answer: Both tools can alert you for free. In Claude Code, set preferredNotifChannel to "terminal_bell" or add a Notification hook that shows a desktop alert. In Codex, turn on tui.notifications in ~/.codex/config.toml. If you want the alert off your screen, send a push to your phone from a hook, or put a small device on your desk.
AI coding agents stop and wait more often than you would expect: for a permission, for an answer, or because they are done. If you have switched to another window, the agent sits idle until you happen to look. Here is every way to fix that, starting with the free ones.
Does Claude Code notify you by itself?
Sometimes. Claude Code sends a desktop notification on its own only in the Ghostty, Kitty and iTerm2 terminals. In iTerm2 you also have to allow it: open Settings, then Profiles, then Terminal, check “Notification Center Alerts”, click “Filter Alerts” and enable “Send escape sequence-generated alerts”.
In any other terminal, turn on the terminal bell. Add this to ~/.claude/settings.json:
{
"preferredNotifChannel": "terminal_bell"
}
In Apple Terminal, also turn on “Audible bell” under Settings, then Profiles, then Advanced, or you will not hear it.
Two things to know about timing. The alert for a permission prompt fires after the prompt has been waiting about six seconds. The alert for “finished and idle” fires about 60 seconds after Claude stops, if you have not typed anything.
If you run Claude Code inside tmux, desktop notifications don’t reach your terminal by default. Add set -g allow-passthrough on to ~/.tmux.conf, run tmux source-file ~/.tmux.conf, and set preferredNotifChannel to your outer terminal: "iterm2", "kitty" or "ghostty". Even then, a pane in a tmux window you aren’t viewing sends nothing.
How do I get a desktop notification when Claude Code needs input?
Add a Notification hook. A hook is a command Claude Code runs at a set moment, and this one runs whenever Claude is waiting for you. Put this in ~/.claude/settings.json.
On macOS:
{
"hooks": {
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'"
}
]
}
]
}
}
osascript sends notifications through the Script Editor app. If Script Editor does not have notification permission, the command fails silently. Run osascript -e 'display notification "test"' in Terminal once, then open System Settings, then Notifications, and allow Script Editor.
On Linux, use the same structure with this command:
notify-send 'Claude Code' 'Claude Code needs your attention'
Then type /hooks inside Claude Code to check that the hook is listed.
The empty matcher fires on every kind of notification. To be alerted only when a permission is waiting, set the matcher to permission_prompt. For “finished and idle”, use idle_prompt. Background sessions in agent view use the types agent_needs_input and agent_completed, so a permission_prompt matcher will not catch them.
How do I play a sound when Claude Code finishes or needs me?
Use the same hook with a sound command. On macOS:
{
"hooks": {
"Notification": [
{
"hooks": [{ "type": "command", "command": "afplay /System/Library/Sounds/Glass.aiff" }]
}
]
}
}
A sound works well if you stay in the room. It does not tell you which session needs you, or why.
How do I get notified when Codex finishes or needs approval?
Codex has notifications built into its terminal interface. Add this to ~/.codex/config.toml:
[tui]
notifications = ["agent-turn-complete", "approval-requested"]
notification_method = "auto"
notification_condition = "unfocused"
notifications can be true for everything or a list of event types. notification_method is auto, osc9 or bel: osc9 asks your terminal to show a desktop notification, bel rings the bell, and auto tries the first and falls back to the second. notification_condition is unfocused (only when the terminal is in the background) or always.
Codex also has a notify setting that runs a program of your choice. It is a top-level key, so put it at the top of the file, above any [section] line:
notify = ["python3", "/path/to/notify.py"]
The program receives one JSON argument describing the event. At the time of writing, the only event notify supports is agent-turn-complete, so it tells you when a turn finishes but not when an approval is waiting. For approvals, use tui.notifications.
How do I get a notification on my phone?
Have a hook call a push service. Any service that accepts a web request works. As one example, with the free ntfy app installed on your phone and subscribed to a topic name you made up, a Claude Code Notification hook can run:
curl -s -d "Claude Code needs you" https://ntfy.sh/your-hard-to-guess-topic
Pick a topic name nobody could guess: ntfy’s documentation says the topic is essentially a password, because anyone who knows it can read the messages. Keep the message text free of anything private.
A phone push is the only free option that reaches you when you have left your desk. You still have to walk back to answer.
How do I keep track of several Claude Code sessions?
Claude Code has an agent view, opened with claude agents, that lists your background sessions and marks each one as working, needing input, completed or failed. While it is open, Claude Code notifies you when a background session needs input, finishes or fails. It is a research preview, so details may change. There is a separate guide on running several agents at once.
Which option should I use?
| Option | Cost | Setup | Reaches you away from the screen | Answer without switching windows |
|---|---|---|---|---|
| Built-in terminal alert or bell | Free | One setting | No | No |
| Desktop notification hook | Free | A few lines of settings | No | No |
| Sound hook | Free | A few lines of settings | Only within earshot | No |
| Phone push from a hook | Free | An app and a few lines | Yes | No |
| Claude Code agent view | Free | None | No | No, you switch to its terminal |
| Nubby | Not on sale yet | At your desk | Yes |
If you sit at your computer all day, a desktop notification hook is enough for most people. If you walk away a lot, add the phone push. If you run several agents and keep losing track of which one is stuck, try agent view.
Where does Nubby fit?
Nubby sits on your desk and tells you when your AI agents need you, finish or fail. You can answer yes or no without switching windows. It works with Claude, including Claude Code and Claude chats, and with Codex to start.
It is for people who would rather glance at their desk than watch for pop-ups. The free options above solve the same problem, and you should try them first.
Nubby’s Founder Edition is not open yet. You can join the waitlist and we will email you the day it opens.
Sources
- Claude Code: configure your terminal, notifications
- Claude Code: automate actions with hooks
- Claude Code: hooks reference
- Claude Code: agent view
- Codex: advanced configuration
- Codex: configuration reference
Last checked against the official documentation on November 14, 2026. Nubby is not affiliated with, endorsed by or sponsored by Anthropic or OpenAI. Claude and Claude Code are products of Anthropic. Codex is a product of OpenAI.