CortexDB · docs

Getting Started with CortexDB

CortexDB is a long-term memory layer for AI agents and applications. This guide gets you from zero to a running instance with stored, retrievable memories in under five minutes.

Run it (Docker — recommended)

docker run -d \
  --name cortexdb \
  -p 3141:3141 \
  -v cortexdb-data:/data \
  -e OPENAI_API_KEY=$OPENAI_API_KEY \
  -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
  cortexdb/cortexdb:latest

The server starts immediately. To call the API endpoints, also pass -e CORTEX_API_KEY=<your-chosen-key> — until you set one, the data API returns 401 (the web UI, bundled docs, and /v1/admin/health work without a key).

That's it. The server is listening on :3141, serving the v1 API and the built-in admin UI. Probe with:

curl http://localhost:3141/v1/admin/health
# {"status":"healthy","version":"..."}

First memories

# Capture an experience
curl -X POST http://localhost:3141/v1/experience \
  -H 'Content-Type: application/json' \
  -d '{
    "scope": "ws:demo",
    "modality": "observation",
    "content": { "kind": "text", "text": "Priya at Acme Corp signed for 200 seats. Q3 close." },
    "context": { "observed_at": "'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'" },
    "idempotency_key": "'"$(uuidgen)"'"
  }'

# Recall
curl -X POST http://localhost:3141/v1/recall \
  -H 'Content-Type: application/json' \
  -d '{
    "scope": "ws:demo",
    "query": "How many seats did Acme sign for?",
    "budgets": { "tokens_total": 1500 }
  }'

You should see the stored memory come back as part of the recall pack.

What you'll likely want next

Required environment

VariableRequired forWhat it does
OPENAI_API_KEYEmbeddings + fact extractionCalls text-embedding-3-small for vectors and gpt-4o-mini for entity/fact extraction during ingestion.
ANTHROPIC_API_KEY/v1/answerRenders the final answer (Claude is the recommended answer model).
COHERE_API_KEYOptional rerankerIf set, switches the recall reranker to Cohere rerank-v3.5.

Without OpenAI, writes still succeed but no embeddings or extracted facts are produced — recall will be markedly weaker. Without Anthropic, /v1/answer returns 503; everything else works.

See docs/PRODUCTION_DEPLOYMENT.md for the full env-var reference.

Default config (matches our published benchmarks)

The Docker image bakes in the same recall/answer configuration that scored 93.8% on LongMemEval-S and 85.5% on LoCoMo (cats 1-4). Specifically:

Override anything at runtime with -e VAR=value or --env-file your.env. The bench-reproducer doc (docs/REPRODUCE_LONGMEMEVAL_93_8.md in the repo) lists every load-bearing flag with a one-line explanation.

If you're running cortexdb continuously (not just for a benchmark), no extra config is needed. If you're reproducing the benchmark exactly, also set CORTEX_SCHEDULER_DISABLE=1 (skips background compaction during the run).

Run it (binary — for the Docker-haters)

Download the right tarball for your platform from https://github.com/cortexdb/cortexdb-releases/releases/latest and:

tar -xzf cortexdb-1.0.0-linux-amd64.tar.gz
cd cortexdb-1.0.0-linux-amd64
export OPENAI_API_KEY=...
export ANTHROPIC_API_KEY=...
./cortexdb 3141 ./data

The binary expects assets/wordnet_synonyms.json to live alongside it (included in the tarball).

Where data lives

Inside the container: /data (a Docker volume). Outside (binary install): the directory you pass as the second argument.

The directory contains:

Back this directory up with the server stopped (or use RocksDB's checkpoint APIs if you need hot backups).

Get help