Contents
Before you open a PR

The Cerbie CLI

Review your branch with the cerbie CLI before you open a pull request.

cerbie review runs a Cerbie review of your branch before you open a pull request. Fix what it finds while the change is still local and run it again: the next review covers only what you changed and rechecks the earlier findings. Then open the PR, and its first review carries on from your last local review instead of starting again.

The review runs on Cerbie’s servers with the same reviewers, policy and .cerbie/ configuration as pull request reviews. Your machine only packages the change.

Install and sign in

npm install -g cerbie       # or run it without installing: npx cerbie review
cerbie login                # opens github.com/login/device; approve the CerbieAI app

You need read access to the repository on GitHub, and Cerbie has to be enabled for it (any mode except off). The session lasts 90 days. cerbie logout ends it.

Review

From anywhere inside a clone whose origin is on GitHub:

cerbie review                 # this branch plus uncommitted changes, against the default branch
cerbie review --committed     # leave out the working tree
cerbie review --base release  # compare against another branch
cerbie review --json          # machine-readable result, e.g. for Claude Code or Codex to work through
cerbie review --no-wait       # submit, print the run URL and exit; `cerbie show <id>` picks it up later
cerbie review --pr 123        # check against pull request #123's open findings (see below)
cerbie review --no-pr         # don't check against this branch's pull request
Exit status Meaning
0 Nothing blocking (approved, or non-blocking suggestions only)
1 Blocking findings: Cerbie would request changes on a PR
2 The review failed or couldn’t cover the whole change

The base is origin/<branch> as your clone knows it; Cerbie diffs from its merge base with your head, exactly like a pull request. Nothing is pushed: the CLI uploads a git bundle of the commits between the merge base and your head. Uncommitted changes (tracked and untracked files, respecting .gitignore) are captured in a temporary commit made from a copy of your index, so your repository, index and refs are left untouched.

Results appear in the terminal and in the dashboard under Reviews, marked local. Local reviews never post anything to GitHub.

Incremental reviews

Your local reviews of a branch form a chain, like the reviews of a pull request. Each one follows on from your last complete review of the same branch against the same base:

The same signals as on pull requests decide when a review is full again: a riskier change than before, or new commits that change most of the change. Changed review rules don’t: as on pull requests, what the review covers is reviewed under the new rules, and a custom check that is new or changed runs over the whole change. How many incremental reviews came before, and how long ago the last full one was, make no difference. A review is also full when the requirements or review setup changed since the last one (a different linked ticket, say, or a Cerbie update to its prompts or models; not the repository’s own review rules), when the code the last one saw is no longer available (uploads are kept for two days), or when too much changed to compare. cerbie review --fresh always reviews everything.

A change to a lockfile alone isn’t reviewed, but it does mean the earlier findings are checked again instead of carried forward, since installing dependencies can settle a dependency finding.

Only your own reviews count: someone else reviewing the same branch starts their own chain.

Opening the pull request

A pull request’s first review takes over its author’s latest complete local review of its head branch against its base. It treats that review as the PR’s previous one, so it reviews only what changed since (or nothing, if nothing did) and posts the findings that are still open as new comments.

Only the PR’s very first review attempt does this: once a review of the PR has run, it may have raised findings the local review never saw. If the requirements or review setup differ from the local review’s (a ticket linked from the PR description, for example; changed review rules alone don’t count), the review is full, though it still posts the open local findings. Re-runs and @cerbieai review review the whole PR, and pull requests from forks don’t take over local reviews.

Checking a fix before you push

Once a branch has a pull request, every push costs a CI run and a Cerbie review of a few minutes, and a fix that misses a case, or breaks something nearby, costs another. cerbie review on the PR’s branch checks the fix first, without pushing or posting anything:

$ cerbie review
Cerbie is reviewing 6 files (including uncommitted changes) on tvd/crb-69-review-volume against origin/main
Checking it against PR #89's 1 open finding, as Cerbie would review it if you pushed now.
Changes requested · incremental: 5 of 6 files, since 1595f4d · 3m04s

PR #89 · 1 still open · since Cerbie's review of 1595f4d
  ✗ still open    Keep unpriced reviews distinct from genuinely zero-cost reviews  apps/worker/src/insights.ts:221-223
      still fails: A window with a wholly unpriced legacy review shows an unqualified $0 in the heatmap peak and range readouts.
      still fails: The heatmap still presents unpriced averages as exact when not hovered

  should fix  apps/worker/src/insights.ts:221-223 (+1 more)
…
Nothing was posted to PR #89; Cerbie reviews it again when you push.

