Get started

Zero to a blocking gate in five minutes.

Six steps — and the fifth is the one every other tool skips: you make the gate refuse on purpose, so you know it's armed. A gate you have never seen go red is a gate you're taking on faith.

no accountno serviceno telemetrya CLI and a config file
1

Install the package

A dev dependency, pinned like any gate you rely on. It runs no script on install — it does not read your repository until you ask it to, and it writes nothing until the next step.

$npm install --save-dev ruleofcode
2

Write the constitution

Writes ruleofcode.config.json with the full law set and detects your stack (TypeScript, Angular, Node, Python). Nothing is enabled behind your back — open the file and read what it wrote. That file is the constitution; everything else enforces it.

$npx ruleofcode init
3

Run the audit — and read the number

The first line that matters is Total Laws Checked. Not the score — the count. It tells you how many laws actually executed against your stack, and it's the number every other gate quietly hides.

$npx ruleofcode audit --mode=full
Total Laws Checked: 119 — remember this number, you need it in step 3 ✓ Passed: 103 ⚠ Warnings: 16 ✗ Failed: 0

Expect debt on day one. A real codebase does not pass 119 laws on its first run — ours didn't either (16 warnings, published on /dogfood). Warnings are visible debt, not failure. What matters is that nothing is hidden.

4

Set the liveness floor — from the number you just read

Open the config and set laws.minLawsChecked just under your measured count. This is the tripwire: if a future config edit, a stack misdetection, or a bad merge silently shrinks the law set, the audit refuses to report compliance at all.

jsonc"laws": { "paretoMode": false, "minLawsChecked": 117 }

Measure it, don't inherit it. The floor is your count minus a small buffer (we run 119 and floor at 117) — never a number copied from someone else's config. A floor above your count blocks you; a floor far below it protects nothing.

5

Make it refuse — on purpose

The step everyone skips. Temporarily raise the floor above your law count and run the audit. Watch it go red. Then put the floor back and watch it go green. Now you have evidence the gate is armed — not an assumption.

$… set minLawsChecked: 999 → audit → watch it refuse → set it back
❌ Only 119 laws selected — below the liveness floor (laws.minLawsChecked: 999) — refusing to report compliance. A shrunken audit is a disarmed gate, never PASSED. exit code: 1

Why this is a step and not a footnote: we once shipped a gate that quietly shrank from 122 laws to 27 — green the whole time. And three of the checkers guarding this very website shipped disarmed, caught only by making them fail on purpose. A check you have never seen go red is not a check. (The full record is on /findings.)

6

Arm the hooks and the CI

Installs pre-commit and pre-push hooks that run the full law set. In CI, run the same audit and let the exit code speak — it exits non-zero on failure and on a collapsed law set, so a pipeline can't ignore it. --export json gives you the machine-readable report if you want to publish your own dogfood page.

$npx ruleofcode reinstall-hooks
cinpx ruleofcode audit --mode=full --export json

Four rules that keep the gate armed

Setup is five minutes. Staying honest is these four habits — each one exists because somebody (usually us) broke it first.

Never

Fast mode in hooks or CI

--mode=fast runs the 27-law Pareto core — great in your editor loop, and it tells you so out loud. But a hook that checks less than your CI is a disarmed gate with good manners. Hooks and CI run --mode=full, always.

Never

A waiver without a reason

Three states, in honesty order: error (blocking) · warning (visible debt) · notApplicable — and the last one carries an argument, a date and an author, or it doesn't exist. A hidden waiver is worse than visible debt.

Always

Graduate warnings, don't mute them

Start with failOnWarnings: false and burn the debt down in the open — then flip it to true and warnings become blocking. The ratchet only turns one way.

Always

Re-prove red after config changes

Touched laws.enabled, notApplicable, or the floor? Re-run step 4. Every silent gate collapse we've ever shipped entered through a config edit that nobody watched fail afterwards.

Five minutes in, you have a gate that refuses to lie to you.

The same gate that guards a trading bot with real money — free, local, no account. What it says next is up to your codebase.

And when every applicable law passes — you'll know. There's a unicorn.