cd /news/ai-agents/agents-and-directory-structure · home › topics › ai-agents › article
[ARTICLE · art-177009] src=jonathannen.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Agents and Directory Structure

Pyn restructured its codebase from a Rails-style MVC layout into an app-based, domain-centric directory structure to support AI agents shipping 200 pull requests on a normal day, according to the company's account of the change. Pyn says the layout gives agents clear lanes to work in, reduces merge conflicts because agents in different apps don't touch the same files, adds an index.md to each package for clickable navigation, and provides template apps agents can copy. Pyn advises teams adapting a codebase for agents to start with directory structure.

recommendation

Scope each agent to a single domain-centric app directory with its own index.md, and keep shared code minimal so parallel agent PRs don't collide on the same files.

more in playbook: Working with AI coding agents
by read2 min views1 publishedNov 26, 2026
Agents and Directory Structure
Image: Jonathannen (auto-discovered)

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.

── more in #ai-agents 4 stories · sorted by recency
── more on @pyn 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/agents-and-directory…] indexed:0 read:2min 2026-11-26 · —