DOCS / PULL REQUESTS
AI code review
Birch can review a pull request with AI and produce a structured markdown report — summary, issues, suggestions. Auto-review runs on newly discovered PRs when you opt in; on-demand review is a CLI command today. Both are Anthropic API features and need the ANTHROPIC_API_KEY environment variable.
What the reviewer produces
Section titled “What the reviewer produces”Each review is a markdown report headed Review: PR #N — <title> with three sections, in order:
- Summary — what the PR does.
- Issues — problems found, citing file paths and line context.
- Suggestions — improvements worth making.
The report is written to the app’s artifacts folder, under artifacts/review/<job-id>/report.md in Birch’s data directory. It’s a plain markdown file — birch review run prints its path, and any markdown viewer (or the agent in your workspace) can work from it. (A report-viewer window that renders these reports inside the app exists, but it currently has no entry point in the shipped build.)
Requirements and cost
Section titled “Requirements and cost”ANTHROPIC_API_KEYmust be set in the environment of whichever process runs the review — the app for auto-review, your shell for the CLI. Without it, starting a review fails with “AI provider is not configured. Set ANTHROPIC_API_KEY.”- Reviews run on a Claude Sonnet model chosen by the app.
- Every review is real API usage, billed to your key. A small PR is one request; a large PR is one request per chunk plus a consolidation request (see below).
Auto-review of new PRs
Section titled “Auto-review of new PRs”Opt in via Settings → AI → “Automatically review new PRs” (off by default). The pane’s own help text states the two rules: “Requires ANTHROPIC_API_KEY. Does not run on the first sync of a repository.”
- Reviews trigger when the background PR sync (roughly every 10 minutes, plus once shortly after app start) discovers PRs it hasn’t seen before.
- A repository’s first-ever sync never triggers reviews — importing a repo with 40 open PRs won’t fire 40 API calls.
- If the toggle is on but the key is missing, the sync logs a warning and skips the review instead of failing.
Failures and timeouts are retried automatically — up to 3 attempts, with a 20-minute cap per review.
On-demand review
Section titled “On-demand review”birch review run <pr-id><pr-id> is a PR number or id — URLs are not accepted here. With the app running, the review is relayed into it; otherwise the CLI runs it standalone. Output is the job status and the report path:
Completed /Users/you/Library/Application Support/birch/artifacts/review/<job-id>/report.mdWith --json you get jobId, status, reportPath, error, attempts, and chunks. Exit code is 0 when the review completed and 3 when it didn’t; the CLI reference has the full exit-code table.
How large diffs are handled
Section titled “How large diffs are handled”A diff up to 32,000 characters is reviewed in a single pass. Beyond that, Birch chunks by file:
- Per-file diffs are packed into chunks of up to 32,000 characters each (a single file larger than the cap is truncated to it).
- Each chunk is reviewed separately, with the PR title, description, and its file list for context.
- A final consolidation pass merges the partial reports into one — deduplicating overlapping issues and preserving file/line citations.
A chunked report opens with a note like “Review produced from 3 chunks (total diff size: 96,000 chars)” so you know how it was assembled.
Reading and acting on the report
Section titled “Reading and acting on the report”Work the Issues section like reviewer comments: each item cites where it applies, so you can hand the report path to the agent in your workspace and ask it to address specific findings. The report is a whole-PR pass; for a targeted patch to one reviewer comment, the per-comment Fix suggestion in Review & manage PRs is the sharper tool.
Teams notification on completion
Section titled “Teams notification on completion”Birch can post to a Microsoft Teams channel when a review completes — and when one fails or times out. Configure the incoming-webhook URL and enable the review toggles under Settings → AI; both are off by default. See Notifications.