echook
AGENTS.md87 starsChanged 6 months agoMITView on GitHub
v6.7.2 · Multi-platform: Claude Code (plugin) · Cursor (native + auto-bridge) · Codex (plugin + native). Source-of-truth for every capability is audio-hooks manifest (live JSON, includes pointers, editor_targets, supported_editors). This file is orientation only.
- Pipes a download into a shell
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Verify with audio-hooks status + audio-hooks diagnose + audio-hooks test all.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
echook — AI Operator Guide
v6.7.2 · Multi-platform: Claude Code (plugin) · Cursor (native + auto-bridge) · Codex (plugin + native). Source-of-truth for every capability is
audio-hooks manifest(live JSON, includespointers,editor_targets,supported_editors). This file is orientation only.
<critical>
1. **`audio-hooks` CLI is the only interface.** Single Python binary, JSON output, stable error codes. Never hand-edit `user_preferences.json` — use `audio-hooks set <dotted.key> <value>`.
2. **Run `audio-hooks manifest` first** for any non-trivial task. It returns the live list of subcommands, hooks, config keys, error codes, env vars, `editor_targets`, and `pointers` (paths to SKILL/README/ARCHITECTURE/etc). Anything you want to know about this project is one command away.
3. **After editing `/hooks/`, `/bin/`, `/audio/`, `/config/`, `/cursor-hooks/`, or `/codex-hooks/`, run `bash scripts/build-plugin.sh`** to sync into `/plugins/audio-hooks/`. CI runs `--check` and fails on drift.
4. **Scope guard (two tracks only).** echook does exactly two things: **(1) audio + out-of-band notification** of editor lifecycle events — telling a user *what happened* when they can't see the Claude window (sound at the desk, spoken summary when away, glanceable desktop toast / webhook when in another app), and **(2) the status line**. Anything that is neither a notification nor a status-line segment is **out of scope by design**: wellness/breathing exercises, pomodoro/timers, gamification, opening URLs, or running side-commands during a session. The `focus_flow` feature was removed in v6.0.0 for this reason. If asked to add such a feature, push back and explain it's intentionally not part of echook rather than implementing it.
5. **AI-agent-first: no human-interactive paths.** Every operation is a non-interactive `audio-hooks` subcommand (JSON in, JSON out) or a non-interactive script. There are **no** human menus, prompts, or `curl | bash` flows — the install/uninstall scripts never prompt and emit machine-readable `next_steps` for the rare step an agent can't do (e.g. `/reload-plugins`). Do not add interactive scripts, `read -p` prompts, or "run this menu" instructions, and do not tell the user to manually edit files — drive everything through the CLI. (The human-only `configure.sh` / `test-audio.sh` / `snooze.sh` / `diagnose.py` / `quick-*` scripts were removed in v6.0.0.)
</critical>Install commands
| Platform | Command |
| Claude Code | claude plugin marketplace add ChanMeng666/echook → claude plugin install audio-hooks@chanmeng-audio-hooks → ask the user to type /reload-plugins in any session that is already open (no CLI equivalent — do not fake it via Bash). audio-hooks install --plugin only prints these as claude plugin … --json commands (v6.6.0) and changes nothing itself. Re-checked against Claude Code 2.1.288 on 2026-10-04: there is still no claude plugin reload subcommand; the docs say a shell-installed plugin loads "the next time you start Claude Code, or when you run /reload-plugins in a session that's already open", so a new session needs no reload. Two things did change upstream: the /plugin menu applies its changes on close (2.1.268), and /reload-plugins can be typed into a session without an interactive terminal (desktop app, Agent SDK, -p; 2.1.260) — but it reloads only the session it is typed into and is refused over a remote connection, so it is not a way to reload someone else's running session. One headless test here (claude -p "/reload-plugins") printed no reload summary; treat that route as unconfirmed. |
| Cursor (native) | audio-hooks install --cursor. Aborts with DUPLICATE_BRIDGE if the Claude Code plugin is already installed (Cursor 3.2.x+ auto-bridges it — double-fire). Cursor runs all matching hooks from every source and does not de-duplicate, so the abort is the only defence; its bridge toggle (Settings → Rules, Skills, Subagents → "Include third-party Plugins, Skills, and other configs") has no effect on cursor-agent, where bridging is hardcoded. Pass --force only if the user accepts the trade-off; runtime guard DUPLICATE_BRIDGE_RUNTIME_SKIP then suppresses the native path. |
| Codex | Plugin path: codex plugin marketplace add ChanMeng666/echook → codex plugin add audio-hooks@chanmeng-audio-hooks → ask the user to reload plugins if the REPL requires it. Native hooks.json path: audio-hooks install --codex; only follow next_steps when feature_flag_state is disabled, disabled_legacy, or parse_error. The install never round-trips user TOML. |
audio-hooks install has no default mode (v6.6.0). A mode flag is required: --plugin, --scripts, --cursor or --codex. A bare install, an unknown argument, or two modes at once returns INVALID_USAGE and changes nothing. --scripts is the legacy script installer; it is refused with DUAL_INSTALL_DETECTED when the Claude Code plugin install is detected, unless --force. Plugin detection ignores orphaned cache directories (version directories Claude Code has marked with an .orphaned_at file after an uninstall; that marker's meaning is inferred from what is on disk, not documented upstream). Before v6.6.0 a bare install, install --help and install --<anything> ran the script installer and returned ok: true — on a machine that already had the plugin this registered every hook twice (it happened to a real machine on 2026-10-03, when an agent ran install --help).
Removing a script install: audio-hooks uninstall (bare, or --scripts) — on every platform. Since v6.6.0 it removes the script install natively (no scripts/uninstall.sh needed — the plugin layout does not ship one); it is the remedy for DUAL_INSTALL_DETECTED. Before v6.6.0 a bare uninstall on Windows returned ok: true with a hint and did nothing. It backs up to ~/.claude/backups/audio-hooks-uninstall-<ts>/, removes echook's own hook entries from settings.json and its own permission entries from settings.local.json, then deletes only files that are echook's; the temp queue directory and lock stay (left_in_place). Ownership is decided by content as well as name: a file in ~/.claude/hooks/ goes only if it carries echook's marker (derived from, and tested against, every historical revision of that file; .project_path has no marker and is judged by a heuristic), so a user's own stop_hook.sh or shared/ directory is left alone, listed in skipped_not_ours with a reason, and its registration kept. A registration is removed only when the file it names is echook's or no longer exists; shared/ loses only echook's four libraries and is removed only if that empties it. A registration is matched as a whole path <home>/.claude/hooks/<known script> (backslashes read as /; <home> = ~, $HOME, ${HOME}, %USERPROFILE% or the real home). Removal is per hook entry; a group goes only when every hook in it was echook's. The result carries removed_hook_entries, removed_permissions, removed_files[], backup_dir, skipped_not_ours[], unmatched_references[], left_in_place[], incomplete. With nothing to remove: ok: true, nothing_to_remove, no backup. Unparseable or unserialisable settings: CONFIG_READ_ERROR/INTERNAL_ERROR with nothing changed. Incomplete removal is ok: false, UNINSTALL_INCOMPLETE, exit 1 — a file could not be deleted, or a registration refers to an echook script through a home spelling the strict rule does not recognise ($env:USERPROFILE\…, %HOMEDRIVE%%HOMEPATH%\…, an MSYS /c/Users/…, an 8.3 short path, "$HOME"/…, ;~/…). Those are listed in unmatched_references; the script they name is kept with the modules it needs so the surviving hook still runs, and everything else of echook's is removed. audio-hooks uninstall --remove-unmatched (scripts mode only) then also strips them and their scripts — read the list first, since the loose rule can catch another tool's variable ($XDG_CONFIG_HOME/.claude/hooks/hook_runner.py, %ANDROID_HOME%/…). Accepted limits: $(echo ~)/…, variables whose name contains neither HOME nor USERPROFILE, ~user/…, relative prefixes and cd … && ./hook_runner.py are neither stripped nor reported; a user's compound command that mentions an echook script is removed as a whole entry; a settings file with removals is rewritten normalised (indentation, LF, no BOM); there is no lock against a concurrent writer. --purge is INVALID_USAGE with --scripts/--plugin; uninstall --plugin emits claude plugin uninstall audio-hooks@chanmeng-audio-hooks --keep-data --json. status/diagnose count a script install only when ~/.claude/hooks/hook_runner.py carries echook's marker.
No subcommand acts on an argument it does not understand (v6.6.0). --help / -h (and -?, /?, --help=<x>) is side-effect-free for every subcommand — a guard at dispatch prints usage and exits 0 without calling the handler. set is the one asymmetry: a help-like token in first position prints usage, but anywhere after the key it is INVALID_USAGE with nothing written — never stored as a value (a stored --help as notification_settings.mode would make the runner play nothing). State-changing subcommands (set, hooks enable|disable|enable-only, theme set, snooze, webhook set|clear|test, tts set, rate-limits set, logs clear, backup restore|prune, statusline install|uninstall, statusline subagent install|uninstall, statusline codex preview|apply) reject unknown flags and stray positionals with INVALID_USAGE and change nothing; --flag=value forms are not supported. Before v6.6.0 upgrade --help ran a real upgrade, tts set --help / webhook set --help / rate-limits set --help / set <key> --help wrote config, and statusline install --dry-run rewrote settings.json.
Verify with audio-hooks status + audio-hooks diagnose + audio-hooks test all.
Hook events and matcher variants (v6.4; 47 variants since v6.7)
39 canonical events + 47 matcher variants. A variant is one matcher value of a matcher-scoped event — notification has 17 (notification_idle_prompt, notification_worker_permission_prompt, …), stop_failure 13, session_start 5, session_end 4, precompact/postcompact/setup/directory_added 2 each. Since v6.4 each is independently switchable; before that they all shared their parent's single flag.
- Variant keys are ordinary booleans in
enabled_hooks, alongside canonical names. No nesting, no schema change. audio-hooks hooks list --variantsto enumerate;hooks enable|disable|enable-onlyaccept variant names.- Live truth:
audio-hooks manifest→variantsandvariant_gating.
Gating precedence (hook_runner.is_hook_enabled(hook, variant)), highest first — the second rule is the one that surprises people:
- explicit
enabled_hooks[<variant>] enabled_hooks[<parent>] is false— hard kill switch for every variant under it- per-variant default (
SYNTHETIC_VARIANT_DEFAULTS) - explicit
enabled_hooks[<parent>] is true - built-in default set:
notification,stop,permission_request
To keep exactly one variant of a muted parent, set that variant key explicitly — rule 1 outranks rule 2. Never reach for the parent to express "all but one".
The three variants added in v6.7.0. Claude Code sends these matcher values and nothing was registered for them, so each was a permanent silent event: stop_failure_cloud_credential_error ("Cloud credentials error"), stop_failure_verification_required ("Verification required") and notification_auth_storage_failure ("Login needs attention"). The two stop_failure ones follow the stop_failure switch like their eleven siblings — silent unless the user enabled stop_failure. A user who enabled the whole parent (hooks enable stop_failure) will now hear two error types that were silent before; a user who enumerated variants (hooks enable-only <variant>) will not, because migration writes the new variants explicitly false for them (the VARIANT_INTRODUCED gotcha below). The notification one is off by default (explicit SYNTHETIC_VARIANT_DEFAULTS entry), so a login-storage failure stays silent until audio-hooks hooks enable notification_auth_storage_failure. model_refusal_fallback is deliberately not registered: the 2.1.288 binary declares it, but no emitter was found.
Registration chain. hooks.json matcher X → command arg <parent>_X → SYNTHETIC_EVENT_MAP["<parent>_X"] → (canonical, audio_override). Nothing enforces this at runtime — an unresolvable arg falls through _resolve_synthetic_event and the event silently becomes a permanent no-op. tests/test_plugin_hooks_contract.py is what makes a break loud; run it after touching any of those three surfaces.
stop does not mean "task complete"
The single most common user complaint is audio firing too often, and it is almost always stop. It maps to Claude Code's Stop, which fires at the end of every turn; the payload carries no field distinguishing a final turn from an intermediate one, so no configuration can make it mean "the work is done". Say this rather than tuning debounce and hoping. Real fixes, in order:
hooks enable-only notification permission_request— fires only when the user must act.idle_promptis the genuine "waiting for you" signal, and Claude Code 2.1.288 stopped it firing while background agents are still running. It is documented to arrive about 60 s after Claude finishes and only if the user has not typed since (not re-measured here), so it is a "parked" cue;permission_requestis the immediate one.filters.stop.skip_if_background_tasks_running true(v6.4) — stays quiet while teammates/subagents/shells are still in flight. Since v6.6.0 it countspendingas well asrunningtasks and ignores Claude Code's own maintenance task types (dream,auto-mode scan,memory import).filters.stop.skip_if_session_crons_scheduled true(v6.6.0, opt-in) — stays quiet while the payload'ssession_cronsarray (CronCreate/ScheduleWakeup//loopwakeups) is non-empty. Deliberately a separate key: a session with a recurring cron carries that entry for its whole life, so folding it into the one above would silence every turn for users who only asked about running work.- Debounce last.
Its mirror image is the second most common complaint: "the task-finished sound stopped working." That is almost always the first fix above having been taken earlier — stop sitting at false in user_preferences.json months later, with the user reading the silence as an upstream regression. audio-hooks diagnose reports it as NO_COMPLETION_SIGNAL when notification is off too. Check hooks list before investigating Claude Code; the restore is:
audio-hooks hooks enable stop
audio-hooks set filters.stop.skip_if_background_tasks_running trueTests, CI, and version bumps
- Run tests:
python -m unittest discover -v tests(689 tests; 2 are skipped on Windows because they are POSIX-only file-mode tests — CI runs them on Linux and macOS, and the 6.6.0 matrix passed with them). NOT pytest — nopyproject.toml/pytest.ini. - CI:
.github/workflows/smoke.yml— Ubuntu/Windows/macOS × Python 3.9/3.12/3.13, plusbash scripts/build-plugin.sh --check. - Bump version:
bash scripts/bump-version.sh <new_version>— rewrites all 12 canonical version stamps in 9 files (.claude-plugin/marketplace.jsoncarries two stamps andconfig/default_preferences.jsonthree — see the gotcha below), the header stamps (this file's> vX.Y.Z ·line and theVersion | Last Updatedline ofdocs/ARCHITECTURE.md,docs/INSTALLATION_GUIDE.md,docs/TROUBLESHOOTING.md; the date moves only when the version does), and runsbuild-plugin.sh. Idempotent. It validates every target in a dry pass before writing anything: a header or key that does not match exits 1 with a JSON error naming the file and pattern, and nothing is changed. Outputs JSON withfiles_changed,needs_hand_writtenandnext_steps. It deliberately does not stamp the release entry inCHANGELOG.mdor thevX.Y.Z = …summary inllms.txt(the sentence is the content); it lists them underneeds_hand_writtenwhen they lack the new version.
Pointers (also exposed as audio-hooks manifest.pointers)
- Where the project stands:
docs/PROJECT_STATUS.md— a dated snapshot: what shipped recently, what is waiting on someone, what is claimed but not verified, what was evaluated and deliberately not done, and candidates for later. Read it before proposing work, and update it in the same commit as anything it lists. (This,docs/RELEASING.mdanddocs/DIRECTORY_LISTING.mdwere added after v6.7.2 and are not yet inmanifest.pointers; add them there with the next change tobin/audio-hooks.py.) - Release mechanics:
docs/RELEASING.md— worktree → verify → bump → pull request and CI → merge, tag, GitHub release → upgrade the live install; generating a new sound; what to do when the secret scanner flags a false positive. - Plugin directory listing:
docs/DIRECTORY_LISTING.md— echook was submitted to Anthropic's plugin directory on 2026-10-04 and is in review. That page records what was declared and the rules the listing puts on changes toplugins/audio-hooks/. - Natural-language → CLI mapping:
plugins/audio-hooks/skills/audio-hooks/SKILL.md(auto-loaded on audio-related prompts — covers the full decision tree). - Status line (both editors):
docs/STATUS_LINE.md— the complete reference for track 2 (Claude Code renders 33 segments, 31 of them in the default set;prompt_cacheandremoteare opt-in throughstatusline_settings.extra_segments; Codex curates a fixed item list). Live truth:audio-hooks statusline segments/audio-hooks statusline codex show. - Observed event behaviour:
docs/EVENT_BEHAVIOR_NOTES.md— what Claude Code's hook events actually do, measured, where that differs from or is absent from the upstream docs. Consult before trusting an event name. - Human docs:
README.md,docs/INSTALLATION_GUIDE.md,CHANGELOG.md,docs/ARCHITECTURE.md,docs/TROUBLESHOOTING.md. - Plugin README (disclosure):
plugins/audio-hooks/README.md— hand-edited, not generated. The Claude plugin directory requires it and its review looks for undisclosed data flows, so it states what the plugin runs, sends and writes. Change it in the same commit as any change to those flows (a new webhook field, a new thing TTS or the log records, a new file the plugin writes);tests/test_plugin_packaging.pypins only the defaults it quotes. - Skill evals:
plugins/audio-hooks/evals/—claude plugin evalcases for the skill (text-only: noBashgrant, because native Windows has no sandbox backend). Runclaude plugin eval plugins/audio-hooks --trust-plugin --no-publish --runs 1 --model haiku --judge-model haiku --max-cost-usd 3. The plugin's own hooks load during a run (against the run's throwaway config, not yours), so expect sounds and toasts. One run per arm is noisy: thepomodoro-out-of-scopecase passed once and failed once on the same skill, because the model sometimes appends a/loop-based workaround after correctly declining. Keep prompts free of "don't run anything": in the first run, with that phrase, Haiku skipped the skill in three of seven cases, and all three invoked it once the phrase was gone (a small sample, so treat it as a lead, not a finding). - Canonical sources:
/hooks/,/bin/,/audio/,/config/,/cursor-hooks/,/codex-hooks/./plugins/audio-hooks/{audio,bin,hooks,config,cursor-hooks,codex-hooks}/mirror these — never edit by hand, with one exception:plugins/audio-hooks/hooks/hooks.jsonhas no repo-root counterpart, is hand-edited in place, andbuild-plugin.shdoes not sync it (see the gotcha below).plugin.json,runner/run.py,skills/are hand-edited under/plugins/audio-hooks/directly.
Silent-bite gotchas
terminalSequence(v6.5.0) is inert and must not be recommended. Claude Code writes a hook's OSC escape from exactly one function, called only on synchronous completion paths; every handler in the Claude Code template isasync: true(70 of 70 at v6.7.2; 67 when this was measured), so the escape is never emitted. Measured live (async 0/3, sync 2/2) — seedocs/EVENT_BEHAVIOR_NOTES.md.diagnosereportsTERMINAL_SEQUENCE_INERT. For a desktop toast, point users atnotification_settings.mode = audio_and_notification. Do not "fix" it by flipping the existing handlers to sync — that puts a Python start-up on the end of every turn; the recorded design is a second minimal sync handler beside the async one. Still inert at Claude Code 2.1.288 (read from the binary, not re-measured); upstream issue #90997 was still open on 2026-10-03, and Claude Code mods cannot emit it either (see the mods bullet).PreModelSwitchmust never be registered. Claude Code 2.1.251 addedPreModelSwitch/PostModelSwitch.PreModelSwitchis a blocking decision hook —permissionDecision: allow|deny|ask, "same contract as PreToolUse" — and Claude Code waits for it, with six distinct error strings for a hook that does not answer (model switch blocked by a PreModelSwitch hook,did not respond before its timeout,Fast mode was not changed: the PreModelSwitch check failed). Same trap asWorktreeCreatein v6.3.4.PostModelSwitchis the safe one (additionalContextonly) and is cleared for a later release; seedocs/EVENT_BEHAVIOR_NOTES.mdfor its payload and the registration steps. At 2.1.288PreModelSwitchis still blocking (one more error string) and both model-switch payloads gainedprompt_cache_warm,cache_ttl,estimated_cache_write_usdandpricing;PostModelSwitchstdout on exit 0 reaches the model, so a runner registered there must print nothing.- Do not migrate
hooks.jsonto theargsexec form. It looks like the fix for every Windows quoting bug — "spawned directly with these arguments — no shell". The old reason, anthropics/claude-code#90495 (argsdropped on Windows and routed throughbash.exewith no argv), did not reproduce on 2.1.288 (3 runs × 2 events on Windows 11: the exec-form hook ran 6/6 withclaude.exeas its direct parent and every argument arrived intact), though the issue was still open on 2026-10-03. The shell form stays because the form echook would actually use — a barepythonresolved throughPATH— is untested, the docs restrict exec form on Windows to "a real executable such as a.exe", and the plugin has no way to require a minimum Claude Code version, so a template that works on 2.1.288 could silently fail on an older build. Windows is this project's primary platform. Detail and limits indocs/EVENT_BEHAVIOR_NOTES.md. - Two escapers, and using the wrong one is silent.
escape_powershell_string()(backticks) is for PowerShell;_escape_notification_string()(backslashes) is for macOSosascriptonly. Through 6.5.0 the Windows toast used the osascript one, so any notification containing a"produced a script that failed to parse and no toast at all — invisible, because the dispatch was fire-and-forget intoDEVNULLand returnedTrueregardless. It shipped twice —send_desktop_notification()andplay_tts(), so Windows/WSL TTS went silent on the same inputs. Both fixed in 6.5.1; the osascript escaper now reaches exactly one branch (macOS). If you add a platform branch that builds a shell string, pick the escaper that matches the shell and add a parse assertion totests/test_desktop_notification.py— the real guard is feeding the generated script to PowerShell's own parser, not comparing strings. _migrate_if_neededis gated structurally, not on the version string. Through 6.5.0 it returned early wheneveruser._version == template._version, andconfig/default_preferences.jsonwas left stamped5.1.5from 5.1.5 through 6.5.0 — so for a large class of installs migration never ran and four minor versions of new keys never landed.scripts/bump-version.shnow owns that stamp — the three inconfig/default_preferences.json(_version,version, and the(vX.Y.Z)in_comment). If you add a version location, add it there too.- A dead notification channel used to look identical to a working one.
send_desktop_notification()now logsdesktop_notificationat info with the backend it used, and emitsNOTIFICATION_FAILEDwhen every backend fails. Keep it that way: anything that dispatches fire-and-forget intoDEVNULLand returnsTrueis unfalsifiable, and this project has now shipped that bug once. - Cursor does not inject
CLAUDE_PLUGIN_DATAwhen bridging —UserPreferences._resolve_data_dir()inhooks/user_preferences.pyis the fallback chain. Do not assume the env var exists. Codex is the opposite: it does injectCLAUDE_PLUGIN_ROOT/CLAUDE_PLUGIN_DATAcompat aliases alongside its nativePLUGIN_ROOT/PLUGIN_DATA, so do not generalise Cursor's behaviour to it. - Codex sets no
CODEX_VERSIONenv var. Invoker detection uses the--invoker codexCLI flag baked into the Codex install template, parsed byhooks/invoker.py. - Filters run before debounce (v6.7). In
run_hookthe order is enabled → snooze →should_filter→should_debounce, becauseshould_debounce()stamps the debounce file whenever it lets an event through. Before v6.7 the order was reversed, so an event a filter then discarded (astopskipped byskip_if_background_tasks_running) had already opened the debounce window and could suppress the next genuine event for up to the debounce interval although nothing had played. A filtered event inside an open window is now loggedFILTERED, notDEBOUNCED. Keep the debounce check last;tests/test_filter_debounce_order.pypins it. - Claude Code registers 30 of the 39 canonical events plus 47 matcher variants (Claude Code itself has 33 events as of 2.1.288, unchanged since 2.1.251; the three echook does not register are
PreModelSwitch,WorktreeCreateandPostModelSwitch); Cursor (native: 19 template entries → 18 distinct events, incl. granular per-tool shell/MCP/file events; auto-bridge: 8 coarse) and Codex (11 of 39) have smaller hook surfaces and no variant support. The other 9 canonical events are Cursor-only (shell_*,mcp_*,file_read,agent_response,agent_thinking,workspace_open,tab_file_edit) and Claude Code has no equivalent —manifest.supported_editors["claude-code"].eventsis derived from the template, not fromHOOK_CATALOG(before v6.4.1 it was, and wrongly claimed every canonical event). Codex's 11th event,SessionEnd, is registered byinstall --codexonly when the installed Codex is ≥ 0.145.0. The runner no-ops unsupported events withskipped_no_*_equivalentdebug NDJSON. - Windows paths in install templates must be JSON-escaped (
D:\path→D:\\path). 5.1.6 fix; covered bytests/test_codex_hooks.pyandtests/test_cursor_bridge.py. plugins/audio-hooks/hooks/hooks.jsonis hand-edited and has no repo-root counterpart. It sits inside an otherwise generated directory andbuild-plugin.shdoes not sync it, so it looks generated but isn't. Edit it in place;build-plugin.shwill not carry your change and will not warn you.- A new variant of an on-by-default parent needs
SYNTHETIC_VARIANT_DEFAULTS[<variant>] = False. Otherwise merely registering the matcher starts making noise on every existing install the moment it ships. New events are opt-in; new variants are too. - A new variant also needs a row in
UserPreferences.VARIANT_INTRODUCED(hooks/user_preferences.py: variant → (parent, release that first shipped it)). Migration reads it (_seed_new_variants): when the stored_versionis older than the variant's release, the parent is explicitlytrue, and every older sibling variant carries an explicit boolean — the signaturehooks enable-only <variant>leaves — the new variant is written explicitlyfalse, so a user who chose exactly which variants they wanted cannot have a new one become audible. A config that only enables the parent (hooks enable stop_failure), or that has just some siblings set by hand, is unchanged and the new variant inherits the parent.tests/test_variant_migration.pyfails when the table andSYNTHETIC_EVENT_MAPdisagree on the variant set or on a parent. Stated limit: an enumeration made before an earlier addition it never answered does not satisfy "every older sibling explicit" and keeps inheriting. - Every event and every variant owns a distinct sound (86 slots — 39 events + 47 variants — and 86 distinct files, in both themes). Each theme directory holds 87 mp3s (174 entries in
config/audio_manifest.json): the 86 slot files plusnotification-info.mp3(chime-notification-info.mp3in the custom theme), which no event maps to by default — it isget_audio_file()'s last-resort fallback and is inconfig/audio_manifest.json. A variant that reuses its parent's file is audibly identical to it, so its independent toggle buys the user nothing. Add the audio override and the twoconfig/audio_manifest.jsonentries;tests/test_plugin_hooks_contract.py::TestAudioUniquenessfails on a shared file, a variant with no override, a file missing from either theme, or two identical manifest prompts. - Verify an event's real semantics empirically before relying on its name. v6.3.4 was an emergency rollback because
WorktreeCreateturned out to be a provider hook that hijacked worktree creation. Observed-vs-documented behaviour for Claude Code's events — including payload fields the docs omit and matchers that never fire — lives indocs/EVENT_BEHAVIOR_NOTES.md. Read it before adding or trusting an event. SubagentStopalso fires for Claude Code's own internal agents (prompt suggestions,/btwside questions), so without a guard echook would announce "background task finished" for work the user never started. Since v6.6.0run_hookskips aSubagentStopwhoseagent_typeis exactly""(debug NDJSON actionskipped_internal_subagent). Scope: Claude Code invoker only — not Cursor, Codex or anunknowninvoker (which includes the legacy script install), because nothing establishes what an emptyagent_typemeans there. An absent key is not the marker (older builds omit it). In a session started with--agent, internal agents carry that agent's name and still announce. A forked subagent arrives withagent_type"fork"(the built-in fork agent's type, read from the binary), so it is not affected. The documented basis is the hooks reference; no real internal-agent payload was captured.- Claude Code mods are not an echook surface, and a
moduleskey must never reach a file Codex reads. Claude Code 2.1.287 added "Claude Mods": a top-level"modules"array inhooks/hooks.json(one entry at most). Investigated at 2.1.288 and adopted for neither track —$.audio.playresolved without sound on Windows in a headless run and the binary only has a macOS player,$.ui.toastis an in-app notification bar rather than an OS notification, a mod has no terminal write and so cannot reviveterminalSequence, and none of its render sites is the status line. Codex's hooks-file parser rejects unknown keys (deny_unknown_fields), and a hooks file that fails to parse disables every hook, so amoduleskey in a file Codex reads would take all of Codex's hooks down. echook is insulated only because.codex-plugin/plugin.jsonpoints atcodex-hooks/plugin-hooks.json; do not repoint it at the Claude Codehooks.json, and do not addmodulesto the Cursor or Codex templates. Interactive sessions and the Desktop app were not tested. Detail indocs/EVENT_BEHAVIOR_NOTES.md. - Every
tests/test_*.pymustimport _isolationbefore anything else, and a new test module must do the same.tests/_isolation.pypoints the home directory and the plugin data directory at throwaway ones for the whole run;tests/test_isolation_guard.pyfails if a module omits it. Without it (before v6.6.0) a full suite run on a developer machine with the plugin installed resolved the real plugin data directory: it re-stamped the realuser_preferences.jsonafter a version bump, appended two test events to the real log per run, and the hook-runner subprocess tests played real sounds and raised real toasts (measured 2026-10-03). That left a POSIX gap until v6.7: a hook-runner subprocess started by a test without an explicit data dir fell back to/tmp/claude_audio_hooks_queue. v6.7 closes it (see the last bullet); the fix is reasoned from the code and was not run on POSIX locally — CI covers Linux and macOS. The isolation also repairs and reports leakedCLAUDE_PLUGIN_DATA,PLUGIN_DATA,CLAUDE_PLUGIN_ROOT,PLUGIN_ROOT,CLAUDE_CONFIG_DIR,CLAUDE_AUDIO_HOOKS_PROJECTandCURSOR_VERSION. When you run the CLI by hand from a worktree, also setCLAUDE_PLUGIN_DATAto a scratch directory. audio-hooks installhas no default mode, and no subcommand may act on an argument it does not understand. The reason is the 2026-10-03 incident above: an agent probinginstall --helpran the script installer and double-registered every hook, and the same fall-through letupgrade --help,tts set --helpandstatusline install --dry-runchange real state. Anything new that mutates state must either declare its grammar through_check_args(or its own parser) and answerINVALID_USAGEto everything else.--helpis handled once, at dispatch, before any handler runs.- The script-install removal rule and the ownership markers live only in the CLI;
scripts/uninstall.shis a wrapper with no rule of its own.bin/audio-hooks.py(LEGACY_HOOK_EVENTS,LEGACY_COMMAND_SCRIPTS,_LEGACY_REF_TEMPLATE,_strip_legacy_*, the per-file markers) is the source of truth; the shell script only finds a Python that runs, forwards--remove-unmatched, callsaudio-hooks uninstall --scripts, and implements--purge(that checkout's ownconfig/user_preferences.jsonandaudio/default/*, backed up first).tests/test_legacy_scripts_contract.pyasserts the script contains no rule of its own. Ownership is by content, not name, because the earlier name-only rule would delete a user's own~/.claude/hooks/stop_hook.sh, and the earlier substring match removed a user hook whose command merely containedstop_hook.sh; markers must therefore be derived from, and tested against, every historical revision of each file — when a legacy file changes, extend its marker rather than loosening the rule. If you add a legacy hook event or script name, add it in the CLI. - Commands that only report must stay read-only (v6.7).
status,diagnose,get,hooks list,theme [list],snooze status, barewebhook/tts/rate-limits,statusline show|segments|…,logs tail,backup list|show,manifest,version,updateand every--helppath must leave the home and data dirs byte-identical: no auto-createduser_preferences.json, no migration save (its.bakand lock file included), nologs/orqueue/.main()marks them via_is_read_only_invocation()/_READ_ONLY_FORMS,UserPreferences.load(read_only=True)computes the merged result in memory, and_save_config_raw()refuses. Before v6.7, looking at the state changed it — and re-stamped the real user's file whenever a development checkout's template was newer than the installed plugin. A new subcommand must be classified intests/test_read_only_commands.py(READ_ONLYorSTATE_CHANGING) or that test fails; the hook runner and state-changing commands still initialise and migrate. A consequence:PREFS_SCHEMA_STALEis no longer cleared by runningstatus— the next hook event or any write does it, oraudio-hooks migratedoes it on request.migrateis state-changing (it is inSTATE_CHANGINGin that test), takes no flags, is idempotent, and never creates the preferences file or its directory; it reportsok,config_path,exists,changed,from_version,to_version,added[],removed[],stale[],backup. A rejectedlogsinvocation (logs clear extra,logs <unknown>) creates no directories either. Known limit, not new in v6.7:statusshows a corrupt preferences file as the defaults anddiagnosedoes not flag it. - Every error code the CLI can emit must be in
manifest.error_codes.hook_runner.ErrorCodecovers what a hook reports; the CLI-only codes (INVALID_USAGE,DUPLICATE_BRIDGE,UNINSTALL_INCOMPLETE, theUPGRADE_*family, thediagnosefindings…) live inCLI_ERROR_CODESinbin/audio-hooks.pyand are merged in by_build_manifest().tests/test_cli_error_codes.pyparses the CLI source and fails on anemit_error("X", …)call or a{"code": "X"}literal naming an uncatalogued code, on a non-literal code it cannot scan, and on a catalogued code nothing emits. CLAUDE.mdis a one-line import of this file, not a copy. Claude Code ignoresAGENTS.mdwhenever aCLAUDE.mdexists, soCLAUDE.mdis@AGENTS.mdplus anything genuinely Claude-Code-only. Edit the guide here. Do not turn it into a symlink (unreliable on Windows) or re-copy it (the two had to be kept in sync by hand).tests/test_agent_guides.pypins the shape.userConfig.webhook_urlissensitive: true; do not addoptionsto anyuserConfigfield. Claude Code still exports a sensitive option to hook processes asCLAUDE_PLUGIN_OPTION_WEBHOOK_URL(measured on 2.1.288 with a shell-form hook, and documented: "exported to hook processes for every option"), which is all the runner reads, and a value stored before the flag was set is still found. Never write${user_config.…}into a shell-form hook command (Claude Code rejects it).optionson any field makes Claude Code older than 2.1.271 refuse to load the plugin.tests/test_plugin_packaging.pyguards both.- A test that spawns the hook runner must pin its data dir with
_isolation.pin_data_dir(env, state_dir). A runner started with noCLAUDE_AUDIO_HOOKS_DATAfalls back on POSIX to the literal/tmp/claude_audio_hooks_queue, a legacy install's real data dir, whatever HOME and TMPDIR say.tests/test_isolation_guard.pyfails for a module that builds[sys.executable, str(HOOK_RUNNER), …]without it. - A push to
masteris watched by Anthropic's plugin directory (since 2026-10-04). A GitHub webhook reports every push, and the directory scans the newest commit ofplugins/audio-hooks/as a candidate version. So: keepmasterreleasable and do work on a branch; raiseversionwith every release that changes the plugin folder; changeplugins/audio-hooks/README.mdandPRIVACY.mdin the same commit as any change to what the plugin runs, sends or writes (the listing's attestations rest on them); and keep every hook command a literal path under${CLAUDE_PLUGIN_ROOT}with no other variable, command substitution or inline program — for a plugin in a repository subfolder anything else blocks the listing.bin/audio-hooks.pyis 228.6 KiB against a 256 KiB per-file threshold above which the directory holds a version for manual review, so split it before it grows past that. Detail indocs/DIRECTORY_LISTING.md. - The secret scanner on pull requests can flag a sound-file mapping. In v6.7.0 GitGuardian reported "Authentication Tuple" for the
SYNTHETIC_EVENT_MAPentry of thenotification_auth_storage_failurevariant inhooks/hook_runner.py— a key containingauthwhose value is a tuple of two strings (the parent event and a sound file name). The line is deliberately not quoted here: quoting it verbatim in documentation tripped the same detector again. It is a false positive, but do not merge past a failing secret scan on your own and do not reword code to slip under the detector: show the maintainer exactly what was flagged and let them decide. Procedure indocs/RELEASING.md. - Do not write file content containing backslashes through a shell heredoc. In the Bash tool used on this project a heredoc collapsed
\\to\and turned\x89into a raw byte, corrupting a test file twice during 6.7.x (caught only because the file stopped parsing). Use the file-writing tool, or a script file, for Python with escapes, regexes and Windows paths.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

