Skip to Content
Environment Variables

Pane is mostly transparent — your existing shell env passes through unchanged. Pane adds a small set of variables describing the current pane so you can conditionally configure shell init scripts or agent prompts.

Pane-injected variables

VariableValue
PANE_WORKTREE_PATHAbsolute path to the pane’s worktree on disk
PANE_WORKTREE_BRANCHThe branch the worktree is tracking
PANE_NAMEThe user-facing pane name you set at creation
PANE_IDStable UUID for the pane, consistent across restarts

These are available immediately in any shell command or script running inside a pane.

Setting env vars per pane

Three common patterns:

1. Shell init script with conditional logic

In ~/.zshrc or ~/.bashrc, branch on PANE_WORKTREE_PATH:

if [[ "$PANE_WORKTREE_PATH" == *"/api-pane"* ]]; then export ANTHROPIC_API_KEY="sk-ant-api-key..." fi

2. Per-pane .envrc with direnv

Add a .envrc to the worktree root:

export ANTHROPIC_API_KEY="sk-ant-..." export DATABASE_URL="postgres://localhost/myapp_dev"

Run direnv allow once in the pane’s terminal. direnv re-loads the vars whenever you enter the directory. Install direnv from direnv.net .

3. Per-pane .env with dotenv-cli

# .env in worktree root ANTHROPIC_API_KEY=sk-ant-... DATABASE_URL=postgres://localhost/myapp_dev

Prefix commands with dotenv --:

dotenv -- claude

Install with npm install -g dotenv-cli.

Provider keys

Pane does not store provider API keys. Agents read keys directly from your shell environment. See AI providers for the full list of ANTHROPIC_API_KEY, OPENAI_API_KEY, and other provider-specific variables.

Avoiding collision in parallel panes

Two panes can run the same agent with different provider keys simultaneously:

Terminal
# Pane A
$ export ANTHROPIC_API_KEY="sk-ant-account-a"
$ claude
 
# Pane B (separate shell)
$ export ANTHROPIC_API_KEY="sk-ant-account-b"
$ claude
$

Each pane’s shell is a separate process. Env vars set in one shell do not leak into another. Both agents run concurrently against their own keys with no interference.

Last updated on