Manage named browser sessions and control session access modes.
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>/:
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
Read-only sessions
Read-only mode prevents any mutating browser actions (clicks, typing, navigation, form fills) while still allowing inspection. This is useful for diagnosing live production sessions without risking accidental state changes.Starting a read-only session
Pass--read-only to open, connect, or run:
sessionMode in .libretto/config.json to change the default for all new sessions:
--write-access to open, connect, or run to override a read-only config default when creating a session.
Changing session mode
View or change the mode of an existing session withsession-mode:
What’s allowed in read-only mode
| Command | Allowed |
|---|---|
snapshot | Yes |
readonly-exec | Yes |
pages | Yes |
close | Yes |
session-mode | Yes |
exec | No |
readonly-exec
A restricted version of exec that only allows read operations on the page. Available methods include:
- Page reads:
url(),title(),content(),viewportSize,waitForLoadState,waitForURL - Locator factories:
locator(),getByRole(),getByText(),getByLabel(),getByPlaceholder(),getByAltText(),getByTitle(),getByTestId() - Locator reads:
textContent(),innerText(),boundingBox(),count(),getAttribute(),inputValue(),isVisible(),isHidden(),isEnabled(),isChecked() - Network:
get(url)(GET/HEAD only, no request bodies) - Viewport:
scrollBy(deltaX, deltaY)for scrolling by pixel offset - Other:
state,console,URL,Buffer
ReadonlyExecDenied error.