# Environment variables

> The environment variables sc reads to find its files, vaults, editor and daemon, and the ones it exports into every Claude Code session it launches.
>
> What sc reads to find its files, vault and editor, and what it sets in every session it launches. A value you set before running sc usually wins.

Set a variable before `sc` to change one run, or export it from your shell profile to change every run.

```sh
export SUPERCLAUDE_EDITOR="nvim"
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=0 sc <project> <agent>
```

## Variables sc reads

| Variable | Default | What it does |
|---|---|---|
| `SUPERCLAUDE_HOME` | `$HOME/.superclaude` | The profiles home: `config.toml`, the vendored plugins, the shared prompt library and the `system/` workspace. |
| `SUPERCLAUDE_VAULT` | from `config.toml` | The active vault, as a path. It outranks the `default` key in `config.toml`. An explicit `-v <vault>` outranks it. |
| `SUPERCLAUDE_EDITOR` | none | The editor `sc edit`, `--sc-edit` and sessions open, for example `"zed --wait"` or `"nvim"`. |
| `SC_PLUGINS` | `<profiles home>/plugins` | The vendored plugin tree that `sc system` refreshes. Anything you write here is replaced on the next refresh. |
| `SC_VAULT_PLUGINS` | `<vault>/plugins` | The active vault's own plugins. Vendoring never touches this tree, so custom plugins live here. |
| `SC_PROMPTS` | `<profiles home>/_global/shared/prompt` | The shared prompt library, where `core.toml` lives. See [The shared system prompt](/docs/system-prompt). |
| `SUPERCLAUDE_DAEMON_PORT` | `[daemon].port`, else `48770` | The daemon's control port. The variable beats `config.toml`, so a nested `sc` and the daemon it talks to agree on one port. |

**A variable I set is ignored, or I need an off-switch**

Three rules apply to every variable on this page.

- **Parent environment wins.** For most exported variables, a value you set before running `sc` is passed through untouched. That makes `NAME=0 sc <project> <agent>` an off-switch for anything `sc` turns on. The export tables mark the exceptions.
- **Empty means unset.** `SUPERCLAUDE_HOME=`, `SUPERCLAUDE_VAULT=` and the three manifest path variables are treated as absent when they hold an empty string, so a stray assignment falls through to the default.
- **Exports reach the whole session.** `sc` replaces itself with `claude`, so an exported variable is visible to Claude Code, every plugin hook, every subagent and every Bash tool command.

For how vaults, the profiles home and plugins relate, see [How it fits together](/docs/concepts).

**Which vault sc picks**

`sc` resolves the vault in this order:

1. `-v <vault>` on the command line, looked up in the `[vaults.*]` registry.
2. `$SUPERCLAUDE_VAULT`, used as a path.
3. The top-level `default` key in `config.toml`.
4. A registered vault literally named `default`.

A launch, including bare `sc` in a workspace, also needs a registered default vault, either the `default` key or a vault named `default`. Without one, every launch stops with "isn't bootstrapped yet (no default vault is registered) — run `sc system` first", even with `-v` or `$SUPERCLAUDE_VAULT` set. Commands that only need a vault, such as `sc ls`, work with `-v` or `$SUPERCLAUDE_VAULT`, and otherwise stop with an error that names the registered vaults and suggests `sc vault default <name>`. `HOME` is used to compute the profiles home when `SUPERCLAUDE_HOME` is unset, and to expand `~` in config paths.

**Point a manifest at a plugin path**

A manifest (`.claude/superclaude.toml`) can start a path with any `$UPPER_SNAKE/` environment variable. `SC_PLUGINS`, `SC_VAULT_PLUGINS` and `SC_PROMPTS` have a computed default, so a manifest that uses them works with nothing exported. Export one to point it somewhere else.

```toml
plugins = [
  "$SC_PLUGINS/sc-memory",
  "$SC_VAULT_PLUGINS/<name>",
]
```

