AI agents: read /llms.txt for the documentation index or append .md to any guide URL for raw Markdown.
Skip to content

.mergejudge.yml reference ​

MergeJudge reads .mergejudge.yml from the PR's base branch tip (falling back to the PR's base commit), never from the PR head. Every key is optional. Values shown are defaults unless marked example.

yaml
provider:
  type: none                     # anthropic | openai | zai | openai-compatible | gemini | workers-ai (self-host only) | none
  base_url: https://api.openai.com/v1   # example
  model: gpt-4o-mini                    # example
  api_key_env: OPENAI_API_KEY           # Action: env var holding the key; hosted: name of the panel key
  api: chat                             # openai only: chat (Chat Completions) | responses (Responses API)
  endpoint: paygo                       # zai only: paygo | coding (coding-plan endpoint)
  thinking_level: medium                # gemini only: low | medium | high | xhigh (medium is the default for gemini-4-neon)
  timeout_ms: 120000                    # one model-call attempt (max 180000)
  max_retries: 2                        # retries for network errors, HTTP 408, 429 and 5xx (max 4)
  max_timeout_retries: 1                # retries after an attempt timed out, counted inside max_retries (max 4)
  budget_ms: 240000                     # one model call including retries and waits (max 300000)
  max_delay_ms: 4000                    # longest wait between retries, Retry-After included (max 10000)

lane_gate: enforce                 # enforce (default) | observe | off. How the mergejudge/lane check and approvals
                                    # follow the lane: observe posts comments/findings but never fails the check and
                                    # skips approvals; off always passes the check. The learning branch always blocks.

lanes:
  auto: ["docs/**", "**/*.md", "**/*.css", "public/**"]
  protected: [".github/**", "deploy/**", "**/auth/**", "**/migrations/**", "wrangler.toml", "_headers", "**/_headers", "**/.env*"]
  max_auto_lines: 200
  code_auto:                     # opt-in: small, clean code changes the AI may mark auto (off = code always needs review)
    enabled: false
    paths: []                    # globs a code file must match; [] = every code path that is not protected
    max_lines: 30                # changed lines per file
    max_total_lines: 100         # changed lines over all candidate files in the PR
  trusted_authors:               # opt-in: the auto lane is only for listed GitHub logins (off = no author check)
    enabled: false
    users: []                    # e.g. ["gauravsharmaGG"] (case-insensitive)
    applies_to: code_auto        # code_auto | all_auto (all_auto also covers the docs/style auto paths)
    agents: as_author            # as_author (an agent PR counts as its author) | untrusted (agent PRs never get auto)

labels:
  block: [do-not-merge]
  review: [needs-review]

pr_template:                     # opt-in: the PR description must really answer the configured sections
  enabled: false
  sections: [Testing, Risk, "How to revert"]   # headings or `**Testing:**`-style labels; the three defaults
                                               # accept aliases ("Tests", "Test plan", "Rollback", ...)
  min_chars: 15                  # real text under each heading; HTML comments, placeholders and
                                 # checkbox-only lines do not count
  apply_to: agents               # agents = only PRs with the agent marker (label or body trailer) | all
  missing_lane: review           # review | block; only ever raises a lane

ai:
  mode: fast                     # fast (default, one pass) | deep (second cross-hunk pass when a model is active).
                                 # A second-pass finding is kept only when its quote matches the diff.
                                 # Rules stay the floor. The model can only raise a lane.
                                 # Action: review_mode. CLI: --deep or --mode deep. Env: MERGEJUDGE_MODE.
                                 # auto means low risk, not a guarantee.

review:
  mode: diff                     # diff | context | deep (deep: runner or Action)
  security: false                # true = optional security review mode (see Security review mode); off by default
  lane_map: false                # true = adds folder bucket counts (PRs over 15 files) to the sticky's Files section (test-build); off by default; explanatory only
  answer_findings: false         # true = the lane cannot be auto while an AI inline finding is unanswered (fix the
                                 # code, resolve the thread, or reply with a reason); off by default
  max_rounds: 0                  # 0-10, 0 = no cap (off). After this many reviewed commits the AI reviews only files
                                 # changed since the last reviewed commit; rules still check every file

