guardrail-hooks

Solid

An agent keeps breaking a rule ('it did it again', 'make this impossible', 'add a hook', 'my hook didn't fire'): make it a hook, permission rule or script.

AI & Automation 633 stars 85 forks Updated today MIT

Install

View on GitHub

Quality Score: 91/100

Stars 20%
93
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Guardrail hooks — rules held by code **Make rules that depend on memory at decisive moments into code paths.** Prose loses that contest to everything else the agent has read. Apply the `agent-instructions` skill for the principle, evidence and test question in its prose-vs-code reference. This skill covers choosing the code path, writing a hook without noise, and two hooks to adapt. ## Pick the smallest code path that holds the rule **Choose the smallest code path that holds the rule.** A permission rule beats a hook. A refusal inside your own tool beats both, because it holds for every agent and every human running it. | The rule is about | Hold it with | Example | |---|---|---| | a command the agent may run, recognisable by its prefix | a permission rule in settings: `permissions.ask: ["Bash(gh repo delete *)"]`, or `permissions.deny` | checked against every subcommand, inside `$()` and loop bodies too, and still prompts in auto mode (read `2026-10-24`). No script to maintain | | what a command does when its text alone can't tell: code in a heredoc, a script it runs, the value of an argument | a PreToolUse hook | `scripts/guard_one_way_doors.py`, `scripts/block_wrong_identity.py` | | how your own tool may be used | a required argument, or a refusal inside the tool | a search-analytics tool: pulls paginate and write a manifest of the exact window, and the report refuses to run without one | | what a commit may contain | a git pre-commit hook in the repository, switched...

Details

Author
phuryn
Repository
phuryn/product-engineering
Created
2 weeks ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Listed

guardrail-hooks

Installs and maintains the hooks that make the guardrails deterministic — blocking destructive commands, protecting generated files, enforcing the blast radius, catching shortcuts, refusing to end a run without evidence. Run it when setting up a repo for unattended work, or when a rule keeps being ignored.

0 Updated 4 weeks ago
AlpayC
AI & Automation Listed

rule-to-hook

Turn one rule that keeps getting broken, not a new automation, into an enforced check (types, lint, CI, a test or a Claude Code hook) proven on a past mistake. Use when the user says 'enforce this rule', 'make this a hook', 'block this command the agent keeps running', 'stop the agent from doing X', or when one rule keeps getting broken or the user keeps repeating the same correction.

2 Updated today
paureis
AI & Automation Listed

sdlc-hooks

Make a rule deterministic with hooks — block writes to protected paths, run a formatter after edits, keep secrets out of a diff, or hold an action until a named person approves. Use when a rule must hold every time, when a documented convention keeps getting ignored, when an approval must survive automation (releases, migrations, infrastructure, protected paths), when asked to configure settings.json or write a hook script, or when deciding whether something should be a skill or a hook. Covers allow/ask/block, where each belongs in a session, and why the block message matters as much as the block.

0 Updated 1 months ago
asaf-shitrit