`$SC_VAULT_PLUGINS` is the only one that needs a vault. If no vault resolves, a manifest that uses it fails to render. `--with <plugin>` takes the same `$VAR/...` specs on the command line. See [superclaude.toml](/docs/superclaude-toml) for the full manifest.

**Choose which editor opens**

`sc edit`, `--sc-edit` and the editor a session opens all share one resolution order:

| Order | Source |
|---|---|
| 1 | `SUPERCLAUDE_EDITOR` |
| 2 | `zed`, when it is on `PATH` |
| 3 | `VISUAL` |
| 4 | `EDITOR` |

`SUPERCLAUDE_EDITOR` comes first on purpose. A shell profile that still sets `EDITOR=nano` would otherwise decide what every session opens. With none of the four set, `sc edit config` stops with an error that names all of them.

**Move the daemon's runtime directory**

The runtime directory holds the daemon's socket, lock, pid file and `daemon.log`.

| Variable | Default | What it does |
|---|---|---|
| `SUPERCLAUDE_RUNTIME_DIR` | see below | The runtime directory, used as given. |
| `XDG_RUNTIME_DIR` | none | When set, the runtime directory is `$XDG_RUNTIME_DIR/superclaude`. |
| `TMPDIR` | `/tmp` | The fallback runtime directory is `$TMPDIR/superclaude-<uid>`. |

Check the running daemon with `sc daemon status`.

**Turn one feature off for one launch**

| Variable | Effect |
|---|---|
| `SUPERCLAUDE_NO_PLUGIN_REFRESH` | Any value other than empty, `0`, `false` or `no` makes `sc system` skip the plugin refresh, the same as `--no-plugin-refresh`. An empty `plugins/` tree is still populated. |
| `SUPERCLAUDE_ISOLATE_VAULT` | Opts this launch into vault isolation (macOS), the same as `--isolate-vault`. |
| `SUPERCLAUDE_NO_VAULT_ISOLATION` | Turns vault isolation off for one launch when `[vault_isolation].enabled = true`. An explicit `--isolate-vault` still wins. |
| `SUPERCLAUDE_NO_HOOK_INJECT` | Skips the daemon hooks `sc` adds to every session. The persistent form is `[hooks].auto_inject = false`. |
| `SUPERCLAUDE_NO_STATUSLINE` | Skips the status line `sc` adds to every session. The persistent form is `[statusline].auto_inject = false`. |
| `SC_RELATIVE_WORKTREE_ROOT` | Where `sc` creates worktrees, relative to the project's `code_repo`. Default `../worktrees`. |
| `CLAUDE_CODE_AUTO_COMPACT_WINDOW` | Overrides `[claude].autocompact` for one launch. |
| `NO_COLOR` | Turns off color in `sc` output and the status line. |

```sh
SUPERCLAUDE_NO_VAULT_ISOLATION=1 sc <project> <agent>
CLAUDE_CODE_AUTO_COMPACT_WINDOW=900000 sc <project> <agent>
```

**Keep keys out of config.toml**

A key in `config.toml` can name an environment variable instead of holding a literal value. `sc` expands `${VAR}` in the keys below when it reads them. An unset variable expands to an empty string.

| Where | Example |
|---|---|
| `[endpoints.<name>].key_csv` | `key_csv = "${OPENAI_API_KEY}"`, which may expand to a comma-separated list of keys |
| `[dist].key` | `key = "${RELEASE_KEY}"`, for a private release server |
| `[share].key` | `key = "${SUPERCLAUDE_KEY}"`, the superclaude key shares use |

The variable names are yours to choose. The chat relay also reads `SC_RELAY_SLACK_BOT_TOKEN`, `SC_RELAY_SLACK_APP_TOKEN` and `SC_RELAY_DISCORD_TOKEN`, and each one beats the matching token in `config.toml`. See [config.toml](/docs/config-toml).

**Install `sc` somewhere other than ~/.local/bin**

The install script reads `SC_INSTALL_DIR`, default `$HOME/.local/bin`, as the directory for `sc` and its `superclaude` symlink. See [Install](/docs/install).

