Building Cryo with agents
5 min read
Cryo went from the first experiment to a public release in two weeks. The spike started on November 2. The open-source release was on November 16. By November 18 it was at 0.2.0 and running its own CI.
It was one person. Coding agents did most of the typing. This post is about how that worked, because the process mattered more than the speed.
Spike, then spec, then build
The work had three phases, and I kept them separate on purpose.
Spike (3 days). One question: can a macOS VM come back from saved state fast enough to hand out on demand? Nothing else. The agents wrote small throwaway tools: freeze a VM, thaw it, time every step, try again. The answer was yes. On my M1 Pro, a VM restored from saved state was usable over SSH in about 0.65 s, and about 0.8 s with Xcode in the image.
Spec (a few days). Once I knew what worked, I wrote down what the real thing should be: what a capsule is, every file under ~/.cryo, the bay’s API, every CLI command and flag, the CI flow. Each spec was marked agreed before any code for it was written. They are public now in docs/spec.
Build. Then the agents built the bay, the CLI, the MCP server and cryo-ci against those specs, and I ran it for real on my own Mac.
The spike code was thrown away. Only its findings were kept.
Measure first, decide second
Every decision had to point at a number from a run on a real Mac. Not a guess and not a forum post.
That rule killed a lot of plausible ideas:
- A small daemon in the guest over vsock for readiness and the clock. It worked, and the first lease path used it. Later, SSH turned out to cover the same needs, and requiring the daemon broke freezes on a Mac without it. It was removed.
- DHCP for guest addresses. It looked fine for days. Then a stale lease in the host’s DHCP database moved a guest to another address and every refill failed. Freezing now pins the guest’s IP.
- Cache disks inside the shared folder. Two of six builds hung. Cache disks stay on a hot-plugged USB disk until that is understood.
Each one was written up with the run that proved it, and the decision doc linked straight back to that evidence. When an agent later asked “why not just use DHCP?”, the answer and the evidence were one file away.
Docs are the memory
Agents forget everything between sessions. I forget most things between weeks. So everything went into docs, and the docs had rules:
- One topic per file, about 150 lines at most.
- A one-line summary under every title, so an agent can skim the folder and pick the right file.
- Every result gets a number and a date, and goes into its topic file.
- Decisions go in one file, newest first, each linking to its evidence.
- Open questions go in one list, and are deleted from it once answered.
Every session started the same way: read the index, read the open questions, pick one. That made sessions cheap to start and cheap to stop. A session could end mid-thought and the next one, with a fresh agent, picked it up from the docs.
How the agents worked
My job was mostly deciding and checking. The agents’ job was mostly reading, writing and running.
- Reading. A lot of the work was reading Apple’s Virtualization documentation and WWDC sessions. Agents are good at “find every API that touches saved state and tell me what each one needs”.
- Writing code to a spec. With the spec agreed, “implement
cryo releaseas written” is a well-defined task. Reviews were about whether the code matched the spec, not about what the code should do. - Running experiments. Most findings came from an agent running a script on my Mac, timing it, and writing up the numbers. I read the write-up and decided.
- Parallel work. Independent tasks ran in separate sessions: one on the bay, one on cryo-ci, one on docs.
Things that needed root, like installing the firewall helper, I ran myself. Agents never got sudo.
Real use finds what tests miss
Unit tests caught a lot. Running the thing caught the rest.
Some of the bugs only a real run showed:
- A signed binary overwritten in place was killed on every later launch, because the kernel caches a binary’s signature per file. Copying to a new file and renaming fixed it.
- A host key regeneration on first login made SSH miss its 2-second timeout after every refill.
- A stuck SSH login held a capsule in “refilling” for more than 10 minutes, because there was no keepalive and no time limit.
- After release, cryo-ci could not find
cryounder Homebrew, so every job failed. I wrote about that in Dogfooding Cryo.
None of these were hard to fix. All of them needed someone to use the software the way a user would.
The loop closed
Cryo now builds and tests itself on a capsule on my Mac. A push to main runs swift test and a signed release build on a bay, in 1 min 36 s against 2 min 5 s on a hosted runner. The coding agents that work on Cryo can lease a capsule from it through its own MCP server.
What I would tell someone starting
- Spike the one risky thing first, and throw the spike code away.
- Write specs agents can build against, and mark them agreed.
- Make every decision point at a measurement.
- Keep docs small, numbered and dated. They are the agents’ memory and yours.
- Install your own release like a stranger before anyone else does.
A few years ago this would have been a team project over months. It is still a lot of work, but most of that work is now deciding what to build and verifying it’s right.
The code, specs and docs are at github.com/rizwankce/cryo.