@hasna/hooks weekly downloads statistics
By hasna (9 listings) · npm · Claude Code
Open source hooks library for AI coding agents - Install safety, quality, and automation hooks with a single command
@hasna/hooks has 318 recorded weekly downloads on npm, a decrease of 95.9% over the past 30 days, ranking #2373 of 3,247 tracked listings.
About @hasna/hooks
@hasna/hooks
Open source hooks library for AI coding agents - Install safety, quality, and automation hooks with a single command
What it does
@hasna/hooks installs hooks into AI coding agents. A hook is a small program the agent runs at a fixed point: before a shell command, after a file edit, or when a turn ends. Hooks block a mistake, check the work, or automate a step. One CLI installs, lists, updates and removes them.
-
Agents. Claude Code (the default target) and Codex. Compatible OpenCode and Sumi builds are supported for the stop-review hook. Gemini CLI is an install target (
--target gemini), but the bundled shell guards do not yet recognise Gemini's tool names (run_shell_commandrather thanBash), so do not rely on them there yet. Codewith targets remain for existing setups, but Codewith is deprecated. -
Install targets.
--targetalso acceptsqwen,muse,kimi,piandcursor, each writing that harness's own config with an entry that callshooks run <hook> --target <name>. They are not interchangeable: Muse hands over the final message as a quoted JSON string, whichhooks run --target museparses once; Kimi's stop payload carries no assistant text and Kimi blocks with exit 2 and stderr; Pi runs hooks through thehasna-pi-hooksbridge and receives no assistant text; Cursor's stop hook can neither block the turn nor carry the assistant text. A hook whose manifest setsrequires_final_messageorrequires_blockis refused at install on a target that cannot honour it, with the measured reason, instead of being installed to do nothing.opencodeandsumihave no generic install path and are refused by name; their stop review is registered throughhooks install stop-review --target <opencode|sumi>. -
Catalog. 58 bundled hooks in 10 categories, listed below. You can also install your own hooks from a local directory, a git URL or a manifest URL.
-
Safety core. Guards that:
- block destructive git commands (gitguard);
- send
rmto a recoverable trash store instead of deleting (trash-guard). It needs thetrashCLI from@hasna/trashon PATH; without it, trash-guard refuses therm; - protect repository checkouts (workspace-repos-guard);
- refuse a delete of
/, the home directory,~/.hasna,~/.ssh,~/.awsand of coding-agent session and history stores, without Trash (protected-delete-guard); - keep signed links out of agent transcripts (signed-link-guard).
scanoutput is detection only: it warns about a secret in tool output after the output is already in the transcript, and cannot prevent or redact it.
Each is installed as a hook. For Claude Code, Codex and Sumi,
hooks safety install trash-guard --target <codex|claude|sumi>can also register trash-guard, workspace-repos-guard and signed-link-guard as one native safety entry; the other guards are not part of it.--targetdefaults tocodex, so name the agent. -
Interfaces. The
hooksCLI, an MCP server (hooks-mcp) and a self-hostable hook registry (hooks-serve).
Quick start
The CLI runs on Bun 1.0 or later, so bun must be on PATH. Without a Hasna hooks registry credential, use local mode: the bundled catalog and a local store in ~/.hasna/hooks. Set it in your shell profile, not only in the current shell. The agent runs each installed hook as hooks run <name>, and that command needs the same setting. Without it the hook exits with REMOTE_API_CONFIG_MISSING and does not guard anything.
bun --version # Bun 1.0 or later is required
npm install -g @hasna/hooks
echo 'export HASNA_HOOKS_LOCAL=1' >> ~/.zshrc # or ~/.bashrc; then open a new shell.
# Only without a registry credential: the opt-in takes precedence over Keychain and file credentials.
hooks list --all --verbose # browse the full catalog
hooks install gitguard --dry-run # preview what would be installed
hooks install gitguard # Claude Code picks it up live; restart if /hooks does not list it
hooks install gitguard --target codex # or Codex; then review and trust it in Codex's /hooks
hooks list --installed --target codex # what is installed for one agent
hooks doctor # check the Claude Code installation
hooks verify # read-only: every hook, what its trust rests on, and any mismatch
echo '{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"git reset --hard"}}' \
| hooks run gitguard # a simulated command: prints a "block" decision, runs nothing
Starting the commands. The hooks, hooks-mcp and hooks-serve commands start through #!/usr/bin/env -S bun --config=/dev/null --no-env-file --no-macros --no-install. Started this way, they do not read the working directory's bunfig.toml or .env, so a project an agent works in cannot run code inside them. Starting them as commands needs GNU coreutils 8.30 or later, or the macOS/BSD env. That covers PATH, an npm or Bun bin link, bun x and bunx. The flags are verified with Bun 1.3.14, which silently ignores flags it does not know, so an older Bun may start the commands without one of these protections.
With BusyBox env (for example on Alpine) or older coreutils, start them through Bun with the same flags:
bun --config=/dev/null --no-env-file --no-macros --no-install <package>/bin/index.jsforhooks;- the same with
bin/hooks-mcp.jsorbin/serve.jsfor the others; <package>is$(npm root -g)/@hasna/hooksfor an npm global install.…
Description from the npm listing.
- claude-code
- codex
- opencode
- sumi
- ai-agents
- agent-safety
- mcp
- hooks
- cli
- typescript
- bun
- git-safety
- code-quality
- security
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm Claude Code plugins
All 20 @hasna/hooks alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@hasna/hooks. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.