Behind the scenes
How to stop Claude Code by slapping your MacBook
By Tonnoz4 min read
You slap the laptop and Claude stops. I made a small free mod for Claude Code called slapmod that reads your MacBook's motion sensor, so when Claude is halfway through something you never asked for, one smack on the palm rest stops it. It does the same thing as pressing Esc, but it feels a lot better. It's open source and it's on GitHub at github.com/tonnoz/slapmod.
Why would you want to slap Claude Code?
Claude Code is the app I use the most, by far, and most of the time it's great, but every now and then it decides that my one-line fix needs a rewrite of half the project, and in that moment I really want to smack it. Esc works, sure, but it doesn't feel like anything.
I already had the slap detection from SlapMac, my app that makes your MacBook scream when you slap it, so I thought, why not let Claude feel it too.
What happens when you slap it?
One slap stops Claude if it's in the middle of something. Then, when you send your next message, Claude gets a little note saying you slapped it, so it knows you weren't happy with where it was going. In the terminal you see the usual "Interrupted" line, and the status line keeps count of your slaps.

Two quick slaps stop it and also send "That's not it. Step back and try a different approach.", so Claude changes direction without you typing a word.
Every slap plays a sound too. By default it's a cartoon bonk that gets meaner the harder you hit, but you can switch to a whip crack or to your Mac's own voice yelling things like "Ow!" and "What did I do?".
How do I install slapmod?
You need a MacBook with Apple Silicon, M1 Pro or newer, because that's where the motion sensor is. iMacs, Mac minis and Intel MacBooks don't have one, so it can't work there. You don't need sudo and you won't get any permission popup.
The lazy way is to paste the link into Claude Code and ask it to install it:
Install this: https://github.com/tonnoz/slapmod
Or type this at the Claude Code prompt yourself:
/plugin install slapmod --marketplace tonnoz/slapmod
Answer y to add the marketplace, pick the user scope, then run /reload-plugins or start a new session. Slap the laptop and type /slap to see the meter and how many times you've hit it.

It also works in the Code tab of the Claude desktop app: click + next to the prompt box, then Plugins, Add marketplace with tonnoz/slapmod, then Add plugin.
Can I choose what a slap does?
Yes, and it's the part I use the most. Type /slap settings and you can set what one slap does and what a double slap does. Each one can stop Claude, just tell Claude you slapped it, run a slash command, send a prompt you wrote, or do nothing at all.

A couple of ideas:
/slap double command /compact, so two smacks compact the context when it gets long./slap on prompt Try again, smaller this time.for when Claude goes way too big./slap sound whip, because a whip is funnier than a bonk.
On the same page there's a sensitivity dial from 1 to 10. Tap the desk, look at the meter, and move the dial until your normal typing doesn't count but a real slap does. A command or a prompt only fires on a solid slap and at most once every 5 seconds, so typing hard won't run anything by accident. I still wouldn't bind it to /clear, unless you like losing your whole conversation.
Does it work with SlapMac?
Yes, and it gets sillier. If SlapMac 1.6.0 or newer is running, slapmod lets SlapMac feel the slap, so you hear the voice pack you picked in SlapMac (or your own custom sounds) and Claude still stops. If you pick the Whip pack, you also get the whip lashing across your screen on every slap, like in the clip at the top.

You don't need SlapMac for any of this. slapmod is free and works fine on its own, and SlapMac is the paid app for when you want more of this nonsense on your Mac.
Is it safe to run?
It's MIT licensed, so you can read every line of it. The part that reads the sensor is a small Swift helper, signed and notarized by Apple, and it only runs while Claude Code is open. slapmod makes no network requests, the motion data never leaves your Mac, and it doesn't read your conversations.
If it counts slaps you didn't make, or misses real ones, open an issue on GitHub and tell me which Mac you have and what the meter showed. And don't be too hard on him, he's trying his best.