AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Harden Rules Into Hooks

skill-ariaxhan-the-agent-library-harden-rules-into-hooks · by ariaxhan

Enforce the agent rules that must never break with hooks the agent can't bypass (secret scans, destructive-command guards, format gates) instead of prose instructions it quietly ignores under load.

No reviews yet
0 installs
19 views
0.0% view→install

Install

$ agentstack add skill-ariaxhan-the-agent-library-harden-rules-into-hooks

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-ariaxhan-the-agent-library-harden-rules-into-hooks)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
29d ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Harden Rules Into Hooks? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Harden Rules Into Hooks

The finding

A rule written as a sentence in a config file gets violated roughly 40% of the time under pressure. The same rule encoded as an enforcing hook approaches zero. Long context, a hard task, and time pressure are exactly when a model stops re-reading its instructions, which is exactly when the rules matter most. Aspiration is not enforcement.

So the test for any must-hold behavior is blunt: if it truly cannot be allowed to break, it has to be a hook, not a paragraph. If it's only a paragraph, assume it will break.

Skeleton vs judgment: the split is the deliverable

Not every rule can or should be a hook. The valuable move is honestly sorting them:

  • Skeleton: mechanically checkable, binary pass/fail, no taste required. These get

hooks. Examples: a hardcoded secret, a destructive command on something you didn't create, a push to the protected branch, a file exceeding a line budget, a missing required field/format.

  • Judgment: requires taste or context, can't be reduced to a regex. These stay

methodology, routed to skills, docs, and review. Examples: "make the smallest viable change," "verify it live," "is this abstraction worth it," "is the premise even right."

Trying to hook a judgment rule produces brittle false-positives; trying to prose-enforce a skeleton rule produces silent violations. Doing the split cleanly is the actual work.

What to hook (concrete)

  • Secret detection: block any commit/write containing a key-shaped or token-shaped

string. Catches the credential leak before it leaves the machine.

  • Destructive-command guard: intercept rm -rf, git reset --hard, clean -fdx,

branch -D, force-push on paths the session didn't author; require confirmation first.

  • Push-to-protected-branch confirmation: refuse a direct push to main/master

unless explicitly allowed for this repo.

  • Budget / size caps: reject a file or diff over a set line count without an override.
  • Format / structure gates: require the commit message shape, the required frontmatter

field, the passing linter, before the action completes.

What to leave as methodology

Smallest-change discipline, runtime proof, premise-auditing, "boring beats clever," investigate-before-mutating. These need a thinking agent, not a regex. Put them in a skill or a reference the agent loads at the relevant moment, and accept they'll be followed by disposition, not guaranteed by a gate.

Hook types & where they fire

  • PreToolUse guard: fires before a tool runs; can block it. The right place for

destructive-command and protected-branch guards (stop the action, don't clean up after).

  • Pre-commit scan: fires on commit; the right place for secret detection and format

gates. Bytes never reach history if it fails.

  • Stop / completion gate: fires when the agent tries to finish; the right place to

force a required artifact (a record, a passing-test check) before "done" is allowed.

The override escape-hatch

Real exceptions exist, so build one deliberate, visible door, never an off-switch. Pattern: the hook passes if (and only if) an explicit override token appears in the commit message or action, with a reason:

[budget-override: vendored lib, generated file] feat: import upstream parser

The token forces the human-or-agent to name why the rule is being suspended, leaves an audit trail in history, and keeps the bypass rare and intentional. A rule with no escape hatch gets disabled wholesale the first time it's wrong; a rule with a logged hatch stays on.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.