From the archive

Why I Wrote silo-os

A Lean 4 unikernel for AWS Nitro Enclaves with no Linux, no libc, and no shared code with the untrusted host next door.

In distributed systems, there's a basic tradeoff between liveness (talking to the internet, staying up, getting work done) and safety (making sure bad things never happen). It's complex, but you can combine them; you just have to go slower and err on the side of safety and it'll work. Linux is great at liveness: networking, APIs, storage, and all the messy software needed to run a real product, which also means you should assume it will eventually get popped. A stripped-down, formally verified OS is great at safety, because it does almost nothing and fails closed.

Think of it like Meta's Llama and Llama Guard, except at the operating system level. Llama is the big, general-purpose model that talks to untrusted users, answers open-ended prompts, and does the real work, which makes it hard to lock down on its own. Llama Guard is a small, separate model sitting next to it whose only job is inspecting what goes in and out against a narrow safety policy and saying safe or unsafe. Because Llama Guard only has to do that one simple job, it's much easier to keep tight and predictable than trying to make the main model police itself. Working together, Llama handles the messy work and Llama Guard gates what gets through.

Splitting a system across Linux and silo-os does the same thing in a distributed way. Linux handles liveness on the outside, and silo-os sits next to it enforcing safety on the inside, so a compromised host breaks liveness without breaking safety. Because the two sides share no code, an attacker has to burn two separate bugs in two separate stacks to take everything.

Llama and Llama Guard flowchart: big helpful brain plus tiny bouncer with two rules

Building and maintaining two completely independent stacks like that used to be way too complicated for most teams to even try. With AI, it's finally practical.

Say you're trying to build a Binance-style hot wallet on AWS. You can use KMS to safely store keys for signing in Bitcoin, which improves security to some extent, but it doesn't give you any policy protections. For anything more complicated than a raw signing key, you end up putting a signing service inside an AWS Nitro Enclave, which is the standard way people try to isolate keys and policy from a host. Then you look at what actually runs inside it. By default, a Nitro Enclave boots a Linux kernel, an init process, glibc or musl, AWS's libraries, and an application in a container. Across the vsock sits the parent EC2 instance, running a Linux kernel, glibc or musl, and often the exact same parsers and cryptography. You drew a hypervisor boundary between two machines and then put the same code on both sides of it. One flaw in the kernel, the C library, or a shared dependency is still a flaw in both. And even when the Nitro hypervisor itself holds up, the C code sitting on the enclave side of vsock doesn't: CVE-2026-119116 in AWS's own aws-nitro-enclaves-sdk-c (kmstool-enclave) was a use-after-free and double-free where a compromised parent could send crafted vsock messages to corrupt heap memory and run code inside the enclave.

That's why I wrote silo-os. It's a Lean 4 unikernel for AWS Nitro Enclaves with no Linux, no C library, and no AWS boot files.

No Shared Bugs, Still Useful

The first thing I wanted was a system that shares zero bugs with existing stacks while still being capable enough to run real services.

On silo-os, the enclave runs none of it. There is no Linux kernel, no libc, no OpenSSL, and no C parser touching untrusted input. Every byte arriving from the parent over vsock is parsed in Lean, where every array index is bounds-checked. The C and assembly underneath never interpret host data.

From a developer's perspective, a service on silo-os is just a Lean function from bytes to bytes, plus three platform calls: vsock, hardware randomness, and attestation. You can build a real co-signer or policy service on that without dragging an entire Linux distro into the room.

Operating Systems Weren't Built for Machines

The deeper reason I built this is that I wanted to design a system for machines and AI from the ground up.

Unix and Linux were designed in the 1970s for people sitting at terminals sharing one expensive computer. That's why we have TTYs, shells, multi-user permissions, signals, dynamic linkers, huge filesystems, preemptive timeslicing across untrusted local users, and hundreds of syscalls. Somehow we ended up shipping thirty million lines of C built around that model into cloud enclaves that run one network service, and then bolting containers, namespaces, and seccomp on top to turn off everything the service never wanted. It's obviously easier to write a tiny system without bugs than to modify a huge one.

Machines don't need a shell or POSIX. A machine-to-machine service wants one transport (vsock), one address space, one program, single-threaded execution, polling instead of interrupts, and no local disk state that an attacker can roll back or clone. If anything goes wrong, whether it runs out of memory, overflows the stack, hits a panic!, or tries to touch a bad device address, the whole machine just halts.

That same simplicity turns out to matter a lot when AI is helping build and maintain the codebase. Hand an AI a massive C kernel full of implicit locking rules and decades of ABI baggage and it spends half its time fighting the mess. Keep the OS small and self-contained (we measured 108 runtime symbols needed for silo-os and the first service on top of it) and both you and the AI can actually understand the whole machine.

