Claude Notifications
简介
Claude Notifications
原始描述
Set up native macOS notifications for Claude Code on local and devpod/remote environments. Use when the user asks to 'setup notifications', 'configure devpod...
通过你的 Agent 添加
安装目录:claude-notifications/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: claude-notifications
description: "Set up native macOS notifications for Claude Code on local and devpod/remote environments. Use when the user asks to 'setup notifications', 'configure devpod notifications', 'get notified when Claude needs attention', 'setup claude alerts', or 'install notification hooks'. Handles local terminal-notifier, SSH reverse tunnel for devpods, launchd listener, tmux passthrough, and Claude Code hook configuration."
Claude Code Notifications Setup
Set up native macOS notifications for Claude Code — works both locally and on remote devpods via SSH reverse tunnel. Get alerts with sound whenever Claude needs permission, is waiting for input, or requires MCP interaction.
What It Does
- Local: Uses
terminal-notifier for native macOS notifications when Claude needs permission, goes idle, or requires MCP input
- Devpod: Routes notifications from remote devpods through an SSH reverse tunnel to the local
terminal-notifier, with OSC 9 fallback
- Hooks: Configures Claude Code
Notification hooks for permission_prompt, idle_prompt, and elicitation_dialog
Platform
terminal-notifier for native macOS notifications when Claude needs permission, goes idle, or requires MCP inputterminal-notifier, with OSC 9 fallbackNotification hooks for permission_prompt, idle_prompt, and elicitation_dialogmacOS only. The setup script will exit with a clear error if run on Linux/devpod. It uses brew, launchctl, and terminal-notifier — all macOS-only. The script SSHs into devpods to configure them remotely, so devpod setup is also done from your Mac.
Important: Run on Local Mac Only
Always confirm the user is running this on their local Mac, NOT on a devpod. The entire setup — including devpod configuration — is done from the local machine via SSH. The script SSHs into devpods to configure them remotely. If the user is on a devpod, ask them to switch to their local Mac terminal first.
Setup Workflow
1. Ask for devpod SSH hosts
Ask the user which devpod(s) to configure. Example hosts: username.devpod-ind, username-web.devpod-ind. If local-only setup, skip devpod args.
2. Run the setup script
# Local only
python3 scripts/setup_notifications.py
# Local + devpods
python3 scripts/setup_notifications.py --devpod <host1> --devpod <host2>
# Local only
python3 scripts/setup_notifications.py
# Local + devpods
python3 scripts/setup_notifications.py --devpod <host1> --devpod <host2>
Run from the skill's directory: ~/.claude/skills/claude-notifications/
The script handles:
- Installs
terminal-notifiervia brew if missing - Copies
notify.pyto~/.claude/scripts/ - Creates and starts the reverse tunnel listener (
notify-listener.py) via launchd - Adds
RemoteForward 19876to~/.ssh/configfor each devpod - Copies
notify.pyto each devpod and configures Claude Code hooks there - Adds
set -g allow-passthrough onto each devpod's~/.tmux.conf - Configures Claude Code notification hooks in
~/.claude/settings.json - Sends a test notification
3. Remind user of manual steps
After the script completes, always tell the user these required manual steps:
- Enable notifications for your terminal in System Settings > Notifications > [Warp / iTerm / Terminal]. Ensure "Allow Notifications" is ON and alert style is "Alerts" or "Banners".
- Enable notifications for Script Editor in System Settings > Notifications > Script Editor (terminal-notifier routes through it).
- Turn off Do Not Disturb or add "Script Editor" and your terminal app to Focus exceptions.
- Reconnect SSH sessions to devpods — existing sessions don't have the reverse tunnel. New sessions get it automatically.
Architecture
┌─────────────────────────────────────────────────┐
│ Devpod (remote) │
│ │
│ Claude Code hook → notify.py │
│ → curl localhost:19876 (reverse tunnel) │
│ → fallback: OSC 9 escape sequence │
└──────────────────┬──────────────────────────────┘
│ SSH RemoteForward 19876
┌──────────────────▼──────────────────────────────┐
│ Local Mac │
│ │
│ notify-listener.py (launchd, port 19876) │
│ → terminal-notifier → macOS Notification Center│
└─────────────────────────────────────────────────┘
Troubleshooting
- No notifications showing: Check System Settings > Notifications for both your terminal app AND "Script Editor" — both must have notifications enabled
- Do Not Disturb blocking: Add "Script Editor" to Focus exceptions, or disable DND
- Listener not running:
launchctl list | grep claude and lsof -i :19876
- Restart listener:
launchctl unload ~/Library/LaunchAgents/com.claude.notify-listener.plist && launchctl load ~/Library/LaunchAgents/com.claude.notify-listener.plist
- Listener logs:
cat ~/.claude/logs/notify-listener.log
- Test locally:
python3 ~/.claude/scripts/notify.py "test" --title "Claude Code" --sound "Glass"
- Test devpod tunnel: From devpod tmux session:
python3 ~/.claude/scripts/notify.py "test" --title "Claude Code" --sound "Glass"
- Debug mode:
DEBUG=1 python3 ~/.claude/scripts/notify.py "test"
┌─────────────────────────────────────────────────┐
│ Devpod (remote) │
│ │
│ Claude Code hook → notify.py │
│ → curl localhost:19876 (reverse tunnel) │
│ → fallback: OSC 9 escape sequence │
└──────────────────┬──────────────────────────────┘
│ SSH RemoteForward 19876
┌──────────────────▼──────────────────────────────┐
│ Local Mac │
│ │
│ notify-listener.py (launchd, port 19876) │
│ → terminal-notifier → macOS Notification Center│
└─────────────────────────────────────────────────┘
- No notifications showing: Check System Settings > Notifications for both your terminal app AND "Script Editor" — both must have notifications enabled
- Do Not Disturb blocking: Add "Script Editor" to Focus exceptions, or disable DND
- Listener not running:
launchctl list | grep claudeandlsof -i :19876 - Restart listener:
launchctl unload ~/Library/LaunchAgents/com.claude.notify-listener.plist && launchctl load ~/Library/LaunchAgents/com.claude.notify-listener.plist - Listener logs:
cat ~/.claude/logs/notify-listener.log - Test locally:
python3 ~/.claude/scripts/notify.py "test" --title "Claude Code" --sound "Glass" - Test devpod tunnel: From devpod tmux session:
python3 ~/.claude/scripts/notify.py "test" --title "Claude Code" --sound "Glass" - Debug mode:
DEBUG=1 python3 ~/.claude/scripts/notify.py "test"
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。