Contents
Your repository

Configuring Cerbie for a repository

Shape how Cerbie reviews your repository with a .cerbie/ folder: config, instructions, rules and checks.

Cerbie reviews every pull request in repositories where the Cerbie GitHub App is installed. It works with no configuration at all. Everything in this guide is optional and lives in a .cerbie/ directory in the repository being reviewed, so anyone who can open a PR can improve how their project is reviewed.

.cerbie/
├── config.yaml          # settings: triggers, ignored paths, review profile, approvals
├── instructions.md      # always-on guidance for reviewing this repository
├── rules/               # guidance scoped to paths (one topic per file)
│   └── api-handlers.md
├── checks/              # custom checks: each file becomes its own GitHub check run
│   └── migration-safety.md
└── escalation/          # high-risk categories that need an approver's sign-off
    └── identity-access.md

apps/billing/.cerbie/instructions.md   # nested instructions apply to apps/billing/** only
Important

Cerbie reads .cerbie/ from the PR’s base branch, not from the PR itself. A pull request cannot weaken the rules it is reviewed against. Changes to .cerbie/ take effect for PRs opened after they are merged. Comment @cerbieai config on any PR to see the configuration Cerbie is using.

How Cerbie decides what to say

Three layers of guidance are combined for every review:

  1. The Cerbie review policy (in the Cerbie repository, apps/worker/src/review/prompts/policy.md). This holds the organisation-wide standards: what counts as critical, the evidence a finding needs and when to ask for tests. Change it with a PR to lleverage-ai/cerbie.
  2. Organisation instructions, edited by Cerbie admins in the dashboard (Settings).
  3. Repository guidance: everything in this guide, plus the convention files your coding agents already read:
    • AGENTS.md, AGENT.md and CLAUDE.md, at the root and in any directory above a changed file
    • .cursor/BUGBOT.md, at the root and nested
    • .github/copilot-instructions.md
    • .github/instructions/*.instructions.md, honouring applyTo. Files with excludeAgent: code-review are skipped.

Repository guidance can add standards and context. It cannot switch off the review policy’s safety rules. For example, it cannot tell Cerbie to approve without reviewing.

config.yaml

Every key is optional. This shows all keys with their defaults:

version: 1

reviews:
  enabled: true            # false turns Cerbie off for this repository
  auto_review: true        # review on open and push; when false, only on `@cerbieai review`
  drafts: false            # review draft PRs automatically
  base_branches: []        # globs of base branches to review; empty = default branch only
  ignore_authors: ["dependabot[bot]", "renovate[bot]"]
  ignore_labels: ["cerbie:skip"]
  ignore_title_patterns: ["^\\[?WIP\\]?\\b", "^DO NOT MERGE"]
  debounce_seconds: 15     # wait this long after a push before reviewing, to batch pushes
  # risk_acceptors: [alice, acme/leads]  # who may accept a risk in a reply; unset = anyone's reasoned deferral is judged. See "Replies"
  # command_bots: ["my-agent[bot]"]     # other Apps' bots whose commands and thread replies Cerbie takes; unset = none. See "Commands"

paths:
  ignore: []               # globs Cerbie does not review (still listed in the summary)
  risk:                    # globs that always get a deep review with a security pass
    - pattern: "apps/app/src/server/auth/**"
      reason: authentication

summary:
  enabled: true            # post the sticky summary comment
  walkthrough: true
  diagrams: auto           # auto | always | never
  description: "off"       # off | append (managed block at the end) | placeholder (replaces "@cerbieai summary")

review:
  profile: balanced        # chill | balanced | assertive
  block_on: should_fix     # critical | should_fix | never: which findings request changes; the rest approve with comments
  min_confidence: 80       # findings below this confidence are dropped
  max_suggestions: 3       # optional suggestions per review
  language: en-GB
  ticket:
    enabled: true          # read the linked Linear ticket and check requirements
    pattern: "\\b[A-Z][A-Z0-9]+-\\d+\\b"

approval:
  mode: approve            # approve: submit GitHub approvals; comment: never approve
  trusted_authors: []      # authors whose PRs Cerbie may approve at any size (empty = everyone)
  human_approval_line_limit: 1001  # untrusted authors at or above this many changed lines need a human

checks:                    # built-in deterministic checks (no LLM, no installs)
  dependencies: true       # new npm packages: existence, age, deprecation, licence, unpinned sources;
                           # known vulnerabilities (OSV) in the versions of added or changed ones
  lockfile: true           # dependency changes without a lockfile update
  secrets: true            # high-confidence credential patterns in added lines
  migrations: true
  workflows: true          # zizmor and actionlint on changed GitHub Actions workflows and actions

context:
  guidelines: ["AGENTS.md", "AGENT.md", "CLAUDE.md", ".cursor/BUGBOT.md", ".github/copilot-instructions.md"]

escalation:                # high-risk changes; see "escalation/*.md" below
  mode: "off"              # off | advisory | enforce
  # approvers: my-org/approvers  # the team that signs off, as org/team-slug; no default
  label: risk:high         # label for a high-risk PR

The secrets check recognises private keys and credentials with a distinctive prefix or shape: AWS, GitHub, Slack (tokens and webhook URLs), Stripe live keys, Anthropic, OpenAI, Google API keys, Cloudflare, Linear, Sentry, PostHog personal keys, npm, PyPI, GitLab, SendGrid, Azure AD client secrets and storage account keys, Hugging Face, Databricks, Doppler, Shopify, DigitalOcean, Grafana, HashiCorp Vault, age, Postman, Pulumi, Notion and Heroku. Most formats come from the Gitleaks and Betterleaks rule sets; keyword-and-entropy rules are left out as too noisy. Stand-ins (test, xxxx, runs such as abcdef) are ignored, and a value that does not look generated is reported at should-fix in tests.

The vulnerability check asks OSV about each npm dependency the PR adds or changes, at the version it will install: the version the PR’s lockfile change shows for that dependency, else an exact specifier, else the lower bound of a simple range (^, ~, >=). It skips a dependency when that version is uncertain, and never reports on dependencies the PR leaves alone. A critical or high advisory is should-fix, anything else a suggestion, and so is a range’s lower bound, since the lockfile may install a later version. Withdrawn advisories are ignored. If OSV can’t be reached, the coverage table says so and the review goes on.

Lockfiles are never reviewed line by line. Unknown keys are reported rather than silently ignored: a typo shows up in the review’s coverage section and in @cerbieai config. A mistake in the escalation key is reported the same way and switches escalation off, but leaves the rest of the file in force.

Review profiles

Profile Reports
chill Critical issues and clearly important should-fix issues; suggestions rarely.
balanced Verified critical and should-fix issues, and a few valuable suggestions.
assertive Every verified should-fix issue and up to three suggestions. Small PRs still get a full (non-light) pass.

instructions.md

Plain markdown that every review of this repository reads. Write it for a senior engineer joining the project who needs to review a PR tomorrow: what matters here, what tends to go wrong, and which conventions are deliberate.

# Reviewing the Lleverage app

- Every tRPC procedure that reads organisation data must go through `organisationProcedure`;
  a plain `protectedProcedure` on org data lets one organisation read another's.
- Money is stored as integer cents. A float anywhere in billing ends in invoices that are a cent out.
- We deliberately use `void promise` for fire-and-forget analytics; do not flag it.

Good instructions are specific, testable and explain why. Avoid style preferences that a linter could enforce: put those in the linter.

Say what goes wrong when the guidance is broken, not how severe a violation is. Instructions and rules tell Cerbie what to look for and what a violation leads to; they don’t set a finding’s severity. Wording such as “Severity for violations: should_fix” is read as what your team cares about, and each violation is still graded by its own consequence and reach (see Severity): a dropped authorisation check holds the merge, a leftover local style is a suggestion. To give every violation of a policy one severity, write a check.

Nested instructions: apps/billing/.cerbie/instructions.md applies only when files under apps/billing/ change. This keeps area-specific knowledge next to the code it describes.

rules/*.md: guidance scoped by path

Use rules for guidance that only applies to some files. The frontmatter paths (or applyTo, for Copilot compatibility) takes globs:

---
description: tRPC handlers
paths: ["apps/app/src/server/api/routers/**/*.ts"]
---
- Input must be validated with zod at the procedure boundary.
- Never return Prisma models directly; map them to an API type so new columns don't leak.

