MergeJudge (repository name mergejudge-runner) is an open-source, self-hostable GitHub Action and CLI for performing AI code review on Pull Requests, licensed under MIT. Its core idea is "rules before AI": deterministic rules first establish a minimum risk level, and optional AI review then attempts to raise the risk level, but AI cannot lower the floor set by the rules.
Purpose and positioning It is aimed at engineering teams that want auditable GitHub AI code review with an explicit risk policy, rather than a bot that merely generates a flood of noisy comments. Each PR is classified into one of three risk lanes: auto (low risk, not a guarantee), review (requires human review), or block (high-risk defects or policy violations). Review results are presented as a summary comment, inline diff findings, and a GitHub status check (mergejudge/lane). MergeJudge itself does not merge PRs; branch protection and required checks still apply.
Key capabilities
- Deterministic risk floor: path rules, secret checks, size limits, labels, and .mergejudge.yml configuration jointly determine the minimum lane; rules marked as review or block cannot be downgraded by AI.
- Two-round adversarial AI verification: the first round proposes candidate defects and must cite exact diff lines; the second round independently attempts to disprove each candidate against the diff, and only findings whose citations match the corresponding file's diff are published. The official claim is that on the offline Martian Code-Review-Bench benchmark of 50 PRs, precision is 75.9% (--deep) and 75.0% (default).
- Policy tamper resistance: in GitHub Actions, .mergejudge.yml is read from the PR's base branch (pull_request.base.ref, i.e., GITHUB_BASE_REF), not from the untrusted PR head; a PR that modifies this configuration file enters at least the review lane.
- Bring your own model (BYOK): supports Anthropic (claude-sonnet-4-20250514), OpenAI (gpt-4.1, gpt-4o), Google Gemini (native provider: gGemini, key GEMINI_API_KEY), as well as any OpenAI-compatible endpoint or local Ollama (provider: openai-compatible plus base_url).
- Pure rule mode: set provider: none or do not provide an LLM key to run the deterministic gate with zero external model API calls.
- Learning mechanism: in issue_comment events, when a human with write permission checks the feedback checkbox on the sticky comment or posts /mergejudge learn …, the experience is recorded to lessons/lessons.jsonl on the mergejudge-learning branch; when triggered on a schedule or manually, if enough experience has accumulated (learning.propose_after, default 10 entries), a proposal PR is opened or updated, which may suggest protected edits to .mergejudge.yml (only adding protected paths or prompt notes) along with report files, labeled do-not-merge, needs-human.
- Optional security mode (review.security: true, off by default): AI review additionally scores five high-severity security checks (injection, authorization, secrets and encryption, callbacks/SSRF and webhook verification, AI tools); failures count only if they cite the changed code, and the lane is escalated to review.
- Optional lane choice map (review.lane_map: true, test build, off by default): adds a "Lane choice map" to the sticky comment, explaining lane reasons, per-lane counts across the whole PR, directory bucket counts, and a file table (up to 100 rows); it is for explanation only and does not change the PR lane or status checks.
Usage As a GitHub Action: just copy two files, and the next PR gets a lane, a summary comment, inline findings, and the mergejudge/lane check. Store AI_API_KEY as a repository secret (Settings → Secrets and variables → Actions); api_key_env only specifies the variable name, and an existing secret named MJ_API_KEY can be used via api_key_env: MJ_API_KEY. Purerule gate: set provider: none and omit the secret. Default mode requires no actions/checkout step; the Action reads .mergejudge.yml and the diff from the base branch via the API; built-in defaults are used when there is no config file. @v1 is the main Action release tag; the 50-PR data was measured based on the npm package mergejudge-runner@0.6.1. Inputs include github_token, app_id/app_private_key (optional GitHub App credentials), mode (auto | triage | feedback | propose), review_mode (fast | deep), config_path, provider, base_url, model, api_key_env; outputs are lane and proposal_pr. auto mode selects by event: pull_request → triage, issue_comment → feedback, schedule/workflow_dispatch → propose. The learning feature requires contents: write and pull-requests: write permissions, and the repository must allow GitHub Actions to create and approve PRs. As a CLI: the repository provides CLI usage documentation and a complete flag list. Runner bundled with the hosted service: this repository also contains an open-source runner (MIT) for running the AI steps of the hosted MergeJudge service on your own machine, using your own Claude Code, Codex (ChatGPT) login, or GLM (z.ai) API key; the runner connects outbound over HTTPS (/runner/v1) to receive review tasks and send back results, requiring no inbound ports. The runner does not run standalone; it must connect to the MergeJudge service and have the MergeJudge GitHub App installed on the target GitHub account or organization, registering via GitHub login or using the registration code in the panel.
Use cases Suitable for GitHub engineering teams; also suitable for teams that want PR gating in pure-rule mode with zero external calls, or that use their own model keys/local Ollama to control code flow.
Limitations and caveats
- auto only indicates low risk and is not a guarantee; MergeJudge does not merge PRs.
- In pure-rule mode, no code is sent to external model APIs, but PRs are still read from GitHub. In AI mode, the PR diff, title, body, base branch policy files, and (in context/deep mode) relevant code snippets are sent directly from the runner to the configured model provider; the Action does not call the MergeJudge server.
- In the hosted service's default diff/context mode, relevant data is temporarily stored on the server via a task queue and deleted within about 48 hours at the latest; deep-local mode (review.mode: deep and runner.code_source: local) can run the AI step and code indexing on the local machine.
- Safe mode is currently supported only by the Action; the hosted runner does not read this key.
- Learning comes only from explicit feedback on PRs; merging or rolling back on its own does not generate Action experience (that path belongs to the hosted Worker).
- Changes that modify .mergejudge.yml always go to review and are never auto-merged or bot-approved.
- The repository does not provide specific billing or pricing information.