README
¶
spank-the-agent
Slap your MacBook. Your AI agent obeys.
You know that moment when Claude Code asks "May I proceed with this?" and you have to stop what you're doing, look at the screen, move your hand to the keyboard, and... press Enter?
What if you could just slap your laptop instead?
spank-the-agent detects the physical impact via the Apple Silicon accelerometer, plays a sound, and automatically fires an Enter keypress — telling your AI agent to stop asking permission and just do the thing.
Peak productivity. Zero regrets.
Requirements
- macOS on Apple Silicon (M2+)
sudo(for IOKit HID accelerometer access)- Accessibility permission (for synthetic keypress in agent mode)
- Go 1.22+ (to build from source)
Install (App — one command)
curl -fsSL https://github.com/zkblk/spank-the-agent/releases/latest/download/SpankTheAgent.zip -o /tmp/SpankTheAgent.zip && unzip -o /tmp/SpankTheAgent.zip -d /tmp && mv /tmp/SpankTheAgent.app /Applications/ && xattr -dr com.apple.quarantine /Applications/SpankTheAgent.app && open /Applications/SpankTheAgent.app && rm /tmp/SpankTheAgent.zip
That's it — downloads, installs, clears quarantine, opens the app. A hand icon appears in your menu bar.
To uninstall: quit the app → sudo rm -rf /Applications/SpankTheAgent.app
Install (App — manual)
- Download SpankTheAgent.zip from Releases
- Unzip → drag SpankTheAgent.app to
/Applications - Run this once in Terminal to clear the macOS quarantine flag:
xattr -dr com.apple.quarantine /Applications/SpankTheAgent.appThis is normal for open-source apps not distributed via the App Store.
- Open the app — a hand icon appears in the menu bar
- Click → Start → enter password once (for accelerometer access)
- Slap your MacBook
Install (CLI — from source)
go install github.com/zkblk/spank-the-agent@latest
sudo cp "$(go env GOPATH)/bin/spank-the-agent" /usr/local/bin/spank-the-agent
Then grant Accessibility permission: System Preferences → Privacy & Security → Accessibility → add your terminal
Usage
# Default — whip crack on every slap
sudo spank-the-agent
# Warcraft mode — whip crack, then your peon reports for duty
sudo spank-the-agent --warcraft
# Agent mode — slap → whip → Enter auto-pressed → AI proceeds
sudo spank-the-agent --agent
# The full experience — whip, peon, AI confirmed
sudo spank-the-agent --agent --warcraft
# Fast mode — shorter cooldown, higher sensitivity
sudo spank-the-agent --agent --warcraft --fast
# Halo death sounds instead of whip (still works with --agent and --warcraft)
sudo spank-the-agent --agent --warcraft --halo
# Sexy mode (escalating) instead of whip
sudo spank-the-agent --agent --warcraft --sexy
All flags
| Flag | Default | Description |
|---|---|---|
--agent |
off | Auto-press Enter on each slap (confirms AI prompts) |
--warcraft |
off | Play WC3 peon response 300ms after the whip crack |
--fast |
off | Faster polling (4ms), shorter cooldown (350ms) |
--sexy |
off | Escalating audio instead of whip |
--halo |
off | Halo death sounds instead of whip |
--custom <dir> |
— | Your own MP3 directory instead of whip |
--min-amplitude |
0.20 | Detection threshold (lower = more sensitive) |
--cooldown |
750 | Cooldown between responses (ms) |
--volume-scaling |
off | Harder hits = louder sound |
--speed |
1.0 | Playback speed multiplier |
How it works
- Reads raw accelerometer data from the Bosch BMI286 IMU via IOKit HID
- Runs STA/LTA + CUSUM + kurtosis detection to identify genuine impacts
- Plays an embedded MP3 response (or your custom sounds)
- With
--agent: firesCGEventPost(kCGHIDEventTap, Enter)via CoreGraphics — a synthetic keypress that lands in whatever window has focus
The keypress fires 80ms after the impact — just after the sound starts — so the crack lands before the confirmation, not after. The ordering matters.
Uninstall
# 1. Quit the app first (menu bar → Quit), then:
sudo rm -rf /Applications/SpankTheAgent.app
# 2. Remove the passwordless sudo rule
sudo rm /etc/sudoers.d/spank-the-agent
# 3. Kill any running helper
sudo pkill -f spank-the-agent-helper
If the helper keeps respawning after you kill it, you have a LaunchDaemon installed (from old documentation). Remove it first:
sudo launchctl unload /Library/LaunchDaemons/com.zkblk.spank-the-agent.plist sudo rm /Library/LaunchDaemons/com.zkblk.spank-the-agent.plistThen kill again:
sudo pkill -f spank-the-agent-helper
FAQ
Does this work with other AI tools (Cursor, Copilot, etc.)? Yes. It just presses Enter. It doesn't know or care what's on screen.
Is this safe? It presses Enter in whatever window has focus. You are responsible for making sure that window is actually the AI asking for permission, and not your production database prompt.
My AI is asking something really consequential. Should I slap my laptop? That's between you and your laptop.
Why is there a 80ms delay before the Enter press? So the sound starts before the key fires. The whip should crack before the door swings open.
Credits
Built on top of spank by Tai Groot. Sensor detection ported from olvvier/apple-silicon-accelerometer.
License
MIT — see LICENSE
Documentation
¶
Overview ¶
spank-the-agent: slap your MacBook, your AI agent obeys.
Detects physical impacts via the Apple Silicon accelerometer (IOKit HID), always plays a whip crack, optionally plays WC3 peon responses, and — when --agent is enabled — automatically presses Enter to confirm whatever your AI overlord was nervously asking permission for.
Inspired by spank (github.com/taigrr/spank). Requires sudo.