Skip to main content

Module env

Module env 

Source
Expand description

The environment a child process on this machine starts from.

Every program the engine launches — a Bash / Monitor command, a command hook, an MCP stdio server, the engine’s own git and pdftotext — gets its environment from here, so that what a model can read with printenv is decided in one place. The engine’s own credentials never pass by default; everything else does unless the operator switches to an allowlist.

Which variables are credentials is decided where configuration names them: a settings file, a plugin, the MCP policy or the host each report the variables they read a secret from (hold_back_credential) before any child starts under them.

Structs§

SubprocessEnv
sandbox.env in settings.json.

Enums§

EnvPlan
What SubprocessEnv::resolve decides to do to the environment a child would otherwise inherit.
EnvScope
How much of the environment a process starts from: a mark on a ProcessSpec a provider reads, not a list of variables, since a remote provider’s environment is not this machine’s.
SubprocessEnvMode

Functions§

expand_vars_with
Expand $VAR, ${VAR}, ${VAR:-default} (the default when unset or empty) and $$ (a literal $) in input, with the variables lookup gives. A variable it does not give expands to nothing.
hold_back_credential
From now on, treat the variable name as one of the engine’s own credentials: no child process inherits it unless a policy’s allow names it. Process-wide, because the environment children inherit from is. The variables a shell cannot work without are never held back, whatever a settings file names.
hold_back_what_an_mcp_server_reads
hold_back_credential for every variable variables_an_mcp_server_reads finds in server.
is_engine_credential
The engine’s own credentials: the ANTHROPIC_* variables, the daemon’s bearer token, and whatever hold_back_credential was told.
referenced_vars
The variables input refers to as $VAR, ${VAR} or ${VAR:-…}.
variables_an_mcp_server_reads
The variables of this process’s environment an mcp_servers entry reads when it connects: every $VAR in its command, args, env, url and headers, and the variables its oauth block names (client_secret_env, private_key_jwt.key_env).