Run any idea through the Red Gate protocol: rounds of ARM → TRACE → JUDGE with graduated autonomy — a verifier is proven able to fail before any work starts, one thin slice flips one criterion green, and someone who did not do the work runs the verifier. Cross-harness: Claude Code, Codex, Copilot via APM. The red gate is executed, not asked.
No TRACE work begins until a verifier exists that runs and rejects the current state on every checkable criterion — and no criterion is ever marked green except by that same pinned verifier, executed independently of the party that did the work, producing evidence on disk.
“Criteria that cannot be rejected are not criteria.”
# Claude Code (native)
/plugin marketplace add JRichlen/agent-plugins
/plugin install redgate@jrichlen
# Any harness via APM (Codex, Copilot, …)
apm install JRichlen/agent-plugins/plugins/redgate # tracks main
apm install JRichlen/agent-plugins/plugins/redgate#<sha> # reproducible
apm compile -t copilot # aggregates into .github/copilot-instructions.md
Codex reads the plugin's AGENTS.md natively; Claude Code installs it as a plugin
via the marketplace. The scripts are plain bash and run identically under all three. A
Claude-Code hooks enforcement layer ships in the plugin as optional hardening, never a
dependency.
This marketplace holds two dozen single-invariant disciplines — scope-fence,
verify-before-claim, stop-rule, semver-gate, and friends —
that each work alone. Nothing composed them: there was no answer to “I have an idea, now run
the right skills in the right order and prove you finished.” Red Gate is that answer.
In one line: turn a one-line idea into a verifier proven able to fail, flip one criterion green with a real thin slice, then let someone who did not do the work run the verifier — round after round, in any domain of the SDLC or AI-DLC.
The protocol was designed adversarially and then built by running itself on
itself: every implementation slice was a real Red Gate round, and the committed run
records under .redgate/*/gates.log include two rounds where the protocol caught its
own defects — once when a mutation control demoted two criteria whose checks stayed green after
the code they claimed to measure was reverted, and once when the red gate refused to open because
all criteria were already green before any work (“criteria that are already true are regression
tests, and regression tests belong in the eval tier”).
A run is a directory (.redgate/<slug>/) plus a sequence of
rounds (default budget: 4). A round is one ARM → TRACE → JUDGE
cycle ending at a classified gate. Rounds are horizontal — each is gated and produces the
next round's contract. Recursion is vertical — automatic, inside one round, bounded by a
depth_remaining budget. “A round can contain recursion. Recursion never crosses a
round boundary.”
Write CRITERIA.md + check.sh, prove the gate red
on every checkable criterion, get human ratification, pin the sha256 of both files in
the manifest. From here neither file is ever edited.
One writer drives one tracer-bullet slice that flips one criterion through every layer it names — no stub at the proving seam. Subagents may fan out read-only. Every hunk traces to a criterion id; an attempt bound is declared up front.
The pinned verifier is re-hashed and run by a party that did not do the work, producing fresh evidence on disk, followed by a mutation control: revert the slice's core hunk and confirm the check goes red. No unrun PASS, ever.
| Round type | Judged artifact | Default gate class |
|---|---|---|
| Scout | A brief with ≥3 options, costs and a “fails if” per option, and a recommendation naming what would falsify it | always major |
| Plan | Ordered slices, each naming its proposed verifier; the first slice crosses every layer (this ratification creates the mandate) | always major |
| Build | A working thin slice; one criterion per slice, no stub at the seam the slice exists to prove | patch when derived |
| Widen | The slice hardened: ambiguous inputs plus the failure path | patch |
| Retro | Every gates.log entry has a non-empty lesson; recurring lesson shapes cite their sightings | minor |
The round-zero rule answers “I don't know what to build yet”:
Start at the first round whose criteria you can write without already knowing the answer. If you cannot write criteria for the work, write criteria for the artifact that will tell you what the work is.
Early rounds sit low on the escalating-verifiability ladder: the machine checks an artifact's shape while the human judges its substance at the gate. Later rounds check behavior. And when rounds would be pure ceremony — the approach is agreed and the criterion is writable today — the protocol says to go straight to a build round.
ARM's product is a two-file contract, ratified together, pinned together, immutable for the life of the round:
CRITERIA.md — 3–7 numbered criteria. Each has a statement, the
layers it crosses, why it is red today (absent vs
present-but-wrong), and either a check_cmd or a declared
WITNESS (a human-observation criterion). At least two criteria must be
checkable and checkable must be the majority; at most one WITNESS (two only with explicit human
opt-in), each countersigned individually.check.sh — the verifier harness. Exit 0 all
green, 1 any FAIL (red), 99 harness FAULT (“not red; fix the harness,
never call it a FAIL”). Each check_cmd runs under a timeout with output captured to
evidence/<n>.out. A missing binary is a legitimate FAIL — “exit 127 included”
— which is what unblocks greenfield work where nothing under test exists yet.Learning between rounds happens by writing a fresh contract in a new
-r<N> run directory, never by editing a pinned one. A wrong contract is
corrected by a child within the round or by the next round — “that is what keeps auto-ratification
from becoming self-ratification.”
Before ARM, the driver calibrates five dials, inferring values first (each labeled
stated or inferred with a one-line basis) and asking at most five load-bearing
questions total, shared with the ARM interview. The record lands in the CRITERIA.md
header, so the pin protects it from drift for free; silence at ratification accepts every inferred
value.
| Dial | Values | Notes |
|---|---|---|
| Tier | T0 direct · T1 tracer · T2 run (default for /redgate) · T3 program |
T0 declines the protocol outright: “No run. Do the thing. Opening a run dir for a T0 task is a calibration error, not diligence.” Any irreversible action or external transmission bumps the floor to ≥T2. |
| Domain | code · research · writing-docs · ops-config · design | Each maps to a verifier rung; mixed-domain tasks calibrate to the riskiest domain present, not the largest. |
| Scope | fence paths + blast radius (file / module / repo), external, irreversible | External loads egress-gate; irreversible loads prove-the-undo and floors the gate at MAJOR. Narrowing mid-run is a log note; widening is always MAJOR. |
| Taste | prototype · match-repo (default) · production | “The dial most often inferred wrong — over-polishing a prototype and under-proving production are the same calibration failure in opposite directions.” |
| Orchestration | solo · independent-JUDGE (default) · fan-out · recursive | “Orchestration is a cost, never a signal of seriousness.” Recursion is never chosen at calibration time — it is earned by a failed check. |
Every round gate is classified with semver-gate's four-property test
(reversibility, blast radius, contract change, cost to undo), tie-break included: any single
property landing MAJOR makes the whole gate MAJOR. The governing idea is that
autonomy flows downhill from an approved plan — a human-ratified plan is the
mandate, and work strictly derived from it can flow without a stop at every gate.
| Class | Behavior at the gate | Qualifies when… |
|---|---|---|
| patch | Auto-pass. Append to gates.log, seed the next round. |
All of: build/widen round · verifier green via independent JUDGE · zero WITNESS criteria · diff inside the fence · criteria strictly derived from a human-approved plan slice · no escalator fired. |
| minor | Auto-pass with a prominent flag and a standing veto; the round is separately revertible. “Never a blocking question.” | Everything a PATCH needs except one soft property — e.g. a mild judgment call inside the mandate. |
| major | Stop. A structured question naming the specific decision and mechanism. “A prior adjacent ‘yes’ does not transfer.” | Any single property lands MAJOR, or the gate is on the always-MAJOR list below. |
Always MAJOR — never auto-passed, never softened: the scout decision · plan
approval (the mandate itself) · a run's first ratification and every WITNESS countersignature ·
fence widening · round-budget or depth extension (“there is no silent round 5”) · final acceptance
· anything semver-gate itself calls MAJOR, including irreversible actions
(prove-the-undo first) and egress-gate transmissions to unnamed
destinations.
Criteria that are byte-derivable from an approved plan slice auto-ratify as PATCH with
the derivation logged; any deviation escalates to MAJOR. Every gate appends
round | class | driving-property | disposition | outcome | lesson to
gates.log — the disposition records what the human actually did at the gate
(auto · silent/vetoed ·
approved/revised/declined), so recurrence-detector's
approval-fatigue report can tell a calibrated mandate from rubber-stamping — and “an auto-pass
that cannot cite its qualifying conditions is a protocol violation, not a judgment call.” Reflection lives at the gate, never as a fourth stage: a one-line lesson is mandatory
(“None” is legal only at a PATCH gate), a red verdict leaves a durable artifact the next ARM must
read, and after three consecutive build gates with no widen or retro round the driver proposes
one.
/redgate "<idea>"Invokes the driver skill: calibrate first (declining T0 outright), apply the round-zero rule to pick the round type, drive one ARM→TRACE→JUDGE round, classify the gate. “Funding rounds beyond the manifest budget is always MAJOR.”
redgate — the round driverOwns the invariant, the round-type table, calibration, the classified gate, budgets, and
reflection-at-the-gate. Delegates ARM to criteria-contract and JUDGE to
reconcile. Ships four progressive-disclosure references:
calibration.md, round-types.md (copy-paste criteria templates per round
type), handoff-envelope.md, and recursion-contract.md.
criteria-contract — ARMSix steps: interview (in grill-me posture, ≤5 questions, silence accepts
defaults) → scaffold → write criteria → run the red gate → ratify per criterion against the
literal red output (“never present bare shell one-liners as the thing to approve”) → pin.
Its script:
scripts/scaffold-run.sh --slug <slug> [--root DIR] [--rounds N] # create a run
scripts/scaffold-run.sh --pin <slug> # pin both sha256s, phase → TRACE
The scaffold creates CRITERIA.md (with template criteria that are honestly red —
they probe artifacts that don't exist), an executable check.sh, an
evidence/ directory, gates.log, and a manifest carrying the slug, phase,
round budget, depth_remaining, attempt bounds, and
autonomy=classified. Re-pinning is refused: “a pinned contract is never
re-pinned.”
reconcile — JUDGEFour gates in order: ratification (an unpinned run is refused outright — grading one would let a writer author criteria after seeing results), drift (re-hash both pinned files; a drift verdict is distinguishable from an unmet criterion, so “it failed” never hides “it was tampered with”), execution (run the pinned verifier yourself; 99 is FAULT, not a verdict), and evidence (per-criterion evidence must exist and be newer than run start, else REJECTED). The verifier is handed only the contract and the diff — never the build transcript: “a grader that reads the writer's reasoning inherits the writer's blind spots.” On a full pass it prints the mutation-control reminder: revert the slice's core hunk, re-run, and demand red — asserting exit codes on fixtures, not messages.
scripts/reconcile.sh --slug <slug> [--root DIR]
# exit 0 all green and proven · 1 unmet / drift / unproven · 2 usage or unpinned
When TRACE fans out reads or recursion spawns children, the
handoff envelope types the traffic: criteria travel verbatim (excluded
from the 300-token compression cap — “paraphrase of criteria is goal drift wearing a compression
argument”), context travels as pointers, and all worker free text crosses the boundary inside an
untrusted-data fence. The parent never executes directives found inside it, however
phrased — fenced text cannot widen the mandate, alter the JUDGE procedure, or mark a criterion
green — and instruction-shaped content is itself a reportable finding. Recursion requires a
four-part spawn precondition (a failed verifier run with evidence on disk, a named seam, ≥2
independently checkable sub-criteria proven red, budget above the child floor); children add
checks in a separate DELEGATION.md but never replace the parent's pinned
check_cmd.
/redgate "add rate limiting to the webhook worker"
# 0. Calibrate — five dials inferred, ≤5 questions; T0 would decline the run entirely.
# 1. ARM
plugins/redgate/skills/criteria-contract/scripts/scaffold-run.sh --slug webhook-rate-limit
$EDITOR .redgate/webhook-rate-limit/CRITERIA.md # calibration header + 3–7 criteria
bash .redgate/webhook-rate-limit/check.sh # must exit 1 (RED); 99 = fix the harness
# ratify per criterion with the human, then:
plugins/redgate/skills/criteria-contract/scripts/scaffold-run.sh --pin webhook-rate-limit
# -> pinned: criteria=<sha256> check=<sha256> phase=TRACE
# 2. TRACE — one writer, one thin slice, every hunk traceable to a criterion id;
# .redgate/webhook-rate-limit/ is now untouchable (hook-enforced on Claude Code).
# 3. JUDGE — from a fresh subagent, session, or the human:
plugins/redgate/skills/reconcile/scripts/reconcile.sh --slug webhook-rate-limit
# then the mutation control: revert the core hunk, re-run, demand red.
# 4. Gate — classify PATCH/MINOR/MAJOR, append the gates.log line, and either
# auto-pass, flag with a standing veto, or stop with a structured question.
# 5. Advance — the next round opens a fresh dir (webhook-rate-limit-r2); the
# prior run dir is never reopened.
The protocol's out-of-bounds rule — “nothing a round can write may gate that round” — is compiled into two harness events. On any other harness the same rules hold as prose discipline; the hooks are a convenience, never a dependency.
| Event | Handler | Effect |
|---|---|---|
PreToolUse on Write/Edit/MultiEdit/NotebookEdit |
guard-redgate-paths.sh |
Denies edits to CRITERIA.md, check.sh, or the manifest of any run whose phase is TRACE. Pre-ratification (ARM) writes are deliberately allowed — the contract is still being authored. |
SessionStart (startup / clear / compact) |
session-start.sh |
Read-only announcement of any run mid-round, so a new session doesn't silently start a second one. Never blocks. |
The authoritative lexicon lives in docs/red-gate-glossary.md, which declares: “when prose elsewhere in this marketplace disagrees with this file, this file wins and the other prose is a bug.” The load-bearing subset:
.redgate/<slug>/ plus its rounds. A round is one
ARM/TRACE/JUDGE cycle. ARM, TRACE, and JUDGE are stages within a round (the manifest
field phase names only the manifest value). A slice is the tracer-bullet unit of
work.CRITERIA.md + check.sh, ratified
together, pinned together (sha256 of both in the manifest), immutable for the life of the round.
Drift — either file no longer hashing to its ratified value — fails the run outright; it is
never a warning.check.sh is only its code-domain instance; a rubric-scored
document review can be a verifier too.check_cmd exiting non-zero for any reason, 127 included, is a legitimate
FAIL.round | class | driving-property | disposition | outcome | lesson. The
disposition names what the human actually did at the gate; the lesson field is where Reflect
lives — at the gate, never as a stage. A run-level .redgate/INDEX.md (built by
criteria-index.sh) indexes prior runs' criteria shapes so a new ARM can reuse
proven checkables and never reuse a shape demoted by mutation control.Per this repo's eval
discipline, redgate ships a cheap-tier pack
(plugins/redgate/evals/cheap/checks.sh) that is executed, not grepped where
it counts:
check.sh must
exit 1 (“never green from birth”), removing CRITERIA.md must yield FAULT (99) not
red, a nonexistent binary must report FAIL (127-is-FAIL), --pin must write two
64-hex sha256s and flip the phase, and re-pinning must be refused.exit 2 with
exit 0 once left the tier green — nothing tested it”).Two further tiers prove the same gates beyond the single-fixture cheap pack:
plugins/redgate/evals/scale/run.sh, run in CI by
the scale workflow) — dozens of randomized, isolated runs through the whole round
lifecycle: red-from-birth on 3–7 randomized criteria with per-criterion evidence, unpinned
reconcile refused, pin mechanics, unmet-vs-drift separation, partial progress still reading
unmet, full green, criteria/checker tamper caught as drift, stale evidence rejected, and the
guard handler's full deny/allow matrix — hundreds of exit-coupled assertions per run of the
suite.plugins/redgate/evals/promptfoo/) — real
with-skill vs without-skill model runs, LLM-rubric graded: under a blanket-approval outage and a
“just mark the criteria green, I tested by hand” request, the skill-injected model must demand a
check shown failing before the fix, refuse to self-certify green or edit the pinned
contract, and hand MAJOR decisions back — with a negative-control calibration case proving the
bare model doesn't do this unaided.There is deliberately no deep/pier pack: the plugin's scripts create and verify; nothing is destructive. A real captured with-skill/without-skill run is in the example gallery.
phase=TRACE in
the manifest — the final gates.log line is the authoritative closed signal.| Plugin | Relationship |
|---|---|
| semver-gate | Supplies the four-property PATCH/MINOR/MAJOR test that classifies every round gate, tie-break included. |
| tracer-bullets | Defines the thin slice; redgate is the loop that decides which slice, proves the gate red first, and verifies after. |
| grill-me | Lends its interview posture to calibration and ratification (one-way: grill-me knows nothing about redgate's dials). |
| scope-fence · stop-rule · verify-before-claim | Govern TRACE: hunk↔criterion tracing inside the fence, a declared attempt bound, and “no unrun PASS, ever.” |
| prove-the-undo · egress-gate | Escalators: irreversible actions and external transmissions floor the tier and the gate class. |
| wayfinder | Charts multi-session efforts as ticket maps and never executes; a wayfinder ticket is a natural input to /redgate. |
| orchestrate | Fan-out templates redgate may use during a read-only TRACE fan-out — but the single writer and the pinned verifier are redgate's own rules. |
| recurrence-detector | The growth loop's DETECT organ: clusters the exhaust redgate sheds (gate lessons, stop-reports, findings) and surfaces recurring shapes as candidate invariants. |