Skip to content
docs/reference and operations
Get started

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.

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.

VariableSame asOn
PM_SOCKET--socketpm
PM_SHARE_DOMAIN--share-domainpm daemon
PM_SHARE_PORT_RANGE--share-port-rangepm daemon
PUSHGW_LISTEN--listenpm pushgw
PUSHGW_APNS_KEY_P8--apns-key-p8pm pushgw
PUSHGW_APNS_KEY_ID--apns-key-idpm pushgw
PUSHGW_APNS_SANDBOX_KEY_P8--apns-sandbox-key-p8pm pushgw
PUSHGW_APNS_SANDBOX_KEY_ID--apns-sandbox-key-idpm pushgw
PUSHGW_APNS_TEAM_ID--apns-team-idpm pushgw
PUSHGW_APNS_TOPIC--apns-topicpm pushgw
PUSHGW_APNS_ENDPOINT--apns-endpointpm pushgw
PUSHGW_TRUSTED_PROXIES--trusted-proxypm pushgw
PUSHGW_RATE_PER_SOURCE--rate-per-sourcepm pushgw
PUSHGW_RATE_PER_TOKEN--rate-per-tokenpm pushgw
PUSHGW_RATE_WINDOW_SECS--rate-window-secspm pushgw
PUSHGW_BAD_TOKEN_LIMIT--bad-token-limitpm pushgw
PUSHGW_BAD_TOKEN_WINDOW_SECS--bad-token-window-secspm pushgw
PUSHGW_BAD_TOKEN_BLOCK_SECS--bad-token-block-secspm 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_LOG selects what is logged, overriding -v. It applies to the commands that log — pm daemon, pm worker and pm pushgw.
  • XDG_RUNTIME_DIR decides where the socket goes when --socket is not given, and XDG_CONFIG_HOME where 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.

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.

VariableWhy it is there
PM_SOCKETEnvironment variables injected into every managed session; hook commands inherit them and use them to reach the daemon.
PM_SESSION_TOKEN
PM_MCP_URLThe 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_SANDBOXEDClaude 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_SCREENSet 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_URLClaude Code reads its endpoint and credential from these.
ANTHROPIC_AUTH_TOKEN
ANTHROPIC_SMALL_FAST_MODELThe 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_KEYThe 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_PATHGemini 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_URLGemini'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_CONFIGOpenCode 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.

FlagDefaultWhat it serves
–http127.0.0.1:7676the dashboard, the API, and HTTP previews under the default mount
–worker-listen0.0.0.0:7677the worker plane, and nothing else
–listen on pm pushgw127.0.0.1:8400the 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-bind is 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-range each takes a listener of its own from that range, and with --share-domain each 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.

The data and configuration directories are the platform’s own. Everything under them moves with a flag.

PathFlagWhat it is
$XDG_RUNTIME_DIR/puppet-master/pm.sock–socketthe socket the CLI and TUI use, falling back beside the database when that variable is unset
<data dir>/pm.db–dball the state there is
<data dir>/pm.db.secretfollows –dbthe key that opens the sealed columns, named after the database it belongs to
<data dir>/scrollback–scrollback-dirwhat 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.

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.

→ Configuration keys