The review is the one Cerbie would make if you pushed your local change (commits and uncommitted changes, as for any local review) now: it follows on from the PR’s last complete review, covers what changed since, and checks each fix against its finding as a whole, as on a push. It reports each of the PR’s open findings, and those it resolved recently whose fixes you touched again, as resolved, still open (with the cases the fix still misses) or reopened, and anything new as newly broken (a fix broke something else) or new. If that assessment doesn’t finish (the follow-up or the fix review), no finding counts as resolved. The full findings and exit status follow as for any local review.

cerbie review --json adds a pullRequest object: number, url, since and sinceRunId (the head the PR was last reviewed at, and that review’s run), baseline (reviewedHead, findingsAsOf: "current", and latestReview with its runId and outcome when the latest review ended failed, superseded or incomplete), complete, and findings, each with id, status (resolved, still_open, reopened, newly_broken or new), severity, title, path, startLine, endLine, and where they apply cases (what the fix still gets wrong) and brokenBy (the finding whose fix broke it). Cerbie’s prompt for agents on each finding suggests running cerbie review before pushing.

Caching: review once, post instantly

Every review is cached against the code, not the commit:

Because it’s the tree that counts, these all hit the cache: committing exactly the uncommitted changes you reviewed, amending a commit message, squashing, or rebasing interactively without changing content. Rebasing onto a newer main changes the merge base, so it’s a fresh review.

When a pull request is opened (or marked ready) and Cerbie hasn’t reviewed it before, it looks for a complete review of the same code. If it finds one, it writes a fresh summary for the PR, posts the cached findings and verdict with inline comments, and notes that the code was reviewed locally first. If a review of the same code is still running, for example cerbie review --no-wait && gh pr create, the PR waits for it rather than paying for the same review twice.

Cached reviews are never reused when the earlier review was incomplete, incremental or more than 14 days old, when the policy fingerprint differs, or for @cerbieai review and re-runs, which always review afresh. cerbie review --fresh skips the cache too. When the last local review of a branch was incremental, the PR doesn’t need the cache: it takes over that review instead (see above).

Limits

Local reviews use the same LLM capacity as pull request reviews, so they’re rate limited to keep headroom for PRs. There are two budgets:

Budget Limit Default
Reviews (runs that review in full) Per person per hour 5
Per person per day 25
All local reviews per hour 40
Submissions (every upload, cache hits included) Running at once per person 2
Uploads per person per hour 30

Reviews served from the cache, and local reviews that found nothing reviewed had changed, don’t count against the review budget. Incremental reviews count like full ones. A submission that follows on from an earlier review of the branch is let in uncharged, like a likely cache hit, and charged only if it turns out to review. A submission that looks like a cache hit is let in uncharged; if it turns out to need a full review (the code or policy differs), it’s charged before reviewing, and refused if the budget is spent. Admins can change the limits without a deploy, under Settings → Local reviews in the dashboard or with PUT /api/settings/cli-limits (with perUserHour, perUserDay, globalHour, perUserConcurrent and perUserSubmissionsHour; setting any to 0 turns local reviews off). Changes are capped at 3,000 files and a 64 MB bundle.

cerbie limits shows what you have left, and when the next review frees up in each hourly or daily window (a window frees a slot when its oldest counted run is an hour, or a day, old):

$ cerbie limits
Local reviews  3 of 5 left this hour (next frees in 12 minutes), 20 of 25 today
Cerbie-wide    31 of 40 left this hour
Running        0 of 2 at once
Uploads        27 of 30 left this hour

cerbie limits --json prints the same as JSON (GET /cli/v1/limits): turnedOff, and for each of reviews.hour, reviews.day, reviews.globalHour, submissions.running and submissions.hour the limit, used, remaining, and resetsAt and resetsInSeconds (null when nothing counts against it, and always for submissions.running, which frees when a run finishes). After each review, cerbie review also prints how many reviews you have left this hour.

Insights

The numbers on the dashboard’s Insights and PR pages, in the terminal. They cover the repositories you can read on GitHub, exactly as the dashboard would show you, and give the same numbers for the same filters.

cerbie insights                        # what reviews cost over the last 14 days, by repository, author, stage, model and PR
cerbie time-to-merge --window 30d      # how long PRs took from ready for review to merge, and where the time went
cerbie pr lleverage-ai/cerbie#80       # one PR's reviews, replies, cost and time to merge (a GitHub PR URL works too)
cerbie backfill                        # how far the time-to-merge backfill and the CI read-back have got

insights and time-to-merge take the dashboard’s filters:

Option Meaning
--window 24h|7d|14d|30d|90d The window, ending now (default 14d)
--from <time>, --to <time> Start or end instead (ISO 8601; a date alone is midnight UTC). At most 90 days
--repo <owner/name> Only this repository; repeat for more
--author <login> Only this author’s PRs (and CLI reviews they requested); repeat for more
--pr <owner/repo#n> Only this pull request
--source pr|local Only pull request reviews, or only CLI reviews (time to merge has PRs only)
--tz <zone> IANA time zone for days, weeks and printed times (default: your machine’s)

