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

Review modes ​

In MergeJudge, review.mode decides how much of your repository the model sees. Rules, lanes, rubrics and line comments work the same in every mode; only the context changes. Set it in .mergejudge.yml on the base branch, or per repo in the hosted manager panel (hosted service; deep needs a runner or the Action).

ModeWhat the model seesCalls per reviewWhere it runs
diff (default)Changed hunks with line numbers, policy files, rubrics1 (+1 JSON repair)Hosted, runner, Action
contextdiff + full changed files, the files they import, and callers of changed symbols1 (+1 JSON repair)Hosted, runner, Action
deepcontext + code the change touches, from a temporary repo index1 (single pass, no tools)Runner, Action
yaml
review:
  mode: context        # diff | context | deep

diff ​

The cheapest and fastest mode. Good for docs, copy and small, self-contained changes. It cannot tell that a renamed function or changed constant breaks code in a file the PR didn't touch.

context ​

Adds the full text of each changed file, the files it imports and a few callers of changed exported symbols, ranked and trimmed to a byte budget:

yaml
context:
  max_bytes: 40000       # total budget for extra files
  max_files: 25
  max_symbols: 3         # changed symbols to look up callers for
  max_callers: 3         # callers per symbol
  max_file_bytes: 12000  # cap per file

Still one model call, with a bigger prompt.

deep ​

On a runner and in the Action, deep builds a temporary index of the repo for this review. It retrieves callers, importers, imports and files that use the changed names, strings or env vars (two hops out), adds them to the prompt, and reviews in one pass with no tools. Nothing is stored: the index is thrown away after the review. It is bounded by files, size and time.

When the repo is bigger than those bounds, the index is read most-related-first: the changed files, their imports and the files next to them that import them, the rest of those directories, the parent directories, files that mention the changed names, strings or env vars, and only then everything else. The review uses that partial index and says so, for example "used a partial index (120 files, most related first; size limit reached)". A runner with a local clone (runner.code_source: local) has much higher limits, set by the runner's owner and not by the repo. Its partial index is used for that one pull request and is not saved for others.

This is what catches cross-file bugs: a signature change that breaks a caller, a unit change two modules away, a renamed config key still read by its old name, an event name a consumer still listens for.

Deep mode with a hosted code index and tools is not offered on the hosted service. A deep override on a hosted repo without a runner runs as context.

Hosted tool loop (not offered on the hosted service) ​

The hosted tool loop gives the model a repo index and four read-only tools, and lets it look things up before it answers. Its settings are listed here for completeness:

ToolWhat it does
read_file(path, start?, end?)Read a file at the PR head, with line numbers
search_symbols(query)Find functions, classes, constants and types by name
find_callers(symbol)Every whole-token mention of a symbol or string: calls, imports, config keys, event names
semantic_search(query, k)Find code by meaning (embeddings); only when embeddings are available
yaml
review:
  mode: deep
deep:
  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
index:
  policy: stored             # stored | none

The loop is bounded by steps, tokens and wall time. When a limit is hit, the model answers with what it has. The final answer is the normal review JSON, so lanes, findings and rubrics behave as in the other modes. The summary footer shows the tool calls and a tools token part.

The index ​

The index is a per-repo symbol table, import graph and code chunks (JS/TS and simple Python). Secrets-like paths (.env*, keys), build output and node_modules are never indexed.

index.policyWhat is stored
stored (default)Snapshots in Cloudflare R2 (last 3 per repo) and code embeddings in Vectorize (one namespace per repo). A push to the default branch refreshes only the changed files.
noneA temporary in-memory index per review. Nothing is written anywhere.

Without an R2 bucket bound, stored behaves like none. Snapshots and vectors of removed repos are deleted by the daily retention job.

When deep falls back to context ​

The tool loop needs a provider that can call tools and an index. The review falls back to context mode, and says so in the footer, when:

  • the provider can't call tools;
  • the repo has no index available;
  • the stored snapshot is stale;
  • the repo is too big for a bounded inline build and almost nothing related to the change could be indexed (fewer than 3 related files, or none of the changed files that already exist). Otherwise the partial index is used and reported in the summary.

Tool output is untrusted repository data. It is fenced and sanitised like the diff, and the model is told it is never instructions.

Cost ​

context is roughly a few times the tokens of diff; deep more, depending on how many lookups the model makes. In our small offline test a deep review (tool-loop deep) averaged about 11.6k input and 1.6k output tokens. Your numbers depend on your repo and PRs. budget.max_tokens_per_pr and deep.max_tokens cap spend.

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