# 23step: getting started

23step records what an AI agent did as a step you can share, audit, and explain. Human version: https://23step.com/getting-started

Pick the guide that matches how the agent runs. Each guide is also available on its own as Markdown (links below).

Rules for AI agents following these guides:

- Run repository-scoped commands from the root of the user's repository; global (`--global`) commands run from anywhere.
- Ask the user whether the **23step Overlay** Electron desktop app should also be installed on macOS or Linux (`curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay`; on Linux also start `nohup ~/.local/bin/23step-overlay >/dev/null 2>&1 &`; see [Desktop overlay](https://23step.com/getting-started/desktop-overlay.md)). Ask before opening the create-key page so one key can pre-select both `runs:read` and `runs:write` scopes when installing the overlay.
- Ask the user whether to opt in to **posting the step link at the end of final responses** (`--step-link`) and whether to opt in to the **live widget progress bar** (`--progress-bar`). Both are **off by default** because injecting pre-turn link instructions and calibrating live progress use extra tokens and slow down agent turns (and when the progress bar is off, it is omitted from the web and desktop live widget UIs). Ask before opening the create-key page or running installers: pass `--step-link` to `hooks.sh` only if the user opts in to posting step links at the end of replies; if the user opts in to the live widget progress bar, append `&progress=1` to the create-key URL (or, when reusing an existing key file without printing it, run `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat <key_file>)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`), pass `--progress-bar` to `hooks.sh` when installing coding-agent hooks, and pass `--progress-bar` to `install.sh` when installing `--overlay`.
- **Automatically open the create-key page** when an API key is needed: check whether the target key file already exists and is non-empty (`test -s ...`, never reading or printing its contents). When a new key is needed, open `https://app.23step.com/app/account?create=1&scopes=<scopes>&name=<agent>` (use `runs%3Aread+runs%3Awrite` when installing 23step Overlay, `runs%3Awrite` for hooks/CLI alone, or `runs%3Aread` for MCP alone, and append `&progress=1` if the user opted in to the live widget progress bar) in the user's **default desktop browser** (`open "$url"` on macOS, `xdg-open "$url" >/dev/null 2>&1 &` on Linux when `DISPLAY` or `WAYLAND_DISPLAY` is set, `wslview "$url"` on WSL—never a headless or isolated automation browser, because key creation uses the user's Google session) **and** include the URL in your reply in case the session is remote.
- API keys start with `st_`. Ask the user to paste the key (save it `chmod 600` without echoing) or run the terminal save command shown on the create-key page and tell you when done; never invent, print, or commit a key.
- Coding agents: install in one repository (`curl -fsSL https://23step.com/install/hooks.sh | sh -s -- <agent>`) or globally across all projects on the machine (`curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global <agent>`), adding `--step-link` and/or `--progress-bar` only for the options the user opted in to, where `<agent>` is one of `claude`, `codex`, `cursor`, `antigravity`, `gemini`, `cline`.
- Finish with the guide's "Check that it worked" step.

## Guides

- **Coding agents**: Claude Code, Codex, Cursor, Antigravity, Gemini CLI, Cline
  - [Claude Code](https://23step.com/getting-started/claude-code.md)
  - [Codex](https://23step.com/getting-started/codex.md)
  - [Cursor](https://23step.com/getting-started/cursor.md)
  - [Antigravity](https://23step.com/getting-started/antigravity.md)
  - [Gemini CLI](https://23step.com/getting-started/gemini-cli.md)
  - [Cline / OpenRouter](https://23step.com/getting-started/cline.md)
  - [OpenRouter SDK](https://23step.com/getting-started/openrouter-sdk.md)
- **Desktop overlay**: macOS & Linux live menu-bar app
  - [Desktop overlay](https://23step.com/getting-started/desktop-overlay.md)
- **Headless Chrome**: Playwright, Puppeteer, Chrome over CDP
  - [Headless Chrome](https://23step.com/getting-started/headless-chrome.md)
- **Linux desktop**: Computer-use agents on X11 or Xvfb
  - [Linux desktop](https://23step.com/getting-started/linux-desktop.md)
- **Grok Bot**: Turn adapter, no live hooks
  - [Grok Bot](https://23step.com/getting-started/grok-bot.md)
- **MCP server**: Let any AI read and explain a step
  - [Claude Code](https://23step.com/getting-started/mcp-claude-code.md)
  - [Cursor](https://23step.com/getting-started/mcp-cursor.md)
  - [Codex](https://23step.com/getting-started/mcp-codex.md)
  - [Gemini CLI](https://23step.com/getting-started/mcp-gemini-cli.md)
  - [Antigravity](https://23step.com/getting-started/mcp-antigravity.md)
  - [VS Code](https://23step.com/getting-started/mcp-vscode.md)
  - [Windsurf](https://23step.com/getting-started/mcp-windsurf.md)
  - [Claude Desktop](https://23step.com/getting-started/mcp-claude-desktop.md)

## Coding agents: in a repository or globally: Claude Code

Record every Claude Code turn as a step—in one repository or globally across every project.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=claude-code) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=claude-code) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=claude-code` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=claude-code` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`. Without a key the hooks exit quietly and never block the agent.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=claude-code'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Install the hooks (repository or global)

Pick **Repository** to commit hooks in `.claude/settings.json` so every contributor records turns in this repo, or **Global** (`--global`) to install once in `~/.claude/settings.json` so every project on your machine records without touching git. Add `--step-link` and/or `--progress-bar` only if opting in to posting the step link at the end of responses or the live widget progress bar (both off by default because they use extra tokens and slow down turns). Both merge safely without overwriting your other hooks, never read your key, can be run again anytime to update, and deduplicate automatically if both are installed.

Pick one:

Repository:

```sh
cd "$(git rev-parse --show-toplevel)"
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- claude
```

Global:

```sh
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global claude
```

### 3. Manual alternative to step 2 (optional)

Skip this if step 2 worked. Download the hook, then merge the matching config below into `.claude/settings.json` (repository) or `~/.claude/settings.json` (global).

Terminal:

```sh
# For a global install, replace .agents/hooks with ~/.agents/hooks
mkdir -p .agents/hooks
curl -fsSL https://23step.com/install/step23_otel.py -o .agents/hooks/step23_otel.py
```

Pick one:

Repository · .claude/settings.json:

```json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$CLAUDE_PROJECT_DIR/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$CLAUDE_PROJECT_DIR/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$CLAUDE_PROJECT_DIR/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$CLAUDE_PROJECT_DIR/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$CLAUDE_PROJECT_DIR/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ]
  }
}
```

Global · ~/.claude/settings.json:

```json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --claude"
          }
        ]
      }
    ]
  }
}
```

### 4. Restart Claude Code

Restart Claude Code. Run `/hooks` to confirm the 23step entries are listed (under **Project** for a repository install, or **User** for a global install).

### 5. Opt in to step links in replies or the live progress bar (optional)

Both **posting the step link at the end of final responses** (`--step-link`) and the **live widget progress bar** (`--progress-bar`) are **off by default**. Technically, injecting pre-turn instructions, printing `[23step](<step_url>)` at the end of replies, and asking coding agents to emit plan checklists and `[est: …]` / `[progress: …]` calibration tags use extra tokens and slow down turns—and when the progress bar is off, it is omitted from the web and desktop live widget UIs. Pass `--step-link` and/or `--progress-bar` to `hooks.sh` (and toggle **Show live progress bar** in [Settings](https://app.23step.com/app/settings#live-overlay-settings) or **23step Overlay Settings**, or append `&progress=1` when creating your key) if you want either enabled.

Terminal:

```sh
# Opt in to posting the step link at the end of responses, the live progress bar, or both:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link claude
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --progress-bar claude
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link --progress-bar claude

# Add --global for a global install, or pass --no-step-link / --no-progress-bar to turn back off:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global --step-link --progress-bar claude
```

### 6. Let 23step see the browser (optional)

The hook starts a headless `23step` recorder for each turn. When the agent opens Chrome with a loopback DevTools port, the recorder attaches and adds browser frames to the step. Add this to `AGENTS.md` or `CLAUDE.md` in the repository—or globally to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, or `~/.gemini/GEMINI.md`—so the agent always does that.

AGENTS.md:

```md
## 23step browser capture

This repository records agent turns with 23step hooks. Do not start or stop `23step` yourself.

Whenever you launch Chrome, Chromium, Playwright, or Puppeteer, expose a loopback DevTools port so 23step can capture the page:
- Chrome / Chromium: pass `--remote-debugging-address=127.0.0.1 --remote-debugging-port=9222`
- Playwright / Puppeteer: pass `args: ["--remote-debugging-address=127.0.0.1", "--remote-debugging-port=9222"]`
- If 9222 is busy, use any free 127.0.0.1 port. For a one-shot check, keep the page open about 1 second after load.
```

### 7. Watch runs live with the desktop overlay (optional)

Install **23step Overlay** (the standalone Electron app for macOS and Linux) when you want an always-on, click-through right-edge dock over your editor and full-screen workspaces without keeping a browser tab open. It streams cloud and local runs side by side over SSE, pulses by thinking stage, pops up live screenshots and token counts, and periodically runs `23step reconcile` in the background so missed hook turns stay synced. Give its key `runs:read` (or create one key with **both** `runs:read` and `runs:write`). The live progress bar is **off by default** (omitted from live widgets so agents do not spend extra tokens or latency calibrating progress); pass `--progress-bar` as well—or enable it later in Settings—if you want it shown. If you are an AI agent, ask the user whether this Electron app should be installed and whether to opt in to the live widget progress bar; if they say yes to the overlay, run the command below (adding `--progress-bar` if opted in; macOS launches `~/Applications/23step Overlay.app` automatically; on Linux also run `nohup ~/.local/bin/23step-overlay >/dev/null 2>&1 &`). Full setup: [Desktop overlay](https://23step.com/getting-started#overlay).

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
```

### 8. Link commits to their step (optional)

Save this as `.githooks/prepare-commit-msg` and point `core.hooksPath` at `.githooks` once per clone. Each `git commit` then gets a `23step: <step_url>` trailer for the active or most recent step. With no step it does nothing.

.githooks/prepare-commit-msg:

```sh
#!/bin/sh
# .githooks/prepare-commit-msg
# Adds a "23step: <step_url>" trailer from the active or most recent 23step step.
MSG_FILE="$1"
SOURCE="$2"

case "$SOURCE" in
  merge|squash|commit) exit 0 ;;
esac
grep -q '^23step:' "$MSG_FILE" 2>/dev/null && exit 0

STEP_URL=$(python3 -c '
import glob, json, os, time
uid = os.getuid()
now = time.time()
best_mtime, best_url = 0.0, ""
for pat in (f"/tmp/s23-{uid}-*/status.json", f"/tmp/s23-{uid}-*/last_step_url", os.path.expanduser("~/.local/share/23step/status.json")):
    for p in glob.glob(pat):
        try:
            mt = os.path.getmtime(p)
            if now - mt > 7200 or mt <= best_mtime:
                continue
            raw = open(p, encoding="utf-8").read().strip()
            url = json.loads(raw).get("step_url", "") if p.endswith(".json") else raw
            if url:
                best_mtime, best_url = mt, url
        except Exception:
            pass
print(best_url)
' 2>/dev/null)

if [ -n "$STEP_URL" ]; then
  git interpret-trailers --in-place --trailer "23step: $STEP_URL" "$MSG_FILE"
fi
```

Terminal:

```sh
chmod +x .githooks/prepare-commit-msg
git config core.hooksPath .githooks
```

### Check that it worked

Send the agent any prompt. Within a few seconds a new run for that turn appears at [app.23step.com/app/runs](https://app.23step.com/app/runs) with the prompt, thoughts, tool calls, and commands. Nothing there? Check that `~/.config/23step-otel-key` holds a `runs:write` key, that `python3 --version` works in the agent's shell, and that the agent was restarted after install.

## Coding agents: in a repository or globally: Codex

Record every Codex turn as a step—in one repository or globally across every project.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=codex) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=codex) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=codex` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=codex` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`. Without a key the hooks exit quietly and never block the agent.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=codex'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Install the hooks (repository or global)

Pick **Repository** to commit hooks in `.codex/hooks.json` so every contributor records turns in this repo, or **Global** (`--global`) to install once in `~/.codex/hooks.json` so every project on your machine records without touching git. If `$CODEX_HOME` is set, the global installer writes `$CODEX_HOME/hooks.json` instead. Add `--step-link` and/or `--progress-bar` only if opting in to posting the step link at the end of responses or the live widget progress bar (both off by default because they use extra tokens and slow down turns). Both merge safely without overwriting your other hooks, never read your key, can be run again anytime to update, and deduplicate automatically if both are installed.

Pick one:

Repository:

```sh
cd "$(git rev-parse --show-toplevel)"
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- codex
```

Global:

```sh
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global codex
```

### 3. Manual alternative to step 2 (optional)

Skip this if step 2 worked. Download the hook, then merge the matching config below into `.codex/hooks.json` (repository) or `~/.codex/hooks.json` (global).

Terminal:

```sh
# For a global install, replace .agents/hooks with ~/.agents/hooks
mkdir -p .agents/hooks
curl -fsSL https://23step.com/install/step23_otel.py -o .agents/hooks/step23_otel.py
```

Pick one:

Repository · .codex/hooks.json:

```json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$(git rev-parse --show-toplevel)/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$(git rev-parse --show-toplevel)/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$(git rev-parse --show-toplevel)/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$(git rev-parse --show-toplevel)/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$(git rev-parse --show-toplevel)/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ]
  }
}
```

Global · ~/.codex/hooks.json:

```json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\" --codex"
          }
        ]
      }
    ]
  }
}
```

### 4. Restart Codex

Restart Codex, open `/hooks`, and trust the new 23step hooks; Codex skips untrusted hooks until approved. Older Codex builds also need `codex_hooks = true` under `[features]` in `~/.codex/config.toml`.

### 5. Opt in to step links in replies or the live progress bar (optional)

Both **posting the step link at the end of final responses** (`--step-link`) and the **live widget progress bar** (`--progress-bar`) are **off by default**. Technically, injecting pre-turn instructions, printing `[23step](<step_url>)` at the end of replies, and asking coding agents to emit plan checklists and `[est: …]` / `[progress: …]` calibration tags use extra tokens and slow down turns—and when the progress bar is off, it is omitted from the web and desktop live widget UIs. Pass `--step-link` and/or `--progress-bar` to `hooks.sh` (and toggle **Show live progress bar** in [Settings](https://app.23step.com/app/settings#live-overlay-settings) or **23step Overlay Settings**, or append `&progress=1` when creating your key) if you want either enabled.

Terminal:

```sh
# Opt in to posting the step link at the end of responses, the live progress bar, or both:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link codex
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --progress-bar codex
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link --progress-bar codex

