Claude Code hooks: open-source examples and tools (2026)
Our pick
Start with CC Safety Net if you want a hook that stops Claude Code from running destructive commands. One command installs it (npx -y cc-safety-net@latest install), it is MIT licensed, and it blocks things like git reset --hard, git push --force and rm -rf on dangerous targets, plus access to .env files and SSH keys, before the tool call runs. The table shows how the other hook tools compare.
Best for
- Blocking destructive commands and secret access
kenryu42/cc-safety-netBlocks commands such as git reset --hard, git push --force and rm -rf on dangerous targets, and access to SSH keys and .env files, before the tool call runs. It supports Claude Code and many other coding CLIs.
- Rules and run history across several agents
FailproofAI/failproofaiHears the hook events an agent fires and can block a bad action before it runs. Install with npm install -g failproofai; failproofai config hooks your agents and signs you in to Failproof Cloud, which keeps your run history. Licensed MIT with the Commons Clause.
- Formatting and linting every edit
alexfazio/planktonRuns automated formatting and linting each time Claude Code edits a file, and hands what is left to separate Claude subprocesses to fix. macOS and Linux only.
- Hearing when the agent is done
heardlabs/heardAdds hooks to Claude Code and Codex so you hear a short spoken summary when the agent finishes, fails or needs approval. Run heard install claude-code on macOS; the voice can run locally with Kokoro or use your own ElevenLabs or Speechify key.
- Seeing every hook event in use
shanraisshan/claude-code-hooksA working example that plays a sound for hook events such as session start and tool use, with a changelog of each hook event Claude Code added.
The repos compared
Checked on Nov 27, 2026: the oldest day any repo in the table was last read from GitHub.
| Repo | Stars | Last commit | Latest release | Licence | Needs |
|---|---|---|---|---|---|
| kenryu42 / cc-safety-net Blocks destructive commands and access to secrets before an agent's tool call runs. | 2,148 GitHub (opens in new tab) | Active Dec 1, 2026 | v2.9.0, Nov 28, 2026 | MIT | |
| FailproofAI / failproofai Policy enforcement and run tracking for coding agents, built on their hook events. | 10,487 GitHub (opens in new tab) | Active Dec 1, 2026 | v1.0.18, Dec 1, 2026 | Custom | |
| alexfazio / plankton Runs formatting and linting on every file edit Claude Code makes, using hooks. | 380 GitHub (opens in new tab) | Inactive Mar 8, 2026 | - | MIT | |
| heardlabs / heard Reads your agent's progress aloud when it finishes, fails or needs approval. | 793 GitHub (opens in new tab) | Active Nov 28, 2026 | v2.0.16, Nov 8, 2026 | Apache-2.0 | |
| shanraisshan / claude-code-hooks Example hooks that play a sound on Claude Code events, with a changelog of hook events. | 575 GitHub (opens in new tab) | Active Jun 4, 2026 | - | MIT | |
| sangrokjung / claude-forge A Claude Code setup that bundles agents, commands, skills and safety hooks in one install. | 888 GitHub (opens in new tab) | Active Sep 3, 2026 | v4.1.0, Aug 25, 2026 | MIT | |
| W17ant / Claude-Office A pixel-art office that shows Claude Code agents at work, fed by hooks and the status line. | 428 GitHub (opens in new tab) | Active Nov 18, 2026 | v1.3.0, Nov 16, 2026 | MIT |
Install commands
Copied from each repo. Read its setup steps before you run anything.
kenryu42/cc-safety-net
npx -y cc-safety-net@latest install
npx -y cc-safety-net@latest doctorFailproofAI/failproofai
npm install -g failproofai
failproofai config
# hook your agents, connect to Failproof Cloud (free)
failproofai backfill --since 7d
# bring in the last week of runs already on diskQuestions
What are Claude Code hooks?
Hooks are commands or other handlers you configure to run automatically at set points in a Claude Code session, such as when a session starts, a prompt is sent, a tool is about to run or has run, a subagent starts, context is compacted, or the agent stops. A hook that runs before a tool call can block that call, which is how CC Safety Net stops a destructive command.
What are good examples of Claude Code hooks?
CC Safety Net blocks destructive commands before they run. Plankton formats and lints each file Claude Code edits. Heard speaks a summary when the agent finishes or needs approval. The shanraisshan/claude-code-hooks repo is a runnable example that plays a sound on each hook event.
Do these hooks only work with Claude Code?
No. CC Safety Net supports Claude Code, Codex, Cursor, OpenCode and other coding CLIs. FailproofAI works with Claude Code, Codex, Cursor, Hermes, OpenClaw and more. Heard covers Claude Code and Codex. Plankton is built on Claude Code hooks and does not support Windows.
Where can I find more hooks to copy?
Claude Code Templates is a catalog and CLI that lists hooks next to agents, skills and settings, and installs a hook by name. Claude Forge is a Claude Code setup that ships a set of safety hooks together with agents, commands and skills.
