GeezerVison is showing agnts.elkodr.com — Review Gate
Review Gate
The Review Gate is the final checkpoint before a commit leaves your machine
(push / PR / merge) - not merely before the first local commit. It has two tiers: a
deterministic automated harness (Tier 1) and a risk-gated, multi-lens adversarial
review (Tier 2).
The gate has three entry points: a plan review (@planner, read-only, before a plan
is presented; record the verdict or a stated skip reason), a pre-report review for
changes that ship to installed users (permissions, agents, skills: run the panel before
reporting the change as applied), and the pre-commit gate below. A plan review that
still has blocking findings after one revision goes to the user with options; it never
proceeds silently.
The pre-report review exists because a permissions or agent change cannot be un-shipped by a
later commit: reviewing only at commit means the change is already presented as done, and its
blast radius (every installed project) went unexamined.
This page is the canonical full spec. The orchestrator loads a compact flow
summary from Pattern 8 in
.opencode/instructions/orchestrator-reference.instructions.md, which points here.
Risk-gated: required for agent, skill, instruction, CI, security, or feature
changes, or more than two staged entries. Optional otherwise for diffs the gate
classifies as trivial (at most two staged entries, no risk path, no gitlink) -
typically comment-only or docs-only edits; site/ docs are non-trivial.
The diff is frozen to a patch file. The canonical freeze is npm run gate:freeze, which writes
the staged snapshot to .gate/diff.patch plus .gate/manifest.json. A non-trivial diff also
requires .gate/plan.md, written when the plan is approved. The plan must carry acceptance
criteria and executable checks, and gate:freeze hashes it into the manifest:
## Acceptance
- the endpoint returns 200 for a valid token
- an audit row is written for every attempt
## Checks
- run: npm test
- expect: exit 0
Freeze refuses a non-trivial diff with no plan, a plan with no ## Acceptance criteria, or a
plan with no matching - run: / - expect: pairs. ## Acceptance criteria is accepted as the
same heading. To freeze by hand:
Terminal window
gitadd-N. && gitdiffHEAD>.gate/review.patch# staged + unstaged, new files included
Every lens brief names the patch path it must read; lenses read that file directly, since they
are not assumed to have shell access. If the named file is missing or empty, @review falls
back to .gate/diff.patch, then .gate/review.patch, and reads no other source. Then one
fresh @review subagent runs per lens, concurrently. Each lens receives only the frozen diff,
the plan, and its lens brief - never the implementation reasoning.
Each lens records hash-bound evidence before the gate can pass:
Terminal window
npmrungate:lens----namecode--verdictPASS--findings3# repeat per lens
gate:lens copies stagedHash from .gate/manifest.json. gate:pass refuses stale,
malformed, or mislabelled evidence, any lens that recorded FAIL, and a non-trivial
panel that names a lens with no evidence file — a lens name alone is not a review. The
pre-commit hook re-applies the same rule through evaluateMarker, so a hand-written
marker must also carry a stagedHash per lens.
--lenses accepts only requirements, code, security, ux-responsive,
architecture, and ponytail.
A non-trivial diff must include requirements, or record why it does not apply:
vulnerabilities, secrets, PII, authn/authz, dependency and license risk (load security-audit)
ux-responsive
UI / markup changes
accessibility, responsive logic, input modes, loading/empty/error states (load ux-responsive)
architecture
a new module, layer, dependency, or abstraction
reuse of an existing capability, boundary and layer fit, responsibility and state placement (Feature Envy, Shotgun Surgery, Divergent Change, Middle Man)
ponytail
the diff adds files, options, or abstractions
Speculative Generality and the deletion test — what the change should delete, inline, or not build
Precondition for the requirements lens: the plan states concrete acceptance criteria
(## Acceptance). gate:freeze refuses a non-trivial diff whose plan has none, so the
lens always has a spec to judge against. A plan with no criteria is not softened — it is
not freezable.
Classify each finding: critical / high / medium / low. Dedupe across lenses by
file:line + finding. Lens-reported severity is authoritative - the orchestrator
may escalate but never downgrade it.
Apply objective, low-risk findings directly (style, minor perf, clarity).
Declined blocking findings (critical, or any security / data-loss /
requirement-miss at any severity) go to a user decision panel - the
orchestrator has no veto over them, and dedupe must never drop a security/data-loss tag.
Declined non-critical findings go to a rationale table for the user.
A finding that would remove something the plan requires must cite it. The
architecture and ponytail lenses judge the change against “should this exist at all”,
which can collide with an approved criterion. Such a finding carries
Conflicts-with: criterion-X (or Conflicts-with: none) in its evidence line:
Conflicts-with: criterion-X — the conflict blocks the commit and becomes a user
decision; the lens cannot veto an approved requirement on its own.
Conflicts-with: none — the finding stands on ordinary severity rules.
No Conflicts-with: line at all — recorded as a suggestion, never blocking.
The requirement wins by default; the plan is the spec both were written from.
A cycle is one review pass: the initial panel is cycle 1, and a scoped delta
re-review of the fixes is cycle 2.
Maximum 2 cycles per gate (initial panel plus at most one delta re-review).
Binding task budget: 8 pre-commit reviewer dispatches per task (a full panel = 4;
delta re-reviews dispatch only the affected lenses), plus up to 2 plan-review
dispatches (initial plan review + one re-review). It supersedes per-loop caps.
A lens that exhausts its step budget returns PARTIAL, and a lens with no readable patch
returns INSUFFICIENT_DIFF. Neither is a verdict: re-freeze the patch if it is missing, then
re-dispatch the affected lens (it counts against the dispatch budget). Never accept either as PASS.
Background lens runs must be collected and triaged before the next user turn - never leave
a review in flight across a handoff.
Gate cycles are a sub-loop inside the outer execution loop and do not multiply the
5-cycle or Pattern 5 budgets.
The gate runs once per push (or per tracked-branch commit), not once per implementation chunk.
A WIP commit may be used only to freeze the snapshot; after findings, amend/fixup or
add a follow-up fix commit before pushing - never push an ungated commit.
On exhaustion, escalate to the human with structured options.
Skip criteria (any one): trivial (at most two staged entries, no risk path,
no gitlink - typically a one-line or comment-only change; the risk-path list
below is authoritative, so a one-line docs edit under site/ is not trivial), a
pre-existing pre-commit pass, Planning Mode for the pre-commit entry point, or an
explicit user opt-out. The plan review skips only for a trivial plan (one phase, no new
files, no interface or schema change), with the reason recorded in the plan’s ### Inputs
or under ## Plan review in .gate/plan.md.
Edge cases:
Baseline pollution - only new failures block; compare against the branch point.
Chicken-and-egg - for validation-infra changes, establish the baseline first.
Offline / degraded - warn and proceed; for security-surface changes, escalate.
Reviewer unavailability - escalate to the human.
Self-referential changes - escalate to the human and exempt from REQUIRED.
Idempotency - cache per diff; skip re-running on rebase.
Mid-cycle diff changes - restart the gate.
Cascading Tier 2 to Tier 1 failures - same cycle, not a new one.
Concurrent-lens drift - all lenses share one frozen snapshot; restart if it changes.
Committed before gating - treat branch-tip vs base as the frozen snapshot and
remediate via amend/fixup before pushing.
gate:pass requires an explicit --verdict PASS or --verdict PASS-WITH-CAVEATS —
there is no default. Keep the -- before the flags: npm run gate:pass --verdict PASS
lets npm swallow --verdict, and the command now fails with a usage error instead of
silently recording PASS.
A risk path is any staged path under scripts/, .opencode/, .github/, .githooks/,
site/, evals/, or adapters/; the root files install.js, package.json,
opencode.json, AGENTS.md, .gitleaks.toml, .gitmodules, or .npmrc; any
package-lock.json; or a staged gitlink (its referenced content is not reviewable
from the superproject diff).
For a trivial diff (≤2 entries, no risk paths, and no gitlinks), npm run gate:quick chains
gate:freeze → npm run doctor → gate:pass --verdict=PASS in one step. It records
no lenses; a non-trivial diff is refused and pointed at the Tier 2 panel flow.
The hook allows a commit only when .gate/pass.json carries a pass verdict whose
stagedHash matches the staged tree. The post-commit hook consumes the marker
once the commit object exists — an aborted commit (GPG signing failure, editor abort,
hook crash) keeps the approval for a retry, and any successful git commit (including
--no-verify and empty commits) uses it up. Empty commits (a staged tree identical
to HEAD) are exempt and need no marker. gate:pass also requires
.gate/manifest.json and refuses if the index moved after gate:freeze, so a pass
binds only to the snapshot the lenses reviewed.
The lens requirement is enforced at the tooling layer (diff classification and
lens cardinality); lens names remain self-reported, like the verdict itself. A
non-trivial diff must record at least 2 distinct lenses. Non-trivial means any
risk path (list above) or more than 2 staged entries. Path matching is
case-insensitive, a rename counts both sides, and duplicate lens names count once.
gate:pass refuses to
write the marker below that, and the hook re-checks the recorded count against the same
rule. A trivial diff (≤2 entries, no risk paths, and no gitlinks) may record a Tier 1 pass with no
lenses. A marker written before this rule (no lens list) counts as zero lenses.
SKIP_GATE=1 is a per-command bootstrap/emergency escape hatch - prefix the
single command (SKIP_GATE=1 git commit ...). Do not export it in a shell
profile or CI job; that would disable the gate for every command.
The pre-commit hook is a local workflow guardrail, not a security boundary:
.gate/pass.json is an unsigned, plain-text marker - it can be forged.
git commit --no-verify bypasses the pre-commit check entirely.
Non-fast-forward git merge (the pre-merge-commit hook) is outside the
pre-commit hook’s scope.
If the versioned post-commit hook is missing or inert, or the commit is created
by git merge (which runs post-merge, not post-commit), a pending marker can
linger; the marker binds the staged tree (not a diff against a base), so once
HEAD has moved it could re-approve the same tree. Normally, any successful
git commit — including --no-verify and empty commits — consumes a pending
marker.
It exists for honest-operator discipline, not to stop a motivated bypass. Commits
made with --no-verify, or merges that produce a merge commit, must be gated
manually before they reach a shared branch.
You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.