CortexDB · docs

CortexDB Production Configuration

Server: CortexProd (ssh CortexProd) Binary: /root/cortex/target/release/cortexdb Service: systemctl restart cortexdb.service Service file: /etc/systemd/system/cortexdb.service Env file: /root/cortex/.env Runtime overrides: /etc/systemd/system/cortexdb.service.d/cohere.conf Data dir: /root/cortex/cortexdb_data/ Log file: /var/log/cortexdb.log Mode: Single-node (no CLI args) Listen: 0.0.0.0:3142 (behind nginx on :443 → api.cortexdb.ai / api-v1.cortexdb.ai; port 3141 is intentionally free — an orphan process squatted it until 2026-07-09) Also on this box: cortexdb-limechat.service (enterprise pilot, second checkout at /root/cortex-enterprise, binds 3143, env /root/limechat/.env, enrichment pinned in the unit file)


Production Checklist — what a deployment must set

Five decisions. Everything not listed here has a benchmarked default — leave it alone unless you have a measured reason.

VariableSettingWhy
OPENAI_API_KEY (or CORTEX_EMBEDDING_* / CORTEX_LLM_* for another provider)requiredPowers embeddings + extraction. Without it recall silently degrades to keyword-only (mock embeddings).
CORTEX_ANSWER_API_KEYrequired if /v1/answer is usedAnthropic key; the endpoint 503s without it.
CORTEX_ENRICHMENT_DELAY_SECONDSmust be a conscious choiceUnset = enrichment OFF: no facts/beliefs, and background concept reflection is gated off too (see CORTEX_V1_LAYERS_AUTO below) — zero background LLM spend. Episodes still build (deterministic, from raw events). N >= 0 = WAL-cursor scanner every N seconds (0 clamps to the 5 s floor ≈ near-realtime; 86400 daily). Restart-safe in every mode. Legacy CORTEX_ENRICHMENT_DELAY_MINUTES still honored x60.
CORTEX_V1_LAYERS_AUTOleave unset unless you know whyThe synthesis scheduler (episodes/beliefs/concept reflection — the last is an LLM call). Unset → runs, but concept reflection follows the enrichment switch above (enrichment off ⇒ no reflection LLM calls). 1 forces concept reflection even with enrichment off (reflects over raw events — conscious spend). 0 disables the scheduler entirely. /v1/admin/layers/stats → health.concepts_gated_by shows the live verdict.
CORTEX_EVICT_VECTORS_ON_ENRICH1 — always set itDemotes chunk vectors to cold storage once enrichment commits: flat memory at any corpus size, recall verified at parity. No-op while enrichment is off, so it is always safe to set — leaving it unset just means RAM grows linearly with corpus size once enrichment is enabled.
CORTEX_API_KEYrequired when the port is reachable beyond localhostBearer auth for the data API.
CORTEX_DEPLOYMENT_PRESETon_prem_enterprise / cloud_shared_saas / cloud_privateValid names only — an unknown preset prevents the v1 surface from starting. Default dev_local allows unsigned actors — never leave it default in production.

Set only if it applies: CORTEX_RERANKER_{PROVIDER,MODEL} (recall quality; recommended when budget allows), CORTEX_ENRICHMENT_{MODEL,URL,API_KEY} (cheaper/different enrichment model), CORTEX_BLOB_* (S3/GCS/Azure instead of local disk), CORTEX_TELEMETRY=0 (policy opt-out), CORTEX_ANSWER_DEFAULT_INSTRUCTIONS (v0.8.6: deployment-wide answer-style policy, e.g. "always include entity identifiers"), CORTEX_RECENCY_TAIL_EVENTS (v0.8.6: default evidence size for order: "recency" timeline-tail recall, default 100; the mode and its question-shape inference ship on — kill-switches CORTEX_RECENCY_ORDER=0, CORTEX_RECENCY_INFERENCE=0).

Effective Runtime Configuration

Secrets (stored in /root/cortex/.env, redacted here)

OPENAI_API_KEY=<redacted>
COHERE_API_KEY=<redacted>
CORTEX_API_KEY=<redacted>
CORTEX_SUPERKEY=<redacted>
TURSO_DATABASE_URL=<redacted>
TURSO_AUTH_TOKEN=<redacted>

Embedding Service

CORTEX_EMBEDDING_PROVIDER=cohere
CORTEX_EMBEDDING_MODEL=embed-english-v3.0
CORTEX_EMBEDDING_DIMS=1024

LLM (entity extraction, query classification)

CORTEX_LLM_URL=https://api.openai.com/v1
CORTEX_LLM_MODEL=gpt-4o-mini

Enrichment (fact augmentation)

CORTEX_ENRICHMENT_CONCURRENCY=16   # default 16; each job = 1-2 LLM calls. Lower only on rate-limited keys.
CORTEX_ENRICHMENT_MODEL=gpt-4o
CORTEX_ENRICHMENT_URL=https://api.openai.com/v1