A rule is included in a review only when at least one changed file matches its paths. Like instructions, a rule doesn’t set the severity of its violations; only a check does.

checks/*.md: custom checks

A check is a rule your team wants enforced on every relevant PR and reported separately, such as “migrations must be backwards compatible” or “new endpoints must have rate limiting”. Each check file becomes its own GitHub check run named Cerbie (<title>), next to Cerbie (Review), so you can see at a glance which policies pass, and make important ones required in branch protection. (Before 2026-10-10 they were named Cerbie: <title>; a branch protection rule that requires one by that name needs updating.)

---
title: Migration safety
description: Database migrations must be safe to deploy while old code is running
include: ["packages/db/prisma/migrations/**"]
exclude: []
severity: critical        # severity of each violation: critical | should_fix | suggestion
conclusion: failure       # check-run conclusion when violated: neutral (default) | failure
enabled: true
---
Fail when a migration:
- drops or renames a column or table that the currently deployed code still reads;
- adds a NOT NULL column without a default to an existing table;
- creates an index on a large table without `CONCURRENTLY`.

Pass when the migration is additive, or when the PR description explains the multi-step rollout.
Field Default Meaning
title file name Check-run name (max 60 characters). Review (any case) is reserved for Cerbie’s own check run: a check with that title is reported as a configuration problem and gets no check run, though its findings are still in the review.
description — One line shown in the dashboard.
include ["**"] Globs of files the check applies to. The check runs only when a changed file matches.
exclude [] Globs to leave out.
severity should_fix Severity of each violation in the review.
conclusion neutral neutral reports problems without blocking. failure fails the check run, which blocks merging if the check is required in branch protection.
enabled true Set to false to switch a check off without deleting it.

Write the body as pass/fail criteria. Checks are for team policy. Don’t duplicate general bug-finding, which every review already does.

escalation/*.md: high-risk changes

Some changes need a sign-off from a particular team before they merge: authentication, secrets, billing, deployment controls. Each file in .cerbie/escalation/ describes one such category of change, and escalation in config.yaml says what Cerbie does about it:

mode Effect
off (default) Nothing. Category files are read, and @cerbieai config shows them and any problems with them, but reviews are exactly as they would be without them.
advisory Changes to a category’s paths get a deep review with a security pass, as with paths.risk (documentation and test-only changes still get a light one). A high-risk PR is labelled, the approvers team is asked to review it, and its review explains why (below). Cerbie approves as usual. The Approver sign-off check reports, but never blocks.
enforce As advisory, and the Approver sign-off check fails a high-risk PR until an approver approves its head. Cerbie’s own review, approvals and verdicts are the same as in advisory: the check is the gate.

approvers is the team, as org/team-slug, whose approval a high-risk PR needs; a leading @ is fine. With mode on and no approvers, Cerbie reports a problem. label (default risk:high) is the label for high-risk PRs.

A PR is high risk once a changed file is in a category’s fixed paths, or someone puts label on it, and it stays high risk for the rest of its life. While mode isn’t off, after each review of a high-risk PR Cerbie:

Someone adding label makes the PR high risk straight away, and Cerbie asks the team then. If someone outside the team removes it while the PR is high risk, Cerbie puts it back. If a member of the team (other than the PR’s author) removes it, that clears the label’s part of the classification: a PR that was high risk only because of the label no longer is, but one with a changed file in a category’s paths stays high risk, and Cerbie puts the label back. Cerbie keeps a record of every trigger, the cleared ones included.

---
title: Identity and access
iso_controls: ["5.15", "8.5"]
paths:
  - "packages/auth/src/**"
  - "apps/app/src/server/api/trpc.ts"
  - "!**/*.test.ts"
  - "!**/test/**"
