The problem
Terminal tabs look alike. An agent waiting for an answer looks the same as one that is working, and a notification for every finished step teaches you to ignore notifications. What you want is one signal when an agent is blocked on you, and none otherwise.
Agent hooks
Several agents can run a command when they stop or need input. Claude Code has a Notification hook; the permission_prompt matcher keeps it to the moments Claude Code waits for your permission to use a tool:
{
"hooks": {
"Notification": [
{ "matcher": "permission_prompt",
"hooks": [ { "type": "command",
"command": "osascript -e 'display notification \"Claude Code needs you\" with title \"Claude Code\"'" } ] }
]
}
}Codex can notify you when it asks for approval, if your terminal shows notifications:
[tui] notifications = ["approval-requested"]
For a signal at the end of every turn instead, Codex runs the program set as notify, with a JSON description as its last argument. Put notify at the top of the file, before any [section], with the script’s full path, and make the script executable with chmod +x ~/bin/codex-notify:
notify = ["/Users/you/bin/codex-notify"]
#!/bin/bash osascript -e 'display notification "Codex finished a turn" with title "Codex"'
For OpenCode, Cursor Agent, Gemini CLI and others, check the agent’s documentation for a hook or a notify setting. Without one, the terminal bell at the end of a turn is often all there is.
A hook knows its agent’s folder and session. It does not know whether you are already looking at that chat, or whether its subagents are still running.
In tmux
tmux can flag the window whose agent rang the bell:
set -g monitor-bell on set -g bell-action other set -g visual-bell off
With Dockazor
Dockazor marks every chat Working, Needs you or Idle, in every project at once, and sends one notification when a chat needs you.
- No notification while its subagents still run, and none for the chat you are already looking at.
- A chat that finishes notifies you too. For needs-you only, turn off When a chat finishes in Settings › Dockazor.
- The Dock icon counts the chats that need you, and ⌃⌘↓ opens the next one.
- Claude Code, Codex, OpenCode and Gemini CLI are marked when they need you. Cursor Agent is marked at the end of a turn. An agent you add is not detected. Support per agent.