Approve Claude Code tool calls by physically slapping your MacBook.
Fork of taigrr/spank — the accelerometer-based slap detector, repurposed as an HTTP approval server for Claude Code hooks.
Claude Code requests permission (e.g. run a bash command)
↓
POST → spank HTTP server (localhost:19222)
↓
🔔 macOS Ping notification sound
↓
👋 You slap the laptop
↓
🔊 Approval sound from selected pack (pain/sexy/halo)
✅ Returns {"decision": {"behavior": "allow"}}
↓
Claude Code continues
- No slap within 30 seconds → empty response → Claude Code shows the normal terminal prompt
- Slaps without a pending request are silently ignored
- macOS on Apple Silicon (M2+)
- Go (for building; installer will install it via Homebrew if missing)
git clone https://github.com/K00pash/spank.git
cd spank
./install.shThe script handles everything:
- Builds the binary and copies it to
/usr/local/bin/ - Sets up passwordless
sudofor spank (IOKit HID needs root) - Configures Claude Code hooks in
~/.claude/settings.json - Starts spank in the background
Choose a sound pack:
./install.sh --sound pain # "Ow!", "Ouch!", "Hey that hurts!"
./install.sh --sound sexy # moans and groans (default)
./install.sh --sound halo # Halo death soundsAfter install, just start Claude Code — spank launches automatically via SessionStart hook.
| Pack | Clips | Description |
|---|---|---|
| pain | 10 | "Ow!", "Ouch!", "Hey that hurts!", "Yowch!" |
| sexy | 60 | Random moans and groans |
| halo | 9 | Halo game death sounds |
# Start the server (requires sudo for accelerometer access)
sudo spank --sound sexy
# Custom port
sudo spank --sound pain --port 8080Test with curl (in another terminal):
curl -X POST http://127.0.0.1:19222/hook \
-d '{"hook_event_name":"PermissionRequest","tool_name":"Bash"}'You should hear a Ping → slap the laptop → curl receives the approval JSON.
Two hooks in ~/.claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "/path/to/spank/ensure-running.sh"
}
]
}
],
"PermissionRequest": [
{
"hooks": [
{
"type": "http",
"url": "http://127.0.0.1:19222/hook",
"timeout": 35
}
]
}
]
}
}- SessionStart — ensures spank is running when you launch Claude Code
- PermissionRequest — routes every tool permission request through spank
sudo rm /usr/local/bin/spank
sudo rm /etc/sudoers.d/spank
sudo pkill -f /usr/local/bin/spank
# Remove hooks from ~/.claude/settings.json manually| Original | This fork |
|---|---|
| Plays sounds on every slap | Sounds only when approving Claude Code actions |
| Standalone CLI toy | HTTP server for Claude Code hooks |
--sexy / --halo flags |
--sound pain|sexy|halo flag |
| No network | POST /hook endpoint on localhost |
| Always listening | Ignores slaps when no permission request is pending |
Reused from the original: accelerometer detection via IOKit HID, sound packs, beep audio playback.
- Original spank by @taigrr
- Sensor and detection from apple-silicon-accelerometer
MIT