# Working with agents

An agent edits the comp file as plain text and asks `lamino` for numbers to check its work. There is no dedicated editing API. The project's `CLAUDE.md` (`lamino schema --template CLAUDE.md`) holds the working rules for agents.

## The working loop

1. **Edit**: change `shots/<shot>/<shot>.comp.ts`.
2. **Save**: `lamino dev` detects the save and runs `check` and `lint`. If `dev` is not running, call `lamino check <file> --json` yourself.
3. **Read**: fix the errors (`E_*`) and warnings (`L_*`) in `diagnostics`. Confirm the result with the statistics and pixel values from `probe` and the times from `stats`.
4. **Look**: call `preview` only when the numbers do not settle it. Zoom in with `--region`, and set it beside the previous commit or a reference with `--compare-with`.
5. **Commit**: once the intended change is confirmed, commit the comp file and `lamino.lock`.

The loop always runs at proxy resolution. Read `lamino schema --json` once at the start to get the node list, the conventions, how to write GLSL and the meaning of the diagnostic codes.

## The MCP server

`lamino mcp` is an MCP server over stdio and provides 21 tools. The tools are thin wrappers around the CLI subcommands. Their names correspond, as in `lamino_check`, `lamino_probe` and `lamino_preview`, and arguments are passed as camelCase keys (`{ "compFile": "shots/010/010.comp.ts" }`).

| Tool | Matching CLI |
| --- | --- |
| `lamino_schema`, `lamino_inspect`, `lamino_check`, `lamino_lint`, `lamino_probe`, `lamino_stats`, `lamino_bench`, `lamino_changes`, `lamino_timeline` | The subcommand of the same name |
| `lamino_preview`, `lamino_compare`, `lamino_render` | The subcommand of the same name. The stream for video (`--pipe`) and `render --job` are CLI only |
| `lamino_viewer`, `lamino_controls`, `lamino_override` | The subcommand of the same name |
| `lamino_prov_add`, `lamino_proxy_build`, `lamino_color_verify` | `prov add`, `proxy build`, `color verify` |
| `lamino_dev_start`, `lamino_dev_status`, `lamino_dev_stop` | Start `dev` watching in the background, read its status, stop it |

`review`, `mcp` and `dest` have no matching tool. The MCP `lamino_render` renders at full resolution unless `proxy` is given, and runs in a child process.

## Finding the person's "here"

When a person zooms in in the review window and says "the glow is too strong here", the agent calls `lamino viewer <comp> --json`. It returns the frame on screen (`frame`), the visible area (`region`, in width units), the node shown (`node`), the channel, the cursor position (`cursor`), the A/B target and the session overrides. If no window is open, it returns `connected: false`, so ask the person for the frame number and the rough position.

In replies and commit message bodies, write the location in the same form.

```
frame 1032 / region [0.00, 0.00, 0.50, 0.28] / node lit
radius 0.04 -> 0.025. probe lit @ (0.12, 0.08): max 2.1 -> 1.4
preview: <path returned by the preview report> (left: HEAD~1, right: current)
```

## Lining up variants for a choice

When there are several candidate values, use session-only overrides such as `lamino override set lit.radius 0.03`, make a `preview` of each, and set them side by side. Write only the chosen value into the comp file and commit it. Do not commit variants or keep them as commented-out code. When it is faster for a person to decide by eye, use the controls in the review window.

## Git

- The agent makes the commits. Undo with `git revert`, keep alternatives on branches, and never rewrite history.
- One review comment becomes one commit.
- On the first line of the commit message, write which shot changed, what changed and how, with numbers (`010: weaken fireworks glow (glow radius 0.04 -> 0.025)`). In the body, write the reason and the numbers you checked. The summary from `lamino changes` helps here.
- Commit `lamino.lock` after `L_LOCK_PENDING` has gone.

## Provenance

When you `read` footage made outside (3D renders, generative model output, AI mattes, tracks), record its provenance in the lock. Do not write it by hand; use `lamino prov add`.

```sh
lamino prov add '$SHOTS/SHOW/010/render/fireworks_v012.####.exr' \
  --kind rendered --tool "Octane 2026.1 (C4D)" --source '$SHOTS/SHOW/010/scenes/fireworks_v012.c4d' --json
```

`--kind` is one of `generated` (a model), `rendered` (3D), `captured` (a camera) or `external` (any other tool). A command line given in `--command` is only recorded; Laminolith never runs it. Generated or rendered footage without provenance gets `L_PROVENANCE_MISSING`.

## Requests outside the lines

A request that parameters cannot cover, such as "change the shape of the fireworks", is not something to push through inside Laminolith. In the reply, say who remakes it with which tool, and at which path and version it comes back. When the footage comes back, bump the `read` path, run `prov add` and commit.
