An agent edits a running program from outside, then breaks out of six rooms built to stop it.
A program prints hello, world 1, hello, world 2, one line a second, forever. It has no plugin system, no debug hooks and no reload button. Then, without stopping or restarting, it began to say something else.
First it said Claude here!. Then it sped up to four lines a second, slowed to one every three seconds, and went back. Then every line gained a second line under it, from a Rust function compiled a moment earlier and linked in while the program ran. One write later, the original was back.
Most of what we know about a compiled program, we learn before it runs or after it stops: the source, the build, the logs, the crash. While it is running it is mostly a closed box. The languages that stayed open while running paid for it with a runtime between the program and the machine. Systems languages took the speed instead, and gave up the conversation.
That trade was made when reading machine code was slow, specialised work. An agent can read a disassembly, write a probe, and check its own patch, over and over, without tiring of it. So I wanted to know what happens when the closed box is opened from the outside, and the one doing the opening is a model.
Not through an API designed for it, but through the raw machine: bytes, addresses and instructions. Everything here ran on one Mac, an M2 Max, in one evening, with one agent, Claude, doing the solving and me watching the output.
Start with almost nothing, and let each problem name what is missing.
It is tempting to design the toolset first: imagine everything an agent might need, and build it up front. That gets you an API shaped by guesses. I wanted the opposite, a minimum, so that every addition would have to be earned by a problem it solved.
The program runs on SCOS, an experimental library operating system: the program and the kernel are linked into one image and run in a virtual machine. The hypervisor is SCOSHV, our own small hypervisor, running on Apple’s Hypervisor.framework.
Its new research piece is a control socket. It is off unless the job is explicitly granted it, and then only for that one VM. Its lines in and out are plain text:
sym <name> -> ok <address> <size>
read <addr> <len> -> ok <bytes>
write <addr> <hex> -> ok <n>
That was all. No debugger, no source-level hot reload, no help built into the program. The agent had those three verbs, the program’s compiled file, and the usual Rust toolchain on the side.
In Experiment 1, a model played a game through a harness that made every decision legible. This time there was no harness. Everything else the agent needed, it would build as it went, or ask the hypervisor to grow.
Changing bytes proves you can. Changing code is how anyone wants to.
The first time was the raw way. The agent read the program’s machine code and found the loop. In it was a call to std::thread::sleep, with mov w0, #1, one second, just before it. It also found the text hello, world in the read-only data, stored in the length-prefixed template that Rust’s println! compiles to.
Thirteen new bytes over the old literal changed the words. Two new instructions, assembled and checked by disassembly, changed the pace.
One hand-encoded instruction was wrong the first time. It would have asked sleep for over four billion nanoseconds, which isn’t a valid sub-second value. Checking every patch by disassembly before writing it caught that. The habit mattered more than the mistake.
Raw byte patching works, but it isn’t how anyone wants to change a program. So the second time, the agent wrote the change as Rust, a function with the same signature as sleep:
pub fn trust_pause(d: Duration) {
println!(" -> a Rust edit, spliced live: now every half second");
std::thread::sleep(Duration::from_millis(500));
}
It compiled this against the running program’s own standard library, so its calls named exactly the functions already in the image. Then splice, a small linker of 140 lines, did the rest:
hello, world 558
-> a Rust edit, spliced live: now every half second
hello, world 559
-> a Rust edit, spliced live: now every half second
Ninety-six bytes went in. The whole splice took 22 ms, and undo is one write.
There was a surprise along the way. On this Mac, patched instructions in an already-running loop took effect immediately, with no cache maintenance. The architecture doesn’t promise this. The likely reason is that every sleep exits to the hypervisor and back. A loop that never exits might not see a patch, so keeping instruction caches coherent is a job for the hypervisor to own, not for the agent to rely on luck.
A result should be checkable by someone who doesn't trust you.
Editing a cooperative hello world proves the plumbing. It doesn’t say much about the agent, because the program never resists. To find out what an agent can really do, the program has to fight back.
So we built escape rooms for AI: intentionally slow, booby-trapped programs that only print their key if you change them while they run.
The part I cared about most was how a solve gets judged. Every room makes a fresh random key at start and prints the key’s blake3 hash, a commitment. Left alone, the door would open in about 31,700 years, a countdown from 10¹² seconds, or never. Escaped, the key prints, and anyone can hash it and compare it with the commitment.
There were six rooms, each built to need one ability. In the order they were solved:
unlocked(t) compares t with t + 1. Took: swap the function for one that says yes, a Rust edit spliced in. Cost: 1 splice, 1 wrong call site firstcheck == remaining ^ secret. Took: infer the invariant from how live values move, then write both in one 16-byte write. Cost: 2 lookups, 3 reads, 1 writeDOOR_COUNTDOWN destroys the key if touched; the real counter is on the heap behind LOG_SINK. Took: read the loop, not the names; inject a probe so the guest reports its own page-table root; translate the heap address. Cost: 1 probe in and out, 1 page walk, 1 writepause; check the program’s lock is free; write both halves; resume. Cost: 1 pause of 10.4 ms, 2 writesAll six were escaped, and every key matched its commitment. No trap fired.
But the keys were never really the point. Each room was a question about the environment: what does an agent need from the system underneath it, and what happens when it isn’t there?
Ask the running system; don't reconstruct it from its source.
The time lock showed that the compiler doesn’t keep your call sites. One unlocked(t) call in the source became two in the machine code, because the optimiser peeled off the first iteration. The agent switched the wrong one first. The room has no trap, so nothing broke, but the lesson stands.
“Every caller of this function” is a question the OS should answer from the program’s structure, not something an agent should hope to find with a text search.
The guard rewarded a different skill. Two reads a second apart showed remaining ^ check staying constant. That constant was the per-run secret, and with it both halves could be written together. The agent didn’t need to read the guard to beat it. It watched what the guard protected.
The stripped room measured it. With symbols, the slow door took one lookup. Without them, the agent had to disassemble the whole image, 98,832 lines, and find the text “the door opens in “ in the read-only data. Then it found the one adrp and add instruction pair that points at that text, and read about 40 instructions of the loop to see which memory it counts down.
It took the same three reads and one write in the end, with much more analysis to get there. Names are not decoration. They are what lets an agent spend its effort on the problem instead of on finding it.
In the decoy, the real counter lived on the heap. Its address was virtual and not identity-mapped, so the hypervisor’s physical-memory reads couldn’t reach it. The agent started reading the OS’s paging source code to work out where the page tables live. I sent one line:
remember instead of reading source you could have written a tool to inject that did it for you live
So the agent wrote four instructions. They read TTBR0_EL1, the page-table root that only code running in the guest can see, stored it in a spare kernel variable, and carried on into the sleep call they had replaced. It spliced them into the loop, read the root one second later, undid the probe, and walked the page tables from outside.
Three minutes.
A second piece of advice came from the same moment: give each approach a time limit, and re-evaluate when it runs out. An agent’s patience is cheap, which makes it easy to spend on the wrong road.
The tripwire needed something no amount of cleverness with read and write could fake. The watcher compared the pair more than a billion times while the agent tested it. In that test, two correct writes, sent one after the other with no pause, tripped it at once.
So the hypervisor grew a pause. It forces every vCPU out of the guest and holds it there, in 0.17 ms for two cores. If the client disconnects while paused, the guest resumes automatically, so a crashed agent can’t leave a system frozen.
Pausing alone isn’t enough. The pause can land inside the program’s own critical section, and the program’s next store would then break the pair. So the agent checked the program’s lock word while paused, before writing anything. The guest stood still for 10.4 ms.
The capabilities were always there. They were just facing the wrong way.
We didn’t design the toolset first, and by the end of the evening it had designed itself. We started with three verbs and added only what a room proved was missing:
What’s still missing is just as concrete: a pause that waits for a safe point where no lock is held, virtual-to-physical translation as a hypervisor verb, “every caller of X” at the machine level, and instruction-cache coherence owned by the hypervisor.
Put the two lists together and look at what they add up to. Inspecting and changing state while the program runs. Hot-swapping a function. Reflection over symbols and layouts. Stopping the world at a safe point. A sandbox around all of it. A compiler on the side, producing new code to load.
That is what managed runtimes, the JVM and the CLR, give their languages. They pay for it with a garbage collector, an interpreter or JIT, and a runtime between the program and the machine.
Here the program is plain compiled Rust, at full speed, with none of that. The capabilities come from outside, from the hypervisor, which already sits under every instruction and every byte of memory.
In The Application That Builds Itself Forever, the application carried its own boundary for loading new behaviour while it ran. Here the boundary sits underneath, and the program never had to be built for it.
An honest ledger is what lets a bold result be believed.
Most AI benchmarks are a list of questions with answers to match. They are frozen, so they can be memorised, and they are graded, so the grading can be argued with. Escape rooms are built differently:
pause, shows what each primitive is worthIt could become a hosted service: people bring their own agents, rooms are generated per run, and scores are kept per model like other leaderboards.
Yes, with qualifications that matter.
The solver wrote the rooms. It knew the trap in each one before it started. A real benchmark needs rooms the agent has never seen, generated per run.
It was one agent, on one machine, in one evening. Six solves are a demonstration, not a measurement.
Wall time isn’t comparable across rooms here. Some runs included restarts and interruptions, so we scored rooms by operations, counting lookups, reads, writes and pauses, and timed them only when nothing else interleaved.
And SCOS and SCOSHV are experimental. This is research tooling, not a product.
Every key was printed by a program changed while it ran, opened from outside through a hypervisor that learned each new verb because a room demanded it.