If you are loop engineering, your repository just got a lot busier. If engineers (and others!) are shipping 100+ PRs a day that inevitably leads to an air traffic control problem. This presents in many ways, but merge conflicts, a growing PR backlog, and aging PRs are some of the clearest signals. I’m going to talk about one the crudest and most effective first solutions: Your directory structure.
Your directory structure used to be to help software engineers navigate your codebase. Whilst that isn’t out the window, you now need to accommodate a whole new set of participants.
At Pyn we structure our codebase by "app", and I think that structure matters more now that agents are doing the work. An app is a discrete domain (a single integration, say) with everything needed to realize it.
Our old layout more philosophically aligned to classic Rails MVC, with models in one tree, controllers in another and views in a third. This type of separation helps when the tech and concerns are all co-located. The simplest example is frontend belongs with frontend.
However, to complete one feature - you needed to navigate multiple trees. Flipping that was one of my first big changes for AI.
The app “domain-centric” structure pays off in four ways.
(1) Clear lanes for agents. I can tell an agent "work on this directory" and what it needs is there. Otherwise it wanders the codebase and copies whatever it finds<sup>[1]</sup>. (2) Fewer merge conflicts, and so faster merges. Agents working in different apps aren't touching the same files. When PRs collide you're back to working sequentially, however many agents you have running.
200 PRs is a normal day now, with a hard cap on open PRs, so a PR stuck on a conflict is taking up one of those slots. Shared code is where work can still collide. Keep it discrete and handle it the right way and it's a non-issue.
(3) Navigation that follows the file structure. Each package has an index.md, which gives clickable navigation through the codebase<sup>[2]</sup>.
(4) Gold templates to copy. I get one app into good shape, point an agent at it and ask for "another one of those". You do end up with some duplication, which is fine within limits. Refactoring is easy with AI, so make it a separate loop.
If you're adapting a codebase for agents, I'd start here.