Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration

Brain Server is configured entirely through environment variables, all resolved in src/config.rs. There is no config file to edit. This page is the complete reference, grouped by concern.

Core server

VariableDefaultDescription
BIND_HOST127.0.0.1Bind address. 0.0.0.0 refused unless BIND_PUBLIC=1.
BIND_PORT8765Listen port
BRAIN_DB_PATH~/.openclaw/workspace/brain.dbSQLite database path
BRAIN_DATA_ROOTv1.0 relocation knob — root for all on-disk paths
BRAIN_WORKER_THREADS# coresTokio runtime worker threads (set 2 on Jetson)
CORS_ORIGINShttp://localhost:3000,http://localhost:8080CORS allowlist
BRAIN_CLIENT_DIRclient/distDirectory served at /app (the web GUI)
BRAIN_CHAIN_CHECK_SECS60How often the background audit-chain integrity check runs
BRAIN_MULTI_DBEnables per-domain SQLite files (multi-DB mode)
BRAIN_CONTROLLER_NAMEOperator/controller identity label
MODEL_PROFILEModel profile selector (affects embedding defaults)
DOMAIN_MIN_COUNTMinimum chunk count for a domain to be listed/used

Authentication

VariableDefaultDescription
AUTH_TOKEN / AUTH_TOKEN_FILEOpaque bearer token(s). Newline-separated = live rotation. Off if unset.
BRAIN_JWT_ISSUEREnables JWT mode when set + keys loaded. URL of the issuer (verified against the iss claim).
BRAIN_JWT_KEY_DIR~/.config/brain-server/keys/Directory holding JWT signing key PEMs (mode 0700; private keys 0600).
BRAIN_JWT_AUDIENCEbrain-serverExpected aud claim value.
BRAIN_PUBLIC_BASE_URLPublic base URL for OIDC discovery. Never inferred from Host.
BRAIN_UMP_KEY_DIR~/.config/brain-server/ump/Directory holding the UMP operator Ed25519 signing key (distinct from the JWT key dir).
BRAIN_TRUST_PROXYoffWhen set, trust X-Forwarded-For from the named proxy for real-IP + rate-limit accounting. Off by default so a spoofed header can’t bypass rate limits.

Retrieval & expansion

VariableDefaultDescription
PRF_ENABLEDtruePRF query expansion on/off
PRF_DEPTH10PRF expansion depth
PRF_TERMS5Number of expansion terms
PRF_MAX_RANK5Max rank for expansion candidates
BRAIN_RECALL_ROUTING_ENABLEDtrueAutomatic retrieval routing (v1.13.1). false restores legacy shim behavior.
BRAIN_GRAPH_RESCUE_ENABLEDtrueComplexity-gated graph rescue pass on abstention (v1.12)

Write-back gating (v1.14)

PII control is deterministic read-time output redaction (always-on for principals without pii:read/Admin); there is no write-time placeholder vault and no BRAIN_REDACT_PII knob (removed v1.20.19).

VariableDefaultDescription
INJECTION_POLICYquarantinequarantine | reject | allow — how prompt-injection-suspicious input is handled.
BRAIN_INGEST_SKIP_PATTERNS— (off)Newline- or comma-separated prefixes; text beginning with any is skipped at ingest (e.g. `!redacted,```). Opt-in; default behavior unchanged.
BRAIN_INJECTION_CLASSIFIERInjection classifier selector
BRAIN_INJECTION_TOKENIZERTokenizer used by the injection classifier
BRAIN_INJECTION_THRESHOLD_HIGHClassifier banding: score ≥ this → reject
BRAIN_INJECTION_THRESHOLD_LOWClassifier banding: score ≥ this (below high) → quarantine
BRAIN_PROPOSAL_TTL_SECS604800 (7 d)How long a proposal can sit pending before auto-expire (audited).
BRAIN_DSAR_WINDOW_DAYS30GDPR Art 17 response window shown on DSARs
BRAIN_DSAR_LEDGER_DAYS30Retention window for the DSAR ledger
BRAIN_RETENTION_ENABLEDEnable per-kind query-time retention expiry
BRAIN_RETENTION_KIND_DAYSPer-kind retention overrides (kind=days,kind=days)
BRAIN_ALERT_WEBHOOK_URL / BRAIN_ALERT_WEBHOOK_SECRETOutbound alert webhook sink (uses the hardened egress client)

Observability & audit (v1.15)

VariableDefaultDescription
BRAIN_AUDIT_READ_EVENTSon (JWT) / off (loopback)When on, /recall, /search, /get/{id}, /multi-get emit hash-chained audit rows (no content, no raw query).
BRAIN_AUDIT_READ_SAMPLE_RATE1.0Read-event sampling (0.0..=1.0); 1.0 = every read event.
BRAIN_AUDIT_RETENTION_DAYSunset = foreverAudit retention window; when set, expired rows are pruned and the chain re-anchored. Deployers subject to AI Act Art 26(6) guidance: set ≥180.
BRAIN_DSAR_WEBHOOK_URL / BRAIN_DSAR_WEBHOOK_SECRETOpt-in Art 19 onward-notification: on a completed DSAR purge, POSTs {subject, certified_at, certificate_id} HMAC-SHA256-signed. Fail-soft.
BRAIN_OTEL_ENABLED / BRAIN_OTEL_ENDPOINToffOptional OpenTelemetry export (endpoint + on/off)
CORS_METHODSGET,POST,PUT,DELETE,OPTIONSAllowed CORS methods
CORS_HEADERScontent-type,authorizationAllowed CORS request headers

Features & kill switches

VariableDefaultDescription
BRAIN_SUGGEST_ENABLEDtruev1.9 kill switch: when false, the /suggest/* routes return 501.

Capacity envelope (v0.9.9)

VariableDefaultDescription
CAPACITY_MAX_DOCS / CAPACITY_MAX_DB_MIB / CAPACITY_MAX_RSS_MIBcapacity profileTighten the /health capacity envelope. Writes over the envelope return HTTP 507; reads are never blocked.

The single source of truth for every tunable is src/config.rs in the repository.

Next steps