Install
Install with PiG
pig install npm:@pi-lab/envInstall with Pi
pi install npm:@pi-lab/envPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"extensions": [
"./src/index.ts"
]
}README
Written by the package's publisher, shown as published in version 1.1.0 (README.md). PiG does not review it.
@pi-lab/env 
Load environment variables for pi from settings and dotenv files.
Install
pi install npm:@pi-lab/env
Usage
Add an env block to ~/.pi/agent/settings.json:
{
"env": {
"OPENAI_API_KEY": "${OPENAI_KEY_PROD}",
"ANTHROPIC_BASE_URL": "https://${GATEWAY_HOST}/anthropic",
"HTTP_PROXY": "http://${PROXY_HOST:-127.0.0.1}:7890"
}
}
You can also use ~/.pi/agent/.env. The legacy ~/.pi/agent/pi-lab/.env
location is used when .env is absent. Set PI_CODING_AGENT_DIR to use a
different agent directory for all global files.
Trusted projects can add or override values in .pi/settings.json. Project
settings are ignored unless Pi confirms trust. Restart pi after editing files.
Variable references
In settings values:
${VAR}uses an existing environment variable. If missing, it stays literal and warns without logging values.${VAR:-default}uses the literal default when the variable is missing or empty.$${VAR}produces the literal text${VAR}.
References use environment values present when this extension loads, not values
it subsequently loads from settings or dotenv. Variable names must match
[A-Za-z_][A-Za-z0-9_]*. No nested expressions, recursive expansion, or command
execution. Dotenv parsing is unchanged.
Loading and precedence
Existing environment variables take priority, followed by trusted project settings, global settings, then dotenv. Values changed or deleted by another extension are left alone.
Put @pi-lab/env before packages that need these variables during startup.
Global values load early; project values load when the session starts and cannot
change tools already registered. Reload preserves existing process values.