$ cat ~/map/pi-notify.md
pi-notify
Focus-aware notifications and sounds for pi: quiet while you watch the terminal, alerting the moment you switch away.
extensions✓ Nov 1
Facts
- repository
- github.com/ethantang1024/pi-notify ↗
- GitHub Stars
- ★ 0
- Forks
- 0
- license
- MIT
- npm / mo
- —
- last push
- Oct 31, 2026
install
pi install https://github.com/ethantang1024/pi-notify.git, then configure the notify block in ~/.pi/agent/settings.json or .pi/settings.json (focusAware, onComplete, onError, onQuestion, sound, volume, minWorkMs, minAwayMs); run /notify check for the detected backend and focus state, /notify test for an end-to-end test notification.## TL;DR
A pi extension that keeps quiet while the terminal holds focus and delivers native desktop notifications and sounds the moment you switch away: task completion, tool errors, and input requests reach Windows balloon tips, Linux notify-send, or macOS osascript, degrading to OSC 777 / OSC 99 and the terminal bell on headless and SSH sessions.
## Key points
- $Focus-aware quiet mode via DECSET 1004: with focusAware enabled, completion and question notifications trigger only while the terminal is unfocused, so active work stays silent.
- $Native delivery per platform: Win32 NotifyIcon balloon tips plus console beep through PowerShell on Windows; the freedesktop notify-send D-Bus protocol with a four-tier audio cascade (paplay, pw-play, aplay, bell) on Linux; osascript Notification Center and afplay on macOS.
- $Headless and SSH remote sessions degrade to OSC 777 / OSC 99 terminal escape sequences and the ASCII bell.
- $Three lifecycle triggers: agent_settled on run finish, tool_result isError for high-priority error alerts, and ui_prompt_start when pi blocks on a question or confirmation.
- $alwaysNotifyOnError fires the error alert even while focused; minWorkMs ignores instant turns and minAwayMs prevents accidental switch triggers.
- $Terminal support is tabulated: WezTerm, Windows Terminal, Kitty, Ghostty, and VTE-based terminals pass focus events through out of the box; tmux needs set -g focus-events on, and Alacritty falls back safely to away-duration heuristics.
- $/notify check prints focus state, detected backend, and active settings in the status bar; /notify test dispatches a test notification and sound.
- $README ships in English and Simplified Chinese (README_zh.md).
## FAQ
Q Does it stay silent while I am working in the terminal?
Yes — with focusAware enabled, completion and question notifications trigger only when the terminal loses focus. Errors still come through by default (alwaysNotifyOnError).
Q What happens over SSH or in a headless session?
Delivery degrades to OSC 777 / OSC 99 escape sequences and the ASCII bell instead of native OS notifications.
Q Does it work inside tmux?
Yes, after appending set -g focus-events on to ~/.tmux.conf so focus events pass through; Alacritty users get a graceful fallback to away-duration heuristics.
Q How do I verify delivery works?
/notify check prints the detected backend and focus state; /notify test sends a test notification and plays the alert sound immediately.
Q Which events trigger a notification?
Run completion (agent_settled), unexpected tool errors (tool_result isError), and input requests (ui_prompt_start).
## References
## Related entries
$ big-pi
Model-driven compression that summarizes completed phases into tiered blocks while Pi's JSONL transcript stays authoritative and untouched.
$ inception
A curator LLM replaces pi's compaction, rewriting old history every few turns to keep the context dense.
$ motus
Redacts exact secret values from pi tool output, blocks the commands and files that print them, and fails closed.
## Guides
Last updated: Oct 31, 2026