Skip to content

Configuration

Complete reference for environment variables, runtime settings, and configuration files.

Environment Variables

Core

Variable Default Description
COGNIBRAIN_RUNTIME_ROOT .cognibrain/ Root directory for runtime state
COGNIBRAIN_PORT 8787 HTTP API port
COGNIBRAIN_HOST 127.0.0.1 HTTP API bind address

Authentication

Variable Description
MEMORY_API_KEY API key for daemon authentication
COGNIBRAIN_API_KEY Alternative API key variable
COGNIBRAIN_API_TOKEN Alternative token variable
MEMORY_BEARER_TOKEN Bearer token for JWT/OIDC auth
MEMORY_OIDC_ISSUER JWT/OIDC issuer URL
MEMORY_OIDC_AUDIENCE JWT/OIDC audience

Storage

Variable Description
MEMORY_DB_URL Database connection string
MEMORY_POSTGRES_URL PostgreSQL connection string

Policy

Variable Default Description
MEMORY_POLICY_MODE development production for default-deny policy

Connectors

Variable Description
MEMORY_SLACK_TOKEN Slack bot token
MEMORY_GITHUB_TOKEN GitHub personal access token
MEMORY_VENDOR_LIVE_SMOKE Enable live connector smoke tests
MEMORY_VENDOR_LIVE_WRITE Enable write operations in live smoke

Runtime State

Runtime data is stored under the runtime root (default: .cognibrain/):

.cognibrain/
├── config.json          # Runtime configuration
├── memories.json        # Local memory store (local-json mode)
├── connectors/          # Connector state
├── service/             # Service management state
└── logs/                # Local logs

Profiles

Profiles pre-configure a set of defaults for common deployment shapes:

solo-dev (default)

storage: local-json
auth: local-only
harnesses: [codex, cursor]
connectors: [github]
adapters: [storage-sqlite]
dashboard: off

team

storage: sqlite
auth: api-key
harnesses: [codex, cursor, vscode, neovim]
connectors: [github, slack, jira]
adapters: [storage-postgres, intelligence]
dashboard: off

enterprise

storage: postgres
auth: oidc
harnesses: all
connectors: [github, slack, jira, confluence, pagerduty]
adapters: [storage-postgres, intelligence, audit]
dashboard: optional

benchmark

storage: local-json
auth: local-only
harnesses: all
connectors: [github]
adapters: [benchmark]
dashboard: off

Harness Configuration Files

Generated by cognibrain init and cognibrain config:

Codex

File Purpose
$CODEX_HOME/config.toml Codex MCP and tool configuration
AGENTS.md Agent instructions file

Cursor

File Purpose
.cursor/mcp.json MCP server configuration
.cursor/rules/open-memory.mdc Cursor rules for memory integration

Package Harness

File Purpose
.cognibrain-harness-package.json Package-level harness metadata

Configuration Precedence

Configuration is resolved in this order (highest wins):

  1. CLI flags (--port, --api-key, etc.)
  2. Environment variables
  3. .cognibrain/config.json
  4. Profile defaults
  5. Built-in defaults

Custom Configuration

Override settings in .cognibrain/config.json:

{
  "port": 9000,
  "storage": "sqlite",
  "auth": {
    "method": "api-key",
    "keys": ["env:MEMORY_API_KEY"]
  },
  "dreamCycle": {
    "autoRun": true,
    "frequencySessions": 10,
    "stalenessThresholdDays": 30
  },
  "contextDefaults": {
    "tokenBudget": 1200,
    "maxMemories": 20
  }
}

Security Configuration

For production deployments:

# Required
export MEMORY_API_KEY="your-secure-key"
export MEMORY_POLICY_MODE="production"

# Recommended for team/enterprise
export MEMORY_OIDC_ISSUER="https://auth.example.com"
export MEMORY_OIDC_AUDIENCE="cognibrain"
export MEMORY_POSTGRES_URL="postgresql://user:pass@host:5432/cognibrain"

Secrets

Never commit secrets to source control. Use environment variables, a secret manager, or the runtime-local connector config file.