# Environment variables

Your shell env passes through unchanged. Pane adds a few variables that describe the current [pane](/docs/panes-and-worktrees), so your scripts, dev servers and agents know where they're running.

## Pane-injected variables

| Variable | Value |
|----------|-------|
| `PANE_WORKSPACE_PATH` | Absolute path to the folder the terminal started in. For a worktree pane, that's the pane's worktree. `WORKTREE_PATH` holds the same path. |
| `PANE_PORT` | First of 10 ports picked from the pane's ID, between 3000 and 8999. Parallel dev servers rarely collide. |
| `PANE_SESSION_ID` | The pane's ID, despite the name. It stays the same across restarts. |
| `PANE_PANEL_ID` | The ID of this tab inside the pane. |
| `PANE_ORCHESTRATION_SESSION_ID` | Only set in a [Session](/docs/sessions) chat. It's the Session's stable ID. |

They're there in every terminal tab, run script and agent Pane starts. On Windows, Pane also adds them to `WSLENV`, so they cross into WSL shells too.

Use `PANE_PORT` in your [run script](/docs/configuration) so every pane gets its own dev server port:

```json
{ "scripts": { "run": "PORT=$PANE_PORT pnpm dev" } }
```

### Commit attribution

Pane also sets `GIT_COMMITTER_NAME=Pane` and `GIT_COMMITTER_EMAIL=runpane@users.noreply.github.com` in the processes it starts. You stay the commit author. GitHub just shows "committed by Pane". Don't want that? Turn off **Settings → Worktrees & Git → Attribute commits to Pane**. New terminals stop getting them. Ones already running keep the env they started with.

## Project environment variables

Every tab and script in a project's panes gets these. Other projects never see them.

1. Open the project's menu in the sidebar and choose **Project settings**.
2. Under **Environment Variables**, add a name and pick its source: **Plain text**, **Pane secret** ([synced and kept in your OS secure store](/docs/providers#keep-keys-in-pane-secrets)), or **macOS Keychain** (an item you already have, macOS only).
3. Save. New terminals and scripts get the change.

> **Note:** A project variable overrides the environment Pane started in. Your shell's startup files run later, so an `export` in `~/.zshrc` still wins. `PATH`, `WORKTREE_PATH` and `PANE_*` are reserved.

If a value can't be read, the terminal starts without it and prints a `[Pane]` line saying why.

## Setting env vars per pane

<a id="avoiding-collision-in-parallel-panes"></a>

**1. Export it in one tab.** Only that tab sees it:

```bash
export ANTHROPIC_API_KEY="sk-ant-..."
claude
```

**2. `.envrc` with [direnv](https://direnv.net)** in the worktree root. Run `direnv allow` once. direnv re-loads the vars whenever you enter the directory:

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

**3. `.env` with dotenv-cli** (`npm install -g dotenv-cli`):

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

```bash
dotenv -- claude
```

Pane copies gitignored `.env*` files, `.envrc` included, into each new worktree ([file sync](/docs/configuration#worktree-file-sync)).

**4. Branch on the path in your shell profile.** A pane's worktree is `<repo>/worktrees/<name>` by default (`echo $PANE_WORKSPACE_PATH` shows it). In `~/.zshrc` or `~/.bashrc`:

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

<a id="provider-keys"></a>

## Related

- [AI providers](/docs/providers): which variables Claude Code and Codex read
- [MCP servers](/docs/mcp): passing credentials to MCP servers
- [Security & permissions](/docs/security): what Pane sends off your machine
