Skip to content
James Ross
articlePublished Updated 10 min read

Shipping a SaaS product with a fleet of AI coding agents

By James Ross

AI coding agents took a rank-tracking SaaS from an empty repository to a live subscription product in one coordinated run: seven git worktrees, one owner per path, a build wave, an independent QA wave, then fix and re-QA waves. The repository finished at 465 commits, and the method behind it is repeatable: settle every decision in a brief, keep agents in separate worktrees, and treat every agent report as a claim rather than evidence.

Seven parallel branch tracks with small robots merging into one finished product tower, depicting AI coding agents shipping a SaaS.

What did the agent fleet actually ship?

The product is a subscription rank-tracking SaaS for agencies and site owners, built end to end by AI coding agents. The stack is a pnpm monorepo: Next.js 15 App Router and TypeScript on the web side, Tailwind v4 for the interface, Prisma on PostgreSQL 16, BullMQ on Redis 7 for scheduled work, Better Auth for authentication, React Email for templates, and Vitest plus Playwright for tests. Marketing pages, the authenticated app and public report links are served from separate hosts.

That shape matters because it is not a toy: schema, billing, background workers, multi-tenant queries, reports, email, an admin console and a marketing site all had to land together. The build plan split the work into a foundation phase and seven implementation streams, with a fixed merge order behind them. It went live on 2026-11-09.

The build was not one long agent session. It was a fleet: several coding agents running in parallel, each in its own checkout, each handed a brief that named the files it owned. The lead wrote the briefs, made the architecture decisions, reviewed the output and merged. That division of labor is the whole method.

Why one git worktree per agent?

A worktree per agent turns “please don’t touch these files” from an instruction into a filesystem fact. Each agent gets a linked worktree on its own branch, so a half-written file in one stream cannot appear in another stream’s build, test run or commit.

The build plan’s Phase 1 created seven of them with the same shape:

git worktree add ../project-<name> -b feat/<name> main

Each brief then named five things the agent could not guess:

  • The worktree path and branch. The agent commits there and never pushes, merges, rebases or touches another worktree.
  • The exact paths it owned. Shared changes went to main as a small pull request first, and the other worktrees rebased.
  • A dev-server port of its own when it needed one, so two streams could run the app at once.
  • A scratch directory outside the repository, for screenshots and browser scripts, so scratch files never entered a commit.
  • Database rules. Create your own test accounts; never truncate or wipe shared tables.

That last rule is not housekeeping. Parallel test suites sharing one database produced false failures, and one cleanup helper with an unfiltered delete wiped data other suites were using. Isolation has to cover state as well as files.

The seven ownership boundaries were deliberately boring:

Worktree Owned area Sample responsibility
billing Checkout, portal, credit ledger, plan sync Subscription and top-up lifecycle, idempotent webhooks
engine Worker, provider client, matching, postback route Scheduled runs, dedupe, snapshots, settle and refund
app Auth and the authenticated routes Sign-up, invites, roles, folder and keyword CRUD, import
reports Project, folder and share pages, metrics Report layout, CSV and PDF export, share tokens
email Email worker, templates, event consumers Verification, digests, credit warnings, unsubscribe
admin Admin console Account detail, audited adjustments, queue retry
marketing Marketing routes, pricing, brand assets Public pages, screenshots, no invented social proof

Six branches from an earlier round merged with zero conflicts because ownership was strict. The rule that made it work was simple: if a stream needed a change outside its list, it described the change under NEEDS FROM OTHERS and the lead applied it at merge time.

The build wave: foundation first, then seven branches

The sequence below is the one the project plan used, and it generalizes to any product with a shared schema.

  1. Write the contract. A spec file at the repository root held the schema, the module boundaries, the locked decisions and the acceptance criteria. The plan explicitly said not to re-litigate locked decisions.
  2. Build the foundation in one session on main. Schema and first migration, seed data, every shared interface with final signatures and mocks, the app shell, the design system, Docker Compose, and CI. Nothing downstream started until this merged.
  3. Cut the independent branches from the new main. Each agent got one worktree, one branch, one port and one brief.
  4. Build the dependency-free streams alongside the foundation where possible. The API and connector streams only consumed a published contract, so their briefs said “build against a mock HTTP server” and they ran in parallel instead of waiting.
  5. Merge in dependency order, one branch at a time, with --no-ff, running the tests after each. The order was billing, engine, app, reports, email, admin, marketing. Marketing’s calls to billing used a stub until billing landed.
  6. Verify on the integration branch, not in the agents’ worktrees. Lint, typecheck, every package’s tests and a production build, run by the lead.
  7. Deploy, then start the QA wave against the deployed build.