# Add --global for a global install, or pass --no-step-link / --no-progress-bar to turn back off:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global --step-link --progress-bar codex
```

### 6. Let 23step see the browser (optional)

The hook starts a headless `23step` recorder for each turn. When the agent opens Chrome with a loopback DevTools port, the recorder attaches and adds browser frames to the step. Add this to `AGENTS.md` or `CLAUDE.md` in the repository—or globally to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, or `~/.gemini/GEMINI.md`—so the agent always does that.

AGENTS.md:

```md
## 23step browser capture

This repository records agent turns with 23step hooks. Do not start or stop `23step` yourself.

Whenever you launch Chrome, Chromium, Playwright, or Puppeteer, expose a loopback DevTools port so 23step can capture the page:
- Chrome / Chromium: pass `--remote-debugging-address=127.0.0.1 --remote-debugging-port=9222`
- Playwright / Puppeteer: pass `args: ["--remote-debugging-address=127.0.0.1", "--remote-debugging-port=9222"]`
- If 9222 is busy, use any free 127.0.0.1 port. For a one-shot check, keep the page open about 1 second after load.
```

### 7. Watch runs live with the desktop overlay (optional)

Install **23step Overlay** (the standalone Electron app for macOS and Linux) when you want an always-on, click-through right-edge dock over your editor and full-screen workspaces without keeping a browser tab open. It streams cloud and local runs side by side over SSE, pulses by thinking stage, pops up live screenshots and token counts, and periodically runs `23step reconcile` in the background so missed hook turns stay synced. Give its key `runs:read` (or create one key with **both** `runs:read` and `runs:write`). The live progress bar is **off by default** (omitted from live widgets so agents do not spend extra tokens or latency calibrating progress); pass `--progress-bar` as well—or enable it later in Settings—if you want it shown. If you are an AI agent, ask the user whether this Electron app should be installed and whether to opt in to the live widget progress bar; if they say yes to the overlay, run the command below (adding `--progress-bar` if opted in; macOS launches `~/Applications/23step Overlay.app` automatically; on Linux also run `nohup ~/.local/bin/23step-overlay >/dev/null 2>&1 &`). Full setup: [Desktop overlay](https://23step.com/getting-started#overlay).

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
```

### 8. Link commits to their step (optional)

Save this as `.githooks/prepare-commit-msg` and point `core.hooksPath` at `.githooks` once per clone. Each `git commit` then gets a `23step: <step_url>` trailer for the active or most recent step. With no step it does nothing.

.githooks/prepare-commit-msg:

```sh
#!/bin/sh
# .githooks/prepare-commit-msg
# Adds a "23step: <step_url>" trailer from the active or most recent 23step step.
MSG_FILE="$1"
SOURCE="$2"

case "$SOURCE" in
  merge|squash|commit) exit 0 ;;
esac
grep -q '^23step:' "$MSG_FILE" 2>/dev/null && exit 0

STEP_URL=$(python3 -c '
import glob, json, os, time
uid = os.getuid()
now = time.time()
best_mtime, best_url = 0.0, ""
for pat in (f"/tmp/s23-{uid}-*/status.json", f"/tmp/s23-{uid}-*/last_step_url", os.path.expanduser("~/.local/share/23step/status.json")):
    for p in glob.glob(pat):
        try:
            mt = os.path.getmtime(p)
            if now - mt > 7200 or mt <= best_mtime:
                continue
            raw = open(p, encoding="utf-8").read().strip()
            url = json.loads(raw).get("step_url", "") if p.endswith(".json") else raw
            if url:
                best_mtime, best_url = mt, url
        except Exception:
            pass
print(best_url)
' 2>/dev/null)

if [ -n "$STEP_URL" ]; then
  git interpret-trailers --in-place --trailer "23step: $STEP_URL" "$MSG_FILE"
fi
```

Terminal:

```sh
chmod +x .githooks/prepare-commit-msg
git config core.hooksPath .githooks
```

### Check that it worked

Send the agent any prompt. Within a few seconds a new run for that turn appears at [app.23step.com/app/runs](https://app.23step.com/app/runs) with the prompt, thoughts, tool calls, and commands. Nothing there? Check that `~/.config/23step-otel-key` holds a `runs:write` key, that `python3 --version` works in the agent's shell, and that the agent was restarted after install.

## Coding agents: in a repository or globally: Cursor

Record every Cursor turn as a step—in one repository or globally across every project.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=cursor) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=cursor) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=cursor` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=cursor` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`. Without a key the hooks exit quietly and never block the agent.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=cursor'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Install the hooks (repository or global)

Pick **Repository** to commit hooks in `.cursor/hooks.json` so every contributor and Cursor Cloud Agent records turns in this repo, or **Global** (`--global`) to install once in `~/.cursor/hooks.json` so every project on your machine records without touching git. **Cursor Cloud Agents** run in remote VMs and do not load `~/.cursor/hooks.json` from your laptop—use the repository install if you run Cloud Agents. Add `--step-link` and/or `--progress-bar` only if opting in to posting the step link at the end of responses or the live widget progress bar (both off by default because they use extra tokens and slow down turns). Both merge safely without overwriting your other hooks, never read your key, can be run again anytime to update, and deduplicate automatically if both are installed.

Pick one:

Repository:

```sh
cd "$(git rev-parse --show-toplevel)"
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- cursor
```

Global:

```sh
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global cursor
```

### 3. Manual alternative to step 2 (optional)

Skip this if step 2 worked. Download the hooks, then merge the matching config below into `.cursor/hooks.json` (repository) or `~/.cursor/hooks.json` (global).

Terminal:

```sh
# For a global install, replace .agents and .cursor with ~/.agents and ~/.cursor
mkdir -p .agents/hooks .cursor/hooks
curl -fsSL https://23step.com/install/step23_otel.py -o .agents/hooks/step23_otel.py
curl -fsSL https://23step.com/install/cursor_step23_otel.py -o .cursor/hooks/step23_otel.py
```

Pick one:

Repository · .cursor/hooks.json:

```json
{
  "version": 1,
  "hooks": {
    "sessionStart": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "sessionEnd": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "subagentStart": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "subagentStop": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "preToolUse": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "postToolUse": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "postToolUseFailure": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "beforeShellExecution": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "afterShellExecution": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "beforeMCPExecution": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "afterMCPExecution": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "beforeReadFile": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "afterFileEdit": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "beforeSubmitPrompt": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "afterAgentResponse": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "afterAgentThought": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "stop": [{ "command": "python3 .cursor/hooks/step23_otel.py" }],
    "preCompact": [{ "command": "python3 .cursor/hooks/step23_otel.py" }]
  }
}
```

Global · ~/.cursor/hooks.json:

```json
{
  "version": 1,
  "hooks": {
    "sessionStart": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "sessionEnd": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "subagentStart": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "subagentStop": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "preToolUse": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "postToolUse": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "postToolUseFailure": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "beforeShellExecution": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "afterShellExecution": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "beforeMCPExecution": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "afterMCPExecution": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "beforeReadFile": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "afterFileEdit": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "beforeSubmitPrompt": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "afterAgentResponse": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "afterAgentThought": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "stop": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }],
    "preCompact": [{ "command": "python3 \"$HOME/.cursor/hooks/step23_otel.py\"" }]
  }
}
```

### 4. Restart Cursor

Restart Cursor (or reload the window). The hooks appear under **Cursor Settings › Hooks** (under **Project** or **User**).

### 5. Cursor Cloud Agents: add secrets (optional)

Cloud Agents run the committed `.cursor/hooks.json` in the repository and do not read `~/.config` or `~/.cursor/hooks.json` from your laptop. Add these in [Cursor › Cloud Agents › Secrets](https://cursor.com/dashboard/cloud-agents) (My Secrets): **Runtime Secret** for the `st_` keys, **Environment Variable** for the URLs. Under **Apply to**, choose all repositories (or at least this one). Existing agents do not pick up new secrets; start a new Cloud Agent after saving. Cursor Desktop ignores dashboard secrets and keeps using the key file from step 1.

Cloud Agent secrets:

| Name | Type | Value |
| --- | --- | --- |
| `STEP23_API` | Environment Variable | `https://api.23step.com` |
| `STEP23_OTEL_ENDPOINT` | Environment Variable | `https://api.23step.com` |
| `STEP23_OTEL_KEY` | Runtime Secret | `runs:write` API key |
| `STEP23_TOKEN` | Runtime Secret | same write key |
| `STEP23_MCP_KEY` | Runtime Secret | `runs:read` API key (for MCP) |

