Claude Code hook that plays a random sound on negative feedback

theletterf1 pts1 comments

GitHub - theletterf/defensive-hook: Claude Code hook that plays a Chewbacca growl when you give negative feedback · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

theletterf

defensive-hook

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>4 Commits<br>4 Commits

LICENSE

LICENSE

README.md

README.md

defensive_hook.py

defensive_hook.py

install.sh

install.sh

View all files

Repository files navigation

defensive-hook

I sometimes long for audio feedback when interacting with Claude, so I've made a Claude Code hook that makes Claude reply to negative feedback with sounds from a folder. You can use any sound you want.

Built as a Stop hook — it fires after every Claude reply, reads the last user message from the session transcript, scores it for negative sentiment, and plays a sound if the score is high enough.

Requirements

macOS (uses afplay for playback; falls back to say -v Trinoids if no sound files are present)

Python 3.9+

Claude Code

Install

git clone https://github.com/theletterf/defensive-hook.git<br>cd defensive-hook<br>bash install.sh

The installer:

Copies defensive_hook.py to ~/.claude/

Creates ~/.claude/negative-sounds/ (the sounds folder)

Adds the hook to ~/.claude/settings.json

Add sounds

Drop any .mp3, .wav, or .aiff files into ~/.claude/negative-sounds/. One is picked at random on each trigger.

If the folder is empty, the hook falls back to macOS say -v Trinoids "negative feedback detected".

How it works

Sentiment is scored with a keyword model — no external dependencies, no API calls:

Match type<br>Score

Negative phrase (e.g. "not what i asked")<br>+2

Negative word (e.g. "wrong", "broken")<br>+1

A score ≥ 2 triggers the sound. Single ambiguous words (like "no" alone) don't fire; combinations and phrases do.

Trigger phrases

that's not · not what i · you're wrong · not right · not correct · doesn't work · not working · didn't work · won't work · this is wrong · that is wrong · still wrong · still broken · still not · you missed · you forgot · you're mistaken · that's incorrect · not what i asked · not what i wanted · not what i meant · that's bad · this is bad · that's broken · totally wrong · completely wrong · you lied · you made up · that's garbage · that's trash · makes no sense

Trigger words

wrong · incorrect · mistake · error · bad · terrible · awful · stupid · useless · broken · fail · failed · failure · hate · frustrated · frustrating · ugh · wtf · damn · dammit · crap · nope · disappointed · disappointing · ridiculous · nonsense · garbage · trash · pathetic · hopeless · worse · worst · no · stop · not · don't · didn't · doesn't · isn't · wasn't · unhelpful · missed · forgot · lied

Manual install

If you prefer not to run the script:

Copy defensive_hook.py to ~/.claude/defensive_hook.py

Create ~/.claude/negative-sounds/ and add your sound files

Add this to the Stop hooks in ~/.claude/settings.json:

"hooks": {<br>"Stop": [<br>"hooks": [<br>"type": "command",<br>"command": "python3 ~/.claude/defensive_hook.py"

License

MIT

About

Claude Code hook that plays a Chewbacca growl when you give negative feedback

passo.uno

Topics

sound

claude-hooks

Resources

Readme

License

MIT license

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

stars

Watchers

watching

Forks

forks

Report repository

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Python<br>68.4%

Shell<br>31.6%

You can’t perform that action at this time.

claude hook negative feedback wrong sound

Related Articles