Commits kept the Conventional Commits shape, so the log stayed searchable across seven branches (Conventional Commits).

The foundation-first rule is the one teams skip. If two agents both need a schema change, neither should invent one. Land the schema once, then branch.

What a brief has to settle before an agent starts

A brief is not a ticket. It is the set of decisions the agent would otherwise make alone, written down before the agent starts. The template that ran this build had nine sections: GOAL, WORKTREE, YOU OWN EXACTLY, GROUND TRUTH, DECISIONS, IMPLEMENT, ESCALATE, TESTS and OUTPUT.

Three of those carried most of the value.

GROUND TRUTH named the symbol, file and line to build on, and the existing pattern to mirror. An agent that has to rediscover the codebase is slow; an agent that invents a parallel implementation is worse. “Mirror the repository in src/accounts/repository.ts” produced code that looked native.

DECISIONS made every judgement call in advance: data shapes, edge-case behavior, error codes, what happens on a duplicate webhook. When a later QA report suggested a different fix, the fix brief said the brief wins over the report. That single line prevented a wave of agents from redesigning a system they had only just met.

ESCALATE gave the agent permission to stop. On a fast model, this is the highest-value paragraph in the document: it turns “guessed and shipped a defect” into “left the code compiling and asked a question”. A stop with a clear question was defined as success.

Every brief also ended with a sentinel: commit, write the result file, then print AGENT DONE <name> <commit>. One grep could then separate a finished run from a dead one.

The QA wave is a separate team

The quality gain did not come from better builders. It came from agents that were not allowed to build. After the build wave, a second set of read-only agents audited the running product, one per application area, against a single shared build.

The audit rules were strict: no repository edits, no server restarts, no production URLs. One base URL for a production build with paid APIs mocked and mail going to a local sink. Playwright ran at 1440×900 and 390×844, in light and dark. Each auditor created its own test account and data in an isolated browser context (Isolation), and reported findings as ID | P0-P3 | area | repro steps | expected vs actual | screenshot | suspected root cause file:line, followed by a “verified working” checklist.

Two details made the reports usable. Each auditor was seeded with known user complaints for its area, so it reproduced real problems instead of exploring at random. And the audit brief required a summary table first, so triage could read seven summary tables instead of a long list of findings.

On the playbook’s largest build, this wave found 49 issues across seven areas, including 5 P0 and 18 P1 — on an app whose builders had all reported success. That is the base rate to plan around: a green report means the agent ran the tests it wrote, not that the feature works.

Fix waves and re-QA

Triage is a lead job. The lead read the summary tables, decided every fix, and grouped the finding IDs into fix briefs partitioned by file ownership. Each fix agent got its finding IDs, its owned paths, and the same rule: the brief wins over the report.

Fix briefs carried one non-negotiable test requirement: a test for the fix must fail without the fix. That is the difference between a patch and a story about a patch. It also catches the failure mode where an agent “fixes” a bug by editing the test that describes it.

Then a fresh set of agents re-ran the same findings against the rebuilt app. Fresh matters: the builder has a mental model of what it meant to do, and the re-QA agent only has the reproduction steps.

Only after that did the lead run lint, typecheck, the full test suite and the production build, commit, and deploy. The pipeline is deliberately serial at the end. Parallelism is for production; the release gate is one person running commands.

Which orchestration model fits your team?

Approach Parallelism Isolation Review load Best for
One long agent session None One checkout Low per step, high at the end Small, single-area changes
Several agents in one checkout Medium Instructions only High: constant conflict triage Two or three agents on disjoint files
Worktrees plus build/QA/fix waves High Filesystem and branch Front-loaded into briefs and triage A product-sized build with a shared schema
Hosted CI with human authors only Low Branches Normal code review Teams that already have the people

