claude-shared@79653f3 2026-11-22 · claude-admin@3e5c95c 2026-11-11 · claude-dev@2ac6a94 2026-11-11A hook is a script the AI tool runs by itself at a fixed moment: when a session starts, when you submit a prompt, before every shell command, when Claude finishes a reply. Claude does not decide whether it runs.
That is the difference from a skill. A skill is instructions Claude follows when they fit; a hook runs every time its moment comes. A hook can stay silent, add a note for Claude to read, write a file, or block the action, in which case Claude is shown the reason.
Each repo is a Claude Code plugin, and Claude Code loads the plugin's hooks/hooks.json when a session
starts. Everyone has claude-shared; administrators also have claude-admin, developers
claude-dev (why three repos).
12 registrations of 9 scripts across 8 events. They run for everyone, in Claude Code.
Ships no hooks. A hook registered in this repo's hooks/hooks.json would run only for administrators, and only in Claude Code.
Ships no hooks. A hook registered in this repo's hooks/hooks.json would run only for developers, and only in Claude Code.
In the order a session meets them. Runs on narrows a hook to some tools; every time means whenever the event fires.
Marks a session started by /refocus as a child, which may not start refocus sessions of its own, and lists incoming briefs and finished results waiting to be picked up.
If an earlier session left a work-in-progress snapshot, tells the new session to read it first. Leaves deleting it to Claude, once the contents are saved properly.
When you type /clear, /compact, /exit or /quit, checks for work that would be lost. With more than 15 changed lines of code and nothing new in docs/context/ it blocks the command and lists what to save; otherwise it lets the command through with the same checklist. A fresh work-in-progress snapshot counts as saved.
The safety guard. Stops shell commands and file edits that cross the autonomous-mode boundary: anything under projects/data or projects/gitlab (except projects/gitlab/docs), destructive database commands, removing datastore volumes, rewriting git history or force-pushing main, and deleting files outside the project. Claude is shown the reason and has to ask you before trying again.
During a long turn, refreshes the work-in-progress snapshot (wip.md beside the session transcript) once the transcript has grown enough and context is filling up, so something survives if the session runs out mid-turn. Silent.
When a shell command creates a GitLab DECISION card, checks that its options are "- [ ]" checkboxes the owner can tick, and blocks the command when they are prose or a table.
Appends each notification as one JSON line to ~/.claude/notifications/<session>.jsonl. No network, never blocks.
Reminds Claude to record decisions in docs/context/. When more than 15 lines of code changed, nothing was saved and context pressure is high, it asks to block the stop so Claude saves first. From medium pressure it also writes the work-in-progress snapshot. Thresholds: Context Save page.
Reminds Claude to record decisions in docs/context/. When more than 15 lines of code changed, nothing was saved and context pressure is high, it asks to block the stop so Claude saves first. From medium pressure it also writes the work-in-progress snapshot. Thresholds: Context Save page.
Reminds Claude to record decisions in docs/context/. When more than 15 lines of code changed, nothing was saved and context pressure is high, it asks to block the stop so Claude saves first. From medium pressure it also writes the work-in-progress snapshot. Thresholds: Context Save page.
Reminds Claude to record decisions in docs/context/. When more than 15 lines of code changed, nothing was saved and context pressure is high, it asks to block the stop so Claude saves first. From medium pressure it also writes the work-in-progress snapshot. Thresholds: Context Save page.
Warns when a /refocus child session exits without /refocus-complete, so the unfinished brief is noticed on the next resume. Changes nothing.
docs/context/ before a
session forgets them. Thresholds, the snapshot and how a manual save works: Context Save.Only the safety guard reaches beyond Claude Code. Other tools cannot read a plugin's hooks.json, so
setup.py writes each one's own hooks file, pointing at the same destructive-guard.sh. The script
translates each tool's tool names into one policy and answers in the form that tool understands. Every other hook
on this page runs in Claude Code only.
| Tool | Registration written by setup.py | Event · matcher | How it blocks | Notes |
|---|---|---|---|---|
| Antigravity | ~/.gemini/config/hooks.json | PreToolUse · * |
JSON {decision, reason} on stdout, nothing else | — |
| Claude Code | ~/.claude/settings.json | PreToolUse · Bash|Edit|Write|NotebookEdit |
exit 2, reason on stderr | registers a real copy at ~/.claude/hooks/destructive-guard.sh, in addition to the plugin's own registration |
| Codex | ~/.codex/hooks.json | PreToolUse · .* |
exit 2, reason on stderr | Codex runs the hook only once it is trusted; setup.py records that trust |
| Gemini CLI | ~/.gemini/settings.json | BeforeTool · .* |
JSON decision deny on stdout | Gemini CLI is no longer installed on linuxserver.lan; the adapter stays for machines that have it |
| OpenCode | No hook support in its adapter, so the guard does not run there. | |||
setup.py --status reports each tool's registration as registered and trusted, or untrusted, disabled, stale or
missing. MCP tool calls are not covered; the MCP server's own access control applies there.A script runs only if a hooks.json names it. These are kept so they can be turned back on.
Would remind you at session start of unresolved agent-memory items. Unregistered since 2026-08-01; hooks/README.md says why and what to fix before turning it back on.
Change a hook, run its suite first; the guard's suite covers every tool's envelope.
~/projects/claude-skills/claude-shared/hooks/test-context-save-wip.sh ~/projects/claude-skills/claude-shared/hooks/test-destructive-guard.sh
Your own ~/.claude/settings.json, and other projects, can register more hooks (the Phoenix tracing
hooks are one example). They are not part of these repos and are not listed here. In Claude Code, /hooks
shows everything that is loaded.
claude-shared, administrators → claude-admin,
developers → claude-dev.hooks/, make it executable, and register it in hooks/hooks.json as
${CLAUDE_PLUGIN_ROOT}/hooks/<script>.HOOKS in scripts/hooks_catalog.py and regenerate this page. The generator
refuses to run until every registered script is described.Generated from each repo's hooks/hooks.json, the scripts in hooks/ and the
hooks_ensure entries in claude-shared/adapters/. Never edit it by hand:
cd ~/projects/claude-skills/claude-shared python3 scripts/hooks_catalog.py --publish ~/projects/nginx/sites/claude-artifacts # regenerate and publish python3 scripts/hooks_catalog.py --check --publish ~/projects/nginx/sites/claude-artifacts # exits 1 if stale