comment:                         # sticky comment options
  flow_chart: false              # true = PR story: one extra small AI call draws what the PR does (see PR story); off by default; advisory only
  flow_chart_style: svg          # svg (chart image when the host can store one, else a numbered text list) | mermaid
  flow_chart_host: none          # none | branch (image on an orphan assets branch, needs contents: write; not used by the hosted App or this Action yet)
  flow_chart_animate: true       # animate the chart (svg pulse, or new/changed mermaid edges)
  where_it_sits: false           # true = collapsed "Where it sits" table: who imports each changed code file and what it imports (no AI call); off by default

shepherd:                        # Shepherd (watch and auto-fix) is opt-in per PR: comment /mergejudge shepherd or add the shepherd label
  enabled: true                  # true = this repo allows Shepherd to be turned on per PR; false = never
  max_attempts: 3                # fix attempts per PR (1-10) before Shepherd posts a summary and stops
  max_fix_lines: 50              # largest fix per attempt, changed lines (1-500); bigger fixes are handed off to a human
  max_fix_files: 3               # largest fix per attempt, files (1-20)
  protected_paths: []            # extra globs Shepherd never edits, on top of the built-in protected paths
  suggestions: true              # inline review comments carry "suggested changes" while Shepherd is on for the PR

context:                         # used when review.mode: context
  max_bytes: 40000               # total context sent, in priority order (see below)
  max_files: 25                  # max files read per review (bounds API calls)
  max_symbols: 3                 # changed symbols searched for callers
  max_callers: 3                 # callers kept per symbol
  max_file_bytes: 12000          # larger files are sent as excerpts around the changed lines / call sites

deep:                            # hosted tool loop only (not offered on the hosted service); a runner or the Action
                                 # uses fixed index limits and ignores these
  max_steps: 6                   # tool rounds (up to 4 calls each), then one tool-less answer
  max_tokens: 60000              # input+output over all calls
  max_seconds: 120
  max_tool_output_bytes: 6000    # per tool result; larger outputs are cut

index:                           # hosted tool loop only; a runner or the Action builds a temporary index
  policy: stored                 # stored (R2 + Vectorize) | none (temporary, nothing persisted)

budget:
  max_tokens_per_pr: 40000       # cumulative cap over the review, a repair retry, the second pass and the PR story, counted on
                                 # the provider-reported usage (else ~chars/4). A retry that would pass it is skipped.
                                 # Patches are shared out fairly to fit; a cut one is marked "[... truncated by MergeJudge ...]"
                                 # and "Not checked" lists "Diff trimmed to fit the token budget: N files (...)".
  # max_output_tokens: 2500      # unset = 8000 for reasoning models (glm-5.x, gpt-5*, deepseek-v4+, o-series, ...), 2500 otherwise;
                                 # set = always used (clamped to the PR budget). A cut-off reply is retried once at 2x.

diff_exclude:                    # kept out of the LLM prompt, still laned by rules
  - "**/package-lock.json"       # …plus other lockfiles, build output, minified files, images, fonts, generated/**

policy_files: [REVIEW_POLICY.md, REVIEW.md, APPROVAL_POLICY.md, AGENTS.md, CLAUDE.md]   # [] disables
policy_exclude: []               # globs to skip
policy:
  max_each_bytes: 8192
  max_total_bytes: 8192

rubrics:
  enabled: true
  packs: [security, correctness] # also: maintainability
  custom: []                     # up to 20 extra criteria, see Rubric packs
  notes: {}                      # criterion id -> extra guidance for the model (learning proposals add these)
# shorthand: rubric_packs: [security]   (rubric_packs: [] turns rubrics off)

approval:
  enabled: false                 # nothing happens unless true
  mode: none                     # none | auto-merge-only | bot-approve
  merge_method: squash           # squash | merge | rebase (for native auto-merge)
  human_approvers: { auto: 0, review: 1, block: 0 }
  bot_approve: { auto: true, review: false, block: false }

