# Design

The design of Laminolith is a set of rules that keep one division of work intact: the agent writes, the engine runs, and the human looks and decides. Whether to add a feature is also decided against this division.

## The code is the source of truth, git holds the history

The source of truth for a comp is the `*.comp.ts` file alone. Laminolith has no project file and no database of its own. The IR, cache and proxies it makes during evaluation live in `.lamino/`, and they can be deleted at any time and rebuilt from the code and the assets.

History, undo and branching are git's job. Laminolith has no undo; to go back, use `git revert`. The content hashes and provenance of the assets are recorded in `lamino.lock`, which also goes into git. Its role is the same as `package-lock.json`: for each commit it pins down "which contents of which assets made this picture".

Because the code is the source of truth, changes can be read. "What changed" can be checked with the diff of the comp file and the per-node diff (`lamino changes`).

## Laminolith does not write comps

Only agents and humans write comp files. Laminolith writes only three things: `.lamino/`, `lamino.lock` and `$OUT`. There is no template generator such as `lamino init`; `lamino schema --setup` prints the templates to standard output and the agent saves them.

It has no built-in LLM either. The agent is outside (an MCP client such as Claude Code), and Laminolith only answers queries. It carries no pinned model and no API costs, and it gains whatever the agent side improves.

## The human looks and decides

The review window is a window for looking. It has no operation that changes the comp. There is no node editing, keyframe editing, gizmo or paint.

The controls (sliders) look like an exception. With them, the agent names which parameters may move and the human decides only the values by eye. The chosen values stay only in the window's session. What writes them into the comp is the agent that reads those values.

It does not store or forward comments either. Instructions arrive through chat or a production tracker, and reading them and making the fix is the agent's job.

## The line between making it inside and making it outside

There is one criterion for the line: "can a review comment be handled by changing parameters?"

|  | Made inside Laminolith | Made outside and read as an asset |
| --- | --- | --- |
| Nature | Parametric, deterministic, cheap per frame | Heavy, non-deterministic, depends on a model or another tool |
| Examples | Grading, transforms, blur, glow, noise, mask processing, combining assets, text, shapes, Lottie, frame blending, Cryptomatte, flat cards in 3D space | 3D rendering, simulation, generative models, AI mattes, tracking, advanced keying, optical-flow retiming, roto, paint |
| How to fix | "Make the glow weaker" changes a parameter | "Change the shape of the fireworks" is remade and swapped in, with its provenance recorded |

This line is also built into the engine. When one node goes over the cost budget at proxy resolution, `E_COST_BUDGET` is returned. This is not a signal to raise the limit. It is a signal to "make it outside" or to bake it with `bake()`.

## Determinism, and never correcting silently

The only deterministic output is the EXR image sequence. The same comp, the same lock and the same engine are promised to give the same picture. For this, nodes are written as pure functions of the frame, and wall-clock time (`Date.now()`) and unseeded random numbers are not available.

Movie compression is not Laminolith's responsibility. ffmpeg makes the movie from the display-transformed frames that `lamino` streams.

It also never silently fills in missing or contradictory input. Colour spaces, AOV conventions and frame ranges, when not declared, become an error or a lint warning. When something is estimated, a warning such as `L_ESTIMATED` always says so. Errors carry `code`, `what`, `why`, `fix` and the line number in the file, in a form the agent can fix directly.

## Resolution-independent description and proxies

Every spatial parameter is written in width units (a unit where the image width is 1.0), never in pixel counts. The same number means the same shape at 4K and on a 960 px proxy, so the agent's loop and the review always run at proxy resolution. Only the delivery render evaluates at full resolution.

## Numbers first, images later

For an agent, images are expensive. So it looks first at node statistics and pixel values at given coordinates (`probe`), lint, evaluation times (`stats`) and colour differences (`compare`), and looks at an image with `preview` only when the numbers do not settle it. MCP, the CLI and the review window use the same engine, so the picture the agent checked and the picture the human sees match.

## Borrow standards, one extension point

Colour follows the OCIO config and timelines follow OpenTimelineIO; Laminolith does not define its own semantics. The only extension point is the GLSL shader node; no plugin ABI is published. Bundled nodes and a project's GLSL nodes implement the same node contract, and the engine does not tell them apart.

## Never damage the assets

Assets are read-only. Output goes only to a versioned folder (`name_v001/`) under `$OUT`, and existing frames are never overwritten. Paths are written with root aliases (`$SHOTS/...`); absolute paths and `..` are refused.
