guard-pack — Claude Code plugin: what it does, how to install
guard-pack is a Claude Code plugin that runs seven guard hooks in one Node process. The first blocking verdict stops the chain.
MIT ★ 586 updated 2026-10-26
/plugin marketplace add karanb192/claude-code-hooks
/plugin install guard-pack@claude-code-hooksWhat guard-pack does
A single PreToolUse registration covers Bash, Read, Edit, MultiEdit, Write, Agent, Task and Grep, then runs seven guards in a fixed order: subagent-spawn-cap, config-guard, block-dangerous-commands, protect-secrets, protect-tests, git-safety, case-insensitive-guard. The first blocking verdict ends the chain and comes out in that guard's own format, tagged (via guard-pack).
One Node startup instead of seven. The authors' benchmark puts the pack at 38 ms median against 199 ms for the six pattern guards run separately on the same machine. Guard scripts in lib/ are byte-identical copies of the standalone plugins, and a test keeps them that way. When a guard throws, the error is logged and that guard is skipped, so the other six keep working.
Running the pack next to the individual guard plugins is a mistake: every duplicated guard fires twice, which doubles latency and denials and counts each spawn twice against the cap. The pack ships no settings of its own, and the guards read their env vars directly. HOOK_SAFETY_LEVEL applies to all six pattern guards at once; SPAWN_CAP_ASK defaults to 20 and SPAWN_CAP_DENY to 60. Unattended runs (-p or dontAsk) can't answer a prompt, so there the ask threshold acts as a hard stop.
What it helps with
- install seven guard hooks with one plugin
- cut Node startups on every matching tool call
- cap subagent spawns per session
- block risky shell commands before they run
- keep a per-verdict log of what each guard decided
Example prompts for the agent
- Spin up one subagent per module and merge their reports.
- Edit
.envand commit it along with the rest of the files. - Which guard blocked the last call, and why? Show me the line from
~/.claude/hooks-logs/.
How to install guard-pack
Plugin marketplace
/plugin marketplace add karanb192/claude-code-hooks/plugin install guard-pack@claude-code-hooksStep by step, with commands for each platform: Claude Code plugins: marketplaces, installing, and building your own
Questions about guard-pack
How do I install guard-pack in Claude Code?
Run /plugin marketplace add karanb192/claude-code-hooks first, then /plugin install guard-pack@claude-code-hooks. Restart Claude afterwards.
What does guard-pack do?
It runs seven guard hooks inside one Node process behind a single PreToolUse registration. The first guard to block stops the chain before the rest are evaluated.
Can I use it alongside the individual guard plugins?
No. A duplicated guard fires twice, doubling latency and denials and counting each spawn twice against the cap. Pick one setup or the other.
Source text
guard-pack · MIT
# guard-pack > All seven guard hooks in one Node process. Installing them individually costs seven Node startups per matching tool call; the pack pays one. Measured ([bench/RESULTS.md](../../bench/RESULTS.md)): 38 ms median for the pack vs 199 ms for the six pattern guards separately on the same machine, before the spawn cap joined. One PreToolUse registration on `Bash|Read|Edit|MultiEdit|Write|Agent|Task|Grep` evaluates, in order: [subagent-spawn-cap](../subagent-spawn-cap), [config-guard](../config-guard), [block-dangerous-commands](../block-dangerous-commands), [protect-secrets](../protect-secrets), [protect-tests](../protect-tests), [git-safety](../git-safety), [case-insensitive-guard](../case-insensitive-guard). The spawn cap goes first because its filter is one cached module load and a single tool-name compare and, on an `Agent` call, it is the only guard that applies; after it, cheap string checks run before the guards that touch the filesystem or spawn git. The first blocking verdict wins and is emitted in that guard's own format (same emoji, same `[id]`, same reason text) with a `(via guard-pack)` suffix. A guard that throws is logged and skipped, so one broken guard can never switch off the other six. The guard scripts in `lib/` are byte-identical copies of the individual plugin scripts, pinned by a test, so the pack can never drift from the standalone guards. `Grep` reaches protect-secrets through the same checks as the standalone plugin, including Windows paths and directory/filter combinations. Its [search limitations](../protect-secrets#search-and-windows-coverage) also apply here; broad searches can still expose secrets. ## Install ``` /plugin marketplace add karanb192/claude-code-hooks /plugin install guard-pack@claude-code-hooks ``` Restart Claude Code, done. **Do not install the pack alongside the individual guard plugins** (or a manual `settings.json` registration of any of the seven): every duplicated guard runs twice on each matching tool call, with double latency, double denials, and for the spawn cap a double-counted budget. Pick one or the other. ## Configuration The pack adds no configuration of its own; the guards' env vars pass straight through because the modules read them directly: - `HOOK_SAFETY_LEVEL` = `critical` | `high` | `strict`: applies to the six pattern guards uniformly (each falls back to its own default on an invalid value). Want different levels per guard? Install the individual guard plugins instead. `subagent-spawn-cap` does not read it; see its own knobs below. - `HOOK_ASK_CRITICAL` / `HOOK_ASK_HIGH` / `HOOK_ASK_STRICT` = `true`: ask instead of deny, for the guards that support ask mode (config-guard, block-dangerous-commands, protect-secrets, case-insensitive-guard). protect-tests and git-safety always deny. - `CONFIG_GUARD_ALLOW` = `true`: skips config-guard for an intentional, human-approved config edit. The other six guards still run. - `SPAWN_CAP_ASK` (default 20) / `SPAWN_CAP_ASK_STEP` (default 10) / `SPAWN_CAP_DENY` (default 60): per session, the pack asks at spawn 20 and every 10 after that (30, 40, 50) and denies at 60. `SPAWN_CAP_ALLOW` = `true` lets spawns through for as long as it is set; each is still counted and logged `ALLOW_OVERRIDE`. Unattended (`-p` or `dontAsk`) runs cannot answer an ask, so there the ask threshold is the hard stop: set `SPAWN_CAP_ASK` equal to `SPAWN_CAP_DENY` for those. Details in the [subagent-spawn-cap README](../subagent-spawn-cap). ## What gets recorded One line per verdict in `~/.claude/hooks-logs/` (guard name, rule id, decision, tool; for the spawn cap also the count and thresholds). The spawn cap writes its own `ALLOW_OVERRIDE` and clamp `WARN` lines on the pack path too, and keeps its per-session ledger under `~/.claude/subagent-spawn-cap/`. The pack makes no network calls; everything stays on your machine.
© Karan Bansal · MIT · karanb192/claude-code-hooks