.libretto/ directory at your project root. This page covers the config file, environment variables, sessions, and auth profiles.
Add
.libretto/ to your .gitignore. Libretto creates a .libretto/.gitignore that automatically ignores sessions/ and profiles/, but the config.json file itself is not ignored. If you prefer to exclude the entire directory, add .libretto/ to your root .gitignore.Config file
Location:.libretto/config.json
The config file controls snapshot analysis and the default viewport. The easiest way to create or update it is through the CLI:
Fields
Config schema version. Always
1.Configures the model used for
snapshot analysis. Snapshot analysis is required — without it, npx libretto snapshot will fail.A
provider/model-id string, for example openai/gpt-5.4, anthropic/claude-sonnet-4-6, google/gemini-3-flash-preview, or vertex/gemini-2.5-pro. This is the model Libretto sends screenshot and HTML data to when you run snapshot.ISO 8601 timestamp of the last time the AI config was written. Set automatically by
npx libretto ai configure.Default viewport size used by
open and run when you don’t pass --viewport. Precedence: CLI --viewport flag > config.json > built-in default of 1366x768.Viewport width in pixels. Must be a positive integer.
Viewport height in pixels. Must be a positive integer.
Optional. Sets the initial position of the headed browser window on screen. Has no effect in headless mode.
Horizontal position in pixels from the left edge of the screen.
Vertical position in pixels from the top of the screen.
AI provider setup
To set your model, run:| Provider | Default model |
|---|---|
openai | openai/gpt-5.4 |
anthropic | anthropic/claude-sonnet-4-6 |
gemini | google/gemini-3-flash-preview |
vertex | vertex/gemini-2.5-pro |
provider/model-id string to pin a specific version:
Environment variables
Provider credentials are read from your shell environment or a.env file at the project root. Set the variable for your chosen provider:
Sessions
Each Libretto session gets its own directory under.libretto/sessions/<name>/. Sessions are created automatically when you run npx libretto open and are cleaned up with npx libretto close.
Session directory layout:
Session files
state.json — Metadata Libretto uses to reconnect to a running browser: the CDP debug port, the browser process PID, and the session status (running, paused, exited).
logs.jsonl — Structured JSONL log of CLI events for the session. Useful for tracing what happened during a run.
network.jsonl — One entry per HTTP request/response captured while the session was open. Each entry includes ts, method, url, status, contentType, and responseBody. Query with jq:
actions.jsonl — One entry per user or agent action. User entries include bestSemanticSelector, nearbyText, and coordinates. Agent entries include the Playwright locator and duration. Query with jq:
snapshots/ — One subdirectory per snapshot run, containing the captured PNG and HTML file.
Sessions are git-ignored by .libretto/.gitignore.
Profiles
Profiles save browser session state — cookies, localStorage, and other persistent storage — so you can reuse authenticated state across runs without logging in again each time. Location:.libretto/profiles/<domain>.json
Saving a profile
-
Open the site in headed mode so you can log in manually:
- Log in to the site in the browser window.
-
Save the current session state as a profile:
Using a profile
Pass--auth-profile <domain> to run: