Sign inGet started

Docs / Writing scenes

Writing scenes

What a scene can do

Step What it does
open(path) Goes to a page of the app
act(goal, { params, say }) One small goal in plain language. Worked out by a model on the first run, replayed after
click, fill, select, hover, upload, drag, press, scroll The same, said exactly, with no model
point(target), zoom(target), label(target, text) Show something without acting on it: a spotlight, a closer look, a tag
animate(target, name) Something on the app's own screen moves: count (a number counts up), draw (a chart draws itself), rows (rows arrive one by one), pulse, pop, lift
sound(name) A sound effect by itself. Any step can also take { sound: "chime" }
see(text) A check. If the text is not on the page the scene fails and nothing is recorded
card(lead, key) Two lines on the stage. Before the app shows, it opens the film and names it; after the last step, it ends it ({ url, button } there); anywhere else, a chapter. No opening card: the film starts in the app; no end card: it ends on its last picture
pause(ms) Holds the film
background(colour or picture) The stage behind the app from here on: a colour, colours for a gradient, or a picture ("assets/sky.jpg", a path in your project, or an address). First, the film starts on it; later, it fades in
fast(steps) Fast-forward: the steps inside play four times quicker, with a mark on screen
piece(target), words(text) One piece of the app alone on the stage; words as a scene, with moving type (below)
mark(kind, target) A circle, box, underline or arrow that draws itself on the app; mark("stroke") across the stage
overlay("component:x") A component laid over the film for a while, as the next steps carry on under it
together(steps) The steps inside start at the same moment
link(target, address), button(text, address) Something of the app the viewer can click through; a button laid over the film
shot(name, { crop, save }) A named picture: for posts, as a plain PNG, and with save, written into your project
mock, replace, blur, freeze Sample data (below)
state(value) Puts a component (or the page) in another state
saveLogin(), totp(secret) Keeps the login: later scenes start signed in with it. The code an authenticator app would show

A target is a control's visible name ("Pay"), a test id ({ testid: "cart" }) or a selector. A step waits up to five seconds for its target to show up and be enabled, so a page that is still loading needs no pause().

say is the step's caption, and its narration when a voice is set. Values in params are typed by Scenlit; the model only ever sees the placeholder ({card}).

A scene can also set look: "marketing", data, and setup / teardown commands (seed the database, clean up).

How the recording works

  • The first time a scene meets an act, a model looks at the page's controls and names the next actions.
  • When the scene ends without an error, those actions are saved to .scenlit/recordings/<scene>.json. Commit it.
  • Later runs replay the recording: no model, no cost.
  • If the app changed and a recorded control is gone, the model takes over from that point and the recording is repaired. --record forgets the recording and starts again.
  • --strict never calls a model and fails when a step is not recorded. It is the default when CI is set.

Sample data: never film a real customer

await freeze("2026-03-02T09:30:00");                       // the date the app believes it is
await mock("/api/customers", [{ name: "Acme Inc", ... }]);  // answer the app's own request
await replace({ "Hartwell & Finch": "Acme Inc" });          // swap text wherever it shows (whole words)
await blur(".email");                                       // hide what is left
await open("/");

The same can be set for every scene under data in the settings.

Signing in

  • By hand: npx scenlit login opens your app; sign in and close the window. --as admin keeps several logins.
  • By a scene: a scene that signs in with fill and click and ends with saveLogin("admin") does the same without a person, which is what CI needs. Take the password from the environment.
  • Scenes start signed in with the saved login. With several (saveLogin("admin"), login --as admin), a scene picks one with as: "admin".

Logins are saved in .scenlit/sessions/ and kept out of git.

Built for agents

Scenlit is meant to be driven by a coding agent as easily as by a person. init installs a /scenlit skill for Claude Code; any other agent can read the same guide with npx scenlit guide.

The guide is about making a good film, not only a working one. It has the agent get to know the product first (its README, changelog and pages) and suggest two or three films before making one. It gives the rules a good demo follows: a hook in the first three seconds, one moment that stands out, the before shown, captions about what the viewer gets, data that tells one story. And it starts every film from an example of its kind, so the agent does not invent the shape each time:

Example For
npx scenlit guide product-demo A landing page: hook, setup, one moment, payoff, next
npx scenlit guide feature A release post: one new thing, shown working, square
npx scenlit guide tutorial The help center: one task, numbered steps
npx scenlit guide story One person's problem across the screens it touches
npx scenlit guide short Reels, Shorts, TikTok: a hook and three quick beats, vertical
npx scenlit guide launch A launch for developers: the scene's own code beside the app, colour fields between

Each is a complete scene that runs on a sample invoicing app, with notes on why it is built that way.

Command What an agent gets
inspect /path The page's controls by name, its text, its states, and a picture: no guessing at selectors
run <scene> --json What each step did, every file written, and notes: what reads wrong, the story included (no hook, nothing that stands out, captions that say what was clicked)
sheet <scene> The film as one image: eight moments, each with its time and caption
frames <scene> --at 7.5 One moment, full size
check --json Every scene without running it

With inspect, an agent writes exact steps (click("Export CSV")), so a scene needs no model call of its own. act stays for goals that are easier said than spelled out.

From the README of Scenlit 0.1.0. Read it on GitHub