Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 6 min read

Monorepos are a mistake when we work together and with coding agents

I used to think monorepos were the only sensible choice. Put everything in one place. One commit updates the backend, the web app, and the mobile clients. Everyone sees the whole world. Then I started running coding age

I used to think monorepos were the only sensible choice. Put everything in one place. One commit updates the backend, the web app, and the mobile clients. Everyone sees the whole world.

Then I started running coding agents on real projects with large teams.

The monorepo broke first.

The monorepo problem

When a human opens a monorepo, they ignore 90% of the files. An engineer working on a React screen does not care about the Go database migrations or the Swift package manifests. Their brain filters out the noise.

A coding agent does not filter anything. It reads everything you give it.

Put an agent inside a large monorepo with Go, TypeScript, Swift, and Kotlin, and three things happen quickly:

First, the context window fills up with junk. The agent searches for a pattern and finds twelve matches across four languages. It tries to fix an API call and ends up touching a mobile mock file it should never have seen.

Second, the toolchains collide. The web agent runs tests and fails because Gradle is not installed on the machine. Or the backend agent tries to run lint and trips over a broken Node dependency in the marketing site. Each agent needs the entire universe installed just to check its own work.

Third, git locks up. When two agents work on different features in the same repo, they fight over the same git index. One agent commits, and the second agent aborts because the working tree shifted under its feet.

I tried splitting the projects into separate repositories. That solved the agent noise, but it created a different mess.

The git submodule trap

The traditional way to group separate repositories is git submodules.

Do not use git submodules with coding agents.

Agents do not understand detached HEAD states. They commit changes, forget to push the child repository, update the commit pointer in the parent repository, and leave the whole team with broken references. Every rebase turns into an investigation. Every checkout requires three flags.

If a human struggles with git submodules on a Friday afternoon, an LLM agent will destroy them in thirty seconds.

So I stopped using submodules entirely.

The meta-workspace

Here is the setup I use now. I call it a meta-workspace.

The structure is simple:

workspace/
β”œβ”€β”€ .gitignore
β”œβ”€β”€ mani.yaml
β”œβ”€β”€ AGENTS.md
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ index.md
β”‚   β”œβ”€β”€ product/
β”‚   β”œβ”€β”€ architecture/
β”‚   └── engineering/
β”œβ”€β”€ backend/       (ignored by git)
β”œβ”€β”€ web/           (ignored by git)
β”œβ”€β”€ ios/           (ignored by git)
└── android/       (ignored by git)

The outer folder is a regular git repository. It holds only three things: configuration, shared documentation, and automation tasks.

The child repositories live inside ignored directories. Look at the .gitignore of the outer repo:

/backend/
/web/
/ios/
/android/

Each child folder is a standard, independent git repository. It has its own git history. It has its own branches. It has its own permissions on GitHub.

A contractor working on the iOS app gets access to the iOS repository only. They clone the meta-workspace for documentation, pull the iOS repo, and never see the backend code.

And none of them are git submodules. The outer repository does not track commit hashes of the children.

Running it with mani

To manage the repositories without submodules, I use a tool called mani.

It is a single binary written in Go. You install it with Homebrew or curl. It reads one config file called mani.yaml in the root of the workspace:

projects:
  backend:
    path: backend
    url: [email protected]:my-org/backend.git
    tags: [backend, go]

  web:
    path: web
    url: [email protected]:my-org/web.git
    tags: [web, typescript]

  ios:
    path: ios
    url: [email protected]:my-org/ios.git
    tags: [mobile, swift]

  android:
    path: android
    url: [email protected]:my-org/android.git
    tags: [mobile, kotlin]

When a new engineer or an agent joins, they run:

mani sync

It clones whatever repositories the user has access to. If someone only has access to web, they run:

mani sync --tags web

To see what changed across every repo:

mani run status

It prints a clean table showing the branch and dirty files in each folder.

The best part is task isolation. In mani.yaml, each repository gets its own test command:

tasks:
  test-backend:
    target: { projects: [backend] }
    cmd: go test -race ./...

  test-web:
    target: { projects: [web] }
    cmd: pnpm test

  test-ios:
    target: { projects: [ios] }
    cmd: swift test

A backend engineer runs mani run test-backend. They do not need Xcode. They do not need Node. They do not need Android SDK.

Why coding agents actually work here

This layout changes how coding agents perform.

When I need work done on the web frontend, I launch an agent scoped to the web/ folder.

Its world is bounded:

  • It only sees TypeScript files.
  • Its language server only indexes the web project.
  • Its test command is pnpm test. It cannot run or fail the Go tests.
  • Its git commits stay on the web repo's branch.

At the same time, I can run a second agent in backend/. The two agents run in parallel in separate terminal panes. They never touch each other's files. They never fight over git locks.

Shared domain knowledge across repositories

The hardest problem in multi-repo setups is shared domain knowledge. How do the backend and web agents agree on business logic, naming, and API contracts?

In the outer workspace, I keep a shared docs/ folder using an open documentation convention:

  1. Global index. The file docs/index.md is the root. It links to the product scope, domain glossary, and architecture decisions.
  2. Canonical ownership. Every concept has one owner. Shared business rules live in workspace/docs/. Implementation details live in <repo>/docs/.
  3. No broken links. Links between documents use standard markdown paths. A small Python script checks that every relative link resolves to a real file.

When an agent needs context on a domain term, it reads docs/product/glossary.md. Because the documentation is plain markdown in the root, agents can read it using standard file tools before switching into a child repository to write code.

The tradeoffs

This setup is not magic. It has real tradeoffs.

Atomic cross-repo commits do not exist. If a backend change breaks the web API, you cannot commit both in one git sha. You have to design APIs with backward compatibility: deploy the backend first, then update the web app. For large teams, this is good discipline anyway. For a solo hacker moving fast, it feels like extra work.

Another issue is editor setup. If you use VS Code, opening four separate repos in one window requires a multi-root workspace file (.code-workspace). If you use Zed, you can open all four folders directly in one command:

zed backend web ios android

Each folder keeps its own language server and git status in the Zed sidebar.

What I learned

Big monorepos work well when you have a dedicated developer productivity team to maintain build caches and remote execution. Most of us do not have that team.

Git submodules promise clean nesting and deliver pain.

A meta-workspace with ignored child repos and mani is quiet. It gives teams real permission boundaries, keeps toolchains isolated, and gives coding agents a clean room to work in without poisoning their context window.

I am still refining how cross-repo integration tests should run locally without forcing every developer to install every compiler. If you have a clean pattern for that, let me know.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.