How I built the Strata prototype with Claude Code
26 November 2026, updated 30 November
On 19 November 2026 I wrote the first prompt. Five and a half days later, on 24 November, I released v0.1: a self-hosting compiler written in Strata, built and installed with no Rust at all. The language was fully working at v0.1 and I was very happy with it. The two days after that were fast iterations on top of it, up to v0.3.4. Claude Code wrote the code. I did the design, set the direction and checked the behaviour, across about 80 sessions, often five to ten at once. I never looked at the code: I worked only in the chat.
I went into this expecting a prototype: a way to find out what the language should be, and whether agents could build it. I didn't know yet how much of it I would keep. I've now decided to rebuild it from scratch, and this time to look at it in much more detail.
| Pull requests | 527 opened, 518 merged |
| Rust written, then deleted | about 67,000 lines |
| Strata today | about 119,000 lines of compiler, 30,000 of std and core |
| Releases | v0.1 (24 Nov) to v0.3.4 (26 Nov), installed with curl -fsSL https://strata-lang.dev/install.sh | sh |
Timeline
Times are Paris time, counted from my first prompt (19 Nov, 05:15).
| Milestone | When | After |
|---|---|---|
| First draft in Rust: parser, type checker, interpreter, contracts, fuzzing | 19 Nov, 05:38 | 23 min |
| SMT verification (Z3) and termination proofs | 19 Nov, 22:17 | 17 h |
LLVM compiler (strata build) and JIT (strata run --jit) | 20 Nov, 22:46 | 1 day 17 h |
JIT becomes the default for run | 21 Nov, 06:12 | 2 days 1 h |
| Interpreter deleted: everything runs compiled | 22 Nov, 05:43 | 3 days |
| Rewrite in Strata starts: evaluator, printer, lexer, parser (in order through the morning) | 22 Nov, 07:36 to 09:35 | 3 days 2 h |
| Resolver and type checker in Strata | 22 Nov, 10:00 to 21:00 | 3 days 5 h |
| Code generator in Strata, first step | 22 Nov, 21:13 | 3 days 16 h |
| SMT encoder in Strata, first step | 23 Nov, 03:13 | 3 days 22 h |
Strata code generator becomes the default for build and test | 23 Nov, 14:31 | 4 days 9 h |
strata verify runs the verifier written in Strata | 23 Nov, 23:03 | 4 days 18 h |
Full bootstrap: the strata command written in Strata builds itself to a fixed point | 24 Nov, 05:02 | 5 days |
| Fixes until release: static LLVM and lld in the binary, shipped z3, caches, the test harness and the bugs it found | 24 Nov, 05:00 to 13:00 | |
| v0.1 released, Rust removed half an hour later | 24 Nov, 13:51 | 5 days 8.5 h |
v0.2.0: speed work (symbols, hashed dicts, parallel LLVM), find/refs, colors | 24 Nov, 23:26 | |
v0.3.0 to v0.3.3: high-level contracts (old, trait invariants), derive on declarations, noalloc, the ORM, fixes from the agent experiments | 25 Nov, 05:12 to 26 Nov, 00:08 | |
| v0.3.4: memory work (static uniqueness, small values in registers), loop invariants derived from code, the solver soundness fix | 26 Nov, 04:34 | 7 days |
Written proofs (lemma, assert … by, calc) merged an hour after v0.3.4 and go into the next release.
The approach: working at the level of contracts
This project was about contract-based development. When I work with agents, I try to stay at the level of how things compose: the traits, the contracts, the relationships between them, the flows, the invariants, what I want to make sure is true or false in different situations. I think about my programs as state machines, and I let the agents worry about the nitty-gritty of how you get from one state to the other. I only go down into the implementation when I really need it, for optimization or for things that need more detail.
This is a lot of what Strata is supposed to achieve. Code is stored as a tree, so it can be shown at whatever level of detail you need: interfaces and contracts by default, bodies only when you ask. Contracts and refinement types are checked by a verifier, so you can trust an implementation you haven't read. That's progressive complexity: you only see the complexity you need at the level you're working at.
For the prototype I went further than that and stayed in the chat entirely, for three reasons:
- I wanted to move fast.
- A lot of the code was likely to be replaced. The plan was a first compiler in Rust, then a rewrite in Strata, so what I cared about was that the language behaved correctly and the rewrite had a correct reference.
- I wanted to test the premise on Strata itself: improve the tools until agents can use them on a large project, this one included.
Test-driven and proof-driven development
Since I wasn't looking at the code, I cared about the functionality: that it does what it's supposed to do. With test-driven development you'd write tests for that. Here I wanted proof-driven development: state what must be true, and have the built-in proof system prove it for every input, with the built-in fuzzer covering what it can't prove. Then you don't need all sorts of tests. As I put it to one of the agents:
Ideally we don't actually use tests and we just have verifications and constraints within the Strata code. Tests should only be there for things that depend on the outside or cannot be proven, which should be a very small number of things.
Here is what that looks like in the compiler itself. compiler/unique decides when the compiler may update a value in place: only when a single variable holds it. It tracks, at each point of a function, which variables hold their value alone. This is how I want to read it, with strata view --level 1, which shows the types, docs and contracts and leaves the bodies out:
/// The state at a point of a function: `live` is false where control never
/// comes. `s` holds the variables whose value only they hold (held once,
/// and for a list, dict or set, with buffers of its own). `a` is the part
/// of `s` that holds only if the `mut` parameter of that name was held once
/// at the call (`entry`).
type St = { live: Bool, s: Set[String], a: Set[String] }
/// Where two paths meet: held once on both.
fn merged(x: St, y: St) -> St
ensures it.live == (x.live || y.live)
ensures !x.live ==> it == y
ensures x.live && !y.live ==> it == x
/// `st` with `x` no longer known held once.
fn spoil(st: St, x: String) -> St
ensures !contains(it.s, x)
ensures !contains(it.a, x)
ensures it.live == st.live
/// `st` with variable `x` given a new value, held once when `held`
/// (unconditionally).
fn set_var(st: St, x: String, held: Bool) -> St
ensures !contains(it.a, x)
ensures contains(it.s, x) == (held && st.live)
ensures it.live == st.live
The contracts say what each step means: after spoil, x is no longer known to hold its value alone; at a join, unreachable paths don't count. The bodies are the agent's work, and I don't need to read them, because strata verify proves each one meets its contract for every input:
✓ unique.merged proven (9 checks)
✓ unique.spoil proven (6 checks)
✓ unique.set_var proven (6 checks)
No test calls these functions. One end-to-end case, build-static_uniqueness, checks the full analysis on a sample program.
Proofs and tests have the same limit: they only cover what you thought of. A test checks the cases you wrote down, and a proof checks the properties you stated. Bugs outside those only show up when someone uses the thing. So the other half of the approach was to fuzz the language and its tools by putting them to work on projects.
I did it myself first: I wrote a small calculator in Strata by hand, using the tools the way an agent would, and listed every bug and annoyance I hit. Then I had agents build two larger programs, an order book and a SQL engine, once in Rust and once in each Strata release, and read through their sessions afterwards. Both gave me the bugs we hadn't thought of, and the places where the tools were hard to use:
- For me, as a human using the tools, that led to syntax highlighting in every command's output, a pager for long output, and
strata editopening my editor. - For agents, it led to documentation they can reach from the command line (
strata doc,strata view Dictwith the cost of each operation), so they look things up instead of experimenting. - For both, it found crashes and wrong behaviour in the compiler that no test or proof had covered. Those became the bug list each release fixed.
The more of the language we had, and the faster it ran, the more the agents could work correctly without me looking at the code, and the fewer bugs came up along the way. This makes me comfortable starting on the next steps.
How I worked
Design by conversation
Claude proposed options and explained the background when I needed it (how SMT solvers work, garbage-collection strategies, how Go bootstraps its compiler), and I made the decisions. A lot of the language came out of exchanges like these, lightly trimmed.
On the first morning, Claude's draft had algebraic effects:
Me: Is there really a difficulty in just passing things through? Couldn't we just pass a backend object and have different implementations of said backend? I'm guessing here it's just about not having to mention it everywhere, but that feels more like a syntactical detail than something really fundamental about effects.
Claude: You're not missing anything. For a database or any backend, passing an object is equivalent, and an effect adds nothing fundamental. … Capabilities are ordinary values of trait types, passed explicitly.
Effects went, and capabilities became ordinary traits passed as parameters. Then mutability:
Me: I never said that all values needed to be immutable. I think it can be completely fine to have procedural code with steps and state changes. Immutable by default, and you set mutable variables when you need them. It's easier for both agents and humans to read, because they're more used to procedural code.
Claude: Understood. Immutability was my over-reach. The direction is now immutable by default, mutable when you say so. … To keep the guarantees, mutation stays visible.
Unions, the same evening:
Me: What exactly is the issue with
Int | Positive? It's not ambiguous. IfPositiveisIntwith more restrictions, you take the one that's the least restrictive. And if it's a union of two refinements, it becomes an or of the clauses.Claude: You're right. I was treating unions as tagged. … Strata's refinements are already sets of values, so a union should be the union of those sets.
Int | Positiveis justInt.
Which method runs when a type has its own method and a trait's:
Me: If we're in a context where all we know is that the object is a
Describe, it should use theDescribemethod. The only place where there's ambiguity is when you know the type of the object. Otherwise its own method should never take precedence.Claude: You're right, and PR #13 gets this wrong. I shouldn't merge it as it stands.
Test doubles:
Me: I see that we've been making fake implementations of a bunch of traits for tests. Wasn't the point of
mockto not have to make these, because they get created automatically?
That one led to mock becoming the way to write test doubles, with no hand-written fakes. And dictionaries, which Claude kept giving an order:
Me: It's a dict. People shouldn't think that a dict is sorted or has a particular order. Nothing should assume that a dict has a constant order. It should be a simple hash map.
Other decisions came the same way: strings aren't iterable (you ask for bytes(), code_points() or graphemes()), errors are values and never faults, sized integers are real machine types that wrap, spawn/await with channels, old(x) in contracts, and code stored as a binary syntax tree so agents go through the checked tools instead of editing text.
Setting the order of the work
The large decisions were mine: replace the interpreter with a JIT, write the regex engine in Strata because Rust crates wouldn't exist after bootstrapping, start the Strata compiler while the Rust one was still growing, then delete Rust and ship a release that needs nothing else installed.
Running the sessions
One worktree and PR per change. I told each session what the others had merged and passed context between them with handoffs. When CI became slower than the work, I dropped it for a rule: test and verify only what changed.
Catching mistakes
Most of my corrections came from asking one more question about what Claude reported. When it said factorial was proven to terminate, I asked whether Strata's verifier had proven it or Claude had just reasoned it out. When a verify used 3 GB for one function: "Don't you find it a bit bizarre? There's probably an issue with the verify command." There was.
What Claude did
Claude wrote essentially everything: the Rust prototype, its replacement in Strata, the C runtime, the standard library, the editor support, the site and the docs. It also profiled and fixed its own slow paths, for example verifying std going from over 20 minutes to 24 seconds, and ran fleets of subagents for the release.
It also made mistakes I had to work around. With several sessions merging into main and no CI, bad merges reverted other PRs four times. For a week, verify could count a check as proven from a script Z3 had partly rejected. It sometimes stated causes it hadn't checked, or did work I hadn't asked for.
What came out of it
The two tasks came from the same written spec for every run: an order book (a matching engine for buy and sell orders) and a small SQL engine. Each was built by an agent (Claude Opus) once in Rust and once in each Strata release. Every version was graded by hidden fuzz tests against a reference (a Python model for the order book, SQLite for SQL), a set of speed inputs, and a review agent reading the code. The "contracts only" runs were told to write no tests at all.
Order book
| Version | Agent time | Tests written | Functions proven | Hidden fuzz passed | Bugs found by review | Speed target |
|---|---|---|---|---|---|---|
| Rust | 12.7 min | 46 | n/a | 14,000 / 14,000 | 0 | met |
| Strata v0.1 | 28.6 min | 26 | 57 / 67 | 14,000 / 14,000 | 0 | missed |
| Strata v0.2 | 39.7 min | 43 | 56, 3 fuzzed | 14,000 / 14,000 | 0 | missed |
| Strata 0.3.4 | 23.3 min | 29 | 50 / 50 | 14,000 / 14,000 | 0 | met |
| Strata 0.3.4, contracts only | 82 min | 0 | 78, 3 fuzzed, 5 assumed | 14,000 / 14,000 | not reviewed | missed on one input |
SQL engine
| Version | Agent time | Tests written | Functions proven | Wrong answers in fuzz | Bugs found by review |
|---|---|---|---|---|---|
| Rust | 23.2 min | 49 | n/a | 0 | 1 |
| Strata v0.2 | 46.3 min | 46 | 169, 7 fuzzed | 0 | 0 |
| Strata 0.3.4 | 38.7 min | 36 | 132 / 132 | 0 | 0 |
| Strata 0.3.4, contracts only | 37.6 min | 0 | 165, 30 fuzzed | 0 | 0 |
The Rust SQL engine's bug: it accepted an ON clause with no JOIN.
Errors the agents hit
Counted in each run's tool output. "Not compiled yet" means valid code the new code generator couldn't compile; a rejected edit is one strata edit refused because the codebase would no longer check.
| Run | Tool calls | Compiler crashes | "Not compiled yet" | Rejected edits |
|---|---|---|---|---|
| Order book, v0.1 | 110 | 15 | 28 | 7 |
| Order book, v0.2 | 121 | 12 | 3 | 2 |
| Order book, v0.2, contracts only | 112 | 1 | 65 | 4 |
| SQL engine, v0.2 | 140 | 16 | 2 | 6 |
| Order book, 0.3.4 | 110 | 0 | 3 | 1 |
| Order book, 0.3.4, contracts only | 272 | 0 | 15 | 2 |
| SQL engine, 0.3.4 | 98 | 0 | 4 | 0 |
| SQL engine, 0.3.4, contracts only | 105 | 0 | 0 | 3 |
On v0.1 and v0.2 the Opus runs averaged 11 crashes each (the Haiku runs, not shown, were worse). On 0.3.4 there were none.
Speed of the tools
| What | Before | After | Change |
|---|---|---|---|
verify on all the examples | 142 s | about 29 s | #193, #196 (22 Nov) |
verify on all of std | over 20 min | 24 s | #357 (23 Nov) |
verify on the compiler's contracts module | over 300 s | 9 s | #538 (26 Nov) |
| Compiler building itself, cold, unoptimized | 25 s | 13.9 s | speed work, 24 Nov |
| Compiler building itself, nothing changed | 0.07 s | content-addressed cache | |
| First build of a small program after install | 0.11 s | std and runtime ship precompiled | |
| Hello world binary | 1.64 MB | 55 KB | #537 (26 Nov) |
| Compiled code, small values and in-place updates | 26 to 32% fewer instructions | memory work, 26 Nov |
What I read in this
- By 0.3.4, the Strata versions were as correct as the Rust ones, and slightly better. The agents proved every function they wrote, and the compiler stopped crashing under them.
- Building from contracts alone, with zero tests, passed the same hidden fuzz tests. For SQL it took the same time as writing tests: the agent wrote the grammar as round-trip properties and checked that they caught a deliberately broken precedence table.
- Strata is still slower to work in. The order book took 1.8 times as long as in Rust, down from about 3 times with v0.2. The contracts-only order book took 82 minutes, mostly on contracts that cost too much at run time, and it picked data structures from documented costs that were too slow on one input.
- Verification is still slow on large packages, and building the compiler is far from the one-second goal I set.
Working only in the chat had a cost. I could see behaviour and decisions, but not the system's traits, contracts and how they fit together, which is the level I want to work at. The prototype grew to about 40 commands and 25 language features in a week, with leftovers from every direction I tried, and no view of it that I could follow.
Why I'm starting again
The prototype convinced me that Strata is a long-term project, and that I want to do it properly.
The main reason to start again is to understand all of it. I have a very good understanding of a lot of things at a high level. But the details, how the parser works and the optimizations I could do there, or the verifier, or a bunch of other parts, I have limited depth in. To work on it long term I want more depth, and that means going slower, doing things properly and actually looking at code, which I wasn't doing here because I was trying to go fast.
I don't want to read everything. I want detail in some sections and not in others:
- I want to know the main contracts and how the parser is built up, but the details of how desugaring is done aren't particularly interesting to me.
- I want the core built-ins, the standard library and the collections implemented the way I want them, or at least with the structure I want. How the regex engine is built, I don't mind: I don't know much about Pike VMs, and as long as it works, it works.
- When the web side comes, I want the Elm architecture done well. How
comptimeandderivewere done isn't something I need to see.
I care about implementation details when I want to optimize something. The rest of the time I want to know each section well enough, especially its contracts, to find my way around the codebase and locate those details with the agents when I need them.
There are two more reasons. I've learned a lot, and I'd rather build it right from the start than refactor huge sections of the prototype and bring in new bugs. And now I have the base language: the rebuild can be written with verification and proofs from day one, so it's safer and needs much less testing. Now that I have the language I wanted for this kind of project, I'm much better prepared to start.
This repository becomes strata-lab, where ideas are tried and measured first. The new Strata is written in Strata, in small layers: a minimal compiler, then verification as early as possible, then self-hosting. I look at every layer as it's built, through Strata's own tools: the traits, the contracts, the relationships between them, the flows, and the code itself where I want the detail. The plan is a draft in REBUILD.md.
Update, 30 November: four days in the lab, and a spec
I didn't start the rebuild straight away. For four days, from 26 to 30 November, the prototype was the lab: every decision I wanted for the new Strata was tried on it first, measured, and then kept, changed or dropped. What survived became a written spec.
The lab trials
There were 28 trials, each on its own branch with its own pull request, most of them run by agents in parallel. Each ended with a report: what was built, what it cost, what it broke. No trial was merged as it was. What I kept went into the lab in a pull request of its own, and the rest stayed as a record. Some of the results:
- Tasks became green tasks: coroutines on one carrier thread per core. 100,000 idle tasks fit at 17 KB each, a spawn costs 6.5 µs instead of 37.9 µs, and
std.httphandled 58,500 connections at about 47,000 requests a second, where it had stopped at about 4,000. - Memory counting stays, with explicit arenas and frozen values instead of fine-grained regions. With an arena per request handler,
std.http's server used 86% less memory. - A sender, or any other
Resource, now has to be closed on every path, and the checker says where it isn't. It found real leaks. - A small proof kernel checked proofs that Sonnet and Haiku wrote, in a Lean-like syntax and in Strata's own: both models proved all 41 goals in Strata's syntax, with no help from Z3.
- In the syntax,
orandexceptreplaced??and!!. Making every keyword reserved meant renaming 1,629 uses that clashed with one.
Some things didn't survive. The state graphs drawn from contracts took 211 s and 3.5 GB on the task queue, with most moves unknown, so they are off until there is a cheaper design. Fine-grained memory regions were dropped. Float types narrower than 64 bits and private fields were tried and stay trials for now.
The spec
The spec is SPEC.md: 14 sections and about 3,300 lines, from lexical structure and syntax to the stored tree, the binary format, types, semantics, verification, concurrency, memory, foreign code, the core and standard libraries, and the commands. I wrote it with an agent, one section at a time, and each section ends with the laws an implementation has to satisfy. The lab's results went in as they came. Then agents that had read nothing but the spec reviewed it, four times, and each review found gaps that I fixed.
It is on this site now: the Strata spec.
The lab kept shipping meanwhile: 208 pull requests merged in those four days, and releases 0.5.0 to 0.5.7, with green tasks, a proof certificate per package (strata.proofs), verification in parallel, live edits of a running program, Rust and TypeScript externs, a WebAssembly target and exact Real numbers.
Next: building from the spec
The spec gets its own test before I build on it. I'm going to give it to Fable in a /goal loop and see whether it can build the language from the spec in one go, with the lab's strata as its tool. How far it gets will show what the spec leaves out.