> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bbrands.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Human and AI review

> Who reviews each PR, what the AI reviews and Danibot do, and when the overrides are used.

Every PR to a protected branch goes through two complementary reviews: a **human** one, which
decides whether the change is correct and maintainable, and an **AI** one, which checks the
initiative, the code and the release against the repository's rules.

## Human review

* At least **1 approval**, including the area's **code owner** (`.github/CODEOWNERS`). Outside the
  merge gates the code owner is **Danibot**, which approves once every control passes; GitHub asks
  no team for that review, so open the PR or ask to be requested if you want to review it.
* Every new push **dismisses the approvals** and requires the last push to be approved.
* Every thread must be **resolved**.
* Merge gates (`.github` and the policy scripts) can only be approved by someone on the
  architecture team.

### Good practices for reviewers

> [card] One review, every comment
>
> Use "Start a review" and submit it complete. Each round costs the author a push and a full CI
> run.

> [card] Blocking or suggestion
>
> Mark what is blocking and what is a suggestion that can go in another PR.

> [card] Review by level
>
> At Level 3, review the sub-PRs thoroughly. The final PR is reviewed for integration, not line by
> line again.

> [card] Respond quickly
>
> A PR waiting for review piles up conflicts and rebases. Prioritize reviewing over starting new
> work.

## AI reviews

| Review | When it runs | Does it block? |
| - | - | - |
| `Initiative review (AI)` | PRs to `develop` that are ready for review, also when the description is edited | Yes, through the Review gate |
| `Code review (AI)` | PRs to `develop` that are ready for review; reviews by area and incrementally | Only when the repository enables it; until then, in shadow mode |
| `Release review (AI)` | `develop → release` PRs | Yes, through the Review gate |

* The AI reviews **do not run on drafts**. That is why, before marking a PR ready, you run
  `pnpm initiatives:review` locally once and fix everything it reports.
* Every PR has a review **budget**. If it runs out, an admin or maintainer can add
  `ai-review-budget-override`.
* `ai-review-full` requests a full review instead of the incremental one.

### Run the initiative review locally

`pnpm initiatives:review` needs an AI key of your own: one from the team's **Vercel AI Gateway**
(the engine CI uses), named after you, or your own **Cursor** API key. The repository never stores
a key and CI's credentials stay in GitHub.

* Keep the key in your 1Password vault and pass it per command with `op read`, or put it in the
  gitignored `.env.local` at the root of the main checkout, which every worktree also reads.
* The command picks the engine from the key it finds, reads the model lists from the repository
  through `gh`, and prints the engine and models it uses, never the key.
* The variable names and every step are in `CONTRIBUTING.md`, section "Local initiative review".

> [!WARNING]
>
> Without a key the command stops with exit code 2. Mark the PR ready anyway: `Initiative review
>     (AI)` runs in CI and the Review gate waits for it. Write in the PR that the local review did not
> run, so reviewers expect the first findings in CI.

## Review gate

The Review gate waits for the required AI reviews to finish on the **latest commit** (up to about
50 minutes on `develop` and 90 on `release`). The gate script is read from the base branch, so a
PR cannot weaken it.

If the gate fails for a reason unrelated to the change, an admin or maintainer can add
`review-override` **after** the failed run.

[Arrives in Wave 3](https://docs.bbrands.io/bbrands-lab/pull-requests/waves-roadmap.md)
The Review gate completes when a review finishes, instead of waiting and polling every 30 seconds.

## Danibot

Danibot is the automation that closes the loop:

* It posts pinned comments with the status of the checks and reviews.
* It moves the PR to draft, or marks it ready again, when Initiative Check asks it to.
* It **approves the commit** when every required check is green, and withdraws the approval if
  something fails, if the PR goes back to draft or if `do-not-merge` appears.
* It does not take commands: it reacts to the workflows.

[Arrives in Wave 1](https://docs.bbrands.io/bbrands-lab/pull-requests/waves-roadmap.md)
Danibot does not start after a run GitHub skipped, such as those of a draft.

[Arrives in Wave 3](https://docs.bbrands.io/bbrands-lab/pull-requests/waves-roadmap.md)
Danibot moves out of GitHub Actions to a webhook.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.