Agent Builder Bundle
Swarm Operator Kit + x402 Builder Skills + MCP Starter Kit. $119 instead of $157.
View Agent Builder Bundle
Stop Gemini CLI from force-pushing main or editing your .env, and make it run the tests before it says it's done.

10 tested hooks for Google's Gemini CLI, plus an installer that merges them into .gemini/settings.json, a simulator that runs any hook the way Gemini CLI does and checks its output contract, and a linter that catches the mistakes that make hooks silently never fire. Python 3.9+, standard library only, works offline. Linux, macOS, WSL.
The screenshot is real output from the kit’s own commands. Tested from a fresh download of this exact zip: ./run_tests.sh ran 24 tests OK on Python 3.13 and 3.10.

| Hook (name in settings.json) | Event / matcher | What it does |
|---|---|---|
| block-dangerous-shell | BeforeTool run_shell_command | Denies rm -rf / ~ *, force push / +branch to protected branches, git reset --hard, git clean -fdx, curl | sh, chmod -R 777, mkfs, dd of=/dev/..., DROP DATABASE, terraform destroy, kubectl delete namespace. rm -rf node_modules and feature-branch force pushes stay allowed. |
| protect-files | BeforeTool write_file|replace|run_shell_command | Blocks edits to .env*, keys/certs, secrets/, .git/ and the hook config itself, including shell writes (>>, sed -i, cp, tee, rm). .env.example stays editable. |
| mcp-guard | BeforeTool mcp_.* | Allow/deny lists for MCP tools (mcp_<server>_<tool> globs) and blocks MCP calls whose arguments contain secrets. |
| scan-prompt-secrets | BeforeAgent | Stops a prompt that contains an API key/token before it reaches the model, without echoing the secret back. |
| redact-tool-output | AfterTool (file, shell, web, MCP tools) | Replaces secrets in tool output with a redaction placeholder before the model sees them. |
| session-context | SessionStart | Adds branch, changed files, recent commits and your .gemini/notes.md as context (capped at 4,000 chars). |
| require-tests | AfterAgent | When code changed, runs your test command; on failure it sends the failing output back so Gemini fixes it. Skips doc-only changes and never loops (stop_hook_active). |
| precompress-notes | PreCompress | Appends branch/changed files to .gemini/notes.md before context compression. |
| audit-log | AfterTool * | JSONL log of every tool call (secrets redacted) in .gemini/logs/audit.jsonl. |
| notify | Notification ToolPermission | Desktop notification (notify-send / osascript) when Gemini waits for approval, plus a JSONL log. |
Profiles: balanced (default, first 7), strict (all 10), guardrails (first 5, no lifecycle hooks), logging (audit, context, notes, notify). Ready-made templates/settings.<profile>.json are included if you prefer to copy by hand.
python3 tools/install.py /path/to/repo # balanced profile into .gemini/settings.json
python3 tools/install.py /path/to/repo --profile strict
python3 tools/install.py /path/to/repo --only block-dangerous-shell,protect-files
python3 tools/install.py --user --profile guardrails # ~/.gemini for every project
python3 tools/install.py /path/to/repo --dry-run # show the merged settings.json, change nothingThe installer copies the scripts to .gemini/hooks/, merges hooks by name (your own hooks and other settings are kept, re-running is safe), writes settings.json.bak, and never overwrites an edited hooks-config.json. Gemini CLI fingerprints project hooks: on the next start it warns you about the new hooks; review them, then check /hooks panel. Turn one off with /hooks disable <name> or add the name to hooks.disabled.
Edit .gemini/hooks/hooks-config.json: protected_paths, protected_branches, mcp_allow / mcp_deny, test_command (empty = auto-detect npm test, pytest or unittest, go test ./..., cargo test), test_timeout, context_limit_chars, log paths, desktop_notifications.
python3 tools/simulate.py hooks/block_dangerous_shell.py BeforeTool --tool run_shell_command --command "git push -f origin main"
python3 tools/simulate.py my_hook.py AfterAgent --prompt "fix it" --stop-hook-active
python3 tools/simulate.py my_hook.py BeforeTool --event event.json --jsonIt prints the decision Gemini CLI would take and flags contract problems: text before the JSON on stdout (Gemini then ignores your deny and shows the text as a message), deny without a reason, decisions on advisory events, exit codes that only warn.
python3 tools/gemini_hooks_lint.py .gemini/settings.json ~/.gemini/settings.json # exit 1 on errors, --json availableChecks: unknown events (Claude Code names like PreToolUse), Claude tool names (Bash, Write) and mcp__server__tool matchers, invalid regexes, regex matchers on lifecycle events (they are exact strings), bad SessionStart / PreCompress values, missing hooks arrays, type other than command, timeouts given in seconds (Gemini uses milliseconds), duplicate names, relative script paths, missing scripts, secrets in commands, and stale hooks.disabled entries.
./tools/demo.sh # simulate hooks, lint examples/broken, install into a temp repo and lint it
./run_tests.sh # 24 unit tests, offlinedocs/events.md is a one-page reference of all 11 events, their matchers and what each output field does.
Zip, 40 KB, v1.0, 32 files. You may use and modify this kit for your own work and for clients you serve, including paid client work. Not affiliated with or endorsed by Google.
10 ready Gemini CLI hooks: block rm -rf and force pushes, protect .env, redact secrets, run tests after each turn, plus a hooks linter and simulator.
Swarm Operator Kit + x402 Builder Skills + MCP Starter Kit. $119 instead of $157.
View Agent Builder BundleRun a team of AI agents as a business: charter, 5 roles, 6 skills, routines and scripts.
View Swarm Operator Kit6 import-ready n8n workflows: x402 monitor, change alerts, Stripe log, AI digest and more.
View n8n Agent WorkflowsShort weekly digest of new x402 + MCP tools and free kits, including the MCP OAuth Checker. No spam, unsubscribe any time.