---
title: "Environment Variables"
description: "Reference for every SlackHive configuration variable in .env."
---

SlackHive stores configuration in a `.env` file in the install directory. `slackhive init` generates this file with safe defaults - you rarely need to edit it by hand.

<Warning>
  `.env` contains encryption keys and the admin password. Never commit it. It's already in `.gitignore` but double-check before pushing.
</Warning>

## Claude Authentication

Pick one option. If both are set, the API key wins.

### Option A: Anthropic API key

Best for teams, production, predictable billing.

```bash
ANTHROPIC_API_KEY=sk-ant-api03-...
```

All agents share this key. Billed per token via the [Anthropic API](https://console.anthropic.com).

### Option B: Claude Pro or Max subscription

Best for individual developers.

```bash
# Leave ANTHROPIC_API_KEY unset
CLAUDE_BIN=/usr/local/bin/claude     # macOS (Intel) or Linux
# CLAUDE_BIN=/opt/homebrew/bin/claude  # macOS (Apple Silicon, Homebrew)
# CLAUDE_BIN=/usr/bin/claude           # Linux (package install)
```

Requirements:

1. Run `claude login` on the host machine
2. Set `CLAUDE_BIN` to the path returned by `which claude`

**Token refresh behavior:**

| Platform | Source of truth | Refresh |
|---|---|---|
| macOS | Keychain → `~/.claude/.credentials.json` | SlackHive auto-syncs from Keychain on 401 |
| Linux (GNOME) | `secret-tool` → `~/.claude/.credentials.json` | Re-run `claude login` when it expires |
| Linux (headless) | `~/.claude/.credentials.json` directly | Re-run `claude login` when it expires |

See [OAuth MCPs](/configuration/mcp-oauth) for how this flows through to MCP connections.

## Dashboard Authentication

`slackhive init` sets these from the prompts - you don't typically need to touch them:

| Variable | Purpose |
|---|---|
| `ADMIN_USERNAME` | Superadmin login |
| `ADMIN_PASSWORD` | Superadmin password |
| `AUTH_SECRET` | Signs session cookies (rotating logs everyone out) |
| `ENV_SECRET_KEY` | Encrypts the secret store (rotating breaks all stored secrets) |

`AUTH_SECRET` and `ENV_SECRET_KEY` are generated automatically on first install with `openssl rand -hex 32`. If you need to regenerate:

```bash
openssl rand -hex 32
```

<Warning>
  Do not rotate `ENV_SECRET_KEY` after initial setup without a plan. All stored secrets become unreadable - every MCP server referencing `${env:NAME}` will fail until you re-enter each secret in **Settings → Env Vars**.
</Warning>

## Platform

| Variable | Default | Purpose |
|---|---|---|
| `NODE_ENV` | `production` | Affects log verbosity and error handling |
| `PORT` | auto | Web server port (default 3001, auto-negotiates if taken) |
| `RUNNER_INTERNAL_PORT` | auto | Runner port (default 3002, auto-negotiates) |
| `AGENTS_TMP_DIR` | `~/.slackhive/agents` | Where per-agent workspaces live |
| `DATABASE_TYPE` | `sqlite` | Always `sqlite` on CLI installs |
| `ACTIVITY_DASHBOARD` | unset | Set to `1` to enable the [Activity Dashboard](/features/activity). When unset, the writer hooks short-circuit and no tasks/activities/tool calls are recorded. |

## Where data lives

Everything is on disk under `~/.slackhive/`:

| Path | Contents |
|---|---|
| `~/.slackhive/data.db` | SQLite database - agents, memories, skills, history, settings |
| `~/.slackhive/agents/<slug>/` | Per-agent workspace (CLAUDE.md, sessions, copies of assigned wiki folders) |
| `~/.slackhive/knowledge/<folderId>/wiki/` | Compiled wiki for one Knowledge Library folder (source of truth; copied to assigned agents) |
| `~/.slackhive/logs/runner.log` | Runner log stream |
| `~/.slackhive/runner.lock` | Singleton runner lock - JSON with `pid`, `startedAt`, `mode` |
| `~/.slackhive/slackhive.pid` | Web server PID file |

Back up `~/.slackhive/` to preserve your full install.

## The `.slackhive-native` marker

The install directory contains a `.slackhive-native` file. It tells the CLI this is a CLI-managed install - `slackhive` commands will target it from any directory.

## Complete .env.example

```bash
# --- Claude Authentication (choose ONE) ---

# Option A: API key
# ANTHROPIC_API_KEY=sk-ant-api03-...

# Option B: Pro/Max subscription
# CLAUDE_BIN=/usr/local/bin/claude

# --- Dashboard ---
ADMIN_USERNAME=admin
ADMIN_PASSWORD=change-me
AUTH_SECRET=generate-with-openssl-rand-hex-32
ENV_SECRET_KEY=generate-with-openssl-rand-hex-32

# --- Platform ---
NODE_ENV=production
DATABASE_TYPE=sqlite

# --- Feature flags ---
# ACTIVITY_DASHBOARD=1
```

## Next steps

<CardGroup cols={2}>
  <Card title="Slack App Setup" icon="slack" href="/configuration/slack-app">
    Create the Slack app for each agent.
  </Card>
  <Card title="MCP Servers" icon="plug" href="/configuration/mcp-servers">
    Use the encrypted env store to pass secrets to MCP tools.
  </Card>
</CardGroup>
