gate-pr
Skill2 starsChanged 46 days agoMITView on GitHub
Run the independent review gates on an existing PR and merge it only after code-review, required security review, configured verification, and CI are green. Use when the user asks to gate a PR, review and merge a PR through the orchestration pipeline, run merge-on-green, or run the equivalent of the Claude /gate command.
In this repository7 other files it gives its agents.
- orchestrate-sprintSkill
- orchestrate-ticketSkill
- orchestration-initSkill
- orchestration-reportSkill
- recover-agent-workSkill
- release-integrationSkill
- scope-ticketSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 8
Run the review gates on one existing PR and merge it only after every required gate is green.
- Very specific: line 45
Before each code-reviewer or security-reviewer pass, resolve its route with scripts/context_pipeline.py route --config …
- Very specific: line 83
Read .orchestration/config.yaml and run orchestration-engine.py validate-config.
- Very specific: line 89
Keep the configured worker_trust_profile fixed for every reviewer.
- Very specific: line 103
If the PR head moved for a non-findings change after the current generation completed, first run review-ledger.py rebind-generation <pr> …
- Very specific: line 127
Before launching the pair, read the authoritative PR headRefName and baseRefName from GitHub, save the raw base-to-head unified diff to a …
- Distinctive: line 145
Wait for both launched reviewers, then record every completed gate through the ledger, blocking and advisory findings alike:
- Very specific: line 177
STOP: do not merge and do not run another round.
≈ “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
Gate a PR through merge-on-green
Run the review gates on one existing PR and merge it only after every required
gate is green. This is the natural-language entry point for Codex and the same
workflow as the Claude Code /gate command.
Plugin paths
The role briefs and scripts below live in this plugin, not necessarily in the target repository. Resolve these paths from this skill file before executing or reading them:
../../agents/orchestration-code-reviewer.md../../agents/orchestration-design-reviewer.md../../agents/orchestration-implementer.md../../agents/orchestration-security-reviewer.md../../scripts/context_pipeline.py../../scripts/api_agent.py../../scripts/merge-guard.sh../../scripts/merge-on-green.sh../../scripts/orchestration-engine.py../../scripts/review-ledger.py../../scripts/run-gates.sh../../scripts/run-verification.sh../../scripts/version_policy.py
Execute scripts by absolute path while keeping the target repository as the working directory.
Procedure
- Validate the active runtime against repository policy before opening or
resuming a review:
version_policy.py --plugin-root <resolved-plugin-root> --config .orchestration/config.yaml. Stop fail-closed unless it reportsstatus: compatible.review-ledger.py permit-reviewandmerge-guard.shrepeat this check mechanically, so an older runtime cannot mint review authority or record/assert merge evidence.
Before each code-reviewer or security-reviewer pass, resolve its route with
scripts/context_pipeline.py route --config .orchestration/config.yaml --role
<role>. Desktop routes use fresh native agents. API routes build their request
with context_pipeline.py payload --config ... --role <role> and use the
api_agent.py run --request - adapter with the ticket and a stable run id.
Give API reviewers exact-head CI results with payload --ci-evidence <gh api
"repos/{owner}/{repo}/commits/<full-exact-head>/check-runs" output>
--review-head <full-exact-head> (or --fetch-ci-evidence --review-head ...)
so a CI-only check can be ci_verified instead of not_run.
First issue a phase permit from the durable ledger with review-ledger.py
permit-review <pr> --role <role> --head <full-exact-head>;
pass it to run --review-pr <pr> --review-authorization <token>. The ledger
issues it only while that gate is the permitted next phase, and it cannot be
reused. This is sequencing, not human authentication.
Desktop fallback is allowed only before provider
acknowledgement; submitted, timed-out, or uncertain work must be reconciled
instead of duplicated. If permit-review reports a started review, reconcile
that run with api_agent.py reconcile --run-id <run>, which also cancels its
permit; if the permit is still started afterwards, run review-ledger.py
cancel-permit <pr> --phase-permit <token> --reason <text>. Either way the
review re-runs under a new permit; no PASS is ever inferred.
For a native desktop reviewer, write its final structured JSON first, then run
review-ledger.py complete-review <pr> --role <role>
--phase-permit <token> --result <file>. complete-review is for desktop
reviewers only: API execution creates the same completion receipt after
successful provider output, so an API run goes straight to record with its
token. Repeating complete-review with the identical result returns the
existing receipt with already_completed: true; a different result is refused.
complete-review refuses a permit an API run already started; recover it
with api_agent.py reconcile instead.
permit-review binds the local git rev-parse HEAD, because reviewers and
receipts read the local tree. When the current checkout is not at the exact PR
head, do not move it: git worktree add --detach <review-path>
<full-exact-head>, run permit-review, the reviewers, complete-review, and
record from <review-path>, then git worktree remove <review-path>. Linked
worktrees resolve the same shared review ledger and canonical config.
- Read
.orchestration/config.yamland runorchestration-engine.py validate-config. Forschema_version: 2, useorchestration-engine.py adapter-plan --host codex <transition>for the configured gate or merge transition; branch roles, evidence, approvals, CI categories, and adapters come from that plan. For legacy configs, continue with the existing review gates below. Keep the configuredworker_trust_profilefixed for every reviewer. It governs only worker-versus-host assumptions and never relaxes application, tenant, client, ticket-input, or provider security. - Open the durable review ledger and build this round's brief:
review-ledger.py open <pr>thenreview-ledger.py brief <pr>. The failure ledger lives on disk, not in this conversation -- it survives compaction, normalizes component keys so a repeated defect actually accumulates strikes, and decides when the loop stops. Paste thebriefoutput verbatim into every reviewer pass this round. A round is the ledger's shared review generation for one exact head, never the arrival order of individual gate responses. It carries the round number, the scope mode, the round-aware uncertainty rule, and the open component keys to reuse. Without it a reviewer assumes round 1 and reviews with full blocking authority. If the PR head moved for a non-findings change after the current generation completed, first runreview-ledger.py rebind-generation <pr> --head <full-exact-head> --reason "<auditable reason>". This starts a fresh review generation while preserving history, findings, strikes, and repair-cycle accounting. It is valid only when the prior generation is complete and has no open blocker or outstanding permit. Never use it instead ofrecord-repairfor a findings repair. - Launch the code-review gate and any required security-review gate concurrently
against the same exact PR head, raw diff, and round brief. Do not let one
reviewer's findings contaminate the other's independent pass. Run code review
as a fresh pass. If the host supports
subagents, launch one with
orchestration-code-reviewer.md; otherwise apply that brief yourself without using the implementer's reasoning as evidence. Generate and pass the raw unified base-to-head git diff as the default and authoritative code input, alongside only the ticket, configured rules docs, stable repository map, and round brief. Do not pass a full-codebase index; additional source is allowed only for a named verification or regression. The reviewer must finish the full checklist, diff, and adversarial matrix even after finding a blocker, then return only concise structured review JSON. Explanations belong only to findings; each finding has a stable component key. A blocker must name a concrete failing input/precondition, production path, wrong outcome/impact, and reproduction or exact falsifying assertion under the selected profile. Do not let a reviewer expand the PR into new host infrastructure based only on a stronger, unconfigured threat model. - Before launching the pair, read the authoritative PR
headRefNameandbaseRefNamefrom GitHub, save the raw base-to-head unified diff to a file, and runorchestration-engine.py security-gate --source-branch <headRefName> --target-branch <baseRefName> --diff-file <raw-diff-file>. This shared decision evaluatessecurity_required_when,security_required_source_branches, andsecurity_required_target_branches. Save its JSON output and bind it to the generation withreview-ledger.py record-security-gate <pr> --head <full-exact-head> --decision <security-gate-output.json>. The ledger requires every configuredgates:entry; a configuredsecurity-reviewis waived only by a recordedrequired: falsedecision for this generation's exact head, and stays required when none is recorded. Record a new decision after everyrecord-repairorrebind-generation. Ifrequiredis true, run a fresh security-review pass usingorchestration-security-reviewer.mdwith the same raw unified diff and diff-isolated context. If it is false, record the decision and skip. If metadata, diff capture, configuration validation, or the decision command fails, stop fail-closed; never infer that security is optional. - Wait for both launched reviewers, then record every completed gate through the
ledger, blocking and advisory findings
alike:
review-ledger.py record <pr> --gate code-review --result .orchestration/.review-results/code-review.json --head <exact-sha> --phase-permit <token>(plus--ci-evidence <exact-head file>when it has aci_verifiedcheck). The validated JSON carries disposition, severity, regression, and explanation. Both concurrent results retain the same generation and scope mode regardless of which is recorded first. A partial generation cannot returngates-clear; every issued gate must be recorded. The ledger increments strikes, auto-resolves components this gate no longer reports, demotes out-of-scope new findings in a frozen round, and returnsnext_action. Itseffective_verdictgoverns, not the claimed one. - Act on
next_action. Never merge while a blocking component is open.review-- runreview-ledger.py repair-brief <pr>once after all gates record. Give that single deduplicated brief to one fresh implementer on the same branch. The implementer must map every stable finding ID to root cause, planned change, affected boundaries, objective closure condition, and named verification before editing. After editing it writes the strict repair JSON named by the brief; record it withreview-ledger.py record-repair <pr> --report <file>; it stores the full commit id git resolves from the report head. Record that head'srecord-security-gatedecision. A claimed closure is not proof. Re-run code and required security reviewers concurrently against that exact repaired head, record both withrecord ... --head <exact-sha>, then callreview-ledger.py complete-repair-review <pr>. Advisory findings go to the PR body and never widen the repair.redesign-- an agreed finding survived a completed repair. Runorchestration-design-reviewer.mdscoped to the named component against the root design and a revised adversarial matrix; no further implementation starts until it returnsVERDICT: PASS, then recordreview-ledger.py redesign <pr> --key <key> --verdict PASS.escalate-human-- the repair cap is spent with blocking findings still open. STOP: do not merge and do not run another round. Give the userreview-ledger.py handoff <pr>with the PR link. A component that survives two evidenced repairs needs human diagnosis, not another autonomous patch.gates-clear-- necessary, not sufficient. Confirm the security gate actually ran if the diff triggers it, then continue.
- For each configured
verification:entry whosewhen:applies to the target, runrun-verification.sh <name>. A GREEN result file is required; RED or a missing result file blocks the merge. - Confirm every required configured target CI check is green.
- Carry the ledger's advisory findings into the PR body as follow-ups, then
record the all-green marker with
merge-guard.sh --record-green <pr> [result_file], then merge withmerge-on-green.sh <pr> <branch> all-green <verify_path>. The merge script itself revalidates the active plugin version, exact PR head branch/sha, exact target base branch/sha, and marker freshness; never treat host hook registration as required evidence.
Report each gate verdict, the round number and scope mode, any blocking findings, the advisory findings carried to the PR body, verification result paths, CI status, and the merge result. CI-green alone is not the gate; the independent verdicts are mandatory.
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.

