> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/thiagofinch/mega-brain/llms.txt
> Use this file to discover all available pages before exploring further.

# /setup Command

> Interactive wizard for configuring Mega Brain environment, API keys, and dependencies

# /setup - First-Time Configuration

Interactive wizard that guides you through initial Mega Brain setup: dependency verification, API key configuration, and connection validation.

## Syntax

```bash theme={null}
/setup
```

<Note>
  This command auto-triggers on first use if `.env` file is missing.
</Note>

## What It Does

The setup wizard performs 7 sequential steps:

1. **Python verification** - Checks for Python 3.10+
2. **Node.js verification** - Checks for Node.js 18+
3. **Python dependencies** - Installs from `requirements.txt`
4. **API key configuration** - Interactive prompts for each service
5. **Connection validation** - Tests each API endpoint
6. **Generate `.env` file** - Saves configuration
7. **Display onboarding** - Shows JARVIS operational briefing

## Step-by-Step Process

### Step 1: Python Verification

```bash theme={null}
python --version
# or
python3 --version
```

**Expected Output:**

```
✓ Python 3.10.5 found
```

**If Not Found:**

```
✗ Python 3.10+ required
  Install from: https://python.org
```

<Warning>
  Setup will stop if Python 3.10+ is not found. This is a hard requirement.
</Warning>

### Step 2: Node.js Verification

```bash theme={null}
node --version
```

**Expected Output:**

```
✓ Node.js v18.17.0 found
```

**If Not Found:**

```
✗ Node.js 18+ required
  Install from: https://nodejs.org
```

### Step 3: Python Dependencies

Automatically installs required Python packages:

```bash theme={null}
pip install -r requirements.txt
```

**Key Dependencies:**

* `youtube-transcript-api` - For YouTube video transcription
* `voyageai` - For semantic embeddings
* `anthropic` - For Claude API (optional)
* `PyYAML` - For configuration parsing

### Step 4: API Key Configuration

Interactive prompts for each service:

#### Required: OpenAI API Key

```
OPENAI_API_KEY (REQUIRED)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The OpenAI API provides Whisper for automatic
transcription of YouTube videos and audio files.

Essential for /ingest to work with videos.

Get your key at:
https://platform.openai.com/api-keys

Enter your OpenAI API key:
```

