How it works β
MergeJudge answers one question for every pull request: can this merge on its own, does a human need to look, or should it stop? Those are the three lanes: π’ auto, π‘ review and π΄ block.
A pull request is opened or updated
Nothing to set up per PR. MergeJudge reacts to the GitHub event.
GitHub sends a webhook to the Worker
The MergeJudge GitHub App notifies the Cloudflare Worker. The Worker checks the signature, queues a job and answers right away.
The rules floor runs first
Deterministic rules (protected paths, secrets, safety guards) set the minimum lane. No model is involved yet. Two opt-in checks, both off by default, can only raise it: a PR description check (sections such as Testing, Risk and How to revert) and trusted authors (only the GitHub users you list can get small code changes into auto).
AI review: hosted with your key, or your own runner
The AI reads the change for real bugs, security holes and broken logic, and follows your repo's review guide (REVIEW_POLICY.md, AGENTS.md or CLAUDE.md). In context or deep mode it also reads the surrounding code: full files, imports and callers. It checks your rubric too, and a failed criterion only counts if it quotes a line from the diff. What your reviewers taught it, such as known false alarms, keeps repeat noise down. It runs on the hosted service with your own provider key, or in the open-source runner on your machine (connected to the hosted service with an enrollment code) with your own Claude Code, Codex or GLM login. In deep-local mode the runner reads your local clone. The AI can only raise the lane (one opt-in exception for small code changes).
One result, and MergeJudge doesn't merge it
A lane check (auto, review or block), a sticky summary comment and a capped number of inline comments. Merging stays with you. For runner reviews, the diff and code snippets sent to your runner are removed once the review is done (a daily sweep catches the rest), and job records are deleted after 90 days. In deep-local mode the AI step and code index run on your machine; our servers still read the PR diff from GitHub for the rule checks and don't store it.
Learning, with a human in charge
Reviewer feedback is recorded, and on the hosted App so are merges over a lane, reverts and follow-up fixes. Findings your reviewers dismiss stop coming back. A scheduled proposal PR suggests stricter protected paths and clearer rubric notes for a human to merge. Learning never lowers a lane.
The same steps, in words β
- A pull request is opened or updated. Nothing to do on your side.
- GitHub sends a webhook from the MergeJudge GitHub App to the Cloudflare Worker. The Worker checks the signature (
X-Hub-Signature-256), puts a small job on a queue and answers right away. - The rules floor runs first. Deterministic rules (protected paths, secrets, safety guards, file types) set the minimum lane. No model is involved.
- AI review. The AI reads the change for real bugs, security holes and broken logic, following your policy files (for example
REVIEW_POLICY.md), and in context or deep mode the surrounding code. It also scores your rubric, and learned false alarms keep repeat noise down. It runs either on the hosted service with your own provider key, or on your own runner on your machine (it connects to the hosted service with an enrollment code): it polls the Worker and uses your own Claude Code, Codex or GLM login. The AI can only raise the lane, never lower it (one opt-in exception:lanes.code_auto). Where your code goes is described in Privacy and your code. - Result. One lane check (
mergejudge/lane), a sticky summary comment and inline comments on diff lines (at most 20 findings per review). MergeJudge doesn't merge PRs itself; withapproval.mode: auto-merge-onlyit asks GitHub to auto-merge auto-lane PRs (approvals). - Learning. Reviewer feedback is recorded. On the hosted App, merges over a lane, reverts and follow-up fixes are recorded too. A scheduled proposal PR suggests config changes for a human to merge. See how learning works.
How learning works β
MergeJudge learns from what your team does with its reviews. It uses that to cut repeat noise and to suggest stricter config. It never changes a lane, and it never changes your config on its own.
Your reactions to findings are recorded. A π, a reply such as "false positive" or "by design", or resolving a thread without changing the code marks a finding as a false alarm. A π, or resolving it after the code there changed, marks it as useful. Only people with write access to the repo count. Merges over a lane, and reverts or quick fixes after an auto-lane merge, are recorded too (hosted App). Merges over a lane and label changes count only from humans; reverts and linked fixes count from anyone, including bots and coding agents.
Dismissed findings stop coming back. When a finding that was dismissed before shows up again, it moves out of the inline comments into the summary after two dismissals, and is hidden after three. Confirmations count against this, so a finding people found useful keeps showing. Findings on files laned
blockare never hidden.Your notes guide the next reviews. Tick a feedback box on the summary comment (Correct, Too lenient, Too strict, Wrong reason, Missed something; each rubric item has a
wrongand arightbox) or comment/mergejudge learn <note>. The latest notes go to the AI with the next reviews (hosted App and runner; the Action uses notes only for proposal PRs), as background it may not use to relax any rule. They are stored on themergejudge-learningbranch, never in your PR.A scheduled proposal PR. On a schedule (Mondays 11:00 CEST on the hosted service, and each time the lesson count reaches
propose_after), MergeJudge looks at what it has recorded and opens one proposal PR. With strong evidence it edits.mergejudge.ymlin two ways only:- a stricter protected path, after auto-lane PRs in one folder were reverted or quickly fixed at least twice;
- a clearer rubric note on an existing check that people keep marking as too strict or a false alarm (at least 3 PRs and 2 different people): "fail it only with a concrete defect quoted from the changed lines". Security checks never get one.
With too little evidence the PR is report-only: it adds a
MERGEJUDGE_LEARNING_PROPOSAL.mdfile and changes no config. The PR is labelleddo-not-mergeandneeds-human, and MergeJudge lanes itblock. It never approves or merges it, so nothing changes until a human merges it.Learning never lowers a lane. Lanes come from the rules, the AI review and the rubric. Learning only changes how many repeat comments you see, and config only changes when a human merges a proposal.
Learning starts when MergeJudge is installed. Older pull request history is not read. Details: learning loop.
The review rubric β
Every review is the same few checks, in the same order. Some are deterministic rules, some are model answers. The rules set a floor; everything else can only push the lane up.
| Check | What it looks at | Effect on the lane |
|---|---|---|
| Protected paths | Files matching lanes.protected (default: .github/**, deploy/**, **/auth/**, **/migrations/**, wrangler.toml, _headers, **/.env*) | at least review |
| Secrets | Added lines that look like an AWS access key, a private key block, a GitHub token or a hard-coded api_key = "β¦" | block |
| Safety guards | A protected-path change that removes --match-head-commit, persist-credentials: false, set -e or --frozen-lockfile / npm ci | block |
| File type | Source files (by extension), dependency manifests and lockfiles, files with no diff or over 5000 changed lines, and anything outside the auto paths | review |
| Auto paths | Docs, markdown, CSS and public/** (default), up to 200 changed lines | stays auto |
| Labels | do-not-merge and needs-review (names are configurable) | block / at least review |
| AI review | Real bugs, security and logic issues in the diff (plus surrounding code, depending on the review mode), guided by your policy files | can raise a file to review or block |
| Rubric | Yes/no criteria, each with an id and a severity. A high-severity failure only counts if the model quotes a line that really is in the diff | review, or block for criteria that say so |
| Opt-in: security review | review.security: true or the panel switch: five attack-class criteria (sec.audit.injection, sec.audit.authz, sec.audit.secrets-crypto, sec.audit.callbacks, sec.audit.ai-tools) for trust-boundary breaks (rubrics) | review on a confirmed diff quote; unquoted suspicions are listed as β needs validation (and keep lanes.code_auto off), only when switched on |
| Opt-in: PR description | pr_template: the description must answer the sections you list | review (or block), only when switched on |
| Opt-in: trusted authors | lanes.trusted_authors: only listed GitHub logins get the light auto paths | takes auto away, only when switched on |
| Opt-in: lane-choice map (test-build) | review.lane_map: true: the sticky's collapsed Files section adds folder bucket counts (auto/review/block) on PRs over 15 files, plus an optional GIF/panel link when the host provides one. Default off; the sticky alone is enough to understand the lane | explanatory only β does not change the PR lane |
How the final lane is chosen β
- Each file gets its own lane from the rules, then the AI and the rubric may raise it.
- The PR lane is the strictest of all its files and labels. One
blockfile makes the whole PRblock. - Nothing lowers a lane (apart from the opt-in code auto exception below). If the model call fails or its answer can't be read after a retry, MergeJudge uses the rules alone and says so in the comment.
- Your config is read from the PR's base branch, never from the PR's own changes. Changing
.mergejudge.ymlin a PR has no effect on how that PR is judged. - Policy files are guidance.
REVIEW_POLICY.md,REVIEW.md,APPROVAL_POLICY.md,AGENTS.mdandCLAUDE.mdfrom the PR's base branch are given to the model as instructions. See what a good REVIEW_POLICY.md looks like. - Approvals follow the lane. Optionally MergeJudge approves auto-lane PRs as its own app and you can require human approvers per lane; if a later push raises the lane, its approval is withdrawn (approvals).
What a rubric is β
A rubric is a list of yes/no questions a reviewer should ask. Each question is a criterion with an id, a severity (low, medium or high) and a scoring style: pass/fail, or a 1β5 score where 1β2 counts as a fail. Criteria are grouped into packs:
| Pack | On by default | Criteria (severity) |
|---|---|---|
security | yes | sec.no-secrets (high, raises to block), sec.no-exfiltration (high, block), sec.no-unsafe-exec (high), sec.input-handling (medium) |
correctness | yes | cor.logic (high), cor.errors (medium), cor.tests (low, 1β5) |
maintainability | no (opt-in) | mnt.readable (low, 1β5), mnt.scoped (low) |
The model answers each criterion with pass, fail or n/a, with a short reason. For a fail it also gives the file, the line and a quote. MergeJudge checks that the quote really appears in that file's diff. A fail without a matching quote is shown as unverified and does not change the lane.
Only a failed high-severity criterion raises the lane, to its raise_to (review by default). Low and medium failures are reported in the comment but never change the lane. You can switch packs on and off and add your own criteria in .mergejudge.yml: see rubric packs.
The model's findings are line comments with a line number, a short message and a quote of that diff line. MergeJudge posts a finding inline only when the quote verifies against the pull request diff. Findings without a verifiable quote are listed in the sticky summary under What to check, marked "needs a human check", and are not posted as line comments. They do not carry a severity of their own; severity belongs to rubric criteria. The sticky summary also says that review is advisory (mergejudge/lane concludes neutral) and only block fails the check β require mergejudge/lane in branch protection or rulesets so block actually stops merges. See stop AI agents merging their own pull requests.
What can never be auto β
These are enforced by code, not by the model:
- Protected paths (the list above) are at least review, and
_headersfiles (which set security headers such as CSP and caching) always need at least review, even if you remove them from your protected list. - Possible secrets in added lines are block. Obvious fakes (documentation keys,
EXAMPLE,PLACEHOLDER,DUMMY,FAKE,XXXX, repeated characters) are noted but not blocked. This is a coarse screen, not a secret scanner. - Removing a safety guard from a protected path is block.
- Source files (
.js,.ts,.py,.go,.sql,.shand many more) are review, unless you switch onlanes.code_auto. - Dependency manifests and lockfiles (
package.json,package-lock.json,go.modand similar) are review. - Files with no diff (binary or very large) and changes over 5000 lines are review.
- Anything outside your auto paths, and auto-path files over
max_auto_lines(200), are review. - Learning proposal PRs (head
mergejudge/proposal-*) and themergejudge-learningbranch are always block. - Hold labels force block (
do-not-merge) or at least review (needs-review).
Low-risk code auto (opt-in) β
lanes.code_auto is off by default: code files always need review. If you turn it on, a code file can only become auto when all of this holds:
- the rules found nothing else wrong with it (not protected, not a dependency file) and it was added or modified (not deleted or renamed);
- it is not a CI/workflow,
.env,_headers, shell, SQL or wasm file (those are never eligible); - it matches
lanes.code_auto.paths(if you set any), has at mostmax_lineschanged lines (default 30), and the candidate files together have at mostmax_total_lines(default 100); - the AI says
autofor that file with a reason, and reports no findings on it; - if rubrics are on with at least one pack or custom criterion (the default), the rubric was scored; and no criterion in the whole PR failed or came back unverified;
- the author is trusted, if you use
lanes.trusted_authors.
Any doubt means review. This is the one place an AI answer can bring a file down to auto.
PR description and trusted authors (opt-in) β
Both are off by default and both are raise-only. Details: PR template and trusted authors.
pr_templatechecks the PR description for the sections you list (defaultTesting,Risk,How to revert, with at least 15 characters of real text each; comments, placeholders and checkbox-only lines do not count). By default it only checks PRs made by coding agents (marked with themergejudge:agentlabel or aMergeJudge-Actor: agentline);apply_to: allchecks every PR. A missing section raises the PR toreview(orblock, if you setmissing_lane: block).lanes.trusted_authorslimits the light auto paths to GitHub logins you list. The author comes from GitHub, so a PR cannot fake it. With the defaultapplies_to: code_autoit only affectslanes.code_autocandidates: an untrusted author's code file stays at review. Withapplies_to: all_auto, docs/style auto-path files go to review too. Bots are untrusted unless listed. Agent-marked PRs are judged by the author's login (agents: as_author, default) or never trusted (agents: untrusted). It can only take auto away.
Privacy and your code β
When AI review is on, your code is sent to your own AI provider under your own account. What MergeJudge's servers see depends on the mode:
- Deep-local (
review.mode: deepwithrunner.code_source: local): the AI review runs on your machine with your own login and reads your local clone. The AI step and code index run on your machine. Our servers still read the pull request diff from GitHub to run the rule checks, and don't store it. They keep the review result (lane, reasons, summary, findings). It needs a runner that supports it (0.4.0+); without one, the hosted service builds the deep context itself and sends it to your runner through the job queue (next item). - Runner reviews in
diff,contextor worker-builtdeep: the diff, policy files and snippets pass through the job queue, are removed when the review finishes (a daily sweep removes anything missed), and finished job rows are deleted after 90 days. - Hosted reviews with your key: processed in memory, not stored. The AI result is cached for 7 days.
- Related files: in context and deep mode, MergeJudge may read other files in your repository that use the changed code or that it imports, found with a few GitHub code searches per review (up to 3 by default in context mode, up to 4 when deep mode builds its temporary index). They are used only for that review, not kept afterwards, and the relevant parts go to the AI provider you chose or to your runner.
More in Run reviews on your own machine.
What you get β
- A floor the AI can't lower. The Worker re-applies the rules floor, labels and any opt-in PR checks to every runner result before posting, so an old or modified runner can't lower a lane.
- Config from the base branch. One
.mergejudge.ymlper repo (reference). A PR can't loosen its own rules. - Evidence for rubric failures. A high-severity failure only counts with a quoted line that is in the diff.
- Editing the PR description re-checks the PR. The deterministic checks (labels,
pr_template) re-run on the new text, and the stored model result for the same commit is reused (hosted AI and runner), so there is no new model call. - Learning from outcomes, with a human in charge. On the hosted App, merges over a lane, reverts, follow-up fixes and label overrides are recorded. A scheduled run (Mondays 11:00 CEST on the hosted service) may open one proposal PR that adds protected paths or rubric notes to
.mergejudge.yml. It is alwaysblockfor MergeJudge, and a human merges it. It can't remove protected paths or change packs, severities orraise_to(learning loop). - Agents are told apart from humans. A coding agent that merges through a person's login can mark itself with the
mergejudge:agentlabel or aMergeJudge-Actor: agentline in the PR body or merge message (gh pr merge 123 --merge --body "MergeJudge-Actor: agent"). Such merges and label changes are not counted as human decisions. - An audit trail. The hosted panel keeps an audit log of changes: sign-ins, repo links, provider key changes (name only, never the value), runner enrollment and revocation, runner jobs and the results posted, and manual learning runs. It stores no code.
- One comment, capped inline comments, one check. A sticky summary, at most 20 inline findings, and a
mergejudge/lanecheck. MergeJudge doesn't merge PRs itself; withapproval.mode: auto-merge-onlyit asks GitHub to auto-merge auto-lane PRs (approvals).
How rules and rubrics change β
Rules never change in the PR being judged. They change like any other code: through a PR a human approves.
- Feedback. Tick a box on the comment (Correct, Too lenient, Too strictβ¦) or comment
/mergejudge learn β¦. Only people with write access count. On the hosted App, merges over a lane, reverts and follow-up fixes count too. - Lessons. Each signal becomes a line in
lessons/lessons.jsonlon themergejudge-learningbranch. - Proposal PR. When enough evidence builds up, a scheduled run opens a
mergejudge/proposal-learningPR with small config changes. - A human decides. You review it like any PR. MergeJudge never merges it and always lanes it as block.
Details: learning loop and security model.