Unikernels and Lean

Existing operating systems are also terrible targets for formal verification. Preemptive scheduling, interrupts, multi-process virtual memory, and huge driver trees blow up the state space. seL4 is an amazing piece of engineering, and it took decades of specialist work just to verify a microkernel.

Unikernels make proving your whole system a bit easier because there's so much less system to prove. silo-os has no scheduler, no interrupts, no dynamic loading, and only two devices: virtio-vsock and the Nitro Secure Module. The whole stack fits in a small table:

Layer Language What's in it
Service Lean Pure bytes-to-bytes logic (ping, attest, random, selftest, or your own)
Drivers & kernel Lean virtio-mmio, vsock, Nitro Secure Module, serial, heartbeat, server loop
High-level runtime Lean (Runtime/) Big-number arithmetic and RFC 3629 UTF-8 rules
Low-level runtime Mini/ (a small 64-bit language in Lean, printed to C) Allocator, refcounting/freeing, arrays, big numbers in memory, hashing, strings, page tables, constant-time primitives
Hand-written runtime C (rt/) Closures, permanent constants, startup, halt, raw hardware primitives (~520 lines in an image)
Boot stub Assembly & C (boot/) Linux boot protocol header and entries, fatal-exception handlers (~480 lines)

With the surface area that small, proofs become part of the normal build. Proofs.lean compiles with everything else, so if a proof breaks, the build fails.

Right now, Kernel/VsockProofs.lean proves that no sequence of packets or calls can push the vsock connection table past its limit, and writes never take more bytes than the peer advertised room for. Runtime/BigProofs.lean proves big-number add, sub, mul, compare, shifts, bitwise ops, powers, and full multi-limb division (Knuth's Algorithm D) on Lean's three standard axioms, and Runtime/Utf8Proofs.lean proves the RFC 3629 UTF-8 rules.

For the low-level memory code under Lean, instead of writing a C allocator by hand and hoping for the best, Mini/ defines a tiny 64-bit word language inside Lean whose interpreter fails anywhere C would leave behavior undefined, and prints C at build time. Against that semantics, Mini/AllocHeap.lean proves the small-block allocator (1 to 4,096 bytes) sound for any sequence of rt_malloc and rt_free calls: no two live blocks share a byte (headers included), writing inside a block never corrupts a header, freed memory is zeroed, and nothing triggers undefined behavior. Mini/Constant.lean and Mini/WordProofs.lean check constant-time comparison (Secret.equal) and branchless select (Secret.select) so no secret can control a branch, loop, memory address, or division, along with proved branchless bounds masking (array_index_nospec).

AI Is Good at Lean

When I started porting Winnow into Lean 4, I was surprised by how fast formal proofs moved once AI was writing them with me.

AI is good at Lean mostly because of training. Modern models have seen a ton of Lean and formal math, so they already know the tactics and how to break a proof down. And unlike writing C or Python with an LLM, where the model can hand you plausible-looking code with a subtle bug that slips past tests and a tired human reviewer, Lean's kernel doesn't care how confident the model sounds. Either the proof typechecks or it doesn't.

The catch is that Lean only checks the theorem you wrote down, not whether you wrote down the right theorem. An AI will happily prove a tautology, sneak in a precondition that never holds in practice, or verify a clean model that doesn't match the code actually running on the machine. Proving the math is getting cheap. Figuring out what we are actually proving, and whether it closes the real attack surface, is the hard part, and why they pay me the big bucks.

Where This Actually Works

I'm not suggesting anyone rewrite desktop Linux or a general-purpose cloud OS in Lean. Complex, general-purpose software has too many moving parts and too much legacy compatibility.

silo-os isn't done either. You still trust AWS's hypervisor, the Nitro Secure Module, and the CPU. If an attacker can bust the hypervisor or the silicon underneath, one bug still gets both sides, because both the parent and the enclave sit on top of it. You also still trust the Lean and C compilers, and Lean's compiled Init and Std libraries. There are still about a thousand lines of hand-written C and assembly in the runtime and boot stub. Large-block allocation, Mini/String.lean, and Mini/Map.lean are tested rather than proved, and speculative execution is only partly handled. All of that is tracked openly in THREAT_MODEL.md and TODO.md, along with the work still ahead, including compiler speculative-load hardening and eventually a small checkable x86-64 backend for Mini/ so even clang comes out of the boot path.

For high-security, simple systems like signing enclaves, custody co-signers, and policy engines, simplicity is the whole point. We don't have to keep dropping thirty million lines of Linux into an enclave and calling it isolated. With unikernels, Lean, and AI, we can build small, formally verified systems from scratch that share nothing with the untrusted machines sitting next to them.

← All writing