Monorepo vs polyrepo: what each one costs once the team grows

A polyrepo pays for coordination between repositories, and a monorepo pays for tooling that keeps one repository fast. Agents raised the monorepo's bill.

Buse Senol

Editor, How They Ship · · 7 min read

Share
A large cream building with many windows held up by a teal machine of gears, beside six small separate houses linked by tangled threads

A monorepo keeps many projects in one version-controlled repository, and a polyrepo gives each project its own. Neither is free. A polyrepo pays when shared code and cross-project changes have to be coordinated, and a monorepo pays for the tooling that keeps one shared repository fast as more people write to it.

In 2026, the people writing to it started to include agents. Anthropic merged around 2,500 code changes a day in May and over 30,000 a day by September, according to its engineering blog as quoted by The Pragmatic Engineer on October 22. Gergely Orosz reports that the monorepo's working copy alone is 25GB, that CI runs about 25 million Git checkouts a day, and that about 3,000 staff typically run 10 to 15 Claude agents each. "At Anthropic, coding is no longer the bottleneck to building systems or doing research," the company wrote.

The bottleneck became the repository. Anthropic ran hundreds of Git mirrors, and once the repository outgrew their disks it could not scale any further. The company moved the entire monorepo off Git onto a system it built, called Scion, and then had to build a code review tool, Antique, because leaving GitHub also meant leaving GitHub's reviews behind. A team of seven engineers maintains all of it.

Anthropic did not split the repository into smaller ones. It paid the monorepo's bill in full, at a scale few teams will ever reach. The rest of this piece is about which bill a smaller team pays, and how to tell before the agents arrive. (The full Anthropic story is on our link page for The Pragmatic Engineer's report.)

What is the difference between a monorepo and a polyrepo?

The difference is where the cost of working together lands. A monorepo concentrates it in shared tooling, and a polyrepo spreads it across every change that crosses a repository boundary.

The table below sets the two side by side on the costs that show up as a team grows. Each cell names what a team has to pay for, not an abstract advantage.

What growsWhat a monorepo pays forWhat a polyrepo pays for
Shared codeEvery change to shared code reaches every project that uses it at once, so it has to be tested against all of themEach repository pins its own version of shared code, and the versions drift apart
A change that spans projectsOne commit, but the tooling has to find and test everything it touchesOne change and one release per repository, in the right order
CISelecting what to build and test, because rebuilding everything on each change stops being possibleMany small pipelines, each simple, with integration tested somewhere else
Version controlA server that keeps up with every writer in the company, people and agentsOrdinary hosting, because each repository stays small
Ownership and accessFile-level ownership and access rules inside one repositoryRepository boundaries, which give ownership and access for free
What breaks firstThroughput of version control and CICoordination of versions and releases

Both columns list real work. The rest of the piece follows teams that paid each one.

What does a polyrepo cost as the number of repositories grows?

A polyrepo's cost grows with the number of repositories that share code. Each one keeps its own copy of shared libraries, and keeping those copies in step is work nobody owns.

Segment's 2018 post "Goodbye Microservices", by Alexandra Noonan, followed this from both directions. Segment's integrations with outside services, which it called destinations, began as separate services in one repository. The trouble there was that "a single broken test caused tests to fail across all destinations," so an engineer fixing one destination had to fix an unrelated test first. Segment split the code into one repository per destination, and the isolation worked for a while.

Then the repositories multiplied. Segment added more than 50 new destinations, which meant 50 new repositories, and moved common code into shared libraries. Changing a shared library meant testing and deploying dozens of services, so under time pressure engineers updated it in only the one repository they were working on. "Eventually, all of them were using different versions of these shared libraries," Noonan wrote. Segment's eventual answer was to consolidate the more than 140 services into a single service.

Segment's post is about services as well as repositories, and the two decisions are not the same. The repository lesson still stands on its own. A split that removed one kind of coupling, a shared test suite, created another kind, shared code that every team updated at its own pace.

What does a monorepo cost as the team grows?

A monorepo's cost grows with the number of people writing to it. Version control, builds, tests and ownership all have to work for the whole company at once, and each one needs tooling that a small repository never needed.

Google's 2016 paper "Why Google Stores Billions of Lines of Code in a Single Repository", by Rachel Potvin and Josh Levenberg, is the best-known case for a monorepo, and it lists the bill plainly. Among the drawbacks are "having to create and scale tools for development and execution and maintain code health, as well as potential for codebase complexity." At the time of the paper's figures, in January 2015, the repository held about one billion files and 35 million commits and was used by 95% of Google's developers. Google had run it on a single Perforce instance with custom caching for more than ten years before building its own system, Piper, to replace it.

Matt Klein's 2019 post "Monorepos: Please don't!" makes the opposite case with the same bill in view. In his words, at scale "a monorepo must solve every problem that a polyrepo must solve, with the downside of encouraging tight coupling, and the additional herculean effort of tackling VCS scalability." He sets that scale at more than 100 developers writing code full time. Above it, he writes, nobody can rebuild the whole codebase and run every test on each change, which is why the large monorepos built dependency-aware build systems such as Bazel and Buck.

