Merge chore/notify-attention-hook into develop

This commit is contained in:
Bastien Chanot
2026-09-01 15:42:25 +02:00
4 changed files with 47 additions and 1 deletions
+4
View File
@@ -448,3 +448,7 @@ rules:
- `/darwin-skill all skills and agents` (background). Fresh results.tsv (May file wiped). 7 blind judges, 54 rows (31 skill-systems + 23 agents), mean 83.4, 13 <80. find-docs excluded — machine-owned ctx7 (gitignored), 3rd exclusion ground after BDR-015/058.
- Phase 2: 12 rounds / 13 units, 0 reverts, all paired 3-0 ([[EVAL-028]]). Star: skills-perso detection 8/31 → 31/31 live-verified. Bug pass [[BDR-086]]: 8 commits in above-80 units kept 3-0 (hotfix git-restore data-loss path ★, onboarder contract bounce, plugin data-flow, plan-challenger grammar, handover stale §refs + gate order, tour report-only commit, harden severity, fixtures).
- make test green after census-rewrap fix ([[LRN-144]]); [[LRN-143]] head-pipe grep mask. 29 commits, report `.claude/audits/DARWIN-2026-08-26.md` + card PNG. Branch awaits human review + merge.
## 2026-09-01
- Attention signal shipped: hooks/notify-attention.sh + Notification entry in settings.json (bell x2 + OSC 777 toast via terminalSequence). Client-side VS Code steps pending: terminalBell sound:on + osc-notifier ext. [[LRN-145]]. Branch chore/notify-attention-hook, UNMERGED.
- Pre-existing model switch opus[1m] committed separately on same branch.
+5
View File
@@ -1389,3 +1389,8 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
- **Context**: darwin 2026-08-26 — hotfix RULES rewrap split "No verifier is dispatched at hotfix weight"; loops-light.test.sh lock RED; make test caught post-edit.
- **Pattern**: lib/tests/*.test.sh lock sentences verbatim, single-line. Rewording/rewrapping skill+agent md near locked phrases silently breaks census.
- **Future**: before editing skill/agent prose, grep lib/tests/ for locks in the touched region; run make test BEFORE dispatching judges, not after.
## LRN-145 — hooks reach the terminal only via terminalSequence JSON field
- **Context**: 2026-09-01 — attention bell for VS Code Remote-SSH (CLI on remote Linux). Hook subprocess has no controlling TTY; /dev/tty unreliable. Docs: terminalSequence = supported side-effect field, fires even on events that discard output.
- **Pattern**: Notification hook → stdout JSON `{suppressOutput:true, terminalSequence:"<BELx2><OSC 777 notify><ST>"}`. VS Code terminal ignores OSC 777/9 natively (claude-code #28338); client-side ext wenbopan.vscode-terminal-osc-notifier converts to native toast over Remote-SSH; beep needs accessibility.signals.terminalBell sound:on. permission_prompt fires ~6s late, idle_prompt ~60s.
- **Future**: any hook ringing/notifying the terminal (bell, toast, title) — terminalSequence, never /dev/tty. Input-needed matcher set: permission_prompt|idle_prompt|agent_needs_input|elicitation_dialog|elicitation_url_dialog.
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Notification hook — signal the user through the terminal when Claude
# needs input (permission prompt, question, idle wait).
#
# Runs on the remote (Linux); the only channel that crosses SSH into the
# VS Code client is the terminal stream. Hooks have no controlling TTY,
# so the sequence goes through the supported `terminalSequence` JSON
# output field and Claude Code writes it to the terminal:
# - BEL x2 (double beep) -> sound, needs VS Code setting
# accessibility.signals.terminalBell { "sound": "on" }
# - OSC 777 notify -> Windows toast via the client-side extension
# "Terminal Notification" (wenbopan.vscode-terminal-osc-notifier)
# Both are invisible no-ops in terminals that ignore them.
set -u
msg=$(jq -r '.message // .notification_type // empty' 2>/dev/null \
| tr -d '\000-\037' | cut -c1-200)
[ -n "$msg" ] || msg="Claude Code needs your input"
bell=$(printf '\a')
esc=$(printf '\033')
seq="${bell}${bell}${esc}]777;notify;Claude Code;${msg}${esc}\\"
jq -cn --arg seq "$seq" '{suppressOutput: true, terminalSequence: $seq}'
exit 0
+14 -1
View File
@@ -250,7 +250,7 @@
"disableBypassPermissionsMode": "disable",
"additionalDirectories": []
},
"model": "claude-fable-5[1m]",
"model": "opus[1m]",
"hooks": {
"SessionStart": [
{
@@ -273,6 +273,19 @@
]
}
],
"Notification": [
{
"matcher": "permission_prompt|idle_prompt|agent_needs_input|elicitation_dialog|elicitation_url_dialog",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/notify-attention.sh",
"timeout": 5,
"statusMessage": "Ringing terminal bell..."
}
]
}
],
"UserPromptSubmit": [
{
"hooks": [