Sound notification hooks for Claude Code that play audio alerts when Claude needs attention or completes tasks. Works on macOS, Windows, and Linux without external dependencies.
π΅ macOS Enhancement: Now uses built-in system sounds on macOS - no sound files needed!
Vision: This repository aims to become the central hub for awesome Claude Code hooks, featuring a curated collection of community-contributed hooks and eventually a hook manager to easily discover, install, and manage hooks across projects.
- π Notification Hook: Plays sound when Claude needs user attention
- β Stop Hook: Plays sound when Claude completes a task
- π€ SubagentStop Hook: Plays sound when a subagent completes
- π Event Logging: All events are logged to JSON files for review
- π¬ Chat Transcript Processing: Optionally logs full chat transcripts
- π Cross-Platform: Works on macOS, Windows, and Linux using native commands
- Clone this repository or copy the
.claude
directory to your project - For Windows/Linux: Ensure the sound files are in your project root:
on-agent-need-attention.wav
on-agent-complete.wav
- For macOS: No sound files needed - uses built-in system sounds!
- The hooks will automatically work for this project
To use these hooks in all your Claude Code projects:
# Install globally
./install-global.sh
# To uninstall
./uninstall-global.sh
The global installer will:
- Copy hooks to
~/.claude/hooks/
- Copy sound files to
~/.claude/
(Windows/Linux only) - Update
~/.claude/settings.json
with hook configurations (preserves existing permissions) - Create a logs directory at
~/.claude/logs/
- macOS: Automatically uses system sounds - no file copying needed!
The hooks use native system commands for audio playback:
- macOS:
afplay
with built-in system sounds- Notification:
/System/Library/Sounds/Funk.aiff
- Completion:
/System/Library/Sounds/Glass.aiff
- Notification:
- Windows: PowerShell
Media.SoundPlayer
(built-in) with custom WAV files - Linux:
aplay
,paplay
, orplay
(usually pre-installed) with custom WAV files
Hooks are written in TypeScript and executed directly using npx tsx
- no build step required!
- Claude Code sends JSON event data to the hook via stdin
- Hook processes the event and plays appropriate sound
- Event details are logged to JSON files
- Exit code indicates success/failure
The .claude/settings.json
configures three hooks:
Note: The installer only updates the
hooks
configuration and preserves any existingpermissions
you may have configured.
{
"hooks": {
"PreToolUse": [],
"PostToolUse": [],
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "npx tsx .claude/hooks/notification.ts --notify"
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "npx tsx .claude/hooks/stop.ts --chat"
}
]
}
],
"SubagentStop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "npx tsx .claude/hooks/subagent_stop.ts"
}
]
}
]
}
}
--notify
: Play sound for notification events--chat
: Process and log chat transcripts
Logs are stored in the logs/
directory (or ~/.claude/logs/
for global installation):
notifications.json
- All notification eventsstop.json
- All stop eventssubagent_stop.json
- All subagent stop eventschat.json
- Chat transcripts (when using--chat
flag)
Test hooks locally:
# Test notification hook
npx tsx .claude/hooks/notification.ts --notify
# Test with sample input
echo '{"type":"Notification","data":{}}' | npx tsx .claude/hooks/notification.ts --notify
- Node.js (for
npx
) - Required for running TypeScript hooks - must be available in your $PATH - TypeScript execution via
tsx
- Installed automatically via npx - Sound files (Windows/Linux only):
on-agent-need-attention.wav
andon-agent-complete.wav
- macOS: No sound files required - uses built-in system sounds
All dependencies are already covered by the core requirements above - no additional dependencies needed for global installation.
macOS (using Homebrew):
brew install node
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install nodejs npm
Windows (using Chocolatey):
choco install nodejs
Manual installation:
- Node.js: https://nodejs.org/
Make sure to have Claude installed globally.
Most Linux distributions include at least one of these audio players:
aplay
(ALSA)paplay
(PulseAudio)play
(SoX)
If none are available, install one:
# Debian/Ubuntu
sudo apt-get install alsa-utils # for aplay
# or
sudo apt-get install pulseaudio-utils # for paplay
# or
sudo apt-get install sox # for play
Uses built-in PowerShell, no additional software needed.
Uses built-in afplay
with system sounds, no additional software or sound files needed.
Available system sounds in /System/Library/Sounds/
:
- Basso, Blow, Bottle, Frog, Funk, Glass, Hero, Morse, Ping, Pop, Purr, Sosumi, Submarine, Tink
Currently configured:
- Notifications:
Funk.aiff
(distinctive alert sound) - Completions:
Glass.aiff
(pleasant completion chime)
- No sound playing:
- Windows/Linux: Check that sound files exist in the project root
- macOS: Ensure system volume is not muted
- Permission errors: Ensure hooks have execute permissions
- Linux audio issues: Try installing one of the supported audio players
- Logs not appearing: Check file permissions on the logs directory
- Installation fails with Node.js errors: Ensure Node.js is installed and available in your PATH
- Installation fails with "npx not found": Install Node.js first
- Hooks not triggering: Restart Claude Code after global installation
- Permission denied errors: Ensure you have proper permissions configured in your
~/.claude/settings.json
This project was inspired by claude-code-hooks-mastery by @disler, which provided excellent examples and patterns for Claude Code hooks implementation.
Sound effects are provided by Mixkit under their free license:
on-agent-need-attention.wav
- Notification sound for attention eventson-agent-complete.wav
- Completion sound for task finished events
- The Claude Code team at Anthropic for creating such an extensible platform
- The open-source community for TypeScript and Node.js ecosystem
- All future contributors who will help build the awesome Claude hooks collection