r/AI_Agents • u/Legal_Answer_6956 • 4d ago
Discussion Nine gates before code: how I keep multi-agent builds from drifting
I run multi-agent build pipelines for a living, and the failure I see most is not a bad model. It is drift. The requirements doc says one thing, the design says another, the schema says a third, and by the time the app is live nobody can say which step changed the intent.
The fix that worked for me is boring: put a gate between every stage, and make every later change a diff against the version a human approved.
Here is the sequence I use, and what each gate is for.
Requirements. Written by hand, approved by hand. This is the source of truth. Everything after it is derived, so if it is wrong, the gate is cheap to fix here and expensive to fix later.
User flows. One screen-by-screen journey per persona. Approve the map before any pixel exists. Most scope fights are flow fights in disguise.
Design. The home page first, because it sets the type scale, spacing and tone. Approve it, then the rest generate in parallel against that reference.
Architecture. Services, data model, auth. This gate catches the "we will add accounts later" decision before it becomes a migration.
Task breakdown. Every task names the files it touches. Two agents never own the same file at the same time.
Code review per task. The diff, not the summary. If the agent cannot explain the diff in one line, the task was too big.
Test run. Visual checks plus replay: did the screen render, did the flow complete, did the failure path fail cleanly.
Security scan on every task, not once at the end.
Release approval. A human signs off the deploy.
Three things I would not do again:
- Approve a diff I did not read, even a one-line one. The one-liners are where defaults change.
- Let an agent edit the requirements document to "match" the code. That reverses the direction of trust.
- Gate the code but not the design. Most rework I have paid for came from an unapproved design decision, not a compile error.
The trade-off is honest: you approve more often, and the build is slower than a one-prompt tool that ships something broken. I think that is the right trade for anything with a database and a login.
Question for this sub: where do you put your gates, and which one do you skip under deadline pressure?
I write about this at 8080ai, so bias noted. I am more interested in the arguments against gating than in agreement.
2
u/CapitalLog7599 4d ago
Separate file ownership avoids merge conflicts, but it won't catch two agents changing opposite ends of an API. One adds a required field to create an order; the other updates the caller without it. Both task diffs can look fine on their own.
Under deadline pressure I'd skip a separate design review for a change that leaves the user flow alone. I'd keep one test that creates the order from the actual caller against the combined diff.
2
u/Avinash2k5 4d ago
the biggest issue with 9 human gates in practice is reviewer fatigue. by the time you reach gate 6 (code diffs), human attention is shot, especially when an agent generates 400 lines of plumbing across multiple files. that is usually where rubber stamping starts happening even with the best intentions.
file level locks (gate 5) also have a massive blind spot around semantic contracts. an agent can have exclusive ownership of a service file, change a function signature or mutate global state, and silently break three other files without ever triggering a file contention warning.
what saved us a lot of headache: replace manual file ownership with symbol level blast radius checks. before the agent writes, an ast pass checks which external callers depend on the symbols it is modifying. instead of reviewing raw unified diffs line by line under deadline crunch, review the call graph diff first. if you see unexpected external side effects or new state mutations, you drill into those specific lines and skip reading the boilerplate. under pressure, the gate to skip is design polish, never the contract schema. if the typed interface holds, you can fix ui quirks later without database or state migrations.
how are you handling review fatigue when multiple agents are producing PRs faster than you can genuinely read them?
1
u/AutoModerator 4d ago
Thank you for your submission, for any questions regarding AI, please check out our wiki at https://www.reddit.com/r/ai_agents/wiki (this is currently in test and we are actively adding to the wiki)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/heyramzi 3d ago
A new module of ours once got committed without its index.ts export. It broke 2 add-ons. Builds in the same folder kept passing, because the export line was in the working copy but not in the commit. In a diff review that's hard to spot, since nothing in it looks wrong.
So we build the committed tree on its own now, in a fresh checkout, before the push. If I could keep only one gate under deadline pressure it'd be that one. We run it as a script, so nobody has to read anything.