The sled CLI: commands, flags and exit codes
Sledbot's sled CLI reference: install it, every command and flag, exit codes, agent-to-agent messaging, and CLI-only checkpoint, explain and rename.
Updated 11 min read
On this page
This page is a reference for the sled CLI. It covers every command, its main flags, its exit codes, and how agents message each other. sled is one binary for terminals, agents, files, jobs, machines and Sled Core. Every Sledbot terminal already has it on its PATH, so you only need to install it if you want to use it in other terminals too.
Some things exist only in the CLI: turn checkpoints, sled explain and renaming a machine. They are collected under Features only in the CLI.
Install the sled CLI for other terminals
- Open Sledbot's settings with ⌘, (Command-Comma).
- Select General.
- Under Command line ▸ sled command, click Install….
Sledbot creates a symlink at ~/.local/bin/sled. If ~/.local/bin isn't on your PATH, it uses /usr/local/bin/sled instead, and macOS asks once for an administrator password. The result shows as "Installed at <path>". If you skip the password, sled stays at ~/.local/bin/sled only. In that case the result reads "<path> (add ~/.local/bin to your PATH)".
To add that folder to your PATH in zsh (the default shell on macOS), add this line to ~/.zshrc, then open a new terminal window:
export PATH="$HOME/.local/bin:$PATH"To undo it, delete the line from ~/.zshrc.
Check the install with sled --version, which prints 1.0.0. sled --skill prints the guide Sledbot gives to agents. If you see "The bundled sled helper is missing (Contents/Helpers/sled).", the app install is broken. Reinstall Sledbot from the DMG.
Addressing terminals
Wherever a command takes <t>, you can pass:
- an id such as
t7or just7; - a remote terminal as
<machine>/t<N>, for examplevps/t7; - the terminal's name.
sled ls lists ids and names. Add --all-machines to include remote machines.
Terminal commands
| Command | What it does | Main flags |
|---|---|---|
sled run [--] cmd… | Starts a program in a new terminal. Without --bg it waits like a shell and returns the program's exit code. | --bg, --name, --as <template>, --on <machine>, --cwd, --worktree BRANCH, --parent, --no-parent, --outlive-parent, --timeout (180; 0 = no limit), --label k=v, --keep, --json |
sled ls | Lists terminals: id, name or agent, where, status. | --all-machines, --json |
sled get <t> | Shows one terminal. | --json |
sled read <t> | Prints a terminal's screen and history. | --lines (the core caps it at 10,000), --json |
sled send <t> <text…> | Pastes text into a terminal and presses Enter. It waits for a person to pause typing. | --if idle|working, --wait, --force, --timeout 180 |
sled keys <t> <keys…> | Presses named keys: Enter, Escape, Tab, Up, C-c, M-x, F5, a and so on. | none |
sled interrupt <t> | Presses Ctrl-C in a terminal. | none |
sled wait [t…] | Waits for a terminal or your children to change state, or for a message to arrive. Use it instead of sleep. | --children any|all, --output <regex>, --timeout 180, --json |
sled attach <t> | Puts your current terminal on a Sled terminal. Ctrl+\ detaches. | --observe, --history 2000 |
sled kill <t> | Ends a terminal's program (hangup, then escalates). | none |
sled rm <t> | Removes a finished terminal. | none |
sled label <t> k=v… | Sets labels. key= removes a label. | none |
sled keep <t> | Replaces a lost program with a shell in its folder. | --off |
sled events | Prints recent events. | --follow, --limit 50, --json |
sled status <state> | Reports this terminal's status (used by agent hooks). States: working, blocked, done, idle, error. | --kind permission|question|auth|limit, --msg |
sled explain <t> | Shows why a terminal has its status. | --json |
sled resume [t] [-- argv] | Restarts an exited agent with its own resume command. --report tells Sledbot how to resume you. | --dry-run, --report, --agent, --json |
sled checkpoint ls|diff|restore|create | Turn checkpoints of an agent's working tree. | restore takes a safety checkpoint first; create --label |
sled doctor | Checks this machine or a remote one: core, socket, holders, PATH, agent CLIs and logins, git/gh/rg, language servers, disk, clock. | --on, --json |
sled stats [show] | Tokens, cost and agent activity. | --range (today, yesterday, 7d, 30d, month, lastMonth, all, <n>d), --by (model, provider, agent, account, space, machine, source, teammate, job), --limit, --on, --json |
sled stats export / rescan / limits | Writes usage records to CSV or JSON / indexes local agent logs again / shows plan limits per account and how full each agent's context is. | --format csv|json, --out; --full |
sled top | What uses CPU, memory and ports: by terminal, heaviest processes, Docker. | --on, --limit 10, --no-docker, --json |
sled run also accepts launch options for agents: --plan, --permission-mode default|acceptEdits|plan|bypass, --effort low|medium|high|xhigh and --model.
A typical session:
sled run --bg --name tests -- npm test # start in the background, return at once
sled ls # find ids and names
sled read tests --lines 200 # read the last output
sled send t3 "Run the tests again" # type into an agent and press Enter
sled wait t3 --timeout 600 # block until t3 changes stateIf sled run hits its timeout, it prints "[sled] still running as tN after Ns; it keeps running…" and exits with 124. The program is not stopped.
Run programs without a terminal, and file commands
These commands don't create a terminal. They are useful in scripts and, with --on, on remote machines.
| Command | What it does | Flags |
|---|---|---|
sled exec -- cmd | Runs one program, prints exactly what it wrote and exits with its code. | --on, --cwd, --env k=v, --timeout 60, -i/--stdin, --json |
sled file read <path> | Prints a text file, or lines of it. | --on, --offset, --limit |
sled file write <path> | Writes what is piped in as the file, creating missing folders. | --on |
sled file edit <path> | Replaces exact text found once. Repeat --old/--new pairs; all edits apply or none do. | --old, --new, --all, --on |
sled file write replaces the whole file with what you pipe in.
echo "PORT=3000" | sled file write --on vps /srv/app/.env.localUse an absolute path for remote files. An unquoted ~ is expanded by your local shell to your Mac's home folder, not the remote one.
Agents and teams
| Command | What it does | Flags |
|---|---|---|
sled chat (alias agent) | Chats with Sledbot's native coding agent in this terminal, or runs one prompt with --prompt. | -p/--prompt, -m/--model, --plan, --cwd, --resume, --list, -v, --session, --via <command> |
sled approve "why" | Asks you for approval and blocks until you answer. Exit 0 allowed, 1 denied. | --kind push|deploy|delete|publish|network|sudo|write|tool|other, --title, --command, --timeout, --json |
sled ask "q" | Asks you a question in Sledbot and blocks until you answer. Exit 0 answered, 1 declined, 2 expired. | --option id or id=Label, --text, --body, --timeout, --json |
sled notify "text" | Posts to the activity feed and notifications. | --level info|success|warning |
sled memory read / append [text] | Reads or appends to a teammate's memory (default: yours, else the shared TEAM.md). | --teammate |
sled routine ls / run <id> / logs <id> | Lists routines, runs one now, shows its runs. | --json |
sled templates | Lists role templates you can run with --as (from ~/.config/sledbot/templates). Built-ins: lead, reviewer, tester, fixer, docs, release. | --json |
sled job submit|ls|status|wait|followup|stop|collect|integrate|rm | Delegated jobs: an agent working headless in its own copy of a project, here or on another machine. | see below |
sled job submit flags: --title, --on, --account, --agent claude|codex|gemini|opencode, --model, --effort, --project, --committed, --base, --allow, --permission-mode, --wait, --json. Use sled job integrate --dry-run to see what integrating would do before it writes anything.
sled approve and sled ask let a script or agent put a card in Needs you:
sled approve "Push the release branch" --kind push --command "git push origin release/2.0"Code and GitHub
| Command | What it does | Flags |
|---|---|---|
sled worktree info|create|setup|run|archive | Creates a worktree from a branch, a GitHub issue or a pull request, and runs the repo's setup, run and archive scripts. | create: --branch / --issue N / --pr N, --base, --repo, --on, --no-setup, --prompt |
sled pr status|create|merge|comments | PR, checks, review and mergeability for this branch / push the branch and open a PR / merge a PR / review threads. | --method squash|merge|rebase, --delete-branch, --draft, --send <t> |
sled thread archive|restore|ls | Stops the agent, keeps its worktree and a checkpoint ref, and runs the archive script / brings an archived thread back / lists archived threads. | --no-script, --json |
sled clean | Finds what can be cleaned up (worktrees, job copies, build folders, caches…) and moves it to the trash. | --on, --category, --space, --id, --all-safe, --dry-run, -y/--yes, --delete, --delete-merged-branches, --gc, --refresh, --history, --json |
sled prneeds the GitHub CLI (gh).sled pr mergerun from an agent's terminal asks you first.sled pr comments --send <t>types the unresolved review threads into an agent.- Agents running in Sledbot terminals can scan with
sled cleanbut can't clean.sled clean --deletedeletes permanently instead of moving to the trash. Start with--dry-run.
Machines and the core
| Command | What it does | Flags |
|---|---|---|
sled machine add <target> | Adds a machine you reach with ssh. Targets: vps, me@10.0.0.7, me@10.0.0.7:2222, [::1]:22, or an ssh-config Host. | --name, --key, --jump, --policy ask|allow|never, --password-stdin, --generate-key, --store-secrets, --no-connect, --json |
sled machine ls | Lists the machines added here. | --json |
sled machine login <name> | Logs in with ssh in this terminal (password, code or host key), then reconnects. | none |
sled machine update <name> | Copies this sled there and restarts its core. Its terminals keep running. | none |
sled machine rename <name> <new> | Gives a machine a new name here. | none |
sled machine rm <name> | Forgets a machine. Its terminals keep running there unless you pass --stop-agents. | --stop-agents, --delete-remote-data |
sled server start|stop|status|restart | Starts the core / stops it / shows whether it runs, its version and features / restarts it (programs keep running). | --session, --json |
sled update | Updates Sled Core and restarts it. Terminals keep running. | --from <binary> |
sled schema | Prints every core method with its parameter and result types (OpenRPC-style JSON). | none |
sled mcp | Serves the sled tools over MCP (stdio, JSON-RPC). | none |
sled server stop affects every terminal. Kept terminals get a shell on the next start. Use restart if you only want the core to pick up a new binary.
sled update without --from does not download anything. The app's own update supplies the new binary. After updating the app, run sled update or click Restart core in Settings ▸ General.
sled mcp is what Sledbot wires into supported agents at launch. See MCP integrations for its tools and which agents get it. Adding machines in the app is covered in Run agents on your own servers.
Verbs such as core, connect, hold, hook, askpass, skill and job render are internal. Don't call them yourself.
Agent-to-agent messaging
Agents start, message, wait for and read each other with the same commands you use: sled run, sled send, sled wait and sled read (or the matching MCP tools).
- Messages are tagged. A
sled sendfrom inside a Sledbot terminal arrives wrapped as<sled from="t1 lead">text</sled>. It is pasted after the person at that terminal has paused typing for 600 ms. - Blocked terminals are protected. Sending to a terminal that needs you is refused with "
<id>is blocked (<kind>); answer it first or use --force …" (exit 9).--forcesends anyway. - Conditional sends.
sled send --if idleonly sends when the target is idle; a mismatch exits with 10. - Parents and children. A terminal started from a Sledbot terminal is its child and ends when the parent ends, unless you pass
--outlive-parentor--no-parent.sled wait --children any(orall) waits on them. - Notes typed into the parent (local parents only):
<sled>t3 reviewer is blocked (permission). See: sled read t3</sled><sled>t3 x hit an error: …. See: sled read t3</sled><sled>t3 x exited (exit 0). Read: sled read t3</sled>
Agents inside Sledbot terminals can't make person-only core calls, such as secrets, approval rules or machines. Messages between agents only show inside the terminals; there is no separate feed.
Environment variables in every terminal
| Variable | Meaning |
|---|---|
SLED_TERMINAL_ID | This terminal's id |
SLED_SOCKET | The core socket |
SLED_MACHINE | The machine it runs on |
SLED_SESSION | The core session (default default) |
TERM, COLORTERM | xterm-256color, truecolor |
PATH | Has sled first |
SLED_TEAMMATE, SLED_THREAD, SLED_ROUTINE | Added in teammate threads |
SLED_JOB | Added in delegated jobs |
Worktree terminals also get SLED_PORT (plus SLED_PORT_1 to SLED_PORT_9), SLED_WORKTREE, SLED_ROOT, SLED_BRANCH and SLED_CONTEXT.
Variables you can set to change core behavior: SLED_NO_RESUME=1 (no resume after restart), SLED_NO_CHECKPOINTS=1, SLED_NO_NETWORK=1 (no model catalogue refresh), SLED_CHAT_MODEL (default model for sled chat) and SLED_GITHUB_HOSTS (GitHub Enterprise hosts).
Exit codes
| Code | Meaning |
|---|---|
| 0 | OK, including a sled wait check-in |
| 1 | Error, or denied (approve) / declined (ask) |
| 2 | sled ask expired |
| 3 | Not found, e.g. "No terminal named "<x>". Use sled ls to see ids and names." |
| 9 | Target is blocked |
| 10 | sled send --if mismatch, or a sled job integrate conflict |
| 124 | sled run or sled job wait timed out; the program is still running |
| other | The program's own exit code |
Features only in the CLI
Turn checkpoints
At the end of every agent turn in a git work tree, Sled Core snapshots the working tree into private refs refs/sled/checkpoints/<t>/<turn>. Your index and HEAD are not touched. The last 50 are kept.
Use sled checkpoint ls to list them, diff to compare, create (with --label) to make one by hand, and restore to go back. restore changes files in the working tree, but it first takes a safety-… checkpoint you can restore to undo it. There is no checkpoint view in the app.
To turn checkpoints off, set SLED_NO_CHECKPOINTS=1, label a terminal sled.checkpoints=off (for example with sled label t3 sled.checkpoints=off), or set {"checkpoints": false} in the settings/agents doc.
Explain a status
sled explain <t> shows why a terminal shows working, blocked, done and so on: which source decided it (escape sequences, agent hooks or screen heuristics), the last 10 signals, and the screen it judged. Use it when an agent seems stuck in the wrong state. Add --json for scripts.
Rename a machine
The app can't rename a remote machine. Use sled machine rename <name> <new>.
Troubleshooting
- "Sled Core is not running (
<socket>). Start it withsled server start." Run that command, or click Restart core in Settings ▸ General. - "This core does not support that yet (
<method>). Trysled update." The CLI is newer than the running core. Runsled update. command not found: sledin Terminal. You haven't installed it for other terminals, or~/.local/binisn't on your PATH. See Install the sled CLI for other terminals.sled doctorsuggestssled machine connect <m>. That subcommand doesn't exist. Usesled machine login <m>or Connect in the app.- A send exits with 9. The target needs you. Answer it in Needs you, or use
--forceif you mean to interrupt.
More fixes are in Troubleshooting Sledbot.