> Every Taji docs page as Markdown: https://docs.taji.is/llms.txt

# Shoot a README clip or still

Every image and clip in the README is shot from a mock scene in headless Chrome, never from a real account, so a re-shoot gives the same picture. You need Chrome, `bun` and `uv` on your PATH; run every command below in `ui/`.

| File | Reel or scenes | Command |
|---|---|---|
| `.github/hero.gif` | reel `hero` | `bun run mock/app/clip.ts ../.github/hero.gif` |
| `.github/readme/canvas.gif` | reel `canvas` | `bun run mock/app/clip.ts ../.github/readme/canvas.gif canvas` |
| `.github/readme/backtest.gif` | reel `backtest` | `bun run mock/app/clip.ts ../.github/readme/backtest.gif backtest` |
| `.github/readme/trading.png`, `data.png` | `readme-trading`, `readme-data` | `bun run mock/app/reach.ts <out dir> --scenes 'readme-*' --scale 2`, then copy `<out dir>/<scene>.png` |
| `.github/readme/phone-*.png` | `phone-needs`, `phone-chain-legs`, `phone-chats` | the same, `--scenes phone-needs,phone-chain-legs,phone-chats --scale 2` |
| `.github/social.png` | `readme-card` | the same, `--scenes readme-card --scale 1` |

## Add a clip

1. **Pick or add its scenes** in `ui/mock/app/scenes.ts`: the tree, the book and the settings the clip starts from. Reuse a `clip-*` scene where one fits; `clip-desk` is one live SPY chart.
2. **Write the reel** as a function in `ui/mock/app/clip.ts` and add it to `REELS`. Compose it from the helpers there:
   - `load(scene)` cuts to a scene; `tick(timeframes)` moves every pane one price.
   - `shot(ms)` holds the page as it stands.
   - `press(target)` glides the pointer to a control and clicks it.
   - `drag(from, to, steps, ms)` holds and drags: a gallery card, a pane's `head(kind)`, or the longest gap, `sash("row" | "col")`.
   - `over(kind, zone)` is a drop point on a pane: `tab`, `left`, `right`, `above` or `below`.
   - `framed(nodes)` writes kernel nodes, as an agent's change lands.

   Target controls by `data-eid`, never by pixel.
3. **Render it** to a scratch path: `bun run mock/app/clip.ts <scratch>/reel.gif <reel>`.
4. **Review the frames**: `bun run mock/app/clipSheet.ts <scratch>/reel.gif <scratch>/sheet.png 6` lays every sixth frame on one sheet. A beat that did nothing, such as a press that missed or a drop that was refused, shows as two frames that match. `bun run mock/app/clipSheet.ts <scratch>/reel.gif <scratch>/beats` writes every beat held 300 ms or more at full size, with an `index.html` that steps through them by arrow key: open it to judge each one.
5. **Land it** at its path, and link it from the README with alt text that says what happens.

## Limits

- The encoder writes 896×560 in 255 colours, a frame taking a palette of its own when the one before would print it off its colours, and draws only the pixels that change: the 13-second canvas clip weighs 2.8 MB and the 34-second hero 4.2 MB. Fewer colours make a smaller file with the wrong colours. GitHub refuses an image over 10 MB.
- The window is dark only, so one image serves both GitHub themes.
- Two runs differ by raster noise of a frame or so, so a clip isn't byte-identical run to run.

## If it fails

- **`the encode failed`**: `uv` can't fetch Pillow. Run `uv run --with pillow python -c 'import PIL'`.
- **A `pageerror` or `console.error`**: the scene throws on load. Open it in the mock (`pnpm --filter @taji/ui mock:app`, then `localhost:7793/app/?scene=<id>`) and fix the scene or the window first.
- **A drag moves nothing**: the press landed on another control. The middle of a sash can sit where a crossing sash meets it, which is why `sash` presses three quarters along.
