fix(claude-code): remove the erroring attention-bell hook

The hook rang the terminal bell by walking the process ancestry for a
process named `claude`, but nix wraps the binary so its `comm` is
`.claude-wrapped`.
The match never fired: the bell never rang, and the loop fell through to
a non-zero exit that surfaced as a Stop hook error on every turn.

Remove the hook, its script, and the Stop and Notification wiring.
The tmux monitor-bell config is left in place as a general nicety.
This commit is contained in:
2026-07-21 15:23:03 -04:00
parent 908d7719fb
commit 6f34c95c51
2 changed files with 0 additions and 36 deletions

View File

@@ -10,18 +10,6 @@
let
cfg = config.modules.claude-code;
user = config.user.name;
# Rings the terminal bell so tmux flags the background pane.
bellHook = [
{
hooks = [
{
type = "command";
command = "~/.claude/hooks/attention-bell.sh";
}
];
}
];
in
{
options.modules.claude-code.enable = lib.mkEnableOption ''
@@ -57,14 +45,11 @@ in
skills = ./skills;
# Installed under ~/.claude/hooks, referenced by the settings below.
hooks."attention-bell.sh" = builtins.readFile ./hooks/attention-bell.sh;
hooks."agent-sudo-guard.sh" = builtins.readFile ./hooks/agent-sudo-guard.sh;
settings = {
model = "opus";
hooks = {
Stop = bellHook;
Notification = bellHook;
PreToolUse = [
{
matcher = "Bash";

View File

@@ -1,21 +0,0 @@
#!/bin/sh
# attention-bell.sh — ring the terminal bell in this Claude session's tmux pane
# so tmux's monitor-bell flags the (background) window red in the status bar.
#
# Claude Code runs hooks as detached subprocesses: they have no controlling
# terminal, so /dev/tty is unavailable here. But the parent-process chain up to
# the `claude` process stays intact, and `claude` itself holds the pane's pty.
# So we walk ancestry to find it and write the bell straight to that tty.
# (Writing a bare BEL to an explicit /dev/pts/N works even from a detached
# process — verified against tmux's window_bell_flag.)
pid=$PPID
while [ "$pid" -gt 1 ] 2>/dev/null; do
if [ "$(ps -o comm= -p "$pid" 2>/dev/null)" = claude ]; then
tty=$(ps -o tty= -p "$pid" 2>/dev/null | tr -d ' ')
[ -n "$tty" ] && [ "$tty" != '?' ] && printf '\a' > "/dev/$tty"
exit 0
fi
pid=$(ps -o ppid= -p "$pid" 2>/dev/null | tr -d ' ')
[ -z "$pid" ] && break
done