berthdocs

Reference

Files and environment

Where Berth keeps its state on the laptop and on boxes, and the variables it sets and reads.

Berth keeps two kinds of files:

  • State, which Berth writes: identities, trust stores, sockets, logs. It lives in the state directory: ~/Library/Application Support/berth on a Mac, ~/.config/berth (or $XDG_CONFIG_HOME/berth) on Linux. BERTH_HOME moves it; it must be an absolute path.
  • Things you write, by hand or through the app: hooks, flows, templates, themes, plugins, kits. They live in ~/.berth/; BERTH_USER_DIR moves it.

On the laptop

State, in <state>/client/:

FileWhat it holds
identity.pemThis laptop's key
boxes.jsonPaired boxes, their addresses, fingerprints and networks
forwards.json, routes.jsonSaved forwards and routes
queue.jsonThe offline prompt queue
agent.sock, agent.lock, agent.logThe laptop agent's socket, lock and log
ui-tokenThe token for the app's API (mode 0600)
networks/Embedded Tailscale nodes for other tailnets

Yours, in ~/.berth/:

FileWhat it holds
hooks.jsonLaptop hooks
templates/*.jsonTask templates
themes/*.jsonThemes
plugins/<id>/Plugins, each with a berth-plugin.json
kits/<id>/Your kits library: kit.json, its files, and where it came from
app/<key>.jsonThe app's settings documents: saved prompts, projects, the sidebar, notifications

On a box

State, in <state>/box/:

FileWhat it holds
identity.pemThe box's key
clients.jsonPaired laptops (with a backup)
pairing.jsonPairing codes not yet used
listenThe address berthd serves on
berthd.sock, berthd.logThe local socket (mode 0600) and the log
locations.jsonLocations, each with the box's own config and its kit
ports.jsonEach worktree's block of ports
logs/Setup and archive logs
units/Unit and service logs
kits/<location>/<kit>/Installed kits' files ($BERTH_KIT_DIR)
paused.jsonPaused worktrees
agent-states.jsonWhat each agent last reported, by working directory
tmux.confThe configuration of Berth's tmux server
phone.jsonThe phone companion: on or off, its token, notifications
flow-runs.jsonThe last 200 flow runs
flow-github.jsonWhat GitHub-triggered flows have already seen

Yours, in ~/.berth/: hooks.json, flows.json, env.json, guard.json and plugins/; see the config reference.

Sessions run in tmux on its own socket (tmux -L berth).

Environment

What a worktree gets

Everything run in a worktree (setup and archive scripts, terminals and agents, exec, repository hooks, flow steps, services):

VariableMeaning
BERTH_BOX, BERTH_LOCATIONWhere
BERTH_ROOT_PATHThe repository's main checkout
BERTH_WORKTREE_PATH, BERTH_WORKTREE_NAME, BERTH_BRANCHThis worktree
BERTH_WORKTREE_SLUGlocation_worktree, lowercase, safe for database names
BERTH_PORT, BERTH_PORT_1, …Its ports
BERTH_KIT_DIRIts kit's files, when it has a kit
thenthe box's env.json, the project's env, and resolved secrets
PORTServices only, unless env sets it
ORCA_ROOT_PATH, ORCA_WORKTREE_PATH, ORCA_WORKSPACE_NAMESetup and archive scripts, for scripts written for Orca

What a hook gets

See events and gates.

What Berth reads

VariableMeaning
BERTH_HOMEThe state directory
BERTH_USER_DIRInstead of ~/.berth
BERTH_ORIGINThe origin berth and berthd commands announce events with
BERTH_OPWhere the 1Password CLI is
OP_SERVICE_ACCOUNT_TOKEN, other OP_*Passed to op, from berthd's environment or env.json
SHELLThe shell scripts, sessions and exec run in

The laptop agent explains what runs where; the config reference has the shape of every file you write.

On this page