Which should you choose? Use one session for a change you can describe in a paragraph. Use worktrees and waves when the work has a shared schema, more than three independent areas, and a lead who can spend the time writing briefs and reviewing output. The wave model does not remove review; it moves the review earlier, into decisions, and later, into verification. The middle of the process is where the agents run.

What broke and what we changed

The failures were ordinary engineering failures with unusual authors. Five are worth naming.

The first deploy rolled back on a hostname. The health check used the loopback name. Alpine resolved it to the IPv6 loopback, while the app listened on IPv4 only, so the check failed and the platform rolled the release back. The fix was to check the IPv4 loopback address explicitly. This had nothing to do with agents, which is the point: the fleet does not remove infrastructure surprises.

A test cleanup helper deleted shared rows. The engine tests cleaned up with a deleteMany() that had no filter. It broke parallel test files and wiped local development data. The fix was to delete only the rows the test created, by walking its own run items, plus a per-run suffix on test phrases and a per-instance prefix on mock task IDs so parallel processes could not collide on a unique key.

A server package was bundled instead of externalized. The queue library could not be bundled by the web build, so every server path that enqueued a job failed at runtime: manual runs, PDF export, admin actions. A dynamic import had hidden it for one path. The fix was to mark the queue packages as server-external and make them direct dependencies, then verify with a real enqueue rather than a type check.

A verification email broke when a renderer was externalized. Adding the email renderer to the server-external list made the dev server load a second copy of React, and sign-up verification stopped sending. The change was reverted and the end-to-end journey passed again. The lesson is that build configuration is part of the feature.

A metadata route 404’d because the framework hashed the path. The file-based social image route was served at a hashed URL, while the page metadata pointed at the unhashed one, so every page advertised an image that returned 404. Replacing it with explicit route handlers fixed it and gave integration pages their own cards. In the same pass, telling the framework to treat every user agent as a limited bot moved metadata into the head for all requests and took the SEO score from 91 to 100 (measured in the project’s QA log).

The lead caused two of the more expensive failures. Hand-resolving a merge conflict in a settings registry dropped a secret: true flag, which produced a syntax error that took down most of the web test suites in one verification run. Resolving a CSS conflict by deleting the markers dropped two closing braces that both sides shared: every test passed and the page did not render. After any hand-resolved conflict, run the build, and for anything visual, open the page.

Frequently asked questions

How many coding agents can run in parallel?

On a laptop, about four or five before the machine becomes the bottleneck. On a separate Linux machine, the same setup reached eight concurrent agents. The limit is usually memory and browser processes, not the model. Separate worktrees and a shared build server raise the ceiling; one shared database lowers it again.

Do parallel agents need separate repositories?

No. They need separate worktrees, which give each agent its own working tree and branch while sharing one object store and one history. A separate clone per agent works too, but it duplicates the repository, the dependencies and the build cache, and it makes the merge back less direct.

How do you stop agents from overwriting each other's files?

By ownership, not by trust. Each brief lists the exact paths an agent may edit, and the merge applies any cross-cutting change itself. Strict ownership is why six branches from one round merged with zero conflicts. When an agent needs a file it does not own, it reports the exact change under NEEDS FROM OTHERS instead of editing it.

What is an independent QA wave?

It is a second set of agents that audit the running product and cannot edit the repository. They work from one shared build, use their own test accounts, and report findings with reproduction steps and suspected file locations. On the build described here, that wave found 49 issues that the builders had not reported.

Can the same agent build and review its own work?

It can, and it will report success. That is the problem. A builder grades itself against its own understanding of the task, so it misses the gap between what it built and what was asked. Independent auditors, or a lead running targeted commands, are what close that gap. The playbook treats an agent report as a claim, never as evidence.

Does this method only work for greenfield products?

No, but greenfield is the easiest case because the contract can be written before any code exists. On an existing codebase the foundation phase becomes a survey phase: name the patterns to mirror, the invariants that must not change, and the files each stream owns. That work is slower and more valuable, because the cost of an agent misunderstanding an old system is higher.

How long does a wave take?

It depends on the workstream, not the wave count. A small UI fix can finish in three minutes; a foundation or integration stream takes much longer. The wall clock is usually set by the longest stream plus review, not by the number of agents. Plan the merge and verification time as real work, because it is.