The two sources disagree on whether the bill is worth paying, and they agree on what it contains. The monorepo needs a version control system that scales, a build that only rebuilds what changed, and ownership rules finer than a repository. It usually needs a merge queue too, which has its own arithmetic, covered in what a merge queue costs.

Sponsored: Gitdailies — Install today. Move faster daily.

How did coding agents change the monorepo vs polyrepo decision?

Agents multiplied the number of writers to a repository, and that multiplied the monorepo's tooling bill. In 2026, three companies with large monorepos reported rebuilding what serves the repository instead of splitting it.

  • Anthropic left Git for Scion after its merge rate grew more than tenfold in four months, as described above.
  • OpenAI rebuilt the backend that serves its monorepo. In "Scaling Git at OpenAI", the company says reliability was at times falling below 90%, with slow fetches, slow pushes and failed merges. It built a new backend, Pando, in 10 weeks, kept the old system in sync so traffic could move without downtime, and cut median push latency by nearly 80%. Engineers and agents kept using Git as before. (Our link page has the short version.)
  • GitHub rebuilt its own Git storage. In "Inside GitHub's new Git storage architecture", it reports supporting 5,000 concurrent agents and 7,200 pushes per second on a single repository in internal testing.

OpenAI's team asked the question every growing monorepo eventually reaches. "Had we reached a limit of Git itself, or of the way we served our monorepo?" In both its case and Anthropic's, the answer was to change how the repository is served and keep it whole.

These are three of the largest engineering organizations in the industry, and their numbers are far from what most teams see. What carries over is the direction of the cost. Each agent added to a team is another writer, and writers are what a monorepo's tooling has to keep up with.

When does a polyrepo still make sense?

A polyrepo makes sense when the projects rarely change together and the team prefers to pay for coordination over tooling. The sources point to a few conditions where that trade holds.

Klein's strongest point is that sharing is cultural. He writes that "the efficacy of collaboration and code sharing has everything to do with engineering culture and nothing to do with code storage." A monorepo does not make teams share code, and separate repositories do not stop them. He also points out that even a monorepo ends up with several versions of the same code running in production at once, because not everything deploys at the same time.

Segment's first split shows the other condition. When one project's tests can block every other project, separate repositories give each team its own green build, and that was worth a great deal to Segment until shared code grew. A polyrepo holds up best when the shared layer stays small and stable, so that version drift costs little.

Google's paper adds a caution for anyone choosing a polyrepo for access control alone. Piper supports file-level access lists inside the one repository, so separate repositories are one way to restrict access but not the only one.

A checklist for your own repositories

The choice gets clearer once a team measures what it already pays. These checks take an afternoon and use data most teams have.

  1. Count the changes last quarter that had to land in more than one repository. If the number is high and rising, a polyrepo's coordination bill is growing.
  2. List the shared libraries and the version each repository uses. Several versions of the same library in production is the drift that Segment described.
  3. Measure CI time per change in your largest repository, and note whether it builds everything or only what changed. A monorepo that rebuilds everything will slow down as it grows.
  4. Write down who would own version control, the build and the merge queue if you consolidated. If nobody would, the monorepo's bill has no one to pay it.
  5. Count the agents your team runs, or plans to run, against the repository. Each one is another writer, and pushes and checkouts are where Anthropic and OpenAI felt the strain.

Neither answer is permanent. Segment moved in both directions, and Google, Anthropic and OpenAI each rebuilt their tooling when the old version stopped keeping up.

Frequently asked questions about monorepo vs polyrepo

Is a monorepo the same as a monolith?

They are different decisions. A monorepo is about where code is stored, and a monolith is about how it is deployed. Segment kept many separate services in one repository before it ever split them.

How big does a team have to be before the choice matters?

There is no fixed number. Matt Klein, arguing against monorepos, set his own threshold at more than 100 developers writing code full time, above which the tooling problems in this piece become unavoidable.

Does a monorepo need Bazel?

A small monorepo can do without it. A large one needs a build that rebuilds and tests only what a change affects once the repository is too large to build in full, and Bazel and Buck were built at Google and Facebook for that job.

Do AI coding agents favor a monorepo or a polyrepo?

The published 2026 cases are all monorepos, so the evidence is one-sided. In those cases agents added writers that version control and CI had to keep up with, and the companies rebuilt that tooling instead of splitting the repository.

Buse Senol

Editor, How They Ship

This blog exists thanks to the support of our sponsors:

GitdailiesQA.techAppSignalSuperlinked
Become a sponsor

Comments

Loading comments…

Subscribe

How engineering teams actually ship

A closer look at how the best teams ship. Twice a month.

We’ll email you a confirmation first. Your address is used only to send you this newsletter, and every issue has an unsubscribe link. Privacy policy

Keep reading