---

Who someone is and what they can reach: sign-in, sessions, tokens, roles and tenant isolation.

## Escalate when

- A route becomes reachable without authentication.
- A permission check or tenant filter is removed, loosened or bypassed.

## Not on its own

- Tests, fixtures and documentation.

## Approver checklist

- [ ] Every new or changed entry point authenticates the caller and checks the organisation.
- [ ] Failure paths deny access rather than allow it.
Field Default Meaning
title — Required. The category’s name (max 80 characters). Its id is the file name, so this one is identity-access.
iso_controls [] Controls the category evidences, for audit records. Quote them: unquoted, YAML reads 8.10 as the number 8.1.
paths — Required. The category’s fixed paths, below.

paths use the format of a .gitignore file, which is also the format of the file patterns in a GitHub ruleset’s required reviewers, so the same list can go in both. Patterns apply in order, and the last one that matches a file decides: a pattern starting with ! takes back files that earlier patterns matched, and a later pattern can take them back again. A pattern with a / at the start or in the middle is relative to the repository root; one without, such as CODEOWNERS or *.pem, matches at any depth (/CODEOWNERS matches only the root one). * matches within a directory and ** across any number of them, and a pattern that names a directory covers everything in it. Braces and other extended globs aren’t supported, as in .gitignore. Every list needs at least one pattern without !.