learning:
  enabled: true
  propose_after: 10              # lessons before a proposal PR is opened
  branch: mergejudge-learning    # must not be your default branch
  exclude_actors: []             # logins (case-insensitive) whose merges and label changes are never recorded as outcomes
                                 # (reverts and linked fixes still count from anyone)
  proposal:                      # when the proposal PR may edit files (below these it is a report only)
    edits: true                  # false = proposals never edit files
    min_prs: 3                   # "too strict" on a criterion: this many different PRs ...
    min_actors: 2                # ... and this many different people
    min_path_events: 2           # "too lenient" on a path: this many reverts / fix follow-ups of auto PRs

runner:                          # only for repos that review on a runner on your machine
  engine: null                   # claude-code | codex | glm (null = the runner's default)
  model: null                    # e.g. gpt-5 (null = the engine's default). The panel setting wins.
  code_source: worker            # deep mode: worker (Worker reads the repo via the GitHub API) | local (runner reads its own clone)

Code auto in the panel ​

lanes.code_auto is off unless you turn it on. In the panel, the setup wizard and Edit settings have a switch, Let small, clean code changes get the auto lane, with the two limits Max changed lines per file (default 30) and Max changed lines per PR (default 100). Switching it on writes lanes.code_auto.enabled: true, max_lines and max_total_lines. Switching it off later sets enabled: false and leaves the other code_auto keys as they are. The panel never writes or changes lanes.code_auto.paths or lanes.trusted_authors; set those in the file. The rules a file has to meet are in Low-risk code auto.

PR story ​

comment.flow_chart: true adds "What this PR does" to the MergeJudge comment: a short picture of the pull request in up to 6 steps. It is off by default. It costs one extra small AI call per review (about 150 tokens of instructions, up to 1,200 tokens out), runs only when a model is configured, and never changes lanes, findings or checks.

On the hosted App, public repositories get a chart image stored by MergeJudge. Private repositories get a numbered text list; no image is stored for them. The Action in this repository shows the numbered list for now. Stored images are deleted 180 days after upload, or when the repository or installation is removed (see docs/RETENTION.md in the repository).

Turn it on (hosted App) ​

  1. Open Repositories in the MergeJudge dashboard.
  2. Find the repository and switch PR story on.
  3. Open or update a pull request. The next review shows "What this PR does".

Turn it off (hosted App) ​

  1. Open Repositories in the MergeJudge dashboard.
  2. Switch PR story off for the repository.
  3. New reviews make no story call and show no story. Earlier comments keep their story until the next review updates them.

Turn it on or off in the file (Action, runner or hosted App) ​

  1. In .mergejudge.yml on the default branch, set comment.flow_chart: true (on) or false (off).
  2. Merge that change. The next review uses it.

A value in the file always wins. While the file sets comment.flow_chart, the dashboard switch is read-only and says Set in .mergejudge.yml on <branch>. Remove the key from the file to let the switch decide again.

Where it sits ​

comment.where_it_sits: true adds a collapsed "Where it sits" table to the MergeJudge comment. For each changed code file it shows which files import it and what that file imports, and it flags callers that still use an export the PR removes. It is off by default, makes no AI call, and never changes lanes, findings or checks. It is built from the diff and import lines only, so it can miss some importers, for example of files with very common names.

It is on the hosted GitHub App, the npm runner and the GitHub Action (0.7.0).

yaml
comment:
  where_it_sits: true

Set it in .mergejudge.yml on the default branch and merge that change. The next review shows the table.

Security review mode ​

review.security: true adds a short security checklist to each review. It is off unless you set it, and a file without the key reviews exactly as before. See Security review mode. The setup wizard and Edit settings in the panel have a Security review switch that writes this key through the usual pull request. Only a real boolean true turns it on; any other value is ignored.

