Marginalia
Reviewing PRs at acme right now

Code review that shows its work.

Marginalia is a GitHub agent that reads your pull requests the way a senior engineer does — it investigates the codebase, checks your conventions, and leaves precise notes in the margins. Every finding arrives with the reasoning that produced it.

Reviews land in about two minutes. Re-run any time with @marginalia review.

acme/checkout-service · PR #412reviewing…
get_pr_diff(pr=412)
8 files · +342 −87 · core logic in services/payments/retry.py
search_code("idempotency_key")
clients/gateway.py:167  # returns cached response on key match
→ colliding keys are silently swallowed
criticalservices/payments/retry.py : 87
+ key = f"{order_id}-{int(time.time())}"

Two retries in the same second produce identical keys — the gateway drops the second as a replay. Derive from order + attempt, not the clock.

✓ Review posted to GitHub 4 findings · 2m 14s
1m 52s
median review time
62%
suggestions accepted
100%
findings with reasoning
1
comment to re-review
How it reviews

Not a linter. Not a summary. A reader.

Most AI reviewers skim the patch and pattern-match. Marginalia runs an investigation: it opens files beyond the diff, greps for the conventions your codebase already follows, and only then forms an opinion.

i.

A pull request opens

The GitHub webhook lands in seconds and the review is queued. Drafts wait until they’re marked ready.

ii.

The agent investigates

It reads the diff, opens the files around it, and searches the repo — read_file, search_code — until the change makes sense in context.

iii.

Notes land in your margins

Inline comments mapped to exact diff positions, plus one summary verdict. Critical findings block; nits never nag.

iv.

Push fixes, ask again

Comment @marginalia review and it re-reads only what changed. A clean second pass approves the PR.

What it catches

The bugs that pass tests and fail in production.

Real notes from real reviews. Each one names the evidence — the file, the line, and the convention or failure mode it’s protecting.

criticalretry.py : 87

Idempotency key derived from a timestamp — concurrent retries collide and the gateway silently drops the second charge attempt.

Found by tracing key consumption into gateway.py, not by reading the diff alone.

warningpayments.py : 52

Twelve of thirteen mutating routes carry @rate_limit. This new endpoint triggers real charges and has none.

Convention drift — the agent counted how the rest of the codebase does it first.

warningretry.py : 114

Exponential backoff without jitter — every failed client retries in lockstep. A thundering herd against your gateway.

Concurrency failure modes are invisible to tests and obvious in the margins.

suggestioninvoice.py : 203

House rule: money is integer cents. This handler does float math on a refund amount.

Enforced from your own custom instructions — quoted back so reviewers know why.

The trace

Trust is earned by showing receipts.

Every review keeps its full reasoning trace — each thought, every tool call, every file it opened. When a finding surprises you, you can see exactly how the agent got there.

  • Auditable. Nine steps, seven tool calls, three files read — all on the record.
  • Debuggable. A wrong finding shows you the wrong assumption, so your house rules can correct it.
  • Teachable. Junior engineers read traces like a senior's commentary on the codebase.
retry.py is the heart of it. The diff alone won't tell me how keys flow into the gateway.
read_file("services/payments/retry.py") · 212 lines
Confirmed — the gateway returns the cached response on a key match. A collision doesn't error; it lies.
search_code("idempotency_key") · 4 matches
That's the worst kind of bug: invisible in tests, real in production. Recording as critical.
record_finding(severity="critical", line=87)
Requesting changes — lead with the collision, credit what's done well.
post_review(event="REQUEST_CHANGES") · posted ✓
Custom instructions · acme/checkout-service
“We use structlog — flag any bare print(). Money is always integer cents, never floats. Prefer our internal retry helpers in lib/resilience over hand-rolled loops.”
Per your house rules, this handler does float math on a refund amount — invoice.py:203
House rules

Teach it your house style in plain language.

Write your team’s conventions the way you’d tell a new hire. Marginalia treats them with the same weight as its built-in checks — and quotes the rule back whenever a finding relies on it, so nobody wonders where an opinion came from.

Put a careful reader in your margins.

Install the GitHub App, pick your repos, and the next pull request gets a review that shows its work.