How to Ship 5,000 Lines of Reliable Code a Day With a Multi-Agent Architecture A developer described a three-role multi-agent coding setup (Leader, Dev, Reviewer) that ships roughly 5,000 lines of code a day by capping each task at 800 lines before review and gating merges through a `dev` buffer branch. The setup uses two automated gates — a per-sub-issue read-only review before landing on `dev`, and a full-regression release check before `main` — plus event-driven CI wake-ups and native dependency blocking to avoid polling loops. The developer also wrote a small Python check to catch pytest runs that report green while silently skipping tests. About two weeks after I started running multiple coding agents in real repositories, my normal PR workflow fell apart. I'd wake up to diffs over a thousand lines that froze the GitHub tab, AI reviewers and AI authors bouncing the same PR back and forth five times over variable names, green CI runs hiding silently skipped tests, and an agent changing a default product threshold without mentioning it anywhere in the PR. Reading 5,000 lines of diff by hand every day doesn't work. What fixed it for me was tightening both ends of the loop: capping every task at 800 lines before review starts, then running two automated gates so I only have to sign off on a handful of plain-language behavior changes before merging to main . Here's the setup I'm running now, including the 3-role split on a dev branch, the six rules that stopped review loops, and the small Python check I wrote to catch fake-green pytest runs. When an agent hands over a huge diff touching dozens of files across unrelated modules, tweaking the review prompt won't help much. The review problem usually starts upstream. My first attempt copied a standard team chart: PM, architect, frontend, backend, QA, and a separate observer agent all talking in the same issue thread. I ripped it out after a week. Every handoff added another round of summarization, so by the time code reached QA the original acceptance criteria had drifted. Agents kept @ -mentioning each other in the same comment thread, waking up three sessions at once just to acknowledge messages and re-read the repo. I stripped it down to three roles with hard file and branch boundaries: | Role | Owns | Not allowed to | |---|---|---| | Leader | Task splitting, 500/800-line caps, boundary counterexamples for risky tasks, merging into dev , running full Tier 2 regression | Write feature code, open feature PRs, merge straight to main | | Dev | Coding in an isolated branch or worktree, writing tests, running Tier 0/1 checks, pasting --shortstat counts, self-review | Push to dev or main , run amend , rebase , or force push after review starts | | Reviewer | Cross-model read-only checks at Gate 1 sub-issue into dev and Gate 2 release check on dev | Edit files, commit, push, or open feature sub-issues | Dropping the standalone observer meant moving "check for silent product changes" into Reviewer's Gate 2 pass. Gate 2 carries a bit more context now, but I don't have to pay for another agent wake-up cycle on every epic. dev as a Buffer Between Two Gates Sub-issues never merge straight into main or master . Everything lands on dev first. Gate 1 guards each sub-issue going into dev . Dev branches off dev , runs local static checks and targeted module shards 1 to 2 minutes , and gets a read-only pass from Reviewer. Sub-issues merge into dev automatically via PR auto-merge or Leader --no-ff with zero human sign-off, leaving only a ticket record if you want to check what changed. Parallel tasks don't stall behind each other waiting on slow full-suite runs. Gate 2 runs once all sub-issues for an epic have landed on dev . Leader runs the full regression suite and baseline check on dev , then hands the combined diff to Reviewer. My job is just the final dev - main merge. Running agents concurrently exposed two fast ways to burn budget: polling loops waiting on CI, and copy-pasting workflow instructions into every repo until they drift apart. For scheduling, sub-issues declare native dependencies with --blocked-by