```sh
curl -fsSL https://superclaude.io/install.sh | SC_INSTALL_DIR="$HOME/bin" sh
```

## Variables sc exports into a session

These are set on every normal launch: `sc <project> <agent>`, bare `sc` in a workspace, and `sc system`.

| Variable | Value | If already set |
|---|---|---|
| `CLAUDE_MODE` | `superclaude` | Always overwritten |
| `SUPERCLAUDE_VAULT` | the active vault's path | Kept, unless `-v` names a vault |
| `SUPERCLAUDE_VAULT_NAME` | the vault's registered name, which can differ from its directory name | Set only when `SUPERCLAUDE_VAULT` is unset and `sc` resolves the vault from the workspace path |
| `SUPERCLAUDE_WORKSPACE_ID` | a name such as `personal/<project>/<agent>`, or `system` | Kept |
| `CLAUDE_MEMORY_HUB` | `<vault>/memories` | Kept |
| `SC_WORKFLOWS` | `<vault>/workflows` | Kept |
| `CLAUDE_CODE_FORK_SUBAGENT` | `1` | Kept |
| `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS` | `1` | Kept |
| `CLAUDE_ENV_FILE` | `<profiles home>/bashtoolenv.sh` | Always overwritten |
| `CLAUDE_CODE_AUTO_COMPACT_WINDOW` | `[claude].autocompact`, default `700000` | Kept |
| `CLAUDE_CODE_MAX_CONTEXT_TOKENS` | `[claude].context_window`, unset by default | Kept |
| `VISUAL`, `EDITOR` | the resolved editor | Overwritten, but only when `SUPERCLAUDE_EDITOR` is set or `zed` is on `PATH` |
| `SUPERCLAUDE_DAEMON_PORT` | the daemon's control port | Kept |
| `SUPERCLAUDE_ISOLATE_VAULT` | `1` | Set only for `--isolate-vault` |

**What each export is for**

- **`CLAUDE_MODE`** tells hooks the session came through `sc`, so a session started with plain `claude` is flagged at session start.
- **`SUPERCLAUDE_WORKSPACE_ID`** is a name, not a path: the workspace's location under the profiles home, with the `p` and `a` segments dropped. It is left unset for a workspace outside the profiles home.
- **`CLAUDE_MEMORY_HUB`** is the vault's [memory hub](/docs/memory). It is exported only when `<vault>/memories` exists. Without it, sc-memory works from the project's own `.claude/memory` only.
- **`SC_WORKFLOWS`** is the vault's store for the multi-agent workflow scripts a session runs. `sc` creates the directory if it is missing and also passes it to Claude Code with `--add-dir`.
- **`CLAUDE_CODE_FORK_SUBAGENT`** enables Claude Code's `fork` subagent type, which sc-memory's background consolidation uses. **`CLAUDE_CODE_ENABLE_FUNCTION_HOOKS`** enables in-process function hooks, which several bundled plugins ship. Both are off by default in Claude Code.
- **`CLAUDE_ENV_FILE`** is a script Claude Code sources before every Bash tool command. `sc` creates it on first launch with one line that unsets the HTTP proxy variables, and never overwrites it afterwards. Add your own lines to it.
- **The context variables** come from `[claude]` in `config.toml`. Values from 100000 to 1000000 are exported. `"auto"` exports nothing. An unset `autocompact` exports `700000`; an unset `context_window` exports nothing. They are variables rather than flags because Claude Code ranks the environment above `--autocompact` and settings.
- **`VISUAL` and `EDITOR`** get the same value. For `zed` the exported value is `zed --wait`, so Claude Code waits for the file to close. Your shell's own `EDITOR` is not changed.
- **`SUPERCLAUDE_DAEMON_PORT`** is exported when the launch uses the daemon, so plugin hooks can find it.

**My session runs on a gateway profile**

When a session runs on a gateway profile, through `-u <profile>` or a non-`direct` `default_profile`, `sc` starts the daemon, checks that the profile is ready, and then points Claude Code at the [gateway](/docs/gateways). These are always overwritten.

