Inspiration

AI agents can write code all day, but "the tests pass" isn't a reason to trust a merge. An agent wrote those tests too. We wanted a factory where every change has to prove itself before a person says yes. To make that honest, we pointed the factory at its own source code: Bob builds Bob.

What it does

You tell Bob, the captain, what you want. He asks one sharp question to pin down what "done" means, writes an acceptance test and locks it so only you can change it. Then he starts his Blobs, the little builders. Each Blob works in its own git workspace. It builds, gets reviewed by another Blob, fixes the findings, rebases when two changes collide, and opens a real pull request. You get one approval card per merge, with the proof, a live Preview of the new Bob and a Merge button.

How we built it

  • Captain on Pi Durable inside a Cloudflare Durable Object. Kill the server with kill -9 mid-turn, and Bob resumes and runs each tool call exactly once.
  • Models: the Claude Agent SDK on your own Claude subscription, or deepseek through the Vercel AI Gateway.
  • Memory: HydraDB stores Bob's codebase as a graph of about 2,600 nodes that link files to their tests, theorems and PRs. Bob and the Blobs search it to find the right files for each brief.
  • Reach: Composio for GitHub and other tools, Linear issues become requests.
  • Apps: a Next.js server and a native desktop app over the same conversation.

The merge gate stacks four checks: the locked acceptance test, property tests over 1,200 generated cases, mutation testing that attacks the tests themselves, and Lean 4 proofs checked by lake build. The factory's own rules are proved in Lean (16 theorems). The main one is the merge gate:

$$\forall\, s \in \text{Reach},\ \forall\, p \in s.\text{merged},\ \exists\, a \in s.\text{approvals}:\ a.\text{pr} = p \,\wedge\, a.\text{head} = \text{head}(p) \,\wedge\, a.\text{by} = \text{person}$$

Every merged PR has an approval from a person, for that exact commit.

Challenges we ran into

  • Approvals weren't pinned to commits. A Blob could push new code after you approved, and the old yes would still count. No test caught it. The Lean proof did, and that's why head_swap_refused exists.
  • Blobs collide. Two parallel requests touch the same files, so the crew had to learn to detect conflicts, rebase and get re-reviewed without a human.
  • Crashes mid-turn. Making the captain resume after kill -9 without double-running a tool call meant moving its whole loop into a Durable Object.
  • Proving live changes. Getting Blobs to write a small Lean model of their own change, and have it build, was the last thing we landed.

What we learned

Tests check the cases you thought of. Mutation testing tells you whether your tests would catch a real bug. A proof covers every sequence of events, including the ones nobody thought of. The most useful thing an agent factory can hand a person isn't more code. It's less to trust.

Results

  • 10/10 on the end-to-end walkthrough, including a mid-run server restart
  • In a live run on Bob's own repo, both requests merged at 421 s, through a real merge conflict
  • About 670 tests, with typecheck, tests and build gating every merge

Built With

Share this project:

Updates

Submission history