The --session flag
Almost every Libretto command accepts --session <name> to target a specific browser session. When you omit --session on commands that support auto-generation (open, run), Libretto creates a unique name automatically.
Session state is stored under .libretto/sessions/<session>/:
.libretto
sessions
<session>
state.json
logs.jsonl
network.jsonl
actions.jsonl
snapshots
profiles
pages
Thepages command lists all open pages (tabs) in a session and prints their IDs and URLs.
When to use pages
- A popup or new tab opened during navigation or interaction.
execorsnapshotfails because more than one page is open in the session.- You are not sure which page holds the relevant state.
pages, pass the target page ID to other commands with --page <page-id>:
Flags
The session to list pages for.
save
Thesave command saves the current browser session’s cookies and localStorage as a named auth profile. Load the profile later with --auth-profile to skip manual login.
When to use save
Only use save when the user explicitly asks to save or reuse authenticated browser state. A typical flow:
Profile storage
Profiles are stored in.libretto/profiles/<domain>.json. They are:
- Machine-local — not shared across environments or team members.
- Git-ignored by default.
- Subject to session expiry — if authentication stops working, repeat the login-and-save flow.
Flags
The domain (or URL) used to name the saved profile. Passed as the first positional argument. Example:
app.example.com.The session to save. Use the same name you passed to
npx libretto open --session.close
Theclose command closes a browser session and cleans up its state.
When to use close
- When you are done with a session.
- When an exploration session is no longer helping progress and you want to free up the browser.
- For full workspace cleanup at the end of a task.
When using
connect to attach to an external CDP endpoint, close clears the Libretto session record but does not terminate the remote browser process.Flags
The session to close. Required unless
--all is passed.Close all tracked sessions in this workspace.
Force-kill sessions that do not respond to SIGTERM. Requires
--all.Examples
init
Theinit command sets up Libretto in your project for the first time. It installs Chromium, copies the Libretto skill files to your agent directories, and walks you through configuring a snapshot analysis model.
What init does
- Installs the Playwright Chromium browser via
npx playwright install chromium. - Copies skill files to
.agents/skills/libretto/and.claude/skills/libretto/if those directories exist. - Prompts you to select an AI provider (OpenAI, Anthropic, Google Gemini, or Google Vertex AI) and enter your API key, which is written to
.env.
Flags
Skip the Playwright Chromium installation step. Useful if Chromium is already installed.
After init
You can change or update the snapshot analysis model at any time without re-running init:
open & connect
Start a session after init completes.
network & actions
Explore session logs captured during a run.