Skip to content
Unsnag

Quickstart

In the App

The quickest start needs no install: open the App, connect your CLI's GitHub repository (or give the command that installs a published CLI) and paste an OpenRouter key. Unsnag drafts Scenarios for you to review, then runs the first Report on a machine of its own, which you watch in the browser and share with a link. Using the App walks through every step.

From your terminal

The rest of this page does the same with the unsnag CLI on your own machine: from installing Unsnag to reading your first Report, in about fifteen minutes and a few dollars of model calls. It uses mycli as the name of your Target CLI: type your own CLI's name wherever you see it. Its Reports stay on your machine, unless you link the folder to a Project in the App (the CLI with a Project).

You need:

  • macOS or Linux, with Docker running and usable by your user (docker ps works without sudo). Every Run happens in a fresh Linux container.
  • An OpenRouter API key with a few dollars of credit. Every model call, the Agents' and Unsnag's own, goes through OpenRouter.
  • Your CLI's source code, in a git repository.

1. Install Unsnag

brew install pimlicolabs/tap/unsnag
unsnag --version

Unsnag is a single binary: there's no Python or Node environment to manage. The Homebrew formula arrives with Unsnag's first release; until then, build the binary from the repository with bun install && bun run build, which writes dist/unsnag.

2. Store your OpenRouter key

unsnag key set

It prompts for the key: paste it and press Enter (it isn't shown), or pipe it in: pbpaste | unsnag key set. Unsnag keeps it in ~/.config/unsnag/openrouter-key, readable only by you. OPENROUTER_API_KEY in the environment wins over the stored key, which is how CI passes its own.

3. Write a Benchmark

In your CLI's repository:

unsnag init mycli

This writes unsnag/benchmark.yaml and unsnag/.gitignore, which keeps the Report store (unsnag/reports/) and Unsnag's cache out of git. The Benchmark is short: cli, install and context, then commented-out blocks for when you need them (how much to run and spend, a backend, helping unsnag draft, a Dockerfile). Every other key is in the reference. init then prints what the defaults will run and cost, and a checklist of what is set up.

install holds the shell steps that put your CLI on PATH in the image every Run starts from. They run once per Report, as root on Debian (slim, with git, curl and python3), with your repository copied read-only at /src (without unsnag/, .git and your Context Conditions' skills, instructions and files, so nothing an Agent must not see ends up in the image). init fills them in when it recognises your project: a package.json with bin, go.mod, Cargo.toml, a pyproject.toml with scripts, or a single executable under bin/. Its checklist marks that guess ?. Otherwise it writes a step that fails until you replace it. For a Node CLI, the guess looks like this:

unsnag/benchmark.yaml
cli: mycli
 
install:
  - apt-get update && apt-get install -y --no-install-recommends nodejs npm
  - cp -r /src /opt/mycli && cd /opt/mycli && { npm ci || npm install; } && npm run build && npm install -g .
 
context:
  name-only: {}

Debian's Node is 18. When your package.json names the Node it needs ("engines": { "node": ">=22" }), the first step instead installs the latest release of that major from nodejs.org.

If shell steps can't express your build, replace install with dockerfile: a Dockerfile that starts from Unsnag's base image, which Unsnag passes in as UNSNAG_BASE. Unsnag builds it with the same project copy as install, then adds the Agents and its recording of your CLI on top.

unsnag/Dockerfile
ARG UNSNAG_BASE
FROM ${UNSNAG_BASE}
COPY . /opt/mycli
RUN cd /opt/mycli && make install

context lists the Context Conditions: name-only gives the Agents nothing but your CLI's name. The Context Conditions guide shows how to measure whether your skill file or docs help.

Then check it. validate --build checks the file, builds the Agents' image the way a Report does and finds mycli on PATH in it. It calls no models, so it is free.

unsnag validate --build

4. Draft Scenarios

A Scenario is a goal written the way a user would ask a colleague, with Checks that decide whether it was reached and a Reference Solution that proves it can be. Unsnag can draft them for you:

unsnag draft --count 5

The drafter, a Claude Code Agent, reads your CLI's help (and your source, if you list it under source), writes Scenarios and tries each one's Reference Solution in a container with your CLI installed. Only drafts that pass verify are written to unsnag/drafts/ as Draft Scenarios; an existing file is never overwritten. Drafting spends at most budget.draft ($5 by default).

List them:

unsnag scenarios

Read each draft. A good Scenario is something your users really ask for, and its goal gives no command away. Delete the drafts you reject, and accept the rest with unsnag scenarios accept <id>..., which moves them into unsnag/scenarios/: unsnag run skips drafts. The Scenarios guide covers writing your own.

5. Run the Benchmark

unsnag run

run builds your CLI into an image, verifies every Scenario, then has each of three Agents (Claude Code, Codex and opencode, each on a model from a different vendor) attempt every Scenario 5 times, recording every call to your CLI. The first line it prints is the Report's id and folder; progress goes to stderr. With 5 Scenarios that's 75 Runs, which takes a while and costs a few dollars. Spending is capped: a Run stops at budget.run ($1 by default), and once the Report has spent budget.report ($50) no further Run starts. For a cheaper first look, unsnag run --runs 1 runs each Cell once. The cost control guide has more.

6. Read the Report

When the Runs finish, run prints a summary: the success rate per Context Condition, the top three Findings of the fix queue, and the commands to dig further. Print it again at any time:

unsnag report

Open the HTML Report, with every Finding's evidence, every Run's transcript and every Scenario's results:

unsnag report --open

On a remote or headless machine, serve it over HTTP instead, and open the URL it prints (add --host 0.0.0.0 to reach it from another machine, or forward the port over SSH):

unsnag report --serve

Each Finding comes from fixed-rule Signals that fired in specific Runs. It shows the Runs it hit, the evidence (the step where it fired), the likely source file, a fix as before and after, a prompt to paste into your own coding agent, and the command that reruns exactly the Runs it hit, to check your fix.

The same data, for scripts and coding agents:

unsnag report --json

Next

  • Fix the top Finding, then run its verify command: the next Report compares itself with this one, its Baseline, and marks the Finding resolved.
  • Use Unsnag with your coding agent: unsnag init --skill teaches it this whole loop.
  • Run Unsnag in CI, so a change that makes your CLI harder for Agents fails the build.