protego
Skill9 starsChanged 3 months agoMITView on GitHub
Install a write-time hook that checks instruction artifacts as they are edited, so the defects the audit passes hunt stop accumulating between rituals — the one spell in this book that ships a mechanism rather than prose. Runs only the checks a script can decide without a model: emphasis inflation, descriptions past the truncation cliff, undeclared agent model tiers, rule globs matching nothing, memory files over a size ceiling. Use for "stop this happening again", "enforce the opus pocus rules", "add a lint for my CLAUDE.md", "how do I keep this from regressing", or as part of /opus-pocus. Advisory by default, never blocking. NOT for auditing what is already there (→ the audit passes). NOT for judgement calls a script cannot make.
In this repository20 other files it gives its agents.
- accio-rulebookSkill
- alohomoraSkill
- avada-verbosaSkill
- clarificus-maximaSkill
- configureSkill
- contradicto-revelioSkill
- descriptio-reducioSkill
- finite-recursumSkill
- legilimens-anthropicaSkill
- muffliato-hookusSkill
- nihil-revelioSkill
- obliviate-fossiliumSkill
- opus-pocusSkill
- priori-incantatoSkill
- quietus-capslockiusSkill
- sorting-hatSkill
- tempus-mutaturSkill
- the-pensieveSkill
- the-remembrallSkill
- the-room-of-requirementSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Only what a script can decide without a model.
- Very specific: line 64
If you want it to refuse rather than advise, that is a reasonable choice after you have done what alohomora requires of any blocking guard:
- Very specific: line 67
Measure your own thresholds first: Run descriptio-reducio for your real cliff and quietus-capslockius for your emphasis baseline.
- Distinctive: line 75
Give the escape a TTL, an attribution and a ceiling: before you need it, not after.
- Distinctive: line 90
When installing: confirm the wiring (which event, which matcher), paste the pipe-test output for the fire case and the silent case, and …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
🦋 Protego
"The cheapest curse to remove is the one that never lands."
This book has one loud doctrine — if a rule matters enough to shout, it matters enough to enforce with a hook; blocking hooks achieve near-total compliance, prose is best-effort — and until this spell it was entirely prose: a whole book of advice about mechanism, delivered as text, to be obeyed by goodwill.
Protego is the shield: a hook that runs when an instruction artifact is written, catching the mechanically-decidable defects at the moment they are introduced. Not so the audit becomes unnecessary, but so it stops re-finding the same five classes every quarter.
What ships
hooks/protego.sh— the check itself. Reads the hook payload on stdin, works out whether the edited file is an instruction artifact, runs the checks, and emits only when it has a finding.- A
hooksblock for the plugin manifest wiring it toPostToolUseonWrite|Edit.
Installed as part of the plugin, it is already wired. Copied into a repo by hand, wire it in that repo's settings file with the same event and matcher.
What it checks
Only what a script can decide without a model. Each finding names the spell that owns the full treatment, because the hook's job is to notice, not to adjudicate:
| Check | Fires when | Owner |
| Emphasis inflation | over 6 emphasis tokens in a file under 500 words, or over ~10 per 1k words above that — the small-N split quietus-capslockius uses, because one NEVER in a 300-word file is a rate of 3.3/1k and means nothing | quietus-capslockius |
| Description length | a skill or agent description: over 1,200 characters, conservatively under the commonly-measured cliff | descriptio-reducio |
Late NOT for | the disambiguation clause starts past character 900 — the part that prevents wrong routing is the part most likely truncated | descriptio-reducio |
| Undeclared model tier | an agent with no model:, and only on a roster of 5 or more — below that, inheriting is correct and sorting-hat says so | sorting-hat |
| Dead rule glob | a paths: entry matching zero tracked files under both git pathspec modes | accio-rulebook |
| Memory file size | over 25,000 bytes | obliviate-fossilium |
What it deliberately does not check: anything needing judgement. Whether a rule is vague, whether two rules contradict, whether a verify-your-work line has a loop partner — those are model questions, and a script guessing at them produces exactly the false positives that teach people to disable hooks.
Advisory by default, and why
It never blocks. It always exits 0.
Its thresholds are unmeasured in your repo. The truncation cliff is harness-specific, the size
ceiling is a judgement, and the emphasis threshold is a heuristic with real exceptions — a
security guard's NEVER is correct at any count. A blocking gate built on numbers nobody measured
here, shipped into strangers' repositories, is precisely the failure alohomora documents: a
guard that refuses legitimate work, whose natural remedy is a bypass, which trains everyone to
bypass it.
It also stays quiet on a clean file. A hook that speaks on every edit is the noise
muffliato-hookus exists to cut, and silence-as-output is the only honest default.
Making it blocking, deliberately
If you want it to refuse rather than advise, that is a reasonable choice after you have done
what alohomora requires of any blocking guard:
- Measure your own thresholds first. Run
descriptio-reduciofor your real cliff andquietus-capslockiusfor your emphasis baseline. Blocking on someone else's numbers is blocking on nothing. - Build the negative corpus. Collect the instruction files in your repo that are correct and must never fire, and confirm the hook stays silent on all of them. Negative tests are the deliverable, not an afterthought.
- Narrow to one check. Block on the single check you have measured; leave the rest advisory. A guard that blocks on six heuristics fails on the weakest one.
- Give the escape a TTL, an attribution and a ceiling before you need it, not after.
Then change the emitted decision, and keep the negative corpus as a test that runs on change.
Bounds
- Scope: instruction artifacts only — memory files,
.claude/skills/,.claude/agents/,.claude/rules/. Every other path exits immediately and silently. - Cap: the checks above and no more. Adding a check that needs a model turns a hook into a spiral; adding one whose threshold you have not measured turns it into an
alohomorafinding. - Done when the hook is installed, wired, and pipe-tested. Not when it stops finding things — it is meant to keep running.
- Test before shipping any change to it. Pipe a synthetic payload: a file that must fire, a file that must not, empty stdin, malformed JSON, and a path that does not exist. An untested hook is this book's own
priori-incantatofinding. - Degrade quietly: absent input, unparseable payload, missing file, no
python3, nogit— every one of those is silence and exit 0, never an error surfaced as a tool failure. - See
skills/opus-pocus/references/casting-safety.mdfor the full rules.
Report format
When installing: confirm the wiring (which event, which matcher), paste the pipe-test output for the fire case and the silent case, and state which checks are active. When proposing changes to it: the check, the threshold, where the threshold came from, and the negative-corpus result.
SCANNED NOTHING if the repo has no instruction artifacts for it to watch — a shield over an
empty doorway is not protection, and installing it there would claim a coverage that does not
exist.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