| Variable | Value |
|---|---|
| `ANTHROPIC_BASE_URL` | the daemon's gateway, on the local control port |
| `ANTHROPIC_AUTH_TOKEN` | the placeholder `sc-go`; the daemon adds the real key per request |
| `ANTHROPIC_CUSTOM_HEADERS` | `X-SC-Profile: <profile>`, which tells the daemon which profile to route |
| `ANTHROPIC_DEFAULT_OPUS_MODEL`, `_SONNET_MODEL`, `_HAIKU_MODEL`, `_FABLE_MODEL` | a label such as `<profile> · <model> · opus`, or the bare role name when `config.toml` cannot be read |
| `ANTHROPIC_SMALL_FAST_MODEL` | the haiku role's label |
| `ANTHROPIC_DEFAULT_*_MODEL_NAME` | the model picker label, `<profile> · <endpoint>/<model>` |
| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | `1` |

A hybrid profile, where at least one role uses a `passthrough` endpoint, sets only `ANTHROPIC_CUSTOM_HEADERS` from this table. Claude Code keeps its own login, its own model ids and `api.anthropic.com` as its base URL. `sc` puts the daemon's local proxy in the session's request path, and the proxy routes each request by role: a passthrough role goes on to `api.anthropic.com` unchanged, and any other role goes to the gateway.

Each model label keeps its role word, which is how the daemon maps a request back to a role. The label is also what the status line shows. `sc --no-daemon` launches plain Claude Code and sets none of these. `-u` with any profile other than `direct`, together with `--no-daemon`, is an error.

**My session runs incognito**

`-i` replaces the per-session exports in the table above with a fixed set. It sets no feature gates, no `CLAUDE_MEMORY_HUB`, no `SC_WORKFLOWS`, no editor and no `CLAUDE_ENV_FILE`. `SUPERCLAUDE_VAULT` and `SUPERCLAUDE_WORKSPACE_ID` are still inherited.

| Variable | Value |
|---|---|
| `CLAUDE_MODE` | `incognito` |
| `CLAUDE_INCOGNITO` | `1`, so hooks can detect the mode |
| `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, `DISABLE_ERROR_REPORTING` | `1` |
| `DISABLE_AUTOUPDATER`, `DISABLE_BUG_COMMAND`, `DISABLE_FEEDBACK_COMMAND`, `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` | `1` |
| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | `1` |
| `CLAUDE_CODE_DISABLE_AUTO_MEMORY`, `CLAUDE_CODE_SKIP_PROMPT_HISTORY`, `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING` | `1` |
| `CLAUDE_CODE_AUTO_CONNECT_IDE`, `ENABLE_CLAUDEAI_MCP_SERVERS` | `0` |

`ANTHROPIC_API_KEY` is passed through from your shell unchanged. The filesystem sandbox around an incognito session is macOS-only; on Linux the variables still apply. See [Use cases](/docs/use-cases) for a read-only review with `-i`.

**I run sc from inside a session**

A session launched by `sc` already carries `SUPERCLAUDE_VAULT`, so a nested `sc` keeps the parent's vault, workspace identity and daemon port.

### Test against a throwaway home

`SUPERCLAUDE_VAULT` outranks the `default` in `config.toml`. Pointing `SUPERCLAUDE_HOME` somewhere else does not clear it, because a different function reads each variable. A test run started from inside a session therefore targets the real vault unless you clear both first:

```sh
unset SUPERCLAUDE_VAULT CLAUDE_MEMORY_HUB
export SUPERCLAUDE_HOME="$(mktemp -d)"
sc vault ls
```

Confirm that `sc vault ls` shows the throwaway home before you run anything that writes.

### Check what a launch would set

`sc <project> <agent> --dry-run` prints the resolved environment and argv without starting Claude Code. It marks which variables `sc` added and masks values that look like credentials. It still starts the daemon and the gateway, so treat it as a launch. See [Change an agent](/docs/editing-agents) for the other report selectors.
