Agent Safety & Hooks Pack
Hard-block destructive commands, ask before risky ones, and guard secrets and spend.
Getting started with Agent Safety & Hooks Pack is free to read: what to install, the first 15 minutes after download, and common problems.
Buyer FAQ: delivery, files, software, updates, the license and help.
Zero-dependency Node.js hooks for Claude Code and Cursor. They hard-block destructive commands, ask before risky ones (push, deploy, publish, sudo, deletes), cap tool calls and tokens per session, and log tool calls with secrets redacted. On Claude Code, the secret guard blocks agents writing secrets into files, and it blocks reads and writes of .env and key files. On Cursor, that guard runs only when a file is read: it blocks opening .env and key files, and it does not block the agent writing secrets into ordinary files. A Cursor rule tells the agent not to hard-code secrets. A git pre-commit hook blocks commits with secrets either way. Ready-made configs and rules for both tools are included, and the 57-check test suite runs every hook for real. Requires Node.js 18+.
Who it's for
- Developers who let Claude Code or Cursor run commands and edit files in real projects
- Solo builders and small teams who want a confirmation step before an agent pushes, deploys or publishes
- Anyone who wants commits blocked when they contain secrets, Claude Code blocked from writing secrets into files, and both tools blocked from reading .env and key files
What's included
- Command guard: blocks rm -rf /, force-push to main, git reset --hard, curl | sh, DROP DATABASE and more
- Approval gates: asks before git push, deploys, publishing, data-sending curl, migrations, sudo and deletes
- Secret guard: on Claude Code, blocks API keys, tokens and private keys in agent edits, and blocks reads and writes of .env and key files. On Cursor, the hook blocks reads of .env and key files only; it does not block writing secrets into ordinary files. A Cursor rule asks the agent not to hard-code secrets
- Cost/token budget guard with soft (ask) and hard (stop) limits
- Redacted JSONL audit log of every tool call
- Git pre-commit secret scanner + one-command installer
- Claude Code settings.json + CLAUDE.md, and Cursor hooks.json + 4 .mdc rules
- Config file for your own patterns, and a 57-check test suite
What you can set up with it
- An agent setup where destructive commands are refused outright and pushes, deploys and publishes wait for your yes
- A repo that refuses commits containing secrets or .env files, whichever tool made the change
- Session budgets: past a soft limit on tool calls or tokens you're asked before the agent continues, and past the hard limit it's told to wrap up
- An audit trail of everything an agent ran or edited, with secrets redacted
- Your own rules: add your project's dangerous commands or internal secret formats in one config file
FAQ
- Which tools does it work with?
- Claude Code and Cursor, with ready-made hook configs for both. On Claude Code the secret guard blocks writes of secrets into files, and reads or writes of .env and key files. On Cursor the secret guard runs on file reads, so it blocks opening those secret files and does not block writing secrets into ordinary files. The pre-commit secret scanner works in any git repo, whatever tool made the change.
- Is this a sandbox?
- No. Hooks are a strong safety net, not a sandbox: pattern matching can be evaded by a determined or obfuscated command, and token counts are estimates from transcript size. Keep real secrets out of your repo, use least-privilege tokens and keep backups.
- Will it keep interrupting me?
- Approval prompts only appear for the risky commands on the list. You can add commands you trust to an allow-list to skip the prompt; destructive commands stay blocked either way.
- What if it flags something that isn't a secret?
- Add guard:allow-secret in a comment on that line and the scanner skips it.
- How long does it take to install?
- About two minutes: copy the folder into your project, run the tests, then copy the example configs for Claude Code or Cursor. An optional one-command step installs the pre-commit hook and backs up any existing one.
- What do I need?
- Node.js 18+. The scripts have no dependencies and work on Windows, macOS and Linux.
Delivery: instant zip download right after checkout. Updated versions appear in your Polar purchase page. One-time purchase. Use it in your own and client projects; don't resell the kit itself.