### 6. Opt in to step links in replies or the live progress bar (optional)

Both **posting the step link at the end of final responses** (`--step-link`) and the **live widget progress bar** (`--progress-bar`) are **off by default**. Technically, injecting pre-turn instructions, printing `[23step](<step_url>)` at the end of replies, and asking coding agents to emit plan checklists and `[est: …]` / `[progress: …]` calibration tags use extra tokens and slow down turns—and when the progress bar is off, it is omitted from the web and desktop live widget UIs. Pass `--step-link` and/or `--progress-bar` to `hooks.sh` (and toggle **Show live progress bar** in [Settings](https://app.23step.com/app/settings#live-overlay-settings) or **23step Overlay Settings**, or append `&progress=1` when creating your key) if you want either enabled.

Terminal:

```sh
# Opt in to posting the step link at the end of responses, the live progress bar, or both:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link cursor
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --progress-bar cursor
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link --progress-bar cursor

# Add --global for a global install, or pass --no-step-link / --no-progress-bar to turn back off:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global --step-link --progress-bar cursor
```

### 7. Let 23step see the browser (optional)

The hook starts a headless `23step` recorder for each turn. When the agent opens Chrome with a loopback DevTools port, the recorder attaches and adds browser frames to the step. Add this to `AGENTS.md` or `CLAUDE.md` in the repository—or globally to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, or `~/.gemini/GEMINI.md`—so the agent always does that.

AGENTS.md:

```md
## 23step browser capture

This repository records agent turns with 23step hooks. Do not start or stop `23step` yourself.

Whenever you launch Chrome, Chromium, Playwright, or Puppeteer, expose a loopback DevTools port so 23step can capture the page:
- Chrome / Chromium: pass `--remote-debugging-address=127.0.0.1 --remote-debugging-port=9222`
- Playwright / Puppeteer: pass `args: ["--remote-debugging-address=127.0.0.1", "--remote-debugging-port=9222"]`
- If 9222 is busy, use any free 127.0.0.1 port. For a one-shot check, keep the page open about 1 second after load.
```

### 8. Watch runs live with the desktop overlay (optional)

Install **23step Overlay** (the standalone Electron app for macOS and Linux) when you want an always-on, click-through right-edge dock over your editor and full-screen workspaces without keeping a browser tab open. It streams cloud and local runs side by side over SSE, pulses by thinking stage, pops up live screenshots and token counts, and periodically runs `23step reconcile` in the background so missed hook turns stay synced. Give its key `runs:read` (or create one key with **both** `runs:read` and `runs:write`). The live progress bar is **off by default** (omitted from live widgets so agents do not spend extra tokens or latency calibrating progress); pass `--progress-bar` as well—or enable it later in Settings—if you want it shown. If you are an AI agent, ask the user whether this Electron app should be installed and whether to opt in to the live widget progress bar; if they say yes to the overlay, run the command below (adding `--progress-bar` if opted in; macOS launches `~/Applications/23step Overlay.app` automatically; on Linux also run `nohup ~/.local/bin/23step-overlay >/dev/null 2>&1 &`). Full setup: [Desktop overlay](https://23step.com/getting-started#overlay).

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
```

### 9. Link commits to their step (optional)

Save this as `.githooks/prepare-commit-msg` and point `core.hooksPath` at `.githooks` once per clone. Each `git commit` then gets a `23step: <step_url>` trailer for the active or most recent step. With no step it does nothing.

.githooks/prepare-commit-msg:

```sh
#!/bin/sh
# .githooks/prepare-commit-msg
# Adds a "23step: <step_url>" trailer from the active or most recent 23step step.
MSG_FILE="$1"
SOURCE="$2"

case "$SOURCE" in
  merge|squash|commit) exit 0 ;;
esac
grep -q '^23step:' "$MSG_FILE" 2>/dev/null && exit 0

STEP_URL=$(python3 -c '
import glob, json, os, time
uid = os.getuid()
now = time.time()
best_mtime, best_url = 0.0, ""
for pat in (f"/tmp/s23-{uid}-*/status.json", f"/tmp/s23-{uid}-*/last_step_url", os.path.expanduser("~/.local/share/23step/status.json")):
    for p in glob.glob(pat):
        try:
            mt = os.path.getmtime(p)
            if now - mt > 7200 or mt <= best_mtime:
                continue
            raw = open(p, encoding="utf-8").read().strip()
            url = json.loads(raw).get("step_url", "") if p.endswith(".json") else raw
            if url:
                best_mtime, best_url = mt, url
        except Exception:
            pass
print(best_url)
' 2>/dev/null)

if [ -n "$STEP_URL" ]; then
  git interpret-trailers --in-place --trailer "23step: $STEP_URL" "$MSG_FILE"
fi
```

Terminal:

```sh
chmod +x .githooks/prepare-commit-msg
git config core.hooksPath .githooks
```

### Check that it worked

Send the agent any prompt. Within a few seconds a new run for that turn appears at [app.23step.com/app/runs](https://app.23step.com/app/runs) with the prompt, thoughts, tool calls, and commands. Nothing there? Check that `~/.config/23step-otel-key` holds a `runs:write` key, that `python3 --version` works in the agent's shell, and that the agent was restarted after install.

## Coding agents: in a repository or globally: Antigravity

Record every Antigravity turn as a step—in one repository or globally across every project.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=antigravity) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=antigravity) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=antigravity` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=antigravity` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`. Without a key the hooks exit quietly and never block the agent.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=antigravity'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Install the hooks (repository or global)

Pick **Repository** to commit hooks in `.agents/hooks.json` so every contributor records turns in this repo, or **Global** (`--global`) to install once in `~/.gemini/config/hooks.json` so every project on your machine records without touching git. Add `--step-link` and/or `--progress-bar` only if opting in to posting the step link at the end of responses or the live widget progress bar (both off by default because they use extra tokens and slow down turns). Both merge safely without overwriting your other hooks, never read your key, can be run again anytime to update, and deduplicate automatically if both are installed.

Pick one:

Repository:

```sh
cd "$(git rev-parse --show-toplevel)"
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- antigravity
```

Global:

```sh
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global antigravity
```

### 3. Manual alternative to step 2 (optional)

Skip this if step 2 worked. Download the hook, then merge the matching config below into `.agents/hooks.json` (repository) or `~/.gemini/config/hooks.json` (global).

Terminal:

```sh
# For a global install, replace .agents/hooks with ~/.agents/hooks
mkdir -p .agents/hooks
curl -fsSL https://23step.com/install/step23_otel.py -o .agents/hooks/step23_otel.py
```

Pick one:

Repository · .agents/hooks.json:

```json
{
  "step23-otel": {
    "SessionStart": [
      {
        "type": "command",
        "command": "python3 ./hooks/step23_otel.py"
      }
    ],
    "PreInvocation": [
      {
        "type": "command",
        "command": "python3 ./hooks/step23_otel.py"
      }
    ],
    "PostInvocation": [
      {
        "type": "command",
        "command": "python3 ./hooks/step23_otel.py"
      }
    ],
    "PreToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 ./hooks/step23_otel.py"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 ./hooks/step23_otel.py"
          }
        ]
      }
    ],
    "Stop": [
      {
        "type": "command",
        "command": "python3 ./hooks/step23_otel.py"
      }
    ]
  }
}
```

Global · ~/.gemini/config/hooks.json:

```json
{
  "step23-otel": {
    "SessionStart": [
      {
        "type": "command",
        "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\""
      }
    ],
    "PreInvocation": [
      {
        "type": "command",
        "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\""
      }
    ],
    "PostInvocation": [
      {
        "type": "command",
        "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\""
      }
    ],
    "PreToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\""
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\""
          }
        ]
      }
    ],
    "Stop": [
      {
        "type": "command",
        "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\""
      }
    ]
  }
}
```

### 4. Restart Antigravity

Start a new Antigravity conversation. Hooks load from `.agents/hooks.json` at the workspace root or globally from `~/.gemini/config/hooks.json`.

### 5. Opt in to step links in replies or the live progress bar (optional)

Both **posting the step link at the end of final responses** (`--step-link`) and the **live widget progress bar** (`--progress-bar`) are **off by default**. Technically, injecting pre-turn instructions, printing `[23step](<step_url>)` at the end of replies, and asking coding agents to emit plan checklists and `[est: …]` / `[progress: …]` calibration tags use extra tokens and slow down turns—and when the progress bar is off, it is omitted from the web and desktop live widget UIs. Pass `--step-link` and/or `--progress-bar` to `hooks.sh` (and toggle **Show live progress bar** in [Settings](https://app.23step.com/app/settings#live-overlay-settings) or **23step Overlay Settings**, or append `&progress=1` when creating your key) if you want either enabled.

Terminal:

```sh
# Opt in to posting the step link at the end of responses, the live progress bar, or both:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link antigravity
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --progress-bar antigravity
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link --progress-bar antigravity

# Add --global for a global install, or pass --no-step-link / --no-progress-bar to turn back off:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global --step-link --progress-bar antigravity
```

### 6. Let 23step see the browser (optional)

The hook starts a headless `23step` recorder for each turn. When the agent opens Chrome with a loopback DevTools port, the recorder attaches and adds browser frames to the step. Add this to `AGENTS.md` or `CLAUDE.md` in the repository—or globally to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, or `~/.gemini/GEMINI.md`—so the agent always does that.

AGENTS.md:

```md
## 23step browser capture

This repository records agent turns with 23step hooks. Do not start or stop `23step` yourself.

Whenever you launch Chrome, Chromium, Playwright, or Puppeteer, expose a loopback DevTools port so 23step can capture the page:
- Chrome / Chromium: pass `--remote-debugging-address=127.0.0.1 --remote-debugging-port=9222`
- Playwright / Puppeteer: pass `args: ["--remote-debugging-address=127.0.0.1", "--remote-debugging-port=9222"]`
- If 9222 is busy, use any free 127.0.0.1 port. For a one-shot check, keep the page open about 1 second after load.
```

### 7. Watch runs live with the desktop overlay (optional)

Install **23step Overlay** (the standalone Electron app for macOS and Linux) when you want an always-on, click-through right-edge dock over your editor and full-screen workspaces without keeping a browser tab open. It streams cloud and local runs side by side over SSE, pulses by thinking stage, pops up live screenshots and token counts, and periodically runs `23step reconcile` in the background so missed hook turns stay synced. Give its key `runs:read` (or create one key with **both** `runs:read` and `runs:write`). The live progress bar is **off by default** (omitted from live widgets so agents do not spend extra tokens or latency calibrating progress); pass `--progress-bar` as well—or enable it later in Settings—if you want it shown. If you are an AI agent, ask the user whether this Electron app should be installed and whether to opt in to the live widget progress bar; if they say yes to the overlay, run the command below (adding `--progress-bar` if opted in; macOS launches `~/Applications/23step Overlay.app` automatically; on Linux also run `nohup ~/.local/bin/23step-overlay >/dev/null 2>&1 &`). Full setup: [Desktop overlay](https://23step.com/getting-started#overlay).

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
```

### 8. Link commits to their step (optional)

Save this as `.githooks/prepare-commit-msg` and point `core.hooksPath` at `.githooks` once per clone. Each `git commit` then gets a `23step: <step_url>` trailer for the active or most recent step. With no step it does nothing.

.githooks/prepare-commit-msg:

```sh
#!/bin/sh
# .githooks/prepare-commit-msg
# Adds a "23step: <step_url>" trailer from the active or most recent 23step step.
MSG_FILE="$1"
SOURCE="$2"

case "$SOURCE" in
  merge|squash|commit) exit 0 ;;
esac
grep -q '^23step:' "$MSG_FILE" 2>/dev/null && exit 0

STEP_URL=$(python3 -c '
import glob, json, os, time
uid = os.getuid()
now = time.time()
best_mtime, best_url = 0.0, ""
for pat in (f"/tmp/s23-{uid}-*/status.json", f"/tmp/s23-{uid}-*/last_step_url", os.path.expanduser("~/.local/share/23step/status.json")):
    for p in glob.glob(pat):
        try:
            mt = os.path.getmtime(p)
            if now - mt > 7200 or mt <= best_mtime:
                continue
            raw = open(p, encoding="utf-8").read().strip()
            url = json.loads(raw).get("step_url", "") if p.endswith(".json") else raw
            if url:
                best_mtime, best_url = mt, url
        except Exception:
            pass
print(best_url)
' 2>/dev/null)

if [ -n "$STEP_URL" ]; then
  git interpret-trailers --in-place --trailer "23step: $STEP_URL" "$MSG_FILE"
fi
```

Terminal:

```sh
chmod +x .githooks/prepare-commit-msg
git config core.hooksPath .githooks
```

### Check that it worked

Send the agent any prompt. Within a few seconds a new run for that turn appears at [app.23step.com/app/runs](https://app.23step.com/app/runs) with the prompt, thoughts, tool calls, and commands. Nothing there? Check that `~/.config/23step-otel-key` holds a `runs:write` key, that `python3 --version` works in the agent's shell, and that the agent was restarted after install.

## Coding agents: in a repository or globally: Gemini CLI

Record every Gemini CLI turn as a step—in one repository or globally across every project.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=gemini-cli) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=gemini-cli) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=gemini-cli` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=gemini-cli` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`. Without a key the hooks exit quietly and never block the agent.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=gemini-cli'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Install the hooks (repository or global)

Pick **Repository** to commit hooks in `.gemini/settings.json` so every contributor records turns in this repo, or **Global** (`--global`) to install once in `~/.gemini/settings.json` so every project on your machine records without touching git. Add `--step-link` and/or `--progress-bar` only if opting in to posting the step link at the end of responses or the live widget progress bar (both off by default because they use extra tokens and slow down turns). Both merge safely without overwriting your other hooks, never read your key, can be run again anytime to update, and deduplicate automatically if both are installed.

Pick one:

Repository:

```sh
cd "$(git rev-parse --show-toplevel)"
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- gemini
```

Global:

```sh
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global gemini
```

### 3. Manual alternative to step 2 (optional)

Skip this if step 2 worked. Download the hook, then merge the matching config below into `.gemini/settings.json` (repository) or `~/.gemini/settings.json` (global).

Terminal:

```sh
# For a global install, replace .agents/hooks with ~/.agents/hooks
mkdir -p .agents/hooks
curl -fsSL https://23step.com/install/step23_otel.py -o .agents/hooks/step23_otel.py
```

Pick one:

Repository · .gemini/settings.json:

```json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "SessionEnd": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "BeforeAgent": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "AfterAgent": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "BeforeModel": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "AfterModel": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "BeforeTool": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "AfterTool": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "Notification": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .agents/hooks/step23_otel.py",
            "name": "step23-otel"
          }
        ]
      }
    ]
  }
}
```

Global · ~/.gemini/settings.json:

```json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "SessionEnd": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "BeforeAgent": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "AfterAgent": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "BeforeModel": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "AfterModel": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "BeforeTool": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "AfterTool": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ],
    "Notification": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "python3 \"$HOME/.agents/hooks/step23_otel.py\"",
            "name": "step23-otel"
          }
        ]
      }
    ]
  }
}
```

### 4. Restart Gemini CLI

Restart `gemini`. Run `/hooks` to see the `step23-otel` entries.

### 5. Opt in to step links in replies or the live progress bar (optional)

Both **posting the step link at the end of final responses** (`--step-link`) and the **live widget progress bar** (`--progress-bar`) are **off by default**. Technically, injecting pre-turn instructions, printing `[23step](<step_url>)` at the end of replies, and asking coding agents to emit plan checklists and `[est: …]` / `[progress: …]` calibration tags use extra tokens and slow down turns—and when the progress bar is off, it is omitted from the web and desktop live widget UIs. Pass `--step-link` and/or `--progress-bar` to `hooks.sh` (and toggle **Show live progress bar** in [Settings](https://app.23step.com/app/settings#live-overlay-settings) or **23step Overlay Settings**, or append `&progress=1` when creating your key) if you want either enabled.

Terminal:

```sh
# Opt in to posting the step link at the end of responses, the live progress bar, or both:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link gemini
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --progress-bar gemini
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link --progress-bar gemini

# Add --global for a global install, or pass --no-step-link / --no-progress-bar to turn back off:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global --step-link --progress-bar gemini
```

### 6. Let 23step see the browser (optional)

The hook starts a headless `23step` recorder for each turn. When the agent opens Chrome with a loopback DevTools port, the recorder attaches and adds browser frames to the step. Add this to `AGENTS.md` or `CLAUDE.md` in the repository—or globally to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, or `~/.gemini/GEMINI.md`—so the agent always does that.

AGENTS.md:

```md
## 23step browser capture

This repository records agent turns with 23step hooks. Do not start or stop `23step` yourself.

Whenever you launch Chrome, Chromium, Playwright, or Puppeteer, expose a loopback DevTools port so 23step can capture the page:
- Chrome / Chromium: pass `--remote-debugging-address=127.0.0.1 --remote-debugging-port=9222`
- Playwright / Puppeteer: pass `args: ["--remote-debugging-address=127.0.0.1", "--remote-debugging-port=9222"]`
- If 9222 is busy, use any free 127.0.0.1 port. For a one-shot check, keep the page open about 1 second after load.
```

### 7. Watch runs live with the desktop overlay (optional)

Install **23step Overlay** (the standalone Electron app for macOS and Linux) when you want an always-on, click-through right-edge dock over your editor and full-screen workspaces without keeping a browser tab open. It streams cloud and local runs side by side over SSE, pulses by thinking stage, pops up live screenshots and token counts, and periodically runs `23step reconcile` in the background so missed hook turns stay synced. Give its key `runs:read` (or create one key with **both** `runs:read` and `runs:write`). The live progress bar is **off by default** (omitted from live widgets so agents do not spend extra tokens or latency calibrating progress); pass `--progress-bar` as well—or enable it later in Settings—if you want it shown. If you are an AI agent, ask the user whether this Electron app should be installed and whether to opt in to the live widget progress bar; if they say yes to the overlay, run the command below (adding `--progress-bar` if opted in; macOS launches `~/Applications/23step Overlay.app` automatically; on Linux also run `nohup ~/.local/bin/23step-overlay >/dev/null 2>&1 &`). Full setup: [Desktop overlay](https://23step.com/getting-started#overlay).

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
```

### 8. Link commits to their step (optional)

Save this as `.githooks/prepare-commit-msg` and point `core.hooksPath` at `.githooks` once per clone. Each `git commit` then gets a `23step: <step_url>` trailer for the active or most recent step. With no step it does nothing.

.githooks/prepare-commit-msg:

```sh
#!/bin/sh
# .githooks/prepare-commit-msg
# Adds a "23step: <step_url>" trailer from the active or most recent 23step step.
MSG_FILE="$1"
SOURCE="$2"

case "$SOURCE" in
  merge|squash|commit) exit 0 ;;
esac
grep -q '^23step:' "$MSG_FILE" 2>/dev/null && exit 0

STEP_URL=$(python3 -c '
import glob, json, os, time
uid = os.getuid()
now = time.time()
best_mtime, best_url = 0.0, ""
for pat in (f"/tmp/s23-{uid}-*/status.json", f"/tmp/s23-{uid}-*/last_step_url", os.path.expanduser("~/.local/share/23step/status.json")):
    for p in glob.glob(pat):
        try:
            mt = os.path.getmtime(p)
            if now - mt > 7200 or mt <= best_mtime:
                continue
            raw = open(p, encoding="utf-8").read().strip()
            url = json.loads(raw).get("step_url", "") if p.endswith(".json") else raw
            if url:
                best_mtime, best_url = mt, url
        except Exception:
            pass
print(best_url)
' 2>/dev/null)

if [ -n "$STEP_URL" ]; then
  git interpret-trailers --in-place --trailer "23step: $STEP_URL" "$MSG_FILE"
fi
```

Terminal:

```sh
chmod +x .githooks/prepare-commit-msg
git config core.hooksPath .githooks
```

### Check that it worked

Send the agent any prompt. Within a few seconds a new run for that turn appears at [app.23step.com/app/runs](https://app.23step.com/app/runs) with the prompt, thoughts, tool calls, and commands. Nothing there? Check that `~/.config/23step-otel-key` holds a `runs:write` key, that `python3 --version` works in the agent's shell, and that the agent was restarted after install.

## Coding agents: in a repository or globally: Cline / OpenRouter

Record every Cline / OpenRouter turn as a step—in one repository or globally across every project.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=cline) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=cline) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=cline` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=cline` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`. Without a key the hooks exit quietly and never block the agent.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=cline'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Install the hooks (repository or global)

Pick **Repository** to commit hooks in `.clinerules/hooks/TaskStart` (and the other `.clinerules/hooks/*` files) so every contributor records turns in this repo, or **Global** (`--global`) to install once in `~/Documents/Cline/Hooks/TaskStart` so every project on your machine records without touching git. The global installer writes `~/.cline/hooks/*` (Cline CLI) and, when `~/Documents` exists, `~/Documents/Cline/Hooks/*` (VS Code extension). Add `--step-link` and/or `--progress-bar` only if opting in to posting the step link at the end of responses or the live widget progress bar (both off by default because they use extra tokens and slow down turns). Both merge safely without overwriting your other hooks, never read your key, can be run again anytime to update, and deduplicate automatically if both are installed.

Pick one:

Repository:

```sh
cd "$(git rev-parse --show-toplevel)"
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- cline
```

Global:

```sh
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global cline
```

### 3. Manual alternative to step 2 (optional)

Skip this if step 2 worked. Cline runs any executable file named after a hook in `.clinerules/hooks/` (repository) or `~/Documents/Cline/Hooks/` / `~/.cline/hooks/` (global). Create one per event and `chmod +x` them.

Terminal:

```sh
# For a global install, replace .agents/hooks with ~/.agents/hooks
mkdir -p .agents/hooks
curl -fsSL https://23step.com/install/step23_otel.py -o .agents/hooks/step23_otel.py
```

Pick one:

Repository · .clinerules/hooks/TaskStart:

```sh
#!/bin/sh
# .clinerules/hooks/TaskStart  (same body for UserPromptSubmit, PreToolUse,
# PostToolUse, and TaskComplete; change the last word to the file name)
root=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
exec python3 "$root/.agents/hooks/step23_otel.py" --openrouter --cline TaskStart
```

Global · ~/Documents/Cline/Hooks/TaskStart:

```sh
#!/bin/sh
# ~/Documents/Cline/Hooks/TaskStart (VS Code) or ~/.cline/hooks/TaskStart (CLI)
# Same body for UserPromptSubmit, PreToolUse, PostToolUse, and TaskComplete;
# change the last word to the file name.
exec python3 "$HOME/.agents/hooks/step23_otel.py" --openrouter --cline TaskStart
```

### 4. Restart Cline / OpenRouter

Turn on **Hooks** in Cline settings if they are off, then start a new task. This works with any model Cline uses, including OpenRouter.

### 5. Opt in to step links in replies or the live progress bar (optional)

Both **posting the step link at the end of final responses** (`--step-link`) and the **live widget progress bar** (`--progress-bar`) are **off by default**. Technically, injecting pre-turn instructions, printing `[23step](<step_url>)` at the end of replies, and asking coding agents to emit plan checklists and `[est: …]` / `[progress: …]` calibration tags use extra tokens and slow down turns—and when the progress bar is off, it is omitted from the web and desktop live widget UIs. Pass `--step-link` and/or `--progress-bar` to `hooks.sh` (and toggle **Show live progress bar** in [Settings](https://app.23step.com/app/settings#live-overlay-settings) or **23step Overlay Settings**, or append `&progress=1` when creating your key) if you want either enabled.

Terminal:

```sh
# Opt in to posting the step link at the end of responses, the live progress bar, or both:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link cline
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --progress-bar cline
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --step-link --progress-bar cline

# Add --global for a global install, or pass --no-step-link / --no-progress-bar to turn back off:
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global --step-link --progress-bar cline
```

### 6. Let 23step see the browser (optional)

The hook starts a headless `23step` recorder for each turn. When the agent opens Chrome with a loopback DevTools port, the recorder attaches and adds browser frames to the step. Add this to `AGENTS.md` or `CLAUDE.md` in the repository—or globally to `~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, or `~/.gemini/GEMINI.md`—so the agent always does that.

AGENTS.md:

```md
## 23step browser capture

This repository records agent turns with 23step hooks. Do not start or stop `23step` yourself.

Whenever you launch Chrome, Chromium, Playwright, or Puppeteer, expose a loopback DevTools port so 23step can capture the page:
- Chrome / Chromium: pass `--remote-debugging-address=127.0.0.1 --remote-debugging-port=9222`
- Playwright / Puppeteer: pass `args: ["--remote-debugging-address=127.0.0.1", "--remote-debugging-port=9222"]`
- If 9222 is busy, use any free 127.0.0.1 port. For a one-shot check, keep the page open about 1 second after load.
```

### 7. Watch runs live with the desktop overlay (optional)

Install **23step Overlay** (the standalone Electron app for macOS and Linux) when you want an always-on, click-through right-edge dock over your editor and full-screen workspaces without keeping a browser tab open. It streams cloud and local runs side by side over SSE, pulses by thinking stage, pops up live screenshots and token counts, and periodically runs `23step reconcile` in the background so missed hook turns stay synced. Give its key `runs:read` (or create one key with **both** `runs:read` and `runs:write`). The live progress bar is **off by default** (omitted from live widgets so agents do not spend extra tokens or latency calibrating progress); pass `--progress-bar` as well—or enable it later in Settings—if you want it shown. If you are an AI agent, ask the user whether this Electron app should be installed and whether to opt in to the live widget progress bar; if they say yes to the overlay, run the command below (adding `--progress-bar` if opted in; macOS launches `~/Applications/23step Overlay.app` automatically; on Linux also run `nohup ~/.local/bin/23step-overlay >/dev/null 2>&1 &`). Full setup: [Desktop overlay](https://23step.com/getting-started#overlay).

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
```

### 8. Link commits to their step (optional)

Save this as `.githooks/prepare-commit-msg` and point `core.hooksPath` at `.githooks` once per clone. Each `git commit` then gets a `23step: <step_url>` trailer for the active or most recent step. With no step it does nothing.

.githooks/prepare-commit-msg:

```sh
#!/bin/sh
# .githooks/prepare-commit-msg
# Adds a "23step: <step_url>" trailer from the active or most recent 23step step.
MSG_FILE="$1"
SOURCE="$2"

case "$SOURCE" in
  merge|squash|commit) exit 0 ;;
esac
grep -q '^23step:' "$MSG_FILE" 2>/dev/null && exit 0

STEP_URL=$(python3 -c '
import glob, json, os, time
uid = os.getuid()
now = time.time()
best_mtime, best_url = 0.0, ""
for pat in (f"/tmp/s23-{uid}-*/status.json", f"/tmp/s23-{uid}-*/last_step_url", os.path.expanduser("~/.local/share/23step/status.json")):
    for p in glob.glob(pat):
        try:
            mt = os.path.getmtime(p)
            if now - mt > 7200 or mt <= best_mtime:
                continue
            raw = open(p, encoding="utf-8").read().strip()
            url = json.loads(raw).get("step_url", "") if p.endswith(".json") else raw
            if url:
                best_mtime, best_url = mt, url
        except Exception:
            pass
print(best_url)
' 2>/dev/null)

if [ -n "$STEP_URL" ]; then
  git interpret-trailers --in-place --trailer "23step: $STEP_URL" "$MSG_FILE"
fi
```

Terminal:

```sh
chmod +x .githooks/prepare-commit-msg
git config core.hooksPath .githooks
```

### Check that it worked

Send the agent any prompt. Within a few seconds a new run for that turn appears at [app.23step.com/app/runs](https://app.23step.com/app/runs) with the prompt, thoughts, tool calls, and commands. Nothing there? Check that `~/.config/23step-otel-key` holds a `runs:write` key, that `python3 --version` works in the agent's shell, and that the agent was restarted after install.

## Coding agents: in a repository or globally: OpenRouter SDK

Record agents you build with the OpenRouter Agent SDK, or any OpenRouter traffic via Broadcast.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=openrouter-sdk) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=openrouter-sdk) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=openrouter-sdk` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=openrouter-sdk` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`. Without a key the hooks exit quietly and never block the agent.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=openrouter-sdk'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Download the hook

The SDK handler pipes each event to the same hook the coding agents use.

Terminal:

```sh
# For a global install, replace .agents/hooks with ~/.agents/hooks
mkdir -p .agents/hooks
curl -fsSL https://23step.com/install/step23_otel.py -o .agents/hooks/step23_otel.py
```

### 3. Forward SDK hook events

Register one handler per event and pass the event context to the hook on stdin.

hooks.ts:

```ts
// hooks.ts — @openrouter/agent HooksManager (Node.js)
import { spawnSync } from "node:child_process";
import { HooksManager } from "@openrouter/agent";

export const hooks = new HooksManager();
for (const event of ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "PostModelCall", "Stop"] as const) {
  hooks.on(event, {
    handler: (ctx) => {
      spawnSync("python3", [".agents/hooks/step23_otel.py", "--openrouter", event], {
        input: JSON.stringify({ ...ctx, hook_event_name: event }),
      });
    },
  });
}
```

### 4. Or use OpenRouter Broadcast (optional)

No code: in OpenRouter open **Settings › Observability**, add an **OpenTelemetry Collector**, and use these values.

OpenRouter Broadcast:

```text
Endpoint:  https://api.23step.com/v1/traces
Header:    Authorization: Bearer st_REPLACE_WITH_YOUR_WRITE_KEY
Grouping:  send x-session-id on requests so a multi-turn session lands on one step
```

### 5. Watch runs live with the desktop overlay (optional)

Install **23step Overlay** (the standalone Electron app for macOS and Linux) when you want an always-on, click-through right-edge dock over your editor and full-screen workspaces without keeping a browser tab open. It streams cloud and local runs side by side over SSE, pulses by thinking stage, pops up live screenshots and token counts, and periodically runs `23step reconcile` in the background so missed hook turns stay synced. Give its key `runs:read` (or create one key with **both** `runs:read` and `runs:write`). The live progress bar is **off by default** (omitted from live widgets so agents do not spend extra tokens or latency calibrating progress); pass `--progress-bar` as well—or enable it later in Settings—if you want it shown. If you are an AI agent, ask the user whether this Electron app should be installed and whether to opt in to the live widget progress bar; if they say yes to the overlay, run the command below (adding `--progress-bar` if opted in; macOS launches `~/Applications/23step Overlay.app` automatically; on Linux also run `nohup ~/.local/bin/23step-overlay >/dev/null 2>&1 &`). Full setup: [Desktop overlay](https://23step.com/getting-started#overlay).

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
```

### Check that it worked

Run the agent once. A new run appears at [app.23step.com/app/runs](https://app.23step.com/app/runs).

## 23step Overlay desktop app (Electron)

Pin a live, click-through Electron HUD to the right edge of macOS or Linux for local and cloud agents.

### 1. Why use the Electron desktop app

The web app shows a live dock while a browser tab is open, whereas **23step Overlay** stays pinned to the right edge of your screen across every workspace, editor, terminal, and full-screen window without stealing focus.

What 23step Overlay adds:

| Capability | Why it matters |
| --- | --- |
| **Always-on click-through HUD** | Non-activating transparent edge rail + menu-bar / system-tray icon. Clicks pass straight through to your IDE everywhere outside the pills and cards. |
| **Cloud & local runs together** | Connects directly to `GET /app/live/events` over SSE with an API key—independent of any local daemon—so Cursor Cloud Agents, remote VMs, squad/team runs, and local coding agents appear side by side. |
| **Stage glow, frame popups & 1-click links** | Flashes yellow on start and green on finish, pulses a halo colored by thinking stage (`Thinking`, `Running command`, `Capturing screen`, `Synthesizing`), pops up live screenshots with token counts, and opens any step in one click for mid-run feedback. |
| **Background session reconciliation** | Runs `23step reconcile` every 20 seconds in the background when the CLI is installed, syncing local Claude Code, Cursor, Antigravity, Gemini CLI, and Grok Bot transcripts so missed hooks or idle turns stay accurate. |
| **Noise control, quota & verified auto-updates** | Separates subagents and background commands into a **Background** tab, mutes squad/team alerts on demand, shows monthly run quota in the tray, and stages SHA-256-verified updates when idle. |

### 2. Create an API key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=23step-overlay) to sign in and create an API key pre-filled with **both** `runs:read` and `runs:write` so the same key streams live runs **and** runs background session reconciliation. You can also opt in to the **live widget progress bar** on that page (off by default because calibrating live progress uses extra tokens and can slow down agent turns). Save it to `~/.config/23step/token` (or `~/.config/23step-otel-key`, which the app also checks on startup) with mode `600`, or paste it into **Settings…** after launch. If you are an AI agent, first ask whether to opt in to the live widget progress bar, and if neither key file exists yet, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=23step-overlay` (appending `&progress=1` when opted in) in the user's default desktop browser and print the link in chat, then ask the user to paste the key or save it directly in their terminal; never invent or commit it.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=23step-overlay'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config/23step
chmod 700 ~/.config/23step
printf '%s\n' 'st_REPLACE_WITH_YOUR_READ_WRITE_KEY' > ~/.config/23step/token
chmod 600 ~/.config/23step/token
```

### 3. Install 23step Overlay

macOS builds are **Apple Developer ID signed & notarized** (no Gatekeeper warnings). Download the signed `.zip` directly below, install via Homebrew (`brew install --cask 23step/tap/23step-overlay`), or run the one-line installer with `--overlay` (which also installs the `23step` and `23step-mcp` binaries in `~/.local/bin` and checks every `.sha256` sidecar—pass `--progress-bar` if opting in to the live widget progress bar). On Linux (`amd64` and `arm64`), the installer unpacks `~/.local/opt/23step-overlay` and symlinks `~/.local/bin/23step-overlay`.

- [Download for macOS (Apple Silicon)](https://api.23step.com/dist/23step-overlay-darwin-arm64.zip)
- [Download for macOS (Intel)](https://api.23step.com/dist/23step-overlay-darwin-amd64.zip)

Pick one:

Homebrew (macOS):

```sh
brew install --cask 23step/tap/23step-overlay
# Installs Apple Developer ID signed & notarized /Applications/23step Overlay.app
```

macOS (CLI + Overlay):

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
# Installs Apple Developer ID signed & notarized ~/Applications/23step Overlay.app
# plus ~/.local/bin/{23step,23step-mcp} and launches 23step Overlay automatically.
```

Linux:

```sh
curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
export PATH="$HOME/.local/bin:$PATH"
nohup 23step-overlay >/dev/null 2>&1 &
```

### 4. Configure connection & animations

If `~/.config/23step/token` or `~/.config/23step-otel-key` already holds a key with `runs:read`, the overlay connects right away. Otherwise **23step Overlay Settings** opens automatically on first launch (reopen anytime from the menu-bar / tray icon, the `⚙` button on the expanded drawer, or `Cmd+,` / `Ctrl+,`). Paste your `st_` key under **23step API Connection** (saved `chmod 600` in your user-data folder), toggle **Show live progress bar** if you want opt-in progress bars shown on active runs, and use **Test Start**, **Test Blur**, **Test Shot**, and **Test Done** to tune blink counts, glow radius, screenshot popup duration, or hide the dock.

### 5. Run from source (for contributors) (optional)

Working on the Electron app inside a clone of the 23step repository? Launch it directly from `desktop/`:

Terminal:

```sh
cd desktop
npm install
npm start
```

### Check that it worked

The stepping-stairs icon appears in your macOS Menu Bar or Linux System Tray showing `Live · Idle` (or `Live · N running`), and the slim dock sits on the right edge of your primary display. Open **Settings…** (`Cmd+,`) and click **Test Start** to see the yellow flash on the rail, or send any coding agent a prompt to watch it appear live. `API Key Unauthorized` means the key is missing the `runs:read` scope.

## Headless Chrome, Playwright, and Puppeteer

Capture a headless browser run on macOS or Linux, no display needed.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=headless-chrome) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=headless-chrome) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=headless-chrome` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=headless-chrome` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=headless-chrome'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Install the 23step CLI

The installer puts `23step` and `23step-mcp` in `~/.local/bin` for macOS (arm64, amd64) and Linux (amd64, arm64), checks each download against its SHA-256, and keeps them up to date. It never asks for your key. Pass `--overlay` (`curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay`, plus `--progress-bar` if opting in to the live widget progress bar) to also install the **23step Overlay** Electron desktop app ([setup](https://23step.com/getting-started#overlay)). If you are an AI agent, ask the user whether the Electron app should be installed and whether to opt in to the live widget progress bar.

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
23step version
```

### 3. Start the recorder in the background

Start it before the browser. `--headless` captures through the Chrome DevTools Protocol instead of a display, and `--cdp` names the DevTools port it waits for (use the same port in the next step). It only ever connects to `127.0.0.1` or `localhost`. The key file must be `chmod 600`.

Terminal:

```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 > /tmp/23step.log 2>&1 &
sleep 1 && 23step status
```

### 4. Launch the browser with a DevTools port

Add the two flags below to however you launch Chrome (omit `--headless=new` if you want a visible browser window). 23step records a frame for each click, typing burst, scroll, and navigation, with the tab URL. For a one-shot page load, keep the page open about 1 second before closing.

Pick one:

Playwright:

```js
import { chromium } from "playwright";

const browser = await chromium.launch({
  args: ["--remote-debugging-address=127.0.0.1", "--remote-debugging-port=9222"],
});
const page = await browser.newPage();
await page.goto("https://example.com");
await page.waitForTimeout(1000); // let the first frame upload
await browser.close();
```

Puppeteer:

```js
import puppeteer from "puppeteer";

const browser = await puppeteer.launch({
  args: ["--remote-debugging-address=127.0.0.1", "--remote-debugging-port=9222"],
});
const page = await browser.newPage();
await page.goto("https://example.com");
await new Promise((r) => setTimeout(r, 1000)); // let the first frame upload
await browser.close();
```

Chrome · Linux:

```sh
google-chrome --headless=new \
  --remote-debugging-address=127.0.0.1 \
  --remote-debugging-port=9222 \
  --user-data-dir="$(mktemp -d)" \
  https://example.com
```

Chrome · macOS:

```sh
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new \
  --remote-debugging-address=127.0.0.1 \
  --remote-debugging-port=9222 \
  --user-data-dir="$(mktemp -d)" \
  https://example.com
```

### 5. Stop and get the link

`23step status` prints the `step_url`. `23step stop` uploads anything queued and finalizes the step.

Terminal:

```sh
23step note "Checkout verified"   # optional: attach a note to the step
23step status                       # prints step_url
23step stop                         # uploads the rest and finalizes
```

### Check that it worked

`23step status` shows `captured` and `uploaded` counts above zero while the browser runs, and the `step_url` opens the step with browser frames. If `captured` stays at 0, the browser is not listening on the DevTools port; check `/tmp/23step.log`.

## A computer-use agent on a Linux desktop or VM

Record a computer-use agent on an X11 desktop, VM, or Xvfb display.

### 1. Create a write key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=linux-desktop) to sign in and create an API key pre-filled with `runs:write`—or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=linux-desktop) if you also install the **23step Overlay** Electron app so one key powers both. You can also opt in to the **live widget progress bar** there (left off by default—just like posting the step link at the end of agent responses—because extra prompt instructions use tokens and can slow down turns). The `st_` value is shown once (and copied with one click). Save it to `~/.config/23step-otel-key` (or export `STEP23_OTEL_KEY`). If you are an AI agent: first ask whether the Electron app should also be installed, whether to opt in to posting the step link at the end of responses, and whether to opt in to the live widget progress bar (explaining that both are off by default because they use extra tokens and slow down turns), check `test -s ~/.config/23step-otel-key` without printing its contents, and if a key is needed **automatically open** `https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=linux-desktop` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=linux-desktop` when installing the overlay; append `&progress=1` if the user opted in to the progress bar) in the user's default desktop browser (`open` on macOS, `xdg-open` on Linux with a display, `wslview` on WSL—not a headless automation browser) and print the link in chat, then ask the user to paste the `st_` key or save it directly in their terminal; never invent or commit a key. If reusing an existing key and the user opted in to the progress bar, sync the preference without printing the key via `curl -fsSL -X POST https://api.23step.com/app/live/preferences -H "Authorization: Bearer $(cat ~/.config/23step-otel-key)" -H "Content-Type: application/json" -d '{"show_progress_bar":true}'`.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=linux-desktop'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
mkdir -p ~/.config
printf '%s\n' 'st_REPLACE_WITH_YOUR_WRITE_KEY' > ~/.config/23step-otel-key
chmod 600 ~/.config/23step-otel-key
```

### 2. Install the 23step CLI

The installer puts `23step` and `23step-mcp` in `~/.local/bin` for Linux (amd64, arm64), checks each download against its SHA-256, and keeps them up to date. It never asks for your key. Pass `--overlay` (`curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay`, plus `--progress-bar` if opting in to the live widget progress bar) to also install the **23step Overlay** Electron desktop app ([setup](https://23step.com/getting-started#overlay)). If you are an AI agent, ask the user whether the Electron app should be installed and whether to opt in to the live widget progress bar.

Terminal:

```sh
curl -fsSL https://api.23step.com/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
23step version
```

### 3. Start recording on the agent's display

Start `23step` on the same `DISPLAY` the agent drives, before the task begins. It takes a screenshot on each click and typing burst (key presses are classified, never stored). If Chrome runs with a loopback DevTools port, frames also carry the tab URL. X11 only; Wayland is not supported.

Terminal:

```sh
export STEP23_API=https://api.23step.com
export DISPLAY=:0        # the display the agent drives, e.g. :99 for Xvfb
nohup 23step start --token-file ~/.config/23step-otel-key \
  --run-name linux-agent > /tmp/23step.log 2>&1 &
sleep 1 && 23step status
```

### 4. Stop and share the step

`23step stop` finalizes the step. Send the `step_url` to anyone who should see what the agent did.

Terminal:

```sh
23step note "Checkout verified"   # optional: attach a note to the step
23step status                       # prints step_url
23step stop                         # uploads the rest and finalizes
```

### Check that it worked

`23step status` shows `state: running` and growing `captured` / `uploaded` counts while the agent works. `23step is not running` means it exited; read `/tmp/23step.log` (usually a missing `DISPLAY` or a key file that is not `chmod 600`).

## Grok Bot

Record every Grok Bot turn and attach browser or desktop screenshots to the same run.

### 1. Install 23step and the turn adapter

Grok Bot has no live hook system. This installs `23step`, `23step-mcp`, `23step-grokbot-turn`, and the trace helper into `~/.local/bin` and `~/.local/share/23step`. Create a key on the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=grok-bot) (or [with `runs:read` + `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=grok-bot) if also installing **23step Overlay**; AI agents should first ask whether the Electron app should be installed and whether to opt in to the live widget progress bar—off by default because it uses extra tokens and slows down turns—then open that URL in the user's desktop browser, appending `&progress=1` if opted in, and print the link when no `~/.config/23step/otel-key` exists yet). The key is read from `STEP23_KEY` or a hidden prompt and saved at `~/.config/23step/otel-key` (mode 0600, directory 0700). Never print or commit the key. Add `--overlay` to also install the **23step Overlay** Electron desktop app (and `--progress-bar` if opting in to the live widget progress bar). Add `--dev` to target `https://dev.23step.com` instead of prod. Run it again any time; an existing key file is kept unless `STEP23_KEY` is set.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Awrite&name=grok-bot'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_KEY='st_REPLACE_WITH_YOUR_WRITE_KEY'
curl -fsSL https://api.23step.com/install.sh | sh -s -- --grokbot
# dev instead of prod:
# curl -fsSL https://api.23step.com/install.sh | sh -s -- --grokbot --dev
```

### 2. Connect Grok Bot to the MCP server (optional)

Put a `runs:read` key in `STEP23_MCP_KEY` or `~/.config/23step/mcp-key` (mode 0600). `mcp-remote` reads `${AUTH_HEADER}` from the environment, so the key is not one of its arguments. The header is `Authorization:${AUTH_HEADER}` with no space around the colon.

Terminal:

```sh
mkdir -p ~/.config/23step
printf '%s\n' "$STEP23_MCP_KEY" > ~/.config/23step/mcp-key
chmod 700 ~/.config/23step
chmod 600 ~/.config/23step/mcp-key

# mcp-remote expands ${AUTH_HEADER} from the environment. No space around the
# colon, so clients that split args on spaces still pass one header.
# (With --dev, replace https://mcp.23step.com/mcp with https://dev.23step.com/mcp.)
sh -c 'AUTH_HEADER="Bearer $(cat ~/.config/23step/mcp-key)" exec npx -y mcp-remote@latest https://mcp.23step.com/mcp --transport http-only --header "Authorization:${AUTH_HEADER}"'
```

### 3. Capture each turn as it happens

Call `--begin` at turn start with the user message verbatim. Do not pass `session_id`: the adapter reuses the current session if the previous turn ended less than 30 minutes ago, or starts a new `grokbot-<bot>-<date>-<n>` session, and writes both the session ID and the open `run_id` to `~/.local/share/23step/current.json`. Call `--event` after each tool call with the call and a short result (never secrets). Call `--end` before the final reply with the reply text to finalize the run.

Terminal:

```sh
export PATH="$HOME/.local/bin:$PATH"

# Start of turn: pass the user message verbatim. Omit session_id so the adapter
# reuses the current session under 30 minutes idle or creates grokbot-<bot>-<date>-<n>,
# writing the session and open run_id to ~/.local/share/23step/current.json.
23step-grokbot-turn --begin - <<'JSON'
{"prompt":"Check the deploy","model":"grok-4"}
JSON

# After each tool call, send the call and its short result (never secrets).
23step-grokbot-turn --event - <<'JSON'
{"events":[
  {"kind":"tool_call","tool":"Shell","id":"c1","input":{"command":"git status"}},
  {"kind":"tool_result","tool":"Shell","id":"c1","ok":true,"output":"clean"}
]}
JSON

# Before the final reply: stops any running recorder for the run, sends the reply, and finalizes.
23step-grokbot-turn --end - <<'JSON'
{"status":"completed","events":[
  {"kind":"response","text":"The tree is clean."}
]}
JSON
```

### 4. Attach browser and desktop screenshots

Once Chrome is open on the bot's `DISPLAY`, find its live loopback DevTools port (`ss -ltnp | grep chrome`) and run `23step start --join-session --cdp http://127.0.0.1:<port>` with `--token-file ~/.config/23step/otel-key` in the background. `--join-session` reads `~/.local/share/23step/current.json` and attaches frames directly to the turn's open run instead of creating a second run. Stop it (`kill -INT` or `23step stop`) when browser work ends—stopping detaches and drains queued frames while leaving the turn open until `--end` (and `--end` also stops any recorder still running). You can also pass `--record` on `--begin` so `--begin` starts the recorder and `--end` stops it automatically.

Terminal:

```sh
# Once Chrome is open, find its live DevTools port (e.g. ss -ltnp | grep chrome)
# and attach frames to the open run in ~/.local/share/23step/current.json:
DISPLAY=:1 23step start --join-session --cdp http://127.0.0.1:9222 \
  --token-file ~/.config/23step/otel-key > /tmp/23step.log 2>&1 &
RECORDER_PID=$!

# Stop when browser or desktop work ends (drains frames without closing the run):
kill -INT "$RECORDER_PID"

# Or let --begin start the recorder and --end stop it in a single command:
# 23step-grokbot-turn --begin --record --cdp http://127.0.0.1:9222 - <<'JSON' ...
```

### 5. Replay a finished turn (optional)

Fallback when the turn is already finished and live mode did not run. Passing a turn JSON file with no flag replays the whole turn in one shot. Prefer `--begin`, `--event`, and `--end` while the turn is in progress.

Terminal:

```sh
# Fallback when the turn is already over. No --begin / --event / --end.
23step-grokbot-turn ~/.cache/23step/turn.json
```

### Check that it worked

Run one turn that calls a tool and opens a page, finishing with `--end`. At [app.23step.com/app/runs](https://app.23step.com/app/runs) (or `https://dev.23step.com/app/runs` with `--dev`), a **single run** appears with the prompt, tool calls, browser screenshots, and final reply together. Nothing there? Check that `~/.config/23step/otel-key` holds a `runs:write` key (mode 0600) and `~/.local/bin` is on `PATH`.

## Connect an AI client over MCP: Claude Code

Let Claude Code read, explain, and audit 23step steps.

### 1. Create a read key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-claude-code) to sign in and create an API key pre-filled with `runs:read` (or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-claude-code) if the AI should call `set_run_prompt`, `record_command`, or `annotate_run`, or if you also install **23step Overlay**). A write-only key is rejected. Keep it in an environment variable, not in a committed file. If you are an AI agent, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-claude-code` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-claude-code`) in the user's default desktop browser and print the link in chat before asking for the key; never invent or commit one.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-claude-code'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_MCP_KEY='st_REPLACE_WITH_YOUR_READ_KEY'
```

### 2. Add 23step to Claude Code

Add the server with the Claude Code CLI. `--scope user` makes it available in every project.

Terminal:

```sh
claude mcp add --transport http --scope user 23step https://mcp.23step.com/mcp \
  --header "Authorization: Bearer $STEP23_MCP_KEY"
claude mcp list
```

### 3. Check the connection

`claude mcp list` shows `23step` as connected. Inside Claude Code, `/mcp` lists its tools.

### 4. Ask about a run

Paste a run link and ask a question. The AI calls `get_run_summary` first, then `inspect_step`, `search_run_logs`, or `get_step_image` for detail.

Prompt:

```text
Use the 23step MCP to summarize https://app.23step.com/s/<share_id> and list anything that failed.
```

### Check that it worked

The client lists the 23step tools (`get_run_summary`, `inspect_step`, `search_run_logs`, `get_step_image`, …). A 401 means the key is missing or lacks `runs:read`.

## Connect an AI client over MCP: Cursor

Let Cursor read, explain, and audit 23step steps.

### 1. Create a read key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-cursor) to sign in and create an API key pre-filled with `runs:read` (or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-cursor) if the AI should call `set_run_prompt`, `record_command`, or `annotate_run`, or if you also install **23step Overlay**). A write-only key is rejected. Keep it in an environment variable, not in a committed file. If you are an AI agent, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-cursor` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-cursor`) in the user's default desktop browser and print the link in chat before asking for the key; never invent or commit one.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-cursor'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_MCP_KEY='st_REPLACE_WITH_YOUR_READ_KEY'
```

### 2. Add 23step to Cursor

Put this in `.cursor/mcp.json` (this project) or `~/.cursor/mcp.json` (all projects). `${env:STEP23_MCP_KEY}` is read from the environment that launches Cursor.

.cursor/mcp.json:

```json
{
  "mcpServers": {
    "23step": {
      "url": "https://mcp.23step.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:STEP23_MCP_KEY}"
      }
    }
  }
}
```

### 3. Check the connection

Restart Cursor. **Cursor Settings › MCP** shows `23step` with a green dot and its tools.

### 4. Ask about a run

Paste a run link and ask a question. The AI calls `get_run_summary` first, then `inspect_step`, `search_run_logs`, or `get_step_image` for detail.

Prompt:

```text
Use the 23step MCP to summarize https://app.23step.com/s/<share_id> and list anything that failed.
```

### Check that it worked

The client lists the 23step tools (`get_run_summary`, `inspect_step`, `search_run_logs`, `get_step_image`, …). A 401 means the key is missing or lacks `runs:read`.

## Connect an AI client over MCP: Codex

Let Codex read, explain, and audit 23step steps.

### 1. Create a read key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-codex) to sign in and create an API key pre-filled with `runs:read` (or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-codex) if the AI should call `set_run_prompt`, `record_command`, or `annotate_run`, or if you also install **23step Overlay**). A write-only key is rejected. Keep it in an environment variable, not in a committed file. If you are an AI agent, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-codex` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-codex`) in the user's default desktop browser and print the link in chat before asking for the key; never invent or commit one.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-codex'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_MCP_KEY='st_REPLACE_WITH_YOUR_READ_KEY'
```

### 2. Add 23step to Codex

Add the server to `~/.codex/config.toml`. Codex reads the key from `STEP23_MCP_KEY` at startup.

~/.codex/config.toml:

```toml
[mcp_servers.23step]
url = "https://mcp.23step.com/mcp"
bearer_token_env_var = "STEP23_MCP_KEY"
```

### 3. Check the connection

Restart Codex. `/mcp` lists `23step` and its tools.

### 4. Ask about a run

Paste a run link and ask a question. The AI calls `get_run_summary` first, then `inspect_step`, `search_run_logs`, or `get_step_image` for detail.

Prompt:

```text
Use the 23step MCP to summarize https://app.23step.com/s/<share_id> and list anything that failed.
```

### Check that it worked

The client lists the 23step tools (`get_run_summary`, `inspect_step`, `search_run_logs`, `get_step_image`, …). A 401 means the key is missing or lacks `runs:read`.

## Connect an AI client over MCP: Gemini CLI

Let Gemini CLI read, explain, and audit 23step steps.

### 1. Create a read key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-gemini-cli) to sign in and create an API key pre-filled with `runs:read` (or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-gemini-cli) if the AI should call `set_run_prompt`, `record_command`, or `annotate_run`, or if you also install **23step Overlay**). A write-only key is rejected. Keep it in an environment variable, not in a committed file. If you are an AI agent, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-gemini-cli` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-gemini-cli`) in the user's default desktop browser and print the link in chat before asking for the key; never invent or commit one.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-gemini-cli'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_MCP_KEY='st_REPLACE_WITH_YOUR_READ_KEY'
```

### 2. Add 23step to Gemini CLI

Merge this into `~/.gemini/settings.json` (or `.gemini/settings.json` in a project). Gemini CLI expands `$STEP23_MCP_KEY` from the environment.

~/.gemini/settings.json:

```json
{
  "mcpServers": {
    "23step": {
      "httpUrl": "https://mcp.23step.com/mcp",
      "headers": {
        "Authorization": "Bearer $STEP23_MCP_KEY"
      }
    }
  }
}
```

### 3. Check the connection

Restart `gemini`. `/mcp` lists `23step` as connected.

### 4. Ask about a run

Paste a run link and ask a question. The AI calls `get_run_summary` first, then `inspect_step`, `search_run_logs`, or `get_step_image` for detail.

Prompt:

```text
Use the 23step MCP to summarize https://app.23step.com/s/<share_id> and list anything that failed.
```

### Check that it worked

The client lists the 23step tools (`get_run_summary`, `inspect_step`, `search_run_logs`, `get_step_image`, …). A 401 means the key is missing or lacks `runs:read`.

## Connect an AI client over MCP: Antigravity

Let Antigravity read, explain, and audit 23step steps.

### 1. Create a read key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-antigravity) to sign in and create an API key pre-filled with `runs:read` (or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-antigravity) if the AI should call `set_run_prompt`, `record_command`, or `annotate_run`, or if you also install **23step Overlay**). A write-only key is rejected. Keep it in an environment variable, not in a committed file. If you are an AI agent, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-antigravity` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-antigravity`) in the user's default desktop browser and print the link in chat before asking for the key; never invent or commit one.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-antigravity'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_MCP_KEY='st_REPLACE_WITH_YOUR_READ_KEY'
```

### 2. Add 23step to Antigravity

In Antigravity open **… › MCP Servers › Manage MCP Servers › View raw config** and merge this in. `mcp-remote` (needs Node.js) bridges to the hosted server and sends the key header.

mcp_config.json:

```json
{
  "mcpServers": {
    "23step": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.23step.com/mcp",
        "--header",
        "Authorization: Bearer st_REPLACE_WITH_YOUR_READ_KEY"
      ]
    }
  }
}
```

### 3. Check the connection

Refresh the MCP servers list. `23step` shows its tools.

### 4. Ask about a run

Paste a run link and ask a question. The AI calls `get_run_summary` first, then `inspect_step`, `search_run_logs`, or `get_step_image` for detail.

Prompt:

```text
Use the 23step MCP to summarize https://app.23step.com/s/<share_id> and list anything that failed.
```

### Check that it worked

The client lists the 23step tools (`get_run_summary`, `inspect_step`, `search_run_logs`, `get_step_image`, …). A 401 means the key is missing or lacks `runs:read`.

## Connect an AI client over MCP: VS Code

Let VS Code read, explain, and audit 23step steps.

### 1. Create a read key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-vscode) to sign in and create an API key pre-filled with `runs:read` (or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-vscode) if the AI should call `set_run_prompt`, `record_command`, or `annotate_run`, or if you also install **23step Overlay**). A write-only key is rejected. Keep it in an environment variable, not in a committed file. If you are an AI agent, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-vscode` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-vscode`) in the user's default desktop browser and print the link in chat before asking for the key; never invent or commit one.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-vscode'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_MCP_KEY='st_REPLACE_WITH_YOUR_READ_KEY'
```

### 2. Add 23step to VS Code

Put this in `.vscode/mcp.json`. VS Code asks for the key once and stores it securely. Works with GitHub Copilot agent mode.

.vscode/mcp.json:

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "step23-key",
      "description": "23step read key (st_…)",
      "password": true
    }
  ],
  "servers": {
    "23step": {
      "type": "http",
      "url": "https://mcp.23step.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:step23-key}"
      }
    }
  }
}
```

### 3. Check the connection

Click **Start** above the server in `mcp.json`, or run **MCP: List Servers**.

### 4. Ask about a run

Paste a run link and ask a question. The AI calls `get_run_summary` first, then `inspect_step`, `search_run_logs`, or `get_step_image` for detail.

Prompt:

```text
Use the 23step MCP to summarize https://app.23step.com/s/<share_id> and list anything that failed.
```

### Check that it worked

The client lists the 23step tools (`get_run_summary`, `inspect_step`, `search_run_logs`, `get_step_image`, …). A 401 means the key is missing or lacks `runs:read`.

## Connect an AI client over MCP: Windsurf

Let Windsurf read, explain, and audit 23step steps.

### 1. Create a read key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-windsurf) to sign in and create an API key pre-filled with `runs:read` (or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-windsurf) if the AI should call `set_run_prompt`, `record_command`, or `annotate_run`, or if you also install **23step Overlay**). A write-only key is rejected. Keep it in an environment variable, not in a committed file. If you are an AI agent, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-windsurf` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-windsurf`) in the user's default desktop browser and print the link in chat before asking for the key; never invent or commit one.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-windsurf'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_MCP_KEY='st_REPLACE_WITH_YOUR_READ_KEY'
```

### 2. Add 23step to Windsurf

Merge this into `~/.codeium/windsurf/mcp_config.json`.

~/.codeium/windsurf/mcp_config.json:

```json
{
  "mcpServers": {
    "23step": {
      "serverUrl": "https://mcp.23step.com/mcp",
      "headers": {
        "Authorization": "Bearer st_REPLACE_WITH_YOUR_READ_KEY"
      }
    }
  }
}
```

### 3. Check the connection

Press **Refresh** in Windsurf's MCP panel. `23step` lists its tools.

### 4. Ask about a run

Paste a run link and ask a question. The AI calls `get_run_summary` first, then `inspect_step`, `search_run_logs`, or `get_step_image` for detail.

Prompt:

```text
Use the 23step MCP to summarize https://app.23step.com/s/<share_id> and list anything that failed.
```

### Check that it worked

The client lists the 23step tools (`get_run_summary`, `inspect_step`, `search_run_logs`, `get_step_image`, …). A 401 means the key is missing or lacks `runs:read`.

## Connect an AI client over MCP: Claude Desktop

Let Claude Desktop read, explain, and audit 23step steps.

### 1. Create a read key

Open the [create-key page](https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-claude-desktop) to sign in and create an API key pre-filled with `runs:read` (or [pre-filled with both `runs:read` and `runs:write`](https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-claude-desktop) if the AI should call `set_run_prompt`, `record_command`, or `annotate_run`, or if you also install **23step Overlay**). A write-only key is rejected. Keep it in an environment variable, not in a committed file. If you are an AI agent, automatically open `https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-claude-desktop` (or `https://app.23step.com/app/account?create=1&scopes=runs%3Aread+runs%3Awrite&name=mcp-claude-desktop`) in the user's default desktop browser and print the link in chat before asking for the key; never invent or commit one.

Open in browser:

```sh
url='https://app.23step.com/app/account?create=1&scopes=runs%3Aread&name=mcp-claude-desktop'
if command -v open >/dev/null 2>&1; then open "$url"
elif command -v xdg-open >/dev/null 2>&1 && { [ -n "${DISPLAY:-}" ] || [ -n "${WAYLAND_DISPLAY:-}" ]; }; then xdg-open "$url" >/dev/null 2>&1 &
elif command -v wslview >/dev/null 2>&1; then wslview "$url"
fi
printf 'Create your 23step API key: %s\n' "$url"
```

Terminal:

```sh
export STEP23_MCP_KEY='st_REPLACE_WITH_YOUR_READ_KEY'
```

### 2. Add 23step to Claude Desktop

Open **Settings › Developer › Edit Config** and merge this in. `mcp-remote` (needs Node.js) bridges the desktop app to the hosted server.

claude_desktop_config.json:

```json
{
  "mcpServers": {
    "23step": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.23step.com/mcp",
        "--header",
        "Authorization: Bearer st_REPLACE_WITH_YOUR_READ_KEY"
      ]
    }
  }
}
```

### 3. Check the connection

Quit and reopen Claude Desktop. The tools menu lists `23step`.

### 4. Ask about a run

Paste a run link and ask a question. The AI calls `get_run_summary` first, then `inspect_step`, `search_run_logs`, or `get_step_image` for detail.

Prompt:

```text
Use the 23step MCP to summarize https://app.23step.com/s/<share_id> and list anything that failed.
```

### Check that it worked

The client lists the 23step tools (`get_run_summary`, `inspect_step`, `search_run_logs`, `get_step_image`, …). A 401 means the key is missing or lacks `runs:read`.
