What I built
A bot that does the first code review with AI whenever a PR opens or gets new commits, and posts the result as PR comments and in Slack. It runs unattended around the clock on an in-house server, started with backend repos and grew to cover web and app repos, and became the team's standard first review.
Key work
- Detection and targeting
- polls about every 15 seconds for opened PRs and new commits, no webhook. Deny by default with an allow list, fork PRs excluded
- Isolated review
- reviews a copy of the code read-only in a container sandbox, using Claude Code in headless mode
- Second pass
- checks each first-pass finding against the code and source docs, keeps or withdraws it, then posts
- Verdicts
- PASS / WARN / BLOCK plus a risk level, from risk-map rules per stack (app, web, server)
- Incremental re-review
- new commits get a diff-only review, and earlier findings are tracked until resolved
- Two-way Slack
- start and finish notices, re-review requests and thread replies from Slack
- Locked permissions
- structurally unable to edit, commit, push or merge. High-risk verdicts still need a human merge
- Silent outage fix
- an auth refresh failure stopped reviews for three days while the process stayed alive. Added a 10-minute health check and four Slack alerts (stopped, auth failure, usage, stalled)
- Measurable quality
- normalized 22 mixed verdict spellings so false-positive and acceptance rates can be measured
- Cost analysis
- measured that the second pass never overturned a verdict while doubling cost, and scoped a redesign that always verifies only high-risk findings