# The 23step CLI

`23step` is one static binary for macOS (arm64, amd64) and Linux (amd64, arm64). It runs the capture daemon, talks to it over a `0600` socket in its state directory, reconciles local agent transcripts, and updates itself. Install it with the [installer](https://23step.com/docs/installer.md).

## Commands

23step <command>:

| Command | What it does |
| --- | --- |
| `start` | Start the capture daemon and create a run. Exits with an error if one is already running in the same state directory. |
| `stop` | Upload anything queued, finalize the run, and stop the daemon. |
| `status` | Print the daemon state, `run_id`, `step_url`, and `captured` / `uploaded` / `failed` counts. Exit code 1 and `23step is not running` when no daemon is up. |
| `finalize` | Close the open run (`--prompt TEXT` seeds the next one) and keep the daemon running. Prints `finalized`, or `no open run`. |
| `note TEXT` | Attach an agent note (at most 500 characters) to the latest frame of the running step. Prints `queued`. |
| `feedback` | Fetch review comments and pins that people left on the running step, so an agent can react mid-run. |
| `reconcile` | Sync local Claude Code, Cursor, Antigravity, and Grok Bot sessions with the server, closing runs whose hooks never fired. |
| `login` | Sign in via browser OAuth 2.1 PKCE (`/oauth/cli-key`) and save a revocable `runs:write` key to `~/.config/23step-otel-key` (mode `0600`). |
| `update` | Download and install the latest release now (SHA-256 verified). |
| `version` | Print the version. `--json` adds build metadata. |

## API key and server

The CLI never takes a key as an argument. `start` reads it from `STEP23_TOKEN` or `--token-file PATH`; the file must be mode `600` and the key at least 16 characters. Use a key with the `runs:write` scope, created on [Account](https://app.23step.com/app/account).

`reconcile` also looks at `STEP23_OTEL_KEY`, `STEP23_OTEL_KEY_FILE`, `~/.config/23step-otel-key`, and `~/.config/23step/token`, in that order, so it works with the key the hooks already use.

Set the server with `--api` or `STEP23_API` (`https://api.23step.com`). The state directory defaults to `$XDG_DATA_HOME/23step` or `~/.local/share/23step`; pass `--state-dir` to run more than one daemon at a time.

## 23step start

On an X11 display the daemon takes a full-screen frame on each click and typing burst. Key presses are classified (letter, digit, enter, …) and never stored. With `--headless` it captures Chrome through the DevTools Protocol instead and needs no display. It only ever connects to DevTools on `127.0.0.1` or `localhost`.

Terminal (headless Chrome):

```sh
export STEP23_API=https://api.23step.com
nohup 23step start --headless --cdp http://127.0.0.1:9222 \
  --token-file ~/.config/23step-otel-key \
  --run-name checkout-test --prompt "Verify the checkout total" > /tmp/23step.log 2>&1 &
sleep 1 && 23step status
```

23step start flags:

| Flag | Env | Default | Meaning |
| --- | --- | --- | --- |
| `--api URL` | `STEP23_API` |  | API base URL. |
| `--token-file PATH` | `STEP23_TOKEN` |  | File holding the `runs:write` key. |
| `--run-name NAME` |  |  | Label stored with the run. |
| `--prompt TEXT` | `STEP23_PROMPT` |  | The user prompt that started the run. Redacted and capped at 16 KB. |
| `--session ID` | `STEP23_SESSION` |  | Agent conversation id. Successive prompts in one session chain together. |
| `--join-session` |  | off | Attach to the open run in `~/.local/share/23step/current.json` or to an open run for `--session` instead of making a second run. |
| `--run-id ID` | `STEP23_RUN_ID` |  | Attach directly to a specific open run id. |
| `--previous-step ID` | `STEP23_PREVIOUS_STEP` |  | Earlier run id in this conversation. |
| `--background` | `STEP23_BACKGROUND` | off | Mark the run as a background task. |
| `--background-kind KIND` | `STEP23_BACKGROUND_KIND` |  | `command`, `subagent`, `schedule`, `workflow`, or `swarm`. |
| `--hostname NAME` | `STEP23_HOSTNAME` | detected | Machine name shown on the run. |
| `--headless` | `STEP23_HEADLESS` | off | Capture Chrome over DevTools instead of X11. |
| `--cdp URL` | `STEP23_CDP_URL` | discovered | Loopback DevTools base URL, e.g. `http://127.0.0.1:9222`. |
| `--no-urls` |  | off | Do not record the active tab URL on frames. |
| `--no-cdp-input` |  | off | Do not capture clicks and keys through DevTools. |
| `--debounce D` |  | `400ms` | Typing burst window: one frame per burst. |
| `--settle D` |  | `300ms` | Extra frame after a click or burst. `0` turns it off. |
| `--max-duration D` |  | `0` (off) | Stop on its own after this long. |
| `--scale N` |  | `1` | Scale sent with the screen size. |
| `--state-dir PATH` |  | see above | pid, status, socket, and retry queue. |

## 23step status

Output (23step status):

```text
state: running
pid: 41822
run_id: 6f0c2a7e-5d1b-4c39-9a51-0b7f3f8e2c11
hostname: build-vm-3
step_url: https://app.23step.com/s/<share_id>
sign in to view
captured: 14
uploaded: 14
failed: 0
```

## Notes and live feedback

`23step note` lets an agent explain a frame while it works. `23step feedback` is the other direction: when someone comments on a running step or pins a spot on a frame, the item is waiting for the agent. The hooks call it for you and add the comment to the agent's context on the next tool call; your own scripts can poll it the same way.

`feedback` prints JSON by default and marks the items it returns as seen. `--peek` leaves them unseen; `--json=false` prints one line per item.

Terminal:

```sh
23step note "Checkout total verified at $42.10"
23step feedback --peek
```

Output (23step feedback):

```json
{
  "run_id": "6f0c2a7e-5d1b-4c39-9a51-0b7f3f8e2c11",
  "step_url": "https://app.23step.com/s/<share_id>",
  "items": [
    { "id": "c_19", "kind": "pin", "frame_kind": "image", "seq": 7, "x": 0.62, "y": 0.41,
      "comment": "This total should include tax", "author": "maria@example.com" }
  ]
}
```

## 23step reconcile

Hooks can miss a turn: the agent was killed, the laptop slept, or a turn went idle without a stop event. `reconcile` reads the local session stores and makes the server match them. The hooks start `23step reconcile --watch --idle-exit 15m` in the background, and the desktop overlay runs it every 20 seconds. Set `STEP23_DISABLE_RECONCILER=1` to turn that off.

23step reconcile flags:

| Flag | Default | Meaning |
| --- | --- | --- |
| `--api URL` | `STEP23_API` | API base URL. |
| `--token-file PATH` |  | Key file; see the lookup order above. |
| `--watch` | off | Keep running and poll. |
| `--interval D` | `15s` | Poll interval with `--watch`. |
| `--idle-exit D` | `0` (never) | Exit after this long with nothing to do. |
| `--lookback D` | `20m` | How far back to look on the first run. |
| `--hostname NAME` | detected | Machine name. |
| `--state-dir PATH` |  | Lock and cursor files. |
| `--json` | off | Print the pass statistics as JSON. |

## 23step login

`23step login` starts a temporary loopback callback server, opens the 23step OAuth 2.1 PKCE consent screen in your browser, exchanges the single-use authorization code at `POST /oauth/cli-key` for a revocable `st_` key, and saves it atomically with mode `0600` to `~/.config/23step-otel-key` (or `~/.config/23step-dev-key` when `--dev` is set).

Pass `--status` to verify that a configured key is accepted by `POST /v1/traces` without printing the secret, or `--no-browser` on remote/headless machines to print the login URL without launching a browser.

Terminal:

```sh
23step login
23step login --status
```

## Updates

Release builds check `https://api.23step.com/dist/manifest.json` in the background at most every 15 minutes and install a newer version on their own. Every download is checked against its SHA-256. `23step update --check` only reports; `23step update` installs now.

Update settings:

| Env | Meaning |
| --- | --- |
| `STEP23_AUTO_UPDATE` | `0` turns background updates off; `1` forces them on. |
| `STEP23_UPDATE_CHECK_INTERVAL` | How often to check, as a Go duration (default `15m`). |
| `STEP23_UPDATE_URL` | Where to read the manifest from instead of `STEP23_API`. |

---

Version: `v0.2` (latest). All 23step developer docs: https://23step.com/docs.md
