A hook runs a program on your machine. A rule or a skill is text the model reads. A hook is a shell command that Claude Code executes for you when something happens, such as a session starting or a file being written. That is why the command deserves a read before you install it, and why the scan matters more here than the token count. Hooks written for one repository are counted here too, so the listing pages show fewer.
Which event it fires on
Every hook is tied to an event, and the event decides how often it runs. The three commonest: 1,617 hooks run when a session starts, 1,613 run after a tool call, and 1,582 run before one. At that last event a hook can refuse what the agent was about to do. Then come 1,024 on stop, 774 on every prompt you submit, 328 at session end and 318 before the context is compacted, which is when the conversation gets shortened to make room.
A hook on every prompt runs each time you press enter. A hook on stop runs when the answer is finished. The same command, at two events, does very different amounts of work.
Where it lives: .claude/settings.json for one project, ~/.claude/settings.json for every project, or hooks.json inside a plugin. The hook’s page shows which.
Hooks don’t cost tokens, usually
Nothing in tokens, by itself. Tokens are the units your AI plan counts, and a hook’s command is not part of the conversation, so the usual median and 90th percentile do not exist for hooks.
The exception is what a hook prints. The output of a session-start hook is added to the conversation. A hook that prints as much as the median CLAUDE.md, 1,296 tokens, costs 1,296 tokens every session. At 20 sessions a day that is 25,920 tokens, the same document reread twenty times.
The cost that is real is time and reach. A hook on every prompt that calls the network adds a round trip to every prompt, and sends whatever it sends.
Commands worth reading first
8,420 of the 8,472 hooks are graded A, 25 B and 27 C or D. Across all 8,472, the scan flagged 28 for shell commands, 27 for network calls, 17 for a recursive force delete and 15 for reading the agent’s own configuration directories.
Two of the C grades are the pre-tool-use and post-tool-use hooks in Evo, both flagged for an encoded or obfuscated payload. That is a finding about what you can read, not about what the code does. The Boss Skill pre-tool-use hook carries a recursive force delete. That is the line to read before you decide, not a decision in itself.
Six hooks worth studying
None costs tokens by itself.
- Supabase PostToolUse: formats and lints after every Write or Edit. 14 lines, original.
- Gemini CLI SessionStart: runs
on-start.jsthrough node when a session starts. 12 lines, original, 3 copies. - Superset PreToolUse: looks at the Bash command about to run and, if it is a git commit, runs the project’s pre-commit checks first. 13 lines, original.
- Claude Cookbooks PreToolUse: guards file writes and shell commands, including deletes and installs. 18 lines, original, 1 copy.
- Prisma PostToolUse: TypeScript formatting after the agent writes a file. 13 lines, original, 1 copy.
- RuView PreCompact: runs four commands before the context is compacted, for both the manual and the automatic case. 32 lines, original, 1 copy.
When a hook is the wrong tool
When you cannot read the script the hook calls. A hook that runs run-hook.cmd is exactly as safe as that file, and the page can only show you the hook. When it downloads and runs code from the network, because the code that runs tomorrow is not the code that was scanned today. And when the job is to tell the model something rather than to run something. That is a line in CLAUDE.md, or a skill, which stays out of the session until the model reaches for it.
Questions people ask
Do hooks cost tokens? Not by themselves. What a hook prints into the session does, and 957 of these hooks changed in the last week, so what one prints today is not what it printed a month ago.
Can a hook stop Claude from doing something? Yes. A pre-tool-use hook that exits with code 2 blocks the tool call, and what it wrote to stderr goes back to the model as the reason. 1,582 hooks fire before a tool call, which is the event that allows it.
Can I trust an A grade? As a starting point. The scan reads the hook’s command, not the script it calls, and 8,420 of the 8,472 came out at A. Read the script before you decide.
Do it now
npx agentmods add <slug> installs one by its catalogue slug. Browse all hooks.