Three AI agents built one app at the same time. One file kept them apart.
Keyhaven was built by three AI coding agents working in the same folder at once: the core, the mail side and the browser extension. What made it work was a contract that said who owns what, and one rule about git.

I’ll say it up front, like I did for UFO 40: Keyhaven is AI-built. I directed an AI coding assistant, Claude Code, and it wrote the code and the tests. My part was deciding what it should do, setting the rules (“only for me”, “free plans only”), testing it as a user, and saying when something was wrong.
What was new this time: not one assistant, but three, at the same time, in the same folder.
Why three
Keyhaven has three parts that barely touch each other:
- core: the vault, the crypto, the server, the web and phone app
- mail: the Worker that receives mail, the sealing, the inbox and aliases screens
- extension: the browser extension that fills logins and offers new aliases on sign-up forms
Each one is a real job on its own. Run them in parallel and it’s faster, but only if the three don’t trip over each other.
The contract
Before any of them wrote code, there was one shared file: the contract. It said:
- who owns every path in the folder, in one table
- the database tables, column by column
- every server route, and what it takes and returns
- the crypto functions everyone shares, with their exact names and arguments
- what the app hands the mail screens when it opens them: a small object with things like “call the server”, “the unlocked keys”, “show a message”, “copy this”, “go to this page”. The mail screens never reach into the app’s own code
- the shared CSS classes and colours
Then it had sections the other two filled in themselves: “Mail side” and “Extension side”, where each one wrote down what it built and what it used.
Three rules
- Only the core agent runs git. The other two write files; core commits and deploys. With one committer, there’s nothing to merge in git.
- Never edit another agent’s files. Not even a one-line fix.
- Need something changed? Write it down under “Requests” at the bottom of the contract.
What the requests looked like
The requests section turned into a small inbox between the three. Some real ones, in plain words:
- core to mail: keep the function that protects alias notes exported, because changing the master password uses it to re-encrypt them
- mail to core: keep two rules in the site’s security headers. The mail frame inherits them, and without them mail styles break and “Load images” can’t work
- mail to core: the unlocked mail key has to allow the operation that opening a seal needs
- mail to core: the live database has no tables yet; apply the migrations in order
- extension to core: add a build script for the extension, and keep its generated copies out of git
None of them could have been guessed from the code alone. Each one is a decision that lives between two owners, and now it’s written down.
When two builders share a folder, the conversation between them is part of the code. Keep it in a file.
Small things that mattered
- Tests were split by owner (
core-,mail-,ext-files). The mail side even had its own stand-in database, so its tests didn’t depend on core’s. - Shared code lives once and is copied into the site and the extension by the build. The imports were chosen so the same line works in both places.
- One crypto file for everyone. The extension uses the exact same code as the site, so a login saved from the extension is in exactly the same format.
The merge
There was no git merge, but there was integration: the moment the three parts first ran together. That produced an “end-to-end fixes” round: the mail screens’ links inside the app, the unread badge, the phone layout, the extension build. Then a “new user” round, where everything was tried as if for the first time: duplicates on import, two devices with the same name, the item editor on a phone, clearer wording for 2FA.
At version 1.0.0 that was 115 tests, all passing, plus a run-through in a headless browser on my PC: making the account, signing in with 2FA, making an alias, a mail arriving with its code found, a reply, locking and unlocking, changing the master password, the phone size, and the extension filling a login and offering a new alias.
What the tests didn’t catch
Then I opened it myself. My words at the time: “not aligned, buttons close to the border, a mess”.
Version 1.0.1 was a design pass, and only that: one spacing scale (4, 8, 12, 16, 24, 32 px), one control height, one button system, the same padding in every pane, list and reading panes lined up, settings as cards of equal rows, and a phone layout at 390 px with no sideways scroll. No crypto, server or storage changes.

(Both sides are the real versions, rebuilt on my PC from their old commits and filled with the same made-up mail.)
My guess at the cause: the contract shared class names, but not a rhythm. Three builders styling their own screens each made reasonable choices, just not the same ones. The spacing scale went into the contract afterwards.
A second round, in parallel again
Version 1.3.0 used the same idea a second time, in two steps.
First, one tester: an agent went through Keyhaven as a brand-new user and wrote a review of everything that was confusing, missing or broken. That review, plus my own list of asks, became the work.
Then three fixers at once, split by what they owned this time, not by the original three parts:
- A: the shell, the vault and settings, and, as before, the only one that ran git and deployed
- B: mail, aliases and the extension: the domain picker and address composer, the delivery status in Sent, drafts, undo-send
- C: sign-in, recovery and security: the emergency kit, PIN and Windows Hello unlock, stay unlocked, the stricter master passwords
Before B and C wrote anything, A moved code so each of them had files of their own: the sign-in and lock screens went into their own file for C, the security cards in Settings into another. The contract got a “1.3.0 plan” section saying exactly what each one hands the others. Same rules: no editing someone else’s files, requests in writing.
It ended at 213 tests, all passing, and a headless run-through on my PC at desktop and phone sizes, in both themes.
What I’d do again
- a contract before code
- one committer
- requests in writing
- and a person actually looking at it. The tests were green. My eyes found the mess.