Strata
About

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 requests527 opened, 518 merged
Rust written, then deletedabout 67,000 lines
Strata todayabout 119,000 lines of compiler, 30,000 of std and core
Releasesv0.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).

MilestoneWhenAfter
First draft in Rust: parser, type checker, interpreter, contracts, fuzzing19 Nov, 05:3823 min
SMT verification (Z3) and termination proofs19 Nov, 22:1717 h
LLVM compiler (strata build) and JIT (strata run --jit)20 Nov, 22:461 day 17 h
JIT becomes the default for run21 Nov, 06:122 days 1 h
Interpreter deleted: everything runs compiled22 Nov, 05:433 days
Rewrite in Strata starts: evaluator, printer, lexer, parser (in order through the morning)22 Nov, 07:36 to 09:353 days 2 h
Resolver and type checker in Strata22 Nov, 10:00 to 21:003 days 5 h
Code generator in Strata, first step22 Nov, 21:133 days 16 h
SMT encoder in Strata, first step23 Nov, 03:133 days 22 h
Strata code generator becomes the default for build and test23 Nov, 14:314 days 9 h
strata verify runs the verifier written in Strata23 Nov, 23:034 days 18 h
Full bootstrap: the strata command written in Strata builds itself to a fixed point24 Nov, 05:025 days
Fixes until release: static LLVM and lld in the binary, shipped z3, caches, the test harness and the bugs it found24 Nov, 05:00 to 13:00
v0.1 released, Rust removed half an hour later24 Nov, 13:515 days 8.5 h
v0.2.0: speed work (symbols, hashed dicts, parallel LLVM), find/refs, colors24 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 experiments25 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 fix26 Nov, 04:347 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:

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:

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. If Positive is Int with 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 | Positive is just Int.

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 the Describe method. 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 mock to 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

VersionAgent timeTests writtenFunctions provenHidden fuzz passedBugs found by reviewSpeed target
Rust12.7 min46n/a14,000 / 14,0000met
Strata v0.128.6 min2657 / 6714,000 / 14,0000missed
Strata v0.239.7 min4356, 3 fuzzed14,000 / 14,0000missed
Strata 0.3.423.3 min2950 / 5014,000 / 14,0000met
Strata 0.3.4, contracts only82 min078, 3 fuzzed, 5 assumed14,000 / 14,000not reviewedmissed on one input

SQL engine

VersionAgent timeTests writtenFunctions provenWrong answers in fuzzBugs found by review
Rust23.2 min49n/a01
Strata v0.246.3 min46169, 7 fuzzed00
Strata 0.3.438.7 min36132 / 13200
Strata 0.3.4, contracts only37.6 min0165, 30 fuzzed00

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.

RunTool callsCompiler crashes"Not compiled yet"Rejected edits
Order book, v0.111015287
Order book, v0.21211232
Order book, v0.2, contracts only1121654
SQL engine, v0.21401626
Order book, 0.3.4110031
Order book, 0.3.4, contracts only2720152
SQL engine, 0.3.498040
SQL engine, 0.3.4, contracts only105003

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

WhatBeforeAfterChange
verify on all the examples142 sabout 29 s#193, #196 (22 Nov)
verify on all of stdover 20 min24 s#357 (23 Nov)
verify on the compiler's contracts moduleover 300 s9 s#538 (26 Nov)
Compiler building itself, cold, unoptimized25 s13.9 sspeed work, 24 Nov
Compiler building itself, nothing changed0.07 scontent-addressed cache
First build of a small program after install0.11 sstd and runtime ship precompiled
Hello world binary1.64 MB55 KB#537 (26 Nov)
Compiled code, small values and in-place updates26 to 32% fewer instructionsmemory work, 26 Nov

What I read in this

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 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:

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.