<ParamField query="OPENAI_API_KEY" type="string" required>
  OpenAI API key for Whisper transcription. Get it from [platform.openai.com](https://platform.openai.com/api-keys)
</ParamField>

#### Recommended: Voyage AI API Key

```
VOYAGE_API_KEY (RECOMMENDED)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Voyage AI provides advanced semantic search.

Allows Conclave and agents to find evidence
in your ingested materials.

Get your key at:
https://dash.voyageai.com/api-keys

Enter your Voyage AI API key (or press Enter to skip):
```

<ParamField query="VOYAGE_API_KEY" type="string">
  Voyage AI API key for semantic embeddings. Get it from [dash.voyageai.com](https://dash.voyageai.com/api-keys)
</ParamField>

#### Optional: Anthropic API Key

```
ANTHROPIC_API_KEY (OPTIONAL)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NOT needed if you use Claude Code with Max/Pro.

Only required for standalone scripts outside
Claude Code.

Get your key at:
https://console.anthropic.com/settings/keys

Enter your Anthropic API key (or press Enter to skip):
```

<ParamField query="ANTHROPIC_API_KEY" type="string">
  Anthropic API key for Claude access. Only needed for standalone scripts. Get it from [console.anthropic.com](https://console.anthropic.com/settings/keys)
</ParamField>

#### Optional: Google Drive Credentials

```
GOOGLE_CLIENT_ID + GOOGLE_CLIENT_SECRET (OPTIONAL)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
For importing content directly from Google Drive
(PDFs, documents, spreadsheets).

Configure at:
https://console.cloud.google.com/apis/credentials

Enter your Google Client ID (or press Enter to skip):
```

<ParamField query="GOOGLE_CLIENT_ID" type="string">
  Google OAuth client ID for Drive import
</ParamField>

<ParamField query="GOOGLE_CLIENT_SECRET" type="string">
  Google OAuth client secret for Drive import
</ParamField>

### Step 5: Connection Validation

Tests each configured API:

```
═══════════════════════════════════════════════════════════════
 🔌 CONNECTION VALIDATION
═══════════════════════════════════════════════════════════════

  OpenAI (Whisper):  ✓ Connected (gpt-3.5-turbo available)
  Voyage AI (RAG):   ✓ Connected (voyage-2 model ready)
  Anthropic API:     ⏭️  Skipped
  Google Drive:      ⏭️  Skipped

═══════════════════════════════════════════════════════════════
```

**Validation Tests:**

* **OpenAI**: Lists available models via `/v1/models`
* **Voyage AI**: Tests embedding generation
* **Anthropic**: Simple message test
* **Google Drive**: OAuth token verification

### Step 6: Generate .env File

Creates `.env` in project root:

```bash theme={null}
# Mega Brain Configuration
# Generated: 2026-03-06T10:30:00Z

# OpenAI API (REQUIRED)
OPENAI_API_KEY=sk-...

# Voyage AI API (RECOMMENDED)
VOYAGE_API_KEY=pa-...

# Anthropic API (OPTIONAL)
# ANTHROPIC_API_KEY=

# Google Drive (OPTIONAL)
# GOOGLE_CLIENT_ID=
# GOOGLE_CLIENT_SECRET=
```

<Warning>
  If `.env` already exists, setup will ask before overwriting:

  ```
  ⚠️  .env file already exists
  Overwrite existing configuration? [y/N]
  ```
</Warning>

### Step 7: Onboarding Dashboard

Displays JARVIS operational briefing:

```
╔═══════════════════════════════════════════════════════════════════════════════╗
║                                                                               ║
║     ██╗ █████╗ ██████╗ ██╗   ██╗██╗███████╗                                  ║
║     ██║██╔══██╗██╔══██╗██║   ██║██║██╔════╝                                  ║
║     ██║███████║██████╔╝██║   ██║██║███████╗                                  ║
║██   ██║██╔══██║██╔══██╗╚██╗ ██╔╝██║╚════██║                                  ║
║╚█████╔╝██║  ██║██║  ██║ ╚████╔╝ ██║███████║                                  ║
║ ╚════╝ ╚═╝  ╚═╝╚═╝  ╚═╝  ╚═══╝  ╚═╝╚══════╝                                  ║
║                                                                               ║
║                   AI KNOWLEDGE MANAGEMENT SYSTEM                              ║
║                          v1.3.0 - INITIALIZED                                 ║
║                                                                               ║
╚═══════════════════════════════════════════════════════════════════════════════╝

┌─ SYSTEM STATUS ───────────────────────────────────────────────────────────────┐
│                                                                               │
│  Processing Pipeline:    ░░░░░░░░░░░░░░░░  0%                                │
│  Knowledge Base:         ░░░░░░░░░░░░░░░░  0% (0 sources)                    │
│  Mind Clone Agents:      ░░░░░░░░░░░░░░░░  0% (0 active)                     │
│  RAG Index:              ░░░░░░░░░░░░░░░░  Not indexed                        │
│                                                                               │
└───────────────────────────────────────────────────────────────────────────────┘

┌─ NEXT STEPS ──────────────────────────────────────────────────────────────────┐
│                                                                               │
│  1. Ingest your first material:                                              │
│     /ingest https://youtube.com/watch?v=VIDEO_ID                              │
│                                                                               │
│  2. Process through the pipeline:                                            │
│     /process-jarvis "inbox/PERSON/TYPE/filename.txt"                          │
│                                                                               │
│  3. Check system status anytime:                                             │
│     /jarvis-briefing                                                          │
│                                                                               │
└───────────────────────────────────────────────────────────────────────────────┘

"All systems operational, sir. Ready to begin knowledge ingestion."
```

## Error Handling

### Required Steps Fail

If Python or Node.js verification fails, setup stops immediately:

```
✗ SETUP FAILED

Python 3.10+ is required but not found.

Please install Python from https://python.org
Then run /setup again.
```

### Optional Steps Fail

If optional API keys fail validation, setup continues:

```
⚠️  Voyage AI connection failed: Invalid API key

You can continue without Voyage AI, but semantic
search will not be available.

Reconfigure later by running /setup again.

Continue? [Y/n]
```

### Partial Configuration

If user cancels mid-setup, partial progress is saved:

```
⚠️  Setup cancelled by user

Partial configuration saved to .env:
  ✓ OPENAI_API_KEY
  ✗ VOYAGE_API_KEY (not configured)

Run /setup again to complete configuration.
```

## Reconfiguration

To update your configuration:

```bash theme={null}
# Run setup again (will detect existing .env)
/setup

# Choose to overwrite or keep existing values
```

## Configuration File Location

```
mega-brain/
├── .env                    # Your configuration (gitignored)
├── .env.example            # Template with descriptions
└── bin/templates/
    └── env.example         # Used by setup wizard
```

## Validation Commands

After setup, verify configuration:

<CodeGroup>
  ```bash Check OpenAI theme={null}
  # Should list available models
  curl https://api.openai.com/v1/models \
    -H "Authorization: Bearer $OPENAI_API_KEY"
  ```

  ```bash Check Voyage AI theme={null}
  # Should return embedding dimensions
  curl https://api.voyageai.com/v1/embeddings \
    -H "Authorization: Bearer $VOYAGE_API_KEY" \
    -d '{"input": "test", "model": "voyage-2"}'
  ```

  ```bash Check System Status theme={null}
  # Inside Claude Code
  /jarvis-briefing
  ```
</CodeGroup>

## Troubleshooting

### Python Not Found

**Issue:** `python: command not found`

**Solution:**

```bash theme={null}
# On macOS/Linux
brew install python3

# On Windows
winget install Python.Python.3.11
```

### pip Install Fails

**Issue:** `Permission denied` during `pip install`

**Solution:**

```bash theme={null}
# Use --user flag
pip install --user -r requirements.txt
```

### API Key Invalid

**Issue:** `Invalid API key` during validation

**Solution:**

1. Check for extra spaces in key
2. Verify key is active in provider dashboard
3. Ensure key has correct permissions
4. Re-run `/setup` to enter correct key

### .env Permission Issues

**Issue:** `Cannot write .env file`

**Solution:**

```bash theme={null}
# Check file permissions
ls -la .env

# Fix permissions
chmod 600 .env
```

## Security Notes

<Warning>
  **NEVER commit `.env` to version control**

  The `.env` file contains sensitive API keys and is automatically gitignored.
</Warning>

### Best Practices

1. **Use environment-specific keys** - Different keys for dev/prod
2. **Rotate keys regularly** - Update keys every 90 days
3. **Limit key permissions** - Only grant necessary scopes
4. **Monitor usage** - Check API dashboards for unusual activity

## Next Steps

<CardGroup cols={2}>
  <Card title="Ingest Command" icon="download" href="/commands/ingest">
    Add your first material to the system
  </Card>

  <Card title="JARVIS Briefing" icon="clipboard-check" href="/commands/jarvis-briefing">
    Check your system status
  </Card>

  <Card title="Architecture" icon="sitemap" href="/concepts/architecture">
    Understand how Mega Brain works
  </Card>

  <Card title="API Keys Guide" icon="key" href="/configuration">
    Detailed API key configuration
  </Card>
</CardGroup>
