Skip to main content
The traceroot CLI sets up tracing in your repository with one command, then lets you work with your project from the terminal: traces, detector findings, alerts, dashboards, evaluations, and SQL. Pipe the JSON into whatever comes next. It is built for AI coding agents and power users who prefer the command line. The source is in the traceroot-cli repo.

Set up a repository

Run this from the root of the repository you want to trace:
Setup signs you in, has your coding agent add the traceroot SDK, and waits for your first trace; no install or sign-in needed first. Tracing covers each step, self-hosting, and troubleshooting.

Run without prompts

Setup never prompts when it isn’t attached to a terminal, when CI is set to anything but empty or false, or with --no-input or --json. Pass what it would otherwise ask for:
A project API key also sets the project. Without a key, run npx -y traceroot-cli@latest login first, then run setup without --api-key. Login prints a URL and a code for a person to confirm in a browser, and waits, so a coding agent has to show them to you. If setup exits 10, it can’t choose for you, usually because you have several projects or none: follow the remedy it prints. With several projects, you can pass --project. Without prompts, setup notes uncommitted changes instead of asking, and writes the instrumentation task to .traceroot/prompts/setup-instrument.md rather than running a coding agent. Pass --agent claude or --agent codex to run one. After the task is done and the application has run, rerun the same setup command with --resume, such as npx -y traceroot-cli@latest setup --no-input --resume, to get a link to the first trace. Exit codes lists what each code means, and Coding agents has these steps as a prompt.

Setup flags

Install

Every command also runs through npx, as above. To keep the traceroot command, install the CLI globally:
The examples below use traceroot. Without a global install, replace it with npx -y traceroot-cli@latest. The CLI needs Node.js 20.3 or later, and setup needs 20.12 or later. traceroot --version prints the version you have.

Authenticate

The CLI authenticates with either a browser login (the default interactive device flow) or a project API key (for CI environments and scripts).

Browser login (default)

Run traceroot login to sign in through your browser:
It prints a URL and a code, tries to open your browser, and saves a session to ~/.config/traceroot/credentials.json. If no browser opens, open the URL yourself. A key or saved credential changes what login does.

API key login (CI & scripts)

For CI pipelines, automated scripts, or headless environments, use a project API key (tr-...):
This validates the key against the API and saves it to ./.traceroot/config.json. Or set TRACEROOT_API_KEY, which a saved browser login outranks. A project API key can’t create or change resources. Create API keys in traceroot Cloud or your self-hosted dashboard.

Verify credentials

Confirm your active identity:
  • Browser login: Displays your authenticated email address, host URL, active project (or a hint to select one), and accessible workspaces.
  • API key login: Displays your workspace, project, host URL, and a masked key hint (e.g. tr-d0a3-57e3).

Scope to a project

A browser login identifies you across your workspaces rather than binding to one project, and commands such as traces and evals are project-scoped, so pick a project first. An API key is already scoped to its project, so a key login can skip this step. List the projects you can access to find your project ID:
Set TRACEROOT_PROJECT_ID so later commands need no extra flags, or pass --project <id> to individual commands:
Choose a project has the full order.

Inspect and export traces

Once authenticated and scoped to a project, list, inspect, and export traces:
Traces covers time filters, field groups, and the exported files.

Diagnose and add skills

doctor checks credentials, traceroot files, the repository, the environment, and the installed skills. setup doctor diagnoses a setup that didn’t complete. Both take --service <path> in a monorepo, and exit 1 when a check fails. instrument writes a prompt for a coding agent to add traceroot, without editing your code. It takes --agent (claude, codex, or generic), --print to write the prompt to stdout, --output <path>, and --force to overwrite an existing prompt. setup is the usual route. skills list shows the skills bundled with the CLI and where they’re installed. skills install copies one into an agent’s skill directory, and takes --agent, --force, and --dry-run to show what it would write. Coding agents lists the skills to use.

Command reference

Add --json to any command for machine-readable output, or run traceroot <command> --help for the full flag list. The sql commands are documented in Read-only SQL.

Output and exit codes

Scripting and CI covers JSON output, exit codes, and the flags most commands share.

Next steps

Each command group has its own page under Commands, starting with Traces.

Authentication and Configuration

Which credential, project, and host the CLI uses.

Scripting and CI

JSON output, exit codes, and JSON request bodies.

Evaluations from the Terminal

Read datasets, evaluations, and past runs.

Troubleshoot setup

Fix a setup that stopped before the first trace.