Reranker (cross-encoder confidence scoring)

CORTEX_RERANKER_PROVIDER=cohere
CORTEX_RERANKER_MODEL=rerank-v3.5
CORTEX_RERANKER_MODEL_PATH=

Authentication

CORTEX_API_KEY=<redacted>
CORTEX_SUPERKEY=<redacted>

Turso (customer API key database)

TURSO_DATABASE_URL=<redacted>
TURSO_AUTH_TOKEN=<redacted>

v1 Token Minter (PASETO)

The v1 API surface (/v1/*) authenticates with PASETO v4 public tokens. POST /v1/auth/tokens mints them; the dashboard (app.cortexdb.ai) and SDK examples are the main consumers.

CORTEX_V1_API_ADDR=0.0.0.0:3142
CORTEX_V1_AUDIENCE=cortexdb:tenant:<your-tenant>
CORTEX_V1_MINTER_ENABLE=1
CORTEX_V1_MINTER_KEY_DIR=/root/cortex/minter_keys
CORTEX_V1_MINTER_ISSUER=https://api-v1.cortexdb.ai/issuer

Generate a production keypair:

./build.sh cargo build --release -p cortex-auth --bin gen_minter_keys
./target/release/gen_minter_keys /root/cortex/minter_keys
chmod 600 /root/cortex/minter_keys/secret.key

The generator refuses to overwrite existing files — if you need to rotate, move the old pair aside first and revoke outstanding jtis via POST /v1/auth/revoke.

Capability gate. The mint endpoint requires auth.mint. Pass an optional scope in the request body to make the check scope-aware (caller must hold auth.mint on that scope). Omit scope for a deployment-wide check — used by operators minting service tokens.

Benchmark note

The best LoCoMo runs also depend on benchmark-harness choices such as --mode session, superkey usage, answer-prompt selection, and judge configuration. Those are not production server env settings and are documented separately from the runtime config above.


Implicit Defaults (no CLI args = single-node mode)

SettingValueSource
ModeSingle-nodeNo --node-id / --rpc-addr / --gossip-addr
Port3141Default in parse_config()
Listen address0.0.0.0:3141Hardcoded
Data directorycortexdb_dataDefault in parse_config()
Node ID1Default
Replication factor3Default (unused in single-node)
Log formatTextNo CORTEX_LOG_FORMAT=json
Log levelinfoDefault RUST_LOG filter

CLI Args (cluster mode — not used in prod today)

cortexdb --node-id=1 \
         --rpc-addr=0.0.0.0:3142 \
         --gossip-addr=0.0.0.0:3143 \
         --seed-nodes=10.0.0.2:3143,10.0.0.3:3143 \
         --rf=3 \
         --port=3141 \
         --data-dir=cortexdb_data_1

Data Directory (cortexdb_data/)

PathPurpose
wal/Write-ahead log (RocksDB) — source of truth
content/Content store (RocksDB)
fulltext/Tantivy fulltext index
vector/HNSW vector index
graph/Knowledge graph (RocksDB)
temporal/Temporal index (RocksDB)
resolver/Entity resolution store
api_metrics.jsonPersisted API request metrics
tenant_usage.jsonPersisted per-tenant usage counters

Systemd Service

[Unit]
Description=CortexDB Server
After=network.target

[Service]
Type=simple
WorkingDirectory=/root/cortex
EnvironmentFile=/root/cortex/.env
ExecStart=/root/cortex/target/release/cortexdb
Restart=always
RestartSec=3
StandardOutput=append:/var/log/cortexdb.log
StandardError=append:/var/log/cortexdb.log

[Install]
WantedBy=multi-user.target

Telemetry

The community binary sends an anonymous usage beacon (on by default) so we can see how the free distribution is adopted. It carries aggregate counts and pseudonymous IDs only — never request/response bodies, query text, stored memory content, end-user IPs, or scope strings.

Full data dictionary, wire schema, and the cloud ingest contract are in TELEMETRY.md.

Useful Commands

# Restart server
systemctl restart cortexdb.service

# Check status
systemctl status cortexdb.service

# Tail logs
tail -f /var/log/cortexdb.log

# Rebuild and deploy
cd /root/cortex && git pull origin main && source ~/.cargo/env && cargo build --release -p cortexdb && systemctl restart cortexdb.service

# Health check
curl https://api-v1.cortexdb.ai/v1/admin/health

# Test with superkey
curl -H "<TOKEN redacted>" https://api-v1.cortexdb.ai/v1/admin/usage

PyPI (cortexdb-mcp)

Package: cortexdb-mcp Account: cortexdbai 

# Publish new version
cd mcp-server
# bump version in pyproject.toml
python3 -m build
TWINE_USERNAME=__token__ "<PYPI_TOKEN redacted>" python3 -m twine upload dist/*