Environment variables, ports, paths
Three lists that are easy to get wrong from memory. The variables, the default
addresses and the path pieces below are read out of {ENVIRONMENT.version} and
its source rather than written beside them, so none of them can drift from the
binary without this page changing too.
What the CLI reads
Section titled “What the CLI reads”Every one of these is a flag first. The variable is the same setting for a service manager or a shell that would rather not repeat the flag, and the flag wins when both are given.
| Variable | Same as | On |
|---|---|---|
PM_SOCKET | --socket | pm |
PM_SHARE_DOMAIN | --share-domain | pm daemon |
PM_SHARE_PORT_RANGE | --share-port-range | pm daemon |
PUSHGW_LISTEN | --listen | pm pushgw |
PUSHGW_APNS_KEY_P8 | --apns-key-p8 | pm pushgw |
PUSHGW_APNS_KEY_ID | --apns-key-id | pm pushgw |
PUSHGW_APNS_SANDBOX_KEY_P8 | --apns-sandbox-key-p8 | pm pushgw |
PUSHGW_APNS_SANDBOX_KEY_ID | --apns-sandbox-key-id | pm pushgw |
PUSHGW_APNS_TEAM_ID | --apns-team-id | pm pushgw |
PUSHGW_APNS_TOPIC | --apns-topic | pm pushgw |
PUSHGW_APNS_ENDPOINT | --apns-endpoint | pm pushgw |
PUSHGW_TRUSTED_PROXIES | --trusted-proxy | pm pushgw |
PUSHGW_RATE_PER_SOURCE | --rate-per-source | pm pushgw |
PUSHGW_RATE_PER_TOKEN | --rate-per-token | pm pushgw |
PUSHGW_RATE_WINDOW_SECS | --rate-window-secs | pm pushgw |
PUSHGW_BAD_TOKEN_LIMIT | --bad-token-limit | pm pushgw |
PUSHGW_BAD_TOKEN_WINDOW_SECS | --bad-token-window-secs | pm pushgw |
PUSHGW_BAD_TOKEN_BLOCK_SECS | --bad-token-block-secs | pm pushgw |
PM_SOCKET is the one worth setting in a shell. With a daemon on a custom
socket, every client has to be told the same path, and exporting it once beats
passing --socket to each command.
Two more that are not flags:
RUST_LOGselects what is logged, overriding-v. It applies to the commands that log —pm daemon,pm workerandpm pushgw.XDG_RUNTIME_DIRdecides where the socket goes when--socketis not given, andXDG_CONFIG_HOMEwhere a worker’s configuration lives. A value set only in a shell startup file is not in a service manager’s environment, which is a common cause of a unit that cannot find what you can.
What an agent is handed
Section titled “What an agent is handed”The daemon puts these into every session it spawns. They are listed because they explain what a session is and because seeing one in an agent’s environment should not be a mystery — not because they are yours to set. Setting them yourself does nothing useful: the daemon overwrites them per session.
| Variable | Why it is there |
|---|---|
PM_SOCKET | Environment variables injected into every managed session; hook commands inherit them and use them to reach the daemon. |
PM_SESSION_TOKEN | |
PM_MCP_URL | The daemon's MCP endpoint, read by the `pm _mcp` stdio bridge that serves agent CLIs whose MCP configuration is global rather than per-session. |
CLAUDE_CODE_SANDBOXED | Claude Code treats this as "the environment already constrains this session", which among other things settles its directory-trust question without a prompt. Undocumented, so it is set only where its effect is known to be nil. |
CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN | Set to 1, Claude Code renders into the scrollback instead of taking over the alternate screen, so a session's output stays scrollable in whatever is attached to the PTY. |
ANTHROPIC_BASE_URL | Claude Code reads its endpoint and credential from these. |
ANTHROPIC_AUTH_TOKEN | |
ANTHROPIC_SMALL_FAST_MODEL | The CLI's small/fast model, which is what an entry's background model means. `ANTHROPIC_DEFAULT_HAIKU_MODEL` is deliberately not set: it remaps the haiku tier alias, so it would also change what an explicit haiku selection resolves to. |
PM_MODEL_API_KEY | The variable Codex is told to read its credential from, so the key reaches the child through the environment rather than a config file or the command line. |
GEMINI_CLI_SYSTEM_SETTINGS_PATH | Gemini has no `--settings` flag. It merges four settings layers and this variable points at the System Overrides layer, which merges object-valued settings rather than replacing them, so a per-session file adds our hooks and MCP server without disturbing the user's own settings or their login. |
GOOGLE_GEMINI_BASE_URL | Gemini's endpoint and credential variables. Vertex AI is a second endpoint shape with its own variables that a single `base_url` field cannot disambiguate, so an entry never selects it. |
GEMINI_API_KEY | |
OPENCODE_CONFIG | OpenCode merges every config layer it finds, so this variable adds a per-session file to the user's own config and provider logins rather than replacing them. Its directory form, `OPENCODE_CONFIG_DIR`, makes OpenCode bootstrap the directory with a `node_modules` of its own as soon as it holds a plugin, which would cost an npm install and 60 MB on every spawn. |
The first three go to every session whatever agent it runs. The rest belong to one CLI each and appear only when that CLI is the one running, or when a model profile applies — a credential reaches a child through its environment rather than through a file or a command line, so it never lands on disk or in a process listing.
What it listens on
Section titled “What it listens on”| Flag | Default | What it serves |
|---|---|---|
–http | 127.0.0.1:7676 | the dashboard, the API, and HTTP previews under the default mount |
–worker-listen | 0.0.0.0:7677 | the worker plane, and nothing else |
–listen on pm pushgw | 127.0.0.1:8400 | the push relay |
All three default to loopback. A controller serving other machines has to bind the worker plane somewhere they can route to, which is a separate decision from exposing the dashboard — they are different ports because they are different trust surfaces, and a reverse proxy in front of the web port must not be put in front of the other one.
Two more sets of listeners are bound on demand rather than at startup:
- Raw TCP forwards take an ephemeral port each, on loopback, whatever the
dashboard binds.
--forward-bindis the only thing that moves them and--forward-ports <lo-hi>pins the range so a firewall rule can be written once. - HTTP previews are served on the dashboard’s own port by default. With
--share-port-rangeeach takes a listener of its own from that range, and with--share-domaineach gets a subdomain instead. Both are startup-only, because the mount decides every URL already handed out.
→ Port forwards and directory shares on what each mount does and does not isolate.
What it writes where
Section titled “What it writes where”The data and configuration directories are the platform’s own. Everything under them moves with a flag.
| Path | Flag | What it is |
|---|---|---|
$XDG_RUNTIME_DIR/puppet-master/pm.sock | –socket | the socket the CLI and TUI use, falling back beside the database when that variable is unset |
<data dir>/pm.db | –db | all the state there is |
<data dir>/pm.db.secret | follows –db | the key that opens the sealed columns, named after the database it belongs to |
<data dir>/scrollback | –scrollback-dir | what ended sessions printed, and per-session files adapters write |
<config dir>/worker.toml | — | on a worker: the controllers it is enrolled with |
<config dir>/worker-key.pem | — | on a worker: the key that is its identity. A named worker gets its own |
<data dir>/worker-transcripts | — | on a worker: output buffered while its controller was away |
→ State on disk for what is in each of them and the modes they are kept at.
Settings are not here
Section titled “Settings are not here”Anything you would expect to configure and cannot find above is probably a daemon setting rather than a flag or a variable. Those live in the database and are read when they are used, so changing one needs no restart.