The body has a short description of the category and three sections, matched by heading (in any case):

Problems are reported per file, like checks, and never affect the other files. A file whose frontmatter is invalid is left out; one with a missing or unknown section is kept, since its paths still apply. While mode is off, problems show only in @cerbieai config and the dashboard, not in reviews.

The Approver sign-off check

While mode isn’t off, Cerbie puts a check run named Approver sign-off on each PR’s head, separate from its review’s check. It is worked out again from scratch whenever something it depends on changes: a push, the label added or removed, a review submitted or dismissed, each Cerbie review once it has recorded what it found, and every 15 minutes for open PRs that changed since (in case GitHub didn’t deliver an event). Nothing about it is stored; each time it reads the PR as it is.

PR advisory enforce
Not high risk neutral: would pass success
High risk, with an eligible approval of the head neutral: would pass, naming the approver success, naming the approver
High risk, without one neutral: would block, and why failure: approver sign-off required
Cerbie’s escalation check didn’t finish on the head, without an eligible approval neutral: would block failure: escalation not verified

An approval is eligible when its author is in the approvers team, isn’t the PR’s author, didn’t push the head commit to the PR’s branch, didn’t write or commit it, and approved that commit itself. No app’s approval counts, Cerbie’s included. A reviewer’s latest review is the one that counts: a later request for changes, or a dismissal, takes their approval back. A push needs a new approval of the new head. In advisory mode the check is neutral whatever it finds, and GitHub treats a neutral check as passing, so it never blocks a merge.

Who pushed the head comes from GitHub’s own record of pushes to the branch (the repository activity API, which needs the App’s existing read access to repository contents), read each time the check is worked out: everyone whose push, force push or branch creation made the commit the head counts, so a branch reset to an earlier commit excludes each person who pushed it. For a PR from a fork, that is the fork’s record. If the record can’t be read, has no push of the head, or is longer than the 500 entries Cerbie reads, no approval of the head counts and enforce fails the check: “Couldn’t verify who pushed the head”. The head commit’s author and committer (as GitHub links them to accounts; a rebase makes whoever rebased the committer, and GitHub’s web-flow committer is ignored) are excluded too. As defence in depth, keep the branch ruleset’s pull request rule requiring approval of the most recent push by someone other than the pusher (require_last_push_approval).

Until a review of the head has recorded the PR’s classification, the check knows only what earlier reviews and the label recorded. A review that carries or reuses an earlier one, or reviews only what changed since it, keeps that review’s escalation check: if it didn’t finish, the head stays unverified until a full review’s check does, or an approver signs it off. A chain of more than 100 such reviews counts as unverified. A changed file in a category’s fixed paths is covered meanwhile by the ruleset’s required review below.

At the switch to enforce, add Approver sign-off as a required status check in the default branch’s ruleset (Cerbie’s app as its source), alongside the existing ones. Until it is required, a failing check is only a warning. Add it at the switch, not before: in advisory mode it is neutral, which passes.

With a merge queue, the required check has to report on each commit the queue builds as well as on the PR’s head, or the queue waits for it until it times out. Cerbie hears of those commits from the push to the queue’s branch (gh-readonly-queue/<base>/pr-<number>-<sha>) and puts the PR’s result on them, and it brings them up to date whenever it works the PR’s check out again while they are in the queue. This needs nothing beyond the App’s existing push event; if your App is subscribed to merge_group, Cerbie handles that event the same way. Re-running the check from GitHub works it out again.

