Every program you use was written somewhere else, ahead of time, for people its authors imagined. A recipe app is the same app in every kitchen. It doesn’t know which burner your pan is on, that there’s a bowl sitting on another one, or that halfway through you’d like a reminder to stir.
That’s shipped software, and it’s so normal it’s hard to see. The program is fixed, and you adapt to it.
This essay is about the other way round: software that’s grown. You bring the task. The program is written for this task, in this place, while you’re doing it, out of what the room can actually see. And it stays where you can read it.
The principle. A program should be grown in the place it’s used, out of what’s actually there, and stay readable by the people there.
The recipe is the specification
Start with the thing you already have: a recipe. It’s written for people, but it’s precise enough to build from. Every step names what it needs and how you’ll know it’s done.
“Soften them over a low heat, stirring now and then” needs a pan, a burner turned low, and a way to tell when onions are soft. “Simmer for 20 minutes” needs a big pot, a big burner and a clock.
Reading the recipe is the first thing the room does, and the only thing it does before it looks around. Point at a phrase in the figure to see what it turns into.
Onion soup, for four.
Dice 3 onions.
Soften them in butter over a low heat, stirring now and then, about 10 minutes.
Add 2 cloves of garlic for the last minute.
Pour in 1 litre of stock and simmer for 20 minutes.
| Step | Needs | Done when |
|---|---|---|
| dice | 3 onions, a board | 3 are diced |
| soften | a pan, low heat, stirring | the onions are soft |
| garlic | 2 cloves, close by | they’re in the pan |
| stock | a big pot, a big burner | 20 minutes pass |
Every need becomes a question
Next, every need turns into something the room can ask its camera. Is a pan already on a burner? Which burner is the biggest, and is it free? Is there clear bench near the stove? Is anything sitting on a burner that shouldn’t be?
The words come straight from the recipe. “Soft” becomes a question about the onions: are they soft and see-through yet? That one can’t be answered by measuring; it needs a model that understands what it’s looking at. So the question goes to one.
Each answer lands in a slot that the camera keeps current, and the rest of the program can read it like any other value.
pan.onburner3.freebench.clearburner2.coveredonions.softThe place decides the plan
The answers turn the recipe into a plan for this kitchen. The pan is already on burner 4, so the onions soften there. Burner 3 is the biggest and it’s free, so it’s kept for the stock. The bench to the right is clear, so that’s where garlic and stock wait.
It also notices what nobody asked about. A bowl is sitting on burner 2 and a tray on burner 5. The recipe needs fire, so it keeps an eye on both, and says so if a flame comes on under either.
Nothing it finds is kept just for the record. Every fact feeds a rule, and every rule points at the plan, not the room’s layout: the garlic goes to kitchen.prep, the stock to kitchen.simmer. Take the same recipe to another kitchen and only this step is redone.
kitchen = clone(Place) ( soften <- burner4; simmer <- burner3; prep <- bench; ) keepOff = clone(Cue) ( when <- burner2.lit + burner5.lit; say <- "there's a bowl or a tray on that burner"; )
Light that lands where it should
Before the room can draw a ring around a pan, it has to know where “around the pan” is in the projector’s picture. The camera and the projector see the kitchen from different places, and the cooktop is a tilted rectangle to both of them.
The trick is that a flat surface needs only one small piece of maths: a 3×3 matrix, called a homography, that turns a point on the surface into a point in a picture. Four points pin it down. To find them, the projector shows a pattern for a moment, the camera finds the pattern’s corners, and the room solves for the matrix. It does this once for each flat thing it will draw on: the tiles, the cooktop, the bench.
After that, everything is drawn in real units on the surface itself. Burner 4 is at a spot measured in centimetres on the cooktop, and the ring is a 12 cm circle around it. The matrix turns that into pixels. Drag the corners in the figure: the whole grid, every burner and the ring follow, because they all go through the same nine numbers.
Two kinds of seeing
Most of what the room needs to know is cheap to measure, so it measures it every frame. Each burner has a region in the camera’s picture, mapped through the same matrices. Flame is a patch of bright blue and orange in that region. A stir is a burst of movement inside the pan’s region. Counting pixels like this takes a couple of milliseconds, thirty times a second.
Some questions can’t be measured. Whether onions are soft is a judgement, so it goes to a model, and models are slow and charge by the picture. So the room never sends the whole frame. It cuts out the part the question is about, the pan, and sends that.
A model reads a picture as roughly its width times its height divided by 750 tokens. A 512-pixel crop of the pan is about 350 tokens. Asked 20 times while the onions soften, that’s 7,000 tokens for the whole step. A full camera frame would be about 4,915 tokens every single time.
Everything is a stream
A burner isn’t a fact the room looks up once. It’s a stream: the camera reports it every frame, whether it’s lit, how hot, what’s on it. The pan is a stream, and every stir is an event in one.
Rules are calculations over streams. How long since the last stir is a stream made from the stream of stirs. Ask for a reminder every 120 seconds and, with the stirring in this story, it would have reminded you once.
Asking a model a question is one more operator on a stream: photos of the pan go in, a stream of yes-or-no comes out. It’s slow and it costs something, so it runs only while someone cares. Ask every 30 seconds while the onions soften and that’s 19 questions. The room trusts “soft” when the model says yes twice in a row, which happens at 11:00, 30 seconds after the onions actually got there.
Drag the numbers. Asking more often costs more and answers sooner; asking less often is cheaper and later. That’s the whole trade, and it’s a number in the program you can see and change.
// from the camera flame <- burner4.seen.flame; stirred <- pan.seen.spoonMoving; // a stream made from a stream sinceStirred <- 0 fby (if stirred then 0 else sinceStirred' + 1); left <- 120 - sinceStirred; // a model as a stream operator, asked only while softening tick <- timerE(30000); soft <- false fby (if tick && soften.on then asks(pan.photo, "soft and see-through?") else soft'); softSure <- soft && soft';
fby, ' and timerE are KScript’s planned stream operators; asks is proposed.Inside the stream engine
All of these streams form one graph. Sources at the left: the camera and the clock. Outputs at the right: things the projector draws. Everything between is a formula that reads other streams.
Each frame, the engine takes the new picture, updates the source streams, then recomputes only what depends on something that changed, in order, left to right, so nothing ever reads a half-updated value. A whole pass takes well under a millisecond, inside the 33 ms between camera frames.
There are two kinds of stream. A behaviour always has a value, like how long since the last stir. An event happens and is gone, like a stir or a timer tick. And there’s one awkward guest: the model. Its answer takes a second or two, far longer than a frame. So asking doesn’t wait. The question goes out, the graph keeps running, and when the answer arrives it comes back in as an event on a later frame, like a stir does. Until then, soft simply keeps its last value. Point at any node to see what it is.
The writer’s loop
So far, everything runs without a model writing anything. The writer is the part that changes the graph itself, and it isn’t running all the time. It wakes up when something happens that the current program doesn’t cover: you ask for something, a step finishes, or a rule notices a problem it can’t handle.
When it wakes, it doesn’t get the whole computer. It gets a small context: the recipe, the plan for this kitchen, the program so far, and the last minute of events. A few thousand tokens. From that it decides one change: add a rule, edit one, or retire one.
The change goes in through the same tool the Studio already uses, which takes KScript declarations and puts them into the running world. That tool never deletes anything, so retiring a rule means replacing it with one that does nothing and says why. Before the change is shown, it’s checked: it has to parse, and it has to run one dry frame without errors. Then it’s drawn on the wall, and only then does it start acting.
- Wakea step finished, you asked, or a rule is stuck
- Readrecipe, plan, program, last minute of events
- Decideone change: add, edit or retire
- Checkit parses, and one dry frame runs clean
- Showon the wall, before it does anything
- Actit joins the graph on the next frame
// the writer wakes: onions.soft has been yes twice (11:00) // context: recipe, kitchen plan, program so far, events since 10:00 tool_use kscript { "program": "stir = clone(Retired) ( reason <- \"the onions are soft\"; ) garlic = clone(Cue) ( when <- onions.soft; say <- \"add garlic\"; on <- kitchen.prep; )" } tool_result "ok: 2 declarations applied"
kscript tool. The tool and its “ok: 2 declarations applied” reply are real today; Retired, Cue and the kitchen’s slots are proposed.Write only what’s needed; retire what’s done
With a plan and its streams, the room writes rules, and only a few at a time: for the step you’re on and the one after. When you ask for something, it writes that. When a step is done, it retires the rules that served it and writes the next.
A rule is shown on the wall before it starts acting, and when it’s retired it’s struck out, not quietly deleted. The model is only asked when something new needs writing; watching costs nothing.
Step through the evening in the figure and watch the program grow and shrink. Nobody wrote it in advance. By the end it’s a small, readable record of how onion soup got made in this kitchen, and something you could keep, run again, or hand to someone else.
What this adds up to
Pieces of this exist. Projected kitchens that show guidance on the counter go back to the mid-2000s. Research systems can follow which step of a recipe you’re on. In 2023 an agent called Voyager wrote and kept its own code while playing Minecraft. Dynamicland runs programs on tables and walls, written by the people in the room.
What we haven’t seen is the combination: a program grown live in the place it’s used, out of what the room sees, as readable code in the same language as the rest of the computer, and left on the wall as the record. As far as we know, that’s new.
None of it runs yet. Amaze has the language, live objects and a model that can write into a running world; the camera, the projector calibration and the writer’s loop are next. See the room or what Amaze does today.
A small live language, objects that read each other, a model that writes into the running world
The camera, and questions to a model as a stream
Projection through a calibrated projector
The writer’s loop: compare the task with what’s seen, then add, change or retire