One Source of Truth
What building Whorl taught me about storage for multiplayer agents
I've spent most of the last few months on where Whorl's files live. It sounds like a boring problem, and it turned out to be one of the hardest in Whorl. I want to write down what I learned, partly because it changed how I think about agent systems, and partly because I suspect a lot of people are about to hit the same problem. If you're building anything where more than one agent, or more than one person, works on the same material at the same time, I think this is worth knowing even if you never build it the way we did.
I'll try to be honest about the wrong turns. Most of what follows is a sequence of reasonable decisions that each failed for a reason I should, in retrospect, have seen sooner. I don't think that makes them stupid decisions. I think it makes them the natural ladder that anyone climbs when they start from the tools they already know, and the most useful thing I can do is describe the rungs.
A note on scope: this is about one product and one set of constraints. I'll make some general claims, and I'll try to flag which ones I'm confident about and which are closer to hunches.
1. The problem: work that is shared, not passed around
Whorl is a multiplayer workspace where teams and agents do their work together. Today, everyone works in a silo with their own AI assistant and passes documents back and forth. In Whorl, the unit of work is shared: instead of emailing a statement of work as a PDF, you share the Thread that wrote it, and a teammate tells the agent what to change.
That one decision changes what storage has to do. A Thread is a durable conversation with its own agent, its own working environment, and, often, its own subagents running in parallel. A Space (a team, a project, a company) might have dozens of Threads active at once, each with a sandbox, each reading and writing the same folder of documents. People are in there too, uploading spreadsheets, editing notes, renaming folders.
So from the beginning I knew we needed something like a shared drive. The question was what kind.
2. First attempt: Git
My first bet was Git, and I still think it was a defensible one.
There are now several companies that will host Git repositories for you and let you create them programmatically, by the thousands, through an API. We used one of them. You get all of Git's semantics for free: branches, commits, history, diffs, merges. This is roughly the pattern app builders like Lovable and Bolt use for projects that live inside their systems rather than in a customer's GitHub, and for code it works very well.
The obvious objection was that Whorl is built for people who aren't engineers. Nobody in a sales team should have to understand branching, committing, or pushing. So we hid all of it. Each Thread worked on its own branch. When a run finished, a sync engine brought that branch's changes into main. Commits and pushes happened automatically. And when two Threads collided and produced a merge conflict, we didn't show the conflict to anyone. We forked a subagent from the parent session, handed it the conflict, and let it resolve the merge and push to main.
I'll admit this felt clever at the time. It was also, in hindsight, a warning sign. When the normal path through your system needs an AI to resolve merge conflicts that no person asked for, the abstraction is wrong for the job.
The deeper problem was that Git's model of change doesn't fit most of what Whorl stores. Git is built around text and lines. It knows how to merge two edits to a source file because it can line them up and see whether they touch the same lines. It has no idea how to merge two edits to a spreadsheet, a slide deck, a PDF, or a Word document. To Git, those are opaque blobs, and the only possible merge is "pick one." The vast majority of what people store in Whorl is knowledge work, not code. We were paying the full cost of a version control system whose central capability, merging, didn't apply to most of our data.1
So we removed Git from Files. It's a great tool for code. It was the wrong tool for a shared drive.
3. Second attempt: object storage, copied into every sandbox
The next idea was the one most people would reach for. Put everything in a bucket and give each sandbox a copy.
That's what we built. Each Space's files lived in Cloud Storage, with every version kept. When a Thread's environment started, Whorl copied the Space's files onto that Thread's own disk, followed later changes as they happened, scanned the disk after the agent worked, uploaded what changed, and ran a three-way merge to reconcile the agent's copy with whatever had changed upstream in the meantime.
This works, in the sense that nothing is lost. But in a multiplayer product, a change one Thread makes doesn't exist anywhere else until it's saved, uploaded, and copied back into every other sandbox that wants it. If an agent writes a file and the run is interrupted before the save, that file is stranded on one sandbox's disk. And the cost of starting work grows with the size of the Space. One production Thread in November asked for its environment 72 milliseconds after its run was admitted, before the first model request, and then tried to download 341 files into it. Even a run that only needed to read a file had to wake an environment to copy the files in first.
By the end, about 1,400 lines of our code existed purely to move files in and out of sandboxes and reconcile the copies: copying in, following changes, placing files, relaying uploads, signing downloads, and the three-way merge.
What we wanted was for every change to a file, by a person or by an agent in any Thread, to be visible to everyone else in the Space immediately, without anybody having to save it.
4. This is a replication problem, and replication is expensive
It took me longer than I'd like to admit to name the problem correctly. Once every sandbox has its own copy of the files, "make changes show up everywhere" is a replication problem. And replication, done properly, is one of the genuinely hard problems in distributed systems.
A Space is the root of a graph. Under it are Threads. Under each Thread are its subagents, and in many cases each of those has its own sandbox, its own disk, and its own copy of the files. Every node in that graph is a replica. When any node writes, the change has to travel along the edges to every other live node.
A few properties of this graph make it worse than it looks.
The cost is multiplicative. The work is roughly the number of writes times the number of live replicas. Agents write a lot, and they write in small pieces: append a line to a note, update a JSON file, regenerate a summary. Each tiny change fans out to every active sandbox in the Space. Add a Thread and you add a replica that every other writer now pays for.
The graph is constantly changing. Sandboxes start, pause, resume, and die. A replica that's asleep when a change goes out has to catch up when it wakes, which means you need to know what it missed, which means you need versions or a log. A replica that's starting up has to receive a full copy before it can receive incremental ones. Our sandbox provider at the time, Boat, gave each sandbox a persistent VM with its own disk, and its file API writes into one sandbox at a time, up to 5 MiB per call, waiting up to a minute if the sandbox is still starting.2 That's a perfectly good API for putting a file into a sandbox. It's a painful way to keep every sandbox in agreement, because now you own the fan-out, one call per file per sandbox.
Concurrent writes need a referee. If two replicas change the same file before hearing about each other's change, someone has to decide what the file now says. That's the three-way merge again, now running everywhere, on file types that mostly can't be merged.
If you keep going, you discover that you're building a multi-master replicated database, with a change log, catch-up for lagging replicas, conflict resolution, and the rest, except the database's API is "the Linux file system" and its clients are agents running arbitrary bash. That's a research project, not a feature. And even a perfect version of it does a great deal of work to deliver bytes to sandboxes that will never read them.
At some point it became very obvious that we were solving the wrong problem. The question wasn't how to keep many copies in sync. It was why there were many copies at all.
the wrong problem5. Where the truth lives
Archil, the company we ended up building on, has written a careful guide on this exact question, and its framing helped me a lot.3 Every storage system has to decide which machine is allowed to answer a read or a write without asking anyone else. Three demands pull on that decision:
- Speed wants the answer to come from the machine doing the work, the way a laptop's kernel answers file calls from memory.
- Safety wants copies on other machines before anyone is told a write succeeded, because in the cloud, losing a machine is routine.
- Sharing wants a single authority. If two machines both create
hello.txtin the same folder, only one can win, and only a place both requests reach can decide which.
Each demand is reasonable alone, and together they conflict. A sandbox's own disk is fast but neither safe nor shared. A network file server like NFS is safe and shared but makes every file creation wait several network round trips, which turns an npm install or a git clone of thousands of files into minutes of waiting.
The resolution is old. In 1988, the Andrew File System team at Carnegie Mellon had servers promise to notify a workstation before letting anyone else modify a file it had cached. In 1989, Cary Gray and David Cheriton put an expiry date on that promise and called it a lease. NFSv4 later built both ideas into "delegations," where the server lends a client the right to answer for a file until it recalls it.4 The pattern is to keep the truth remote and replicated, and to lend the right to answer to whichever machine is working right now.
This reframed the problem for me. Our copy-and-sync design had, in effect, given every sandbox its own truth and then spent enormous effort reconciling them. The alternative is to have exactly one truth and give every sandbox a fast, safe way to work against it.
6. What we built: one disk per Space
Every Space has one Archil disk. Its files/ folder holds the Space's files at their real paths. Every environment in that Space, for every Thread and every subagent, mounts that same folder. Nothing is copied in, and nothing is copied out.
Say Maya uploads Reports/q4.xlsx to the Sales Space while two Threads are working. The API writes the bytes to the Space disk. Thread A's agent runs a Python script on the spreadsheet, and the file is simply there. The script writes Reports/q4-summary.md. A second later, Thread B's agent runs cat Reports/q4-summary.md and reads it. Nothing was saved, uploaded, or fanned out. The change was never sent to Thread B's sandbox, because Thread B's sandbox doesn't have a copy. It has a mount of the one place the file lives.
Our prototype numbers matched that story. A file written in one sandbox, without even calling sync, was readable from a second sandbox on its next call (232 ms) and from Archil's file API (35 ms). A rename in a sandbox showed up in the API on the next listing.
What happens when two writers collide. This is the part I most wanted to get right, because it's where the old design spent all its complexity. With a single source of truth, collisions don't disappear, but they stop being a distributed-consensus problem. There is exactly one place that decides, and it decides immediately. Archil disks support a mode where many machines can write the same files at once; if two writers write the same part of a file, the last write to reach the disk wins.5 When an agent needs a folder to itself, it can check that path out, and anyone else who tries to write there is refused until it's checked back in. On top of that, Whorl keeps every version. When a person and an agent change the same file at nearly the same time, the later save becomes the current version and the earlier one stays in the file's history. We no longer try to merge a spreadsheet. We keep both and let a person, or an agent, decide.
That sounds like a step backwards from a three-way merge. I think it's the honest behavior. The merge only ever made sense for text, and for most of our files it was producing either "pick one" or a corrupted file. Making the rule simple and visible ("the later save wins, and nothing is lost") is better than a rule that's clever and occasionally wrong.
How history survives. Moving to live files meant giving up our natural save point. Previously, every change passed through a save step that could inspect it, record it, and refuse it. Now a bash command writes the shared files directly. So we replaced the save step with a recorder. Every two minutes during a run, and again when it ends, Whorl runs one command against the Space disk with no internet access, lists every file's size, time, and hash, compares that with the current version of each file in Postgres, and records each new version, attributed to the run that made it. Old versions live in a versions/ folder on the same disk, which no environment ever mounts. If an agent deletes something it shouldn't, such as another Thread's transcript, the recorder notices that a protected file is missing and puts it back. Against our prototype, the recorder's scan matched all 10,000 files in a test Space, in about 31 seconds cold and about 6 seconds with its cache.
What went away. We deleted the 1,400 lines of copy, follow, relay, and merge code, and the per-Thread manifest. Starting an environment no longer depends on how many files the Space has. And a run that only reads no longer starts an environment at all.
7. You don't always need a sandbox
Once the files live on a disk that isn't attached to any particular machine, you can ask why you'd boot a whole sandbox to run grep.
Archil's answer is serverless execution. You send a bash command to a disk, Archil starts a Firecracker microVM with that disk already mounted, runs the command, returns stdout, stderr, and an exit code, and shuts the VM down. There's no sandbox to create, keep warm, or clean up. It's billed per call, and only what the command writes to the disk outlives it.6
Hunter Leath of Archil made the argument for this. When you query a database, you send instructions to the data and get back only the answer. When you grep a remote file system, your machine downloads every file and searches it locally. What's 100 GB of transfer on a file system might be 2 KB on a database. His conclusion is that bash is the SQL for file systems: a universal language for sending instructions to where the data lives, rather than dragging the data to where the compute lives.7
For agents this is almost perfect, because a bash tool is the most general tool you can give a model. We now use exec for a growing share of what Whorl does:
- File search runs as
rgon exec. - A read-only bash command runs on exec when no environment for that Thread is awake.
- The recorder runs on exec.
- Box builds (more on Boxes below) can run on exec, with only npm and GitHub reachable.
Every exec call Whorl makes starts with internet access denied, and allows specific hosts only when a task needs them, so a command no longer needs a full environment just to be firewalled.
Exec has limits. Commands have a five-minute limit and a fixed machine size, so long-running processes, dev servers, and anything interactive still need a real sandbox. For those, we use Archil's persistent sandboxes, which are full Firecracker VMs whose root filesystem is itself an Archil disk, so they can pause with memory intact, resume later, and fork.8 Every Whorl environment now runs on them. But the default has flipped. A sandbox used to be the precondition for touching a file. Now it's something we start only when the work actually needs a long-lived machine.
8. Git, again, on our own terms
Having removed Git from Files, we still need it, because Whorl has Boxes: small apps that live in a Space, that people and agents build and change, and that run at a stable URL. Boxes are code, and for code, Git is the right model.
We originally kept each Box's code in the hosted Git provider and ran its app on Boat. Both are gone now. Each Box owns two Archil disks: a code disk holding its Git repository and a data disk for its app's data. Whorl's Git gateway speaks the normal Git protocol to agents and people, and serves each fetch and push by running git on exec against the repository on the code disk. Archil handles Git's workload well, which surprised me at first. In Archil's own benchmarks against Amazon EFS, a git checkout of an old React tag was 44 times faster and a git clone of React was 8.3 times faster, because a Git operation is thousands of small file operations and renames, which is exactly the workload delegations make local.9
The disk gives us Git-like semantics without forcing Git's model on data that doesn't fit it. Archil can checkpoint an entire disk in about 13 ms and create a writable, copy-on-write branch from that checkpoint in about 33 ms, regardless of the disk's size.9 We take a daily checkpoint of every Space disk that changed. For code, we use real Git. For everything else, we get history, snapshots, and forks at the level of the whole disk, without anyone needing to know what a branch is.
9. More than files
The last thing I'll mention is where I think this is going, with the caveat that it's further from what we've personally built.
If the disk is the durable, shared thing and compute is ephemeral, then a lot of systems that traditionally owned their own storage can be rearranged around it. Archil has an SQLite integration that lets you create any number of SQLite databases on a disk and query them serverlessly from many clients at once, including for writes, with each query counted as one call.10 This is a natural fit for agents, which tend to keep their context as a mix of files and structured data. Boxes already work this way: each Box's app keeps a SQLite database on its data disk, and Whorl keeps a copy from before each of the last ten deployments so a bad migration can be rolled back.
Archil has also published a guide for running ClickHouse with its entire data directory on an Archil disk.11 The interesting properties there are the same ones that made it work for us. There's one copy of the data, so you don't need replicas to keep it safe. Servers become replaceable: when one dies, another mounts the disk and starts with every table intact. And because a branch of the whole database takes about 50 ms, you can run a heavy analytical query or a backfill against a branch on a separate server, where it never competes with the primary.
Archil isn't faster everywhere. In those same benchmarks, EFS beat Archil on workloads that write a lot of data before a single fsync: a bulk insert of a million SQLite rows in one transaction was 6.5 times faster on EFS.9 Archil wins where agents spend their time, many small files and many small transactions, but it isn't the right home for everything.
10. What I'm still unsure about
I want to end with the parts that aren't solved, because I think they matter as much as the parts that are.
- Caches still lie for a little while. A mounted client caches folder listings for up to five minutes. A file another writer creates may not appear in a listing until that cache is refreshed. Whorl clears the cache before every command, which adds roughly 10 to 40 ms, but a single command that runs for several minutes can still see a stale listing until it ends.
- History has a two-minute gap. Between an agent's change and the next recording, other Threads see the changed file, but the file history doesn't yet. If an agent damages a protected file, other environments can see the damage for up to two minutes before it's repaired.
- We haven't load-tested the worst case. Many environments writing the same folder at the same moment is the scenario this design exists for, and we haven't measured it at scale yet.
- "Last write wins" is a product decision, not a law of nature. I think it's right for documents today. As agents get better at understanding the formats they edit, real semantic merging of a spreadsheet or a deck may become possible, and I'd want to revisit it then.
What I'd tell someone starting today
If I could send one paragraph back to myself at the start of this, it would be this. In a multiplayer agent system, the number of copies of your data is the number you should be trying hardest to minimize. Every copy is a replica, every replica needs to be kept in sync, and every sync strategy eventually turns into a distributed database you didn't mean to build. Start with one source of truth that everything mounts, make the rules for collisions simple and visible, keep every version so that simple rules are safe, and treat compute as something you bring to the data for as long as the work needs it, and no longer.
I don't think we've found the final answer. But I'm fairly confident we've stopped climbing the wrong ladder.
the right ladderNotes
-
Git can store binary files, and tools like Git LFS make large ones manageable. What it can't do is merge two concurrent edits to a binary file in any meaningful way, which is the case a multiplayer product hits constantly. ↩
-
From Boat's file API reference: Write a file. ↩
-
Archil, Why it's hard: where the truth lives and The obvious ways to build it, and where each one breaks, part of their buyer's guide to storage for AI agents. The second walks through nearly the exact ladder I describe here, from a sandbox's own disk to uploads to a mounted bucket to network volumes. ↩
-
Howard et al., "Scale and Performance in a Distributed File System" (1988); Gray and Cheriton, "Leases: An Efficient Fault-Tolerant Mechanism for Distributed File Cache Consistency" (1989); RFC 3010 (NFSv4, 2000) and RFC 5661 (NFSv4.1, 2010). Archil's guide traces this lineage in more detail and notes that every earlier protocol stopped short of letting a client create files locally, which is most of what an agent does. ↩
-
Archil docs, Sharing disks. Archil supports an exclusive mode (one writer), a shared mode (writers must check out a path first), and a conditional mode (anyone can write anywhere another client hasn't checked out). Whorl mounts Space files in conditional mode. ↩
-
Archil docs, Serverless execution. Each call runs in a 2 vCPU, 4 GiB microVM, priced at $0.05 per 1,000 calls at the time of writing. ↩
-
Hunter Leath, Bash is the SQL for file systems (April 2026). ↩
-
Archil docs, Persistent sandboxes. ↩
-
Archil, What Archil does, and where it falls short. Figures are Archil's medians from one EC2 host in us-east-1; I haven't reproduced them independently. ↩ ↩2 ↩3
-
Archil docs, ClickHouse. ↩