guardrail-hooks
Guardrail hooks — rules held by code
Operational boundaries
Keep the scope, sandbox, credentials and approval settings supplied by the user or host. Obtain authorization before delegating, exposing project files to another provider, enabling connectors or hooks, using paid services or deploying. Use synthetic or redacted inputs for examples. Keep security reviews static and defensive, with findings and fixes grounded in source inspection.
When to Use
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.
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.