lmnr-cli is a command-line tool for onboarding a project, querying Laminar data, managing datasets, and annotating debug sessions from your terminal. It is the fastest way to wire up a new project, pull traces into a shell pipeline, script dataset maintenance, or connect an AI coding agent that can shell out, all without leaving the command line.
The CLI is a standalone npm package (
lmnr-cli) and ships independently from the @lmnr-ai/lmnr SDK. You do not need the SDK installed to onboard a project, query data, or manage datasets.Install
Quick start
lmnr-cli setup takes you from a fresh install to an instrumented project in one command:
- Logs you in (if you are not already).
- Lets you pick or create a project.
- Mints a project API key for your application’s SDK and writes
LMNR_PROJECT_API_KEY=...to your env file (an existing.env.localif you have one, otherwise.env). If a valid key for this project is already configured, it keeps that one. - Links the directory by writing
.lmnr/project.json. - Installs the Laminar agent skill into your project (
.claude/,.cursor/,.codex/, or.agents/).
setup is designed to be driven by coding agents. Pass --json for a single machine-readable line on stdout:
setup in the same directory reuses the linked project and keeps a working key in place: if a valid key for this project is already configured (in your environment or env file), it leaves it untouched. If your API key is invalid or revoked it will mint a new one. If your API key does not match the project configured in .lmnr/project.json it will abort with an error. Keys stay visible (and revocable) in Settings → Project API Keys.
Authenticate
Every CLI command authenticates as you, the signed-in user. Log in once withlmnr-cli login (or run lmnr-cli setup, which logs you in as its first step):
~/.config/lmnr/credentials.json (fallback precedence &XDG_CONFIG_HOME/, %APPDATA%\, ~/.config/). The short-lived access token is refreshed automatically as it nears expiry; if your session is revoked, run lmnr-cli login again.
Self-hosting
For a self-hosted deployment, point the CLI at your instance.login talks to your frontend (the auth issuer); the data commands (sql, dataset, project, trace, debug) talk to your API.
The cleanest way is to set the URLs once via environment variables. The CLI reads them from your environment and from a .env or .env.local file in the current directory.
login takes --frontend-url; the data commands take --base-url (and --port):
The CLI does not use a project API key. The
LMNR_PROJECT_API_KEY that lmnr-cli setup writes to your env file is for the Laminar SDK in your application to send traces; the CLI authenticates as you instead.Directory-scoped projects
Every project command (sql, dataset, project, trace, debug) resolves which project it targets from the directory you run in. lmnr-cli setup writes a .lmnr/project.json link file at the project root (it holds the project id and display details, never secrets). Commands then resolve the project in this order:
--project-id <id>flag.- The nearest
.lmnr/project.json, walking up from the current directory.
--project-id.
List the projects you can access and see which one is linked here:
●.
Query data with SQL
Run ClickHouse SQL against your project’s spans, traces, signal events, and more.sql runs against the linked project, so lmnr-cli login plus a linked directory (or --project-id) is all you need:
--json to emit structured JSON on stdout (messages and errors go to stderr), which makes it trivial to pipe into jq, a local script, or an AI coding agent:
Only
SELECT queries are allowed. The query runs scoped to your project automatically; no tenant filter is needed in your WHERE clause.Manage datasets
List, push, pull, and create datasets from files on disk. Supported formats:.jsonl, .json, .csv. Like sql, these commands run against the linked project.
Annotate debug sessions
These commands are the operational layer for the Debugger: you run the agent withLMNR_DEBUG=true, then use these to name the session, write per-trace notes, and open the session view. Like the other commands, they run against the linked project.
None of these commands need an id passed in. By default they target the session in
.lmnr/debug-session.json (the most recent LMNR_DEBUG=true run in this directory), and trace append-note targets that session’s latest trace. Pass --session-id or --trace-id to target a different one.trace append-note
Append a markdown note to a trace (stored inrollout.note trace metadata). Notes are append-only: each call adds a paragraph to the existing note. The note text is the only required argument; the note lands on the latest trace of the current debug session unless you pass --trace-id.
debug session new
Mint a fresh debug session and reset.lmnr/debug-session.json to it. The next LMNR_DEBUG=true run in this directory rejoins the new session instead of continuing the previous one. Use this to start a clean investigation.
--json emits {"sessionId","projectId","debuggerUrl"} instead. The command opens the session in your browser unless you pass --no-browser.
debug session open
Open the debug session’s debugger page in your browser. With no flag it opens the session in.lmnr/debug-session.json; pass --session-id to open another. The URL also prints to stdout (--json emits {"sessionId","debuggerUrl"}). This command is local-only: no login or network call.
debug session set-name
Set the display name of the current debug session (the one in.lmnr/debug-session.json), or pass --session-id to name another. The session must already exist (created by a LMNR_DEBUG=true run or debug session new). You can also rename a session inline by clicking its title in the session view.
debug session summary
Print every trace in the debug session with its note, oldest first. Use this to re-orient in an ongoing session after a context reset. Defaults to the current session; pass--session-id for another.
<trace id="..." end-time="..."/> tag you can feed into SQL queries.
See Debugger for the full record/replay process.
Piping and agent-friendly output
The CLI is designed to be scriptable and to plug cleanly into AI coding agents:- One-shot onboarding.
lmnr-cli setup --jsonemits a single machine-readable line (project id, minted key, dashboard URL) and uses distinct exit codes so an agent can branch on the failure mode:6login failed,7no project to select,8.envwrite failed,9key minting failed,10project discovery failed. - Structured output on stdout, logs on stderr. Every command that supports it takes
--jsonand prints machine-readable output to stdout, while human-friendly progress messages are written to stderr. This keeps pipes clean.
sql query --json, this makes the CLI a drop-in SQL layer for any agent that can run shell commands, with no SDK install required.
Help
Every command accepts-h / --help:
What’s next
SQL Editor
The UI counterpart for ad-hoc SQL queries, with schema reference and examples.
MCP Server
Connect Claude Code, Cursor, or any MCP client to Laminar directly.
Datasets CLI workflow
End-to-end example of pulling, editing, and pushing a dataset.
Debugger
Rerun long-running agents from a checkpoint without leaving the page.
