berthdocs

Reference

berthd CLI

Every command of berthd, the daemon on each box, and what agents on the box use.

berthd runs on each box. berthd serve is the daemon; most other commands talk to it through its local socket, so tools and agents on the box (hooks, flows, skills) can drive it directly. berthd help prints this list.

  • Addressing. A location is cal, a worktree cal/billing, a session by its name. From the laptop, berth takes the same commands with the box in front: berth sessions devl, berth exec devl/cal/billing -- ….
  • JSON. Every listing takes --json.
  • State. BERTH_HOME overrides the state directory. Hooks run from ~/.berth/hooks.json and ~/.berth/plugins.

The daemon

CommandWhat it does
berthd serve [--listen ADDR]Serve paired laptops (default: the tailnet address only, port 7444)
berthd install [--listen ADDR] [--keep-listen] [--dry-run]Run serve as a user service (systemd, or launchd on macOS). --keep-listen keeps an installed service's non-tailnet address; --dry-run checks the box and prints what it would do
berthd uninstallRemove that service
berthd pair [--address HOST[:PORT]] [--ttl 10m]Print a single-use pairing link
berthd clientsList paired laptops
berthd revoke <name|fingerprint>Stop trusting a laptop
berthd idPrint this box's fingerprint
berthd doctor [--json]Check this box's setup and how to fix it
berthd versionPrint this build's version
berthd session attach NAMEAttach to a session in this terminal

Locations and worktrees

CommandWhat it does
berthd locationsLocations and their worktrees
berthd location add NAME PATHRegister a repo or directory
berthd location rm NAMEForget a location (files are untouched)
berthd location scripts NAME [--setup CMD] [--archive CMD] [--clear]Worktree setup and archive scripts (default: the repo's .berth/config.json)
berthd location config NAMEThe repo's, the box's and the effective config
berthd servicesWhich worktree each running server belongs to
berthd service list|start|stop|restart|log LOC/WORKTREE [SERVICE]A worktree's services from the repo's config
berthd preview [LOC/WORKTREE] [PORT] [--path /x]Open a worktree's page in the Berth app
berthd worktree new LOC/NAME [--branch B] [--base REF]Create a git worktree and run its setup
berthd worktree rm LOC/NAME [--force]Remove a worktree

berthd preview with no arguments uses the worktree it runs in (from $BERTH_WORKTREE_PATH or the current directory) and its $BERTH_PORT. It asks the app to open the page as a browser tab beside the agent; the berth-preview skill teaches agents to use it.

Agent sessions

CommandWhat it does
berthd sessionsList sessions
berthd agentsAgent CLIs this box can start
berthd task new LOC/NAME [--agent ID] [--prompt TEXT] [--open split|tab] [--branch B] [--base REF]A worktree with an agent running in it
berthd session new LOC[/WORKTREE] [--name N] [--agent ID [--prompt TEXT]] [--open split|tab] [-- COMMAND...]Start an agent or a command (default: a shell) there
berthd session screen NAME [--history N]Print what the session shows
berthd session send NAME TEXT [--no-enter] [--wait] [--timeout 30m]Type a prompt into a session, and wait for its turn
berthd session wait NAME [--for finished,waiting] [--timeout 30m]Wait for its agent's turn to end
berthd exec LOC[/WORKTREE] [--timeout 10m] -- COMMAND...Run a command there and print its output
berthd loop SESSION --check CMD [--prompt TEXT] [--max 5] [--turn-timeout 30m]Prompt, wait, check, and feed failures back
berthd session kill NAMEStop a session

Ports and sharing

CommandWhat it does
berthd portsWhat is listening on the box
berthd statsMemory, disk, load, and agents running or waiting
berthd infoThe box's name, OS, build, tools and agent presets, as JSON
berthd share PORTMake a port public (Cloudflare quick tunnel; needs cloudflared)
berthd sharesList public shares
berthd unshare IDStop a share

Units

Long-running programs berthd runs under the box's service manager, so they survive reboots and restart on failure. Their output goes to a log berthd owns, not the journal.

CommandWhat it does
berthd unitsManaged units
berthd unit add NAME -- COMMAND...Install and start a unit
berthd unit get NAMEIts state and where its log is
berthd unit log NAMEWhat it has written, for one that will not stay up
berthd unit restart NAMEStart it again
berthd unit rm NAMEStop and remove it (its log stays)

Skills, secrets and events

CommandWhat it does
berthd skills [list|install|uninstall] [SKILL...] [--agent claude|codex|all] [--target user|project] [--location LOC] [--commit]Teach Claude Code and Codex to use Berth
berthd secret test REFCheck this box can resolve op://vault/item/field or env://NAME (prints the value's length, never the value)
berthd secret exec [--socket PATH] -- PROGRAM [ARGS...]Used by sessions and services: resolves secret references, then runs the program. See secrets.
berthd emit TYPE [key=value...] [--origin TOOL]Announce an event, e.g. deploy.finished
berthd eventsStream the box's events

Integrations

CommandWhat it does
berthd integrations install claude|cursor|codex|allInstall Berth's skills and agent hooks for a tool
berthd hook TOOL EVENT [PAYLOAD]What those hooks run: turns a tool's hook into a Berth event (agent.finished, agent.waiting)

See agent integrations for what the hooks and skills do, and the berth CLI for the laptop's side.

On this page