Coding agents

Set up 23step for Cline / OpenRouter

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

Markdown for AIAll install methods
  1. Create a write key

    Open the create-key page 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 create-key page

    Open in browser pre-filled scopes
    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 ~/.config/23step-otel-key
    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.

    Repository .clinerules/hooks/TaskStart
    cd "$(git rev-parse --show-toplevel)"
    curl -fsSL https://23step.com/install/hooks.sh | sh -s -- cline
  3. Manual alternative to step 2Optional

    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 download
    # 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
    Repository · .clinerules/hooks/TaskStart chmod +x
    #!/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
  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 barOptional

    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 or 23step Overlay Settings, or append &progress=1 when creating your key) if you want either enabled.

    Terminal opt-in
    # 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 browserOptional

    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 127.0.0.1:9222
    ## 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 overlayOptional

    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.

    Terminal https://api.23step.com/install.sh --overlay
    curl -fsSL https://api.23step.com/install.sh | sh -s -- --overlay
  8. Link commits to their stepOptional

    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 git interpret-trailers
    #!/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 once per clone
    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 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.