spank-the-agent

command module
v1.4.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 27 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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)

  1. Download SpankTheAgent.zip from Releases
  2. Unzip → drag SpankTheAgent.app to /Applications
  3. Run this once in Terminal to clear the macOS quarantine flag:
    xattr -dr com.apple.quarantine /Applications/SpankTheAgent.app
    

    This is normal for open-source apps not distributed via the App Store.

  4. Open the app — a hand icon appears in the menu bar
  5. Click → Start → enter password once (for accelerometer access)
  6. 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

  1. Reads raw accelerometer data from the Bosch BMI286 IMU via IOKit HID
  2. Runs STA/LTA + CUSUM + kurtosis detection to identify genuine impacts
  3. Plays an embedded MP3 response (or your custom sounds)
  4. With --agent: fires CGEventPost(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.plist

Then 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址