GitHub keeps one check of a name per commit. When a commit is the head of more than one open PR, Cerbie asks GitHub which open PRs have it as their head each time it writes the check, works out each one’s result with the settings at its own base, and writes the strictest (a failure, then neutral, then success), naming each PR’s result. Every write to a commit’s check, whichever PR or event asks for it, reads and publishes one after another, so a PR that needs a sign-off keeps the commit failing however the writes interleave. When a PR moves to another commit or closes, the check on the commit it left is worked out again from the PRs still on it. A PR’s merge-queue commits are its own, so they always carry its own result.

Keeping the ruleset in step

Cerbie’s escalation works alongside a GitHub ruleset on the default branch whose pull request rule requires a review by the approvers team for the same paths (required_reviewers), so those paths need the team even if Cerbie is down. cerbie ruleset prints that required_reviewers value from your clone’s category files (CLI docs); an organisation admin applies it.

While mode isn’t off, Cerbie compares the two. It reads the default branch’s rules (with the App’s read access to repository metadata), takes the file patterns of each required review by the approvers team, from every ruleset on the branch, and compares them with what cerbie ruleset prints: every category pattern that isn’t a negation, then every negation, each once. Two patterns count as the same only if their text is identical; Cerbie doesn’t work out whether different patterns cover the same files, so /src/** and src/** differ. It reports:

The order of the other patterns doesn’t matter.

A difference is a warning only, never a hold or a block. It shows as one line under the coverage table of reviews of PRs to the default branch, and in full on the repository’s page in the dashboard. Reviews make no extra GitHub request while mode is off. If the rules or the team can’t be read, the dashboard says so and reviews say nothing.

The audit record

While mode isn’t off, Cerbie keeps a record of each high-risk PR for audit evidence:

Within the hour after a merge, Cerbie checks from GitHub whether an eligible approval stood on the merged head: from a member of the approvers team who is neither the PR’s author nor whoever pushed the head, on that exact commit. No app’s approval counts, Cerbie’s included. It checks again until a check runs 30 minutes or more after the merge, so a trigger a review records as the PR merges still counts. A failed check is tried again the next hour. A PR merged without an eligible approval is flagged; nothing is blocked or undone. Who pushed the head comes from the push’s webhook, so it is best effort, and the record says where it came from.

The dashboard’s Escalations page lists the records with filters for repository, date range, category and status, and exports them as CSV, one row per PR. Each export is written to the audit log. The repository page shows the escalation mode, approvers, label, categories and any problems with the category files.

Built-in behaviour worth knowing

Commands

Comment Effect
@cerbieai review Review new commits now (incremental).
@cerbieai full review Review the whole PR again from scratch.
@cerbieai pause / @cerbieai resume Stop or restart automatic reviews on this PR.
@cerbieai resolve Close all Cerbie threads. Tidying up only: it doesn’t clear findings or change the verdict.
@cerbieai config Show the effective configuration, the escalation mode, approvers and categories, and any problems with them.
@cerbieai help List commands.
@cerbieai <question> Ask anything about the PR; Cerbie answers with the code in hand.

Commands are accepted from the PR author and from organisation members or collaborators.

Another GitHub App’s bot is ignored unless the repository names it in reviews.command_bots, by the login GitHub shows for its comments (my-agent[bot]; a leading @ is fine). GitHub gives a bot no membership to go by, so writing the PR isn’t enough: an unlisted bot’s comments get no answer, on the PR or on a finding’s thread. A listed bot’s @cerbieai commands are taken as a member’s, and its replies on Cerbie’s threads are read like anyone’s; Cerbie answers at most three times on a thread, whoever replies, so two bots can’t keep each other talking. Three things stay with people: a bot never accepts a risk or defers a finding, whether or not the repository names its risk acceptors (see Replies), anything it teaches Cerbie (@cerbieai remember, or a learning taken from its reply) waits for approval on the dashboard, and Cerbie never answers its own comments. List only bots you would take a command from as you would from a member: whoever can make the bot comment can ask for reviews, pause them, and argue a finding. The list is read from the base branch, so a PR can’t add the bot that comments on it. An entry that isn’t a bot’s login is reported as a configuration problem, and the list still applies without it.

Severity

Severity says what the author has to do with a finding:

The verifier settles each finding’s severity from two judgements: its consequence (what goes wrong) and its reach (how readily ordinary use, or any attacker, gets there). A fixed table maps them, so the line between holding the merge and a follow-up falls in the same place on every review:

Consequence Ordinary Plausible Rare
Security (exposes data, grants authority) critical critical should fix
Data loss, or a flow the user cannot complete critical should fix suggestion
Wrong result should fix should fix suggestion
Degraded (works, with friction) should fix suggestion suggestion
Quality (no behavioural defect) suggestion suggestion suggestion

A wrong result means it ends wrong even if nothing errors (a stale status, items silently missing); degraded means the user still ends up with the right outcome. Violations of a repository check keep the severity the check sets: the verifier only decides whether they are real. Nothing else fixes a severity. A violation of an instruction or rule, and a requirement of the ticket the change leaves unmet, are graded by what is actually left in the code. Take a migration to a shared button that its ticket says is complete: a Delete action that lost its destructive look is a wrong result and holds the merge, while a leftover local size or spacing override, where the button still works and reads correctly, is quality, so a suggestion that lists every remaining place.

Plausible means realistic but needing a specific sequence, timing, data shape, configuration or rollout state; rare means several unlikely conditions, or a path nothing reaches yet.

Verdicts

Like a human reviewer, Cerbie either approves or requests changes; there is no in-between.

Verdict When GitHub effect
✅ Approved No open findings Approval, without a comment (the review is in the check run and on the run page)
✅ Approved with comments Only non-blocking findings (below block_on; suggestions never block) Approval, with the findings as comments
🔴 Changes requested An open blocking finding (block_on, default critical and should-fix) Request changes
⚪ Review incomplete A required review stage failed and nothing blocking was found Comment; never an approval

The fast path to approval. A block clears once Cerbie has cleared every blocking finding: after a push (the incremental review re-checks earlier findings) or after a reply it agrees with. When the change comes from discussion, Cerbie re-reviews only the findings in question, not the whole PR. If that leaves nothing blocking, it approves (without a comment; what was cleared is listed in the check run). The approval replaces its earlier “changes requested” on GitHub, so those are left as they are rather than dismissed one by one; only a comment that no longer blocks (an approval held for a human, or findings left to a person) dismisses them, since a comment replaces nothing. Approvals still follow the approval settings below.

The Cerbie (Review) check run mirrors the verdict: failure for changes requested, neutral for incomplete, success otherwise. Make it a required check to gate merging on Cerbie.

Approval doesn’t wait for CI. Cerbie reads CI status as context but doesn’t wait for it: it can approve while the head commit’s CI is still running, and a CI failure afterwards doesn’t retract the approval. Keeping broken builds out of the base branch is the job of your own required CI checks in branch protection. Requiring only Cerbie (Review) gates merging on Cerbie’s verdict, not on CI, so require your CI checks alongside it.

Learnings

Cerbie also learns from the team. When a developer explains in a thread why a finding doesn’t apply, and Cerbie agrees and withdraws it, Cerbie can record the general fact behind it as a learning for that repository. You can also teach it directly with @cerbieai remember <fact>, or add a learning in the dashboard.

Learnings from people with write access take effect immediately. Others are proposed and wait for approval on the dashboard’s Learnings page, where anyone signed in can approve or reject them and admins can delete them. Approved learnings are included in every future review of the repository, and organisation-wide ones in every review.

Facts that belong in version control (conventions, architecture) are better added to .cerbie/instructions.md or .cerbie/rules/ in a PR, so they are reviewed like code. Learnings are for the small, discovered facts that would otherwise be lost in PR threads.

Cerbie also proposes suggested guidance changes as learnings, once an hour. It proposes one when, over the last 14 days, its reviews raised the same concern on two or more pull requests in a repository, or relied on .cerbie guidance (a rule or check) that coding agents can’t see on two or more pull requests. The proposal drafts the line to add to the repository’s AGENTS.md and says why it was suggested. Cerbie doesn’t open a pull request, so copy the text in yourself if you agree. Approving it also makes it a learning reviews use, as with any other. Each concern or rule is proposed once per repository: a pending, approved or rejected proposal is never made again, and deleting one rejects it.

Edit this page on GitHub ↗