How it’s built · Iterative code generation

Code Morph Lab

A model that writes code once and stops is guessing. Code Morph Lab makes it run what it wrote, read what went wrong and try again, and it shows every step: each tool call, each diff, each run. The loop works in HTML, rendered in a sandbox, and in Python, run in the browser through WebAssembly.

Open Code Morph Lab

One iteration

  1. GoalA plain-language description, or code handed over from another app.
  2. EditThe model lists, reads, writes, edits and deletes files in its workspace.
  3. Runrun_program renders the page or runs the Python, capturing console output and uncaught errors.
  4. ClassifyThe failure is sorted into syntax, runtime, timeout or missing file, with a file and line where one can be found.
  5. RetryA compact report goes back to the model, until the run is clean or the iteration cap is reached.

Design decisions

The loop knows nothing about the UI

The morph loop is pure orchestration: the model call and the runner are passed in. The same loop drives a real model in the app and a scripted stub in the tests.

Feedback the model can use

Raw stderr is noisy. The report leads with the error kind and location, then the tail of stderr and stdout, trimmed to a budget, so a long traceback does not crowd out the code.

Watch it think

Assistant text and tool-call arguments stream into the workspace while the model is still responding, so a stalled or confused generation is visible straight away.

Sessions are kept and can be forked

Every run is saved with its iterations and file snapshots. A session that nearly worked can be forked with a refined goal instead of starting again, or exported as JSON.

Working with the other apps

Code Morph Lab is where generations go to be improved. A page from the Prompt Gallery or an image from the SVG bench can be sent here with its original prompt kept separate from the requested change. When the session finishes, Send back returns the result, and the Prompt Gallery files it as a new variant beside the original. Nothing is overwritten.

Problems worth solving

More write-ups

Game Forge VR Forge Understory Studio