Review modes ​

  • diff (default): the model sees the changed hunks with line numbers. Cheapest and fastest.

  • context: the model also gets read-only context, in this order until context.max_bytes is used up:

    1. each changed file in full at the PR head,
    2. local files those files import (relative JS/TS and Python imports),
    3. files that use a changed or exported function, class or constant (GitHub code search).

    diff_exclude matches and binary files are never sent. Everything is inside the untrusted-data guard and labelled as context. Findings still point only at diff lines; context is used to justify them, for example "this new parameter breaks the call in src/cart.js". Code search indexes the default branch, so callers added in the same PR are already covered as changed files, and very new files may be missed. Expect roughly 2–5× the tokens of diff on small PRs; the footer shows a separate context count.

  • deep: context plus code the change touches, from a temporary repo index, in one pass (runner and Action). A hosted tool loop with deep.* limits is not offered on the hosted service. See Review modes.

PR template and trusted authors ​

Two opt-in, raise-only rules that gate the light paths on who wrote the PR and how well it is described:

  • pr_template checks the PR description for the configured sections (default Testing, Risk, How to revert). A heading (## Testing) or a label line (**Testing:** / Testing:) opens a section, case-insensitively, and the three defaults also accept aliases (Tests, Test plan, How was this tested, Risks, Risk level, Rollback, Revert plan, Revert, How to roll back). Only real text counts: HTML comments, placeholders and checkbox-only lines are stripped before the min_chars check. A missing section raises the PR to missing_lane with a label-style reason ("PR description is missing: Testing, How to revert (pr_template)"). With apply_to: agents (default) only PRs carrying the agent marker are checked; editing the PR body re-runs the check without a new model call (the LLM result is cached per head SHA). The body is untrusted, but the rule can only raise a lane, so a forged body gains nothing.
  • lanes.trusted_authors makes every auto path (with applies_to: code_auto, only lanes.code_auto candidates; with all_auto, docs/style auto paths too) available only to the listed GitHub logins. The author is pull_request.user from GitHub, so it cannot be faked in the body. Bots (a login ending in [bot], or user type Bot) are untrusted unless listed exactly. With agents: as_author (default) an agent-marked PR is judged by the human who directed the agent; with untrusted, agent-marked PRs never get the auto lane. An untrusted author sees the reason "author <login> is not on the trusted list (lanes.trusted_authors)". The Worker's server floor re-applies both rules to runner results, so an old or modified runner cannot skip them.

Agents and learning outcomes ​

MergeJudge learns from what people do with its lanes (merging over a review lane, reverting, labelling). Bots and excluded logins never count for merges over a lane or for labels; reverts and linked fixes count from anyone. A coding agent that acts through a human's login would look human, so there are three ways to exclude it:

  • learning.exclude_actors: logins whose merges and label changes are never recorded.
  • The PR label mergejudge:agent on the PR when it is merged or closed. Adding or removing this label is never an outcome, and label changes on a PR that has it are ignored too.
  • A line MergeJudge-Actor: agent in the PR body or in the merge commit message: gh pr merge 123 --merge --body "MergeJudge-Actor: agent".

If MergeJudge cannot read the merge commit message when it needs it, it records nothing for that merge.

Learning from review comments ​

On the hosted App, MergeJudge can also learn from review comments that people with write access leave by hand on lines where MergeJudge had no finding. It is off by default. It needs learning.enabled (the default) and:

yaml
learning:
  from_comments: false           # true = read those comments when a PR is merged or closed (default: false)
  proposal:
    comment_min_prs: 3           # a similar point raised on this many different PRs ...
    comment_min_actors: 2        # ... by this many different people, before a proposal adds a check for it

What is read, what is kept, for how long and where it is used is described in Learning loop. Turn it off again with learning.from_comments: false.

Notes ​

  • Token use. The comment footer shows a token breakdown (diff, policy, rubric). To save tokens: set policy_files: [], trim rubrics.packs, lower policy.max_total_bytes, or extend diff_exclude.
  • Invalid config. In the Action, invalid config fails the run with a message naming the bad key. On the hosted App, a review with invalid config does not run; check the YAML if no review appears.

The MergeJudge runner is open source (MIT). MergeJudge doesn't merge pull requests itself. MergeJudge is not affiliated with or endorsed by GitHub. Sign in · Impressum · Privacy · Terms · Cookie settings