Tables show the first ten rows. --json prints the server’s whole response instead, as the dashboard gets it: GET /cli/v1/insights (the same as /api/insights), /cli/v1/insights/cycle (/api/insights/cycle), /cli/v1/pulls/:owner/:name/:number (/api/pulls/..., with lifecycle.cycle holding the PR’s waits on review, CI and people) and /cli/v1/insights/backfill. A pull request in a repository you can’t read answers as if Cerbie had never seen it.

cerbie backfill (GET /cli/v1/insights/backfill) reports, over your repositories: the PRs the lifecycle backfill is for (eligible: reviewed live by Cerbie and opened before event recording began, or of unknown age), how many it has finished and how many are left; how many PRs have a time-to-merge breakdown, with the earliest and latest merge among them; and how many completed CI suites from other apps are still waiting to be read back from GitHub (unreadSuites). Totals come first, then a row per repository with anything to report.

The model recipe

cerbie recipe                          # the model recipe in effect, as JSON
cerbie recipe --out cerbie-recipe.json # the same, written to a file

cerbie recipe (GET /cli/v1/recipe) prints the recipe reviews run with now: the one saved in Settings, or the code default, all seven roles. It is the file the dashboard’s Download gives, for the eval gate’s --baseline-recipe (see Changing a model), so a gate run in CI can fetch its baseline with a token.

Updating

npm i -g cerbie@latest

Once a day, the CLI asks the npm registry in the background for the latest version of cerbie and keeps the answer in ~/.config/cerbie/update-check.json. When a newer version is out, the next command ends with one line on stderr:

A new version of cerbie is available: 0.2.0 → 0.3.0. Run npm i -g cerbie@latest

The check never delays a command or makes it fail, and a failed check says nothing. There’s no notice with --json, when stderr isn’t a terminal, or when CI is set. To turn it off, set CERBIE_NO_UPDATE_CHECK=1 (or NO_UPDATE_NOTIFIER=1, which other CLIs honour too).

Every request to Cerbie carries the CLI’s version (User-Agent: cerbie-cli/<version>). If the server no longer supports your version, it answers 426 Upgrade Required and the CLI prints the command to update and exits with status 2.

For scripts and CI

CERBIE_TOKEN and CERBIE_SERVER override the stored login and server, so a job can run any command, cerbie recipe included, without cerbie login. The token is a CLI session token: it belongs to the person who signed in, stops working when the session expires or they leave the organisation, and has to be replaced then. Sessions are stored in ~/.config/cerbie/cli.json (mode 600).

Releasing

Bump version in packages/cli/package.json and merge it to main. .github/workflows/release-cli.yml runs when that file changes on main: if npm doesn’t have the version yet, it tests, builds and publishes it with npm trusted publishing (GitHub OIDC, no npm token), then tags the commit cli-v<version>. Nothing is released when the version is unchanged. If a release fails partway, fix the cause and run the workflow again from the Actions tab (it skips what’s already done).

When a change to /cli/v1 would break older CLIs, raise MINIMUM_CLI_VERSION in apps/worker/src/cli/routes.ts to the first version that works with it, once that version is on npm. CLIs before 0.3.0 didn’t send their version, so they count as 0.0.0 and are refused by any minimum above it.

npm trusts the workflow by its file name, so renaming it breaks publishing until the trusted publisher is updated on npmjs.com (package settings, which needs an npm account with 2FA).

Printing the approver ruleset

With high-risk escalation, the categories’ paths should also be in the GitHub ruleset that requires the approvers team’s review, and Cerbie warns when the two differ. cerbie ruleset prints the ruleset’s required_reviewers value from the .cerbie/escalation/*.md files in your clone, for an organisation admin to apply. It needs no sign-in.

cerbie ruleset --team-id "$(gh api orgs/my-org/teams/approvers --jq .id)" > required-reviewers.json
[
  {
    "file_patterns": ["packages/auth/src/**", "apps/app/src/server/api/trpc.ts", "!**/*.test.ts", "!**/test/**"],
    "minimum_approvals": 1,
    "reviewer": { "id": 16800136, "type": "Team" }
  }
]

Patterns come in category order (files sorted by name), with every negation moved to the end and each pattern listed once, so a negation takes files back from every category’s paths. Two things that list can’t express are warned about on stderr: a negation only some categories have (the ruleset excludes those files for the others too), and a pattern a category lists after one of its negations to take files back in (in the ruleset they stay out). It stops with an error on a category file Cerbie would leave out (invalid frontmatter, or a file name whose id another file already has), rather than print a list without that category.

Put the value in the default branch ruleset’s pull_request rule as parameters.required_reviewers (gh api repos/<owner>/<repo>/rulesets/<id> shows the ruleset; replace that one key and PUT it back).

Edit this page on GitHub ↗