Developer docs · v0.2

CLI & Overlay 0.2.0 · Schema 23step.run/v4 /docs/hooks.md

The hooks installer and hook script

https://23step.com/install/hooks.sh wires coding agents to 23step. It downloads one Python hook script and merges entries for it into each agent's hook config. The hook sends each turn's prompt, thoughts, tool calls, commands, and token usage to the API, and starts a headless recorder when the agent opens a browser with a DevTools port. Per-agent walkthroughs are on Getting started.

Usage

It writes the hook to .agents/hooks/step23_otel.py (plus a Cursor wrapper in .cursor/hooks/), under ~ with --global. Running it again refreshes the script and replaces only its own config entries; your other hooks are kept. If both a repository and a global install exist, the hook sends each turn once. It needs curl and python3, and never reads or writes your key.

Terminal
# In the repository the agent works in (commit the result)
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- claude cursor

# Once for every project on this machine
curl -fsSL https://23step.com/install/hooks.sh | sh -s -- --global all
Options
OptionMeaning
--repo (default)Install in the current repository: the git top level, else the current directory. Aliases --local, --project.
-g, --globalInstall in your home directory for every project. Alias --user.
--step-linkOpt in to injecting the active step_url into pre-turn hooks so the agent posts [23step](<step_url>) at the end of final responses (and save in ~/.config/23step/preferences.json with --global). Off by default.
--no-step-linkExplicitly keep step-link prompt injection off (the default).
--progress-barOpt in to live widget progress-bar calibration prompts in the hook config (and ~/.config/23step/preferences.json with --global). Off by default because calibrating progress uses extra tokens and slows down turns.
--no-progress-barExplicitly keep progress-bar calibration prompts off (the default).
--api <url>Point installed hooks at a custom 23step API base URL (and save apiEndpoint in ~/.config/23step/preferences.json with --global).
--devShorthand for --api https://dev.23step.com.
-h, --helpPrint usage.
Agents
ArgumentRepository configGlobal config
claude (claude-code).claude/settings.json~/.claude/settings.json
codex.codex/hooks.json~/.codex/hooks.json (or $CODEX_HOME/hooks.json)
cursor.cursor/hooks.json~/.cursor/hooks.json
antigravity.agents/hooks.json~/.gemini/config/hooks.json
gemini (gemini-cli).gemini/settings.json~/.gemini/settings.json
cline (openrouter).clinerules/hooks/*~/.cline/hooks/* and ~/Documents/Cline/Hooks/*
allevery agent aboveevery agent above

Installer environment

hooks.sh environment
EnvDefaultMeaning
STEP23_HOOKS_BASEhttps://23step.com/installWhere to download the hook scripts from.
STEP23_REPO_DIRgit top levelRepository root for a repository install.
STEP23_GLOBAL_DIR$HOMERoot for a --global install.

Hook script settings

The hook reads its key from STEP23_OTEL_KEY, then STEP23_TOKEN, then the file in STEP23_OTEL_KEY_FILE, then ~/.config/23step-otel-key. With no key it exits quietly. It never blocks the agent: each request times out after 2 seconds.

The hook config passes the agent with a flag: --claude, --codex, or --cline / --openrouter. Cursor, Antigravity, and Gemini CLI are detected from the event payload. Any other harness that can run a command per lifecycle event can pipe its JSON event to the hook on stdin the same way (see the OpenRouter SDK guide on Getting started).

Hook environment
EnvDefaultMeaning
STEP23_OTEL_ENDPOINThttps://api.23step.comWhere traces are sent.
STEP23_OTEL_TIMEOUT2Seconds per request.
STEP23_DAEMON=0onDo not start the screenshot recorder.
STEP23_STEP_LINK=1offOpt in to injecting the active step_url into pre-turn hooks so the agent includes [23step](<step_url>) at the end of final responses (off by default to save tokens and latency).
STEP23_PROGRESS_BAR=1offOpt in to injecting live progress-bar calibration instructions (off by default to save tokens and turn latency).
STEP23_CDP_PORTdiscoveredDevTools port for the recorder to attach to.
STEP23_TURN_MAX_SECONDS3600Longest a turn may stay open.
STEP23_DISABLE_RECONCILER=1onDo not start 23step reconcile --watch.
STEP23_NO_AUTO_UPDATE=1onDo not update 23step from the hook.
STEP23_BINPATH, ~/.local/binPath to the 23step binary.
STEP23_ARTIFACT_DIRFolder whose Markdown and image outputs are attached to the step as artifacts.
STEP23_HOSTNAMEdetectedMachine name shown on the run.