Skip to content

The agent workflow

View .mdllms.txt

Every step returns a file or data an agent can inspect. Go in order: each step catches in seconds what the next takes minutes to show.

src/theme.ts tokens: size, fps, colors, fonts, beat grid
src/film.ts export async function buildFilm(): Promise<Composition>
src/render.ts frames | grid (render and preview: `framefields render|preview film`)
assets/ every input file: on your bucket, or in Git LFS
fonts/ .ttf .otf
footage/ .mp4 .mov .webm
audio/ .mp3 .wav
images/ .png .jpg .webp
luts/ .cube
models/ .glb .gltf .obj .fbx
lottie/ .json .lottie
captions/ .srt (plain text, no LFS needed)
output/ renders (gitignored, never committed)
.gitattributes LFS rules for assets/

Also commit the lockfile and pin packageManager. Keep film.ts free of side effects: it builds the film and renders nothing. That way the same repo renders on a render worker unchanged.

render.ts is in Getting started. Keeping buildFilm() separate means tests, preview and export all build the same film. Reference assets from the module URL (path.resolve(HERE, "../assets/…")) so the preview can load them too.

Source media goes in assets/, outside git, so the repo stays small and clones stay fast. Renders go in output/ and are never committed.

On a bucket. When framefields.json has a storage remote, pin media with npx framefields assets add <path> (it uploads, records the sha256 and gitignores the file) and commit framefields.json. In a fresh checkout, npx framefields assets pull restores them; framefields render pulls what’s missing itself, and framefields preview streams them from the bucket without downloading. npx framefields assets status lists each as ok, missing or changed. Keys come from the environment (FRAMEFIELDS_STORAGE_<REMOTE>_*); never print or commit them. Setup: Assets and storage.

In Git LFS, as below, when the repo uses it.

Terminal window
git lfs install # once per machine
git lfs track "assets/fonts/**" "assets/footage/**" "assets/audio/**" \
"assets/images/**" "assets/luts/**" "assets/models/**" "assets/lottie/**"
echo "output/" >> .gitignore
git add .gitattributes .gitignore
git commit -m "Track assets with Git LFS"

git lfs track writes the rules to .gitattributes (assets/footage/** filter=lfs diff=lfs merge=lfs -text, and so on). Commit that file before adding any media. Ignore output/, never *.mp4 — that would also hide your footage.

Add and push as usual; Git uploads the LFS objects with the push.

Terminal window
git add assets/footage/interview.mp4
git lfs ls-files # the new file must be listed — otherwise it is not in LFS
git commit -m "Add interview footage"
git push

If a file was committed before its rule existed, it went into normal Git. Fix it with git rm --cached <file>, git add <file> and commit again.

A clone with LFS installed downloads assets automatically. Anywhere else — a fresh container, a CI runner, an agent sandbox, or a clone made with GIT_LFS_SKIP_SMUDGE=1 — fetch them before rendering:

Terminal window
git lfs install
git lfs pull # all assets for the current commit
git lfs pull --include="assets/fonts/**,assets/footage/intro.mp4" # or just what this render needs

Check nothing is still a pointer: in git lfs ls-files, * means the file is downloaded and - means it is still a pointer.

In GitHub Actions, check out with lfs: true (actions/checkout) so the runner has the real files.

Terminal window
npx tsc --noEmit -p .
const film = await buildFilm();
for (const d of film.lint()) console.log(`${d.severity} ${d.code}: ${d.message}${d.layerId ? ` [${d.layerId}]` : ""}`);

Fix every error and warning before rendering. Codes and fixes: Lint & QA codes.

Terminal window
npm run frames -- 0 30 60 89

Open each PNG in output/ and compare it to what was asked. A black frame usually means a font that isn’t registered, a layer off canvas, opacity stuck at 0, or an asset that is still a Git LFS pointer (git lfs pull) or a pinned asset not pulled yet (npx framefields assets pull).

Terminal window
npm run grid -- 0 6 12 18 24 30 36 42

One image of the whole move: easing hitches, text that re-wraps, wrong z-order, missing cuts. Not for vision layers (they need frames in order).

Terminal window
npm run preview # framefields preview film; run in the background; prints the URL
  • Give the person the URL, or open it in your own browser pane.
  • Read the command’s output: page errors and lifecycle lines show up there.
  • When they say they left notes, read .framefields/preview-notes/notes.json and open each open note’s note-<id>.jpg before editing. Each note has the frame, the spot (x, y as fractions) and the text.
  • Rerun the preview after changes; the open tab reloads at the same moment. Mark notes "done": true when addressed.
import { formatQaReport } from "framefields";
const result = await film.renderVideo({ outputPath: "output/film.mp4", quality: "high", qa: { targetLufs: -14 } });
console.log(formatQaReport(result.qa!));
process.exit(result.qa!.passed ? 0 : 1);

qa.passed is false on any error or warning: dropped, black or frozen frames, clipping, loudness off target, plus every lint finding. Treat it as the gate.

To render on framefields GPUs instead of locally, commit and push (LFS assets included), then render a named render from framefields.json:

Terminal window
npx framefields render film --cloud --plan # GPUs, time and estimated cost; show this to the user first
npx framefields render film --cloud # render and download

Add a named render per cut (teaser, vertical edit) instead of flags in render.ts, and run npx framefields check <name> before pushing. Long films with "workers": "auto" split across several GPUs. Go through the project checklist first. When a render fails, read its code and fix the project; the API retries infrastructure errors itself. Details: Cloud rendering. To run the worker on your own GPUs, see Render on a server.

A runner without a GPU renders on the CPU: on Linux once Mesa lavapipe is installed (apt-get install -y libvulkan1 mesa-vulkan-drivers), on Windows through the built-in WARP. That is enough for frames and short exports; run long films on a GPU runner or with cloud rendering (npx framefields render film --cloud, with FRAMEFIELDS_API_KEY as a CI secret). On any runner you can also gate on types and lint() without rendering:

scripts/check.ts
import { CompositorProgramSchema } from "framefields";
import { buildFilm } from "../src/film.js";
const film = await buildFilm();
const bad = film.lint().filter((d) => d.severity !== "info");
const schema = CompositorProgramSchema.safeParse(film.toSpec());
if (bad.length || !schema.success) {
for (const d of bad) console.error(`${d.code}: ${d.message}`);
process.exit(1);
}
process.exit(0);
  • Change one scene at a time and re-render only its frames.
  • Keep all magic numbers in theme.ts; a tweak is then one line.
  • Name layers with id — lint, QA and chart children report by id.
  • Put asset paths through import.meta.url so the preview loads them too.