Cortex · data-mesh memory engine for LLMs
One memory engine.
Any domain.
Cortex gives an LLM a memory that understands meaning, time, cause, and structure - not just similarity. Seven retrieval strategies run in parallel and fuse into a single ranked, fully traceable context bundle. Every result explains why it was retrieved.
Same engine, same topology - only the vocabulary changes with the domain.
What it remembers
Four kinds of memory, one engine.
A cosine-similarity lookup covers the first kind and forgets the rest. Cortex covers all four - plus user preference - and fuses them by the query's intent.
Meaning
Semantic & hybrid
Dense vectors plus BM25 find what a query is about, even when it's phrased in words the documents never use.
Time
Temporal & episodic
Recency is weighed, and events are grouped into ordered episodes - so the engine can recall a story in the order it happened.
Cause
Causal
Declared and inferred CAUSED_BY / FIXED_BY edges answer “what caused this?” and “how was it fixed?” directly.
Structure
Graph
Typed relationships - SUPPORTS, CONTRADICTS, DEPENDS_ON - are walked one to two hops for context that vectors miss.
How a query runs
Six steps, every one of them visible.
- 01
Query
A question arrives via the API - from the showcase, an assistant, or your own application, authenticated with an API key and scoped to one project space.
POST /api/retrieval - 02
Intent
A lightweight classifier produces an intent distribution that re-scales the fusion weights. It never gates a strategy - causal queries lean causal, recall queries lean episodic.
re-scales, never gates - 03
Retrieve ×7
Vector, hybrid, temporal, episodic, causal, graph, and preference strategies run in parallel. Every hit carries a why trace: strategy, score, graph path, recency.
asyncio.gather · timeout - 04
Fuse
Weighted reciprocal-rank fusion merges the seven lists, deduplicates by id, and normalizes scores using the intent-scaled weights.
weighted RRF - 05
Rerank
Optionally, a reranker re-scores the fused pool - a cross-encoder or an LLM judging each query–candidate pair - and reorders hits by true relevance. Best-effort: if it fails or times out, the fusion order stands.
optional · post-fusion - 06
Trace
The full run - per-strategy hits, intent, fused ranking - is persisted as a RetrievalTrace, and the bundle returns with a trace_id: a permalink to its own reasoning. When context feeds an LLM, a composer additionally bins hits into a token budget with MMR diversity.
trace_id returned
7 strategies · 5 memory layers · 4 stores · every hit traced
Integrate
One brain, many apps.
Cortex runs as a standalone memory server. The web UI is one client; your other apps are more clients of the same API, each in its own isolated project space.
- ProjectsIsolated project spaces
- One account owns many projects. Each has its own documents, memories, episodes, traces, FAISS indexes, and graph nodes - pick one per request with an X-Project-Id header.
- KeysAPI keys, scoped
- Programmatic access with an X-API-Key header. Account keys manage everything; project-bound keys are confined to one project - the kind you hand to an external app. Only a hash is stored.
- SearchCross-project retrieval
- Ask across several projects - or all of them - in one call. Each space is fused on its own, then interleaved by score, and every hit records which project it came from.
- DeploySelf-hosted
- Docker Compose brings up the API, workers, and all four stores, with optional automatic TLS. Signup can be closed and accounts created from the command line.
curl -X POST https://api.example.com/api/retrieval -H "X-API-Key: $CORTEX_KEY" -H "Content-Type: application/json" -d '{"query": "how did we fix the last checkout outage",
"budget": 20}'
# → ranked hits, each with a why trace,
# plus the intent analysis and a trace_idInteractive OpenAPI docs ship at /docs. No LLM is called on this path.
Architecture
Four stores, one responsibility each.
No blurred boundaries. FAISS is the only ANN path, and per-project isolation is structural - not a filter bolted on.
Per-project, per-namespace ANN indexes over documents, memories, episodes, and events. Snapshotted to local/S3, lazily loaded, hot-reloaded across processes.
All structured data: accounts, projects, API keys, documents, chunks, memories, events, episodes, entities, and retrieval traces. Never queried for vector search.
Documents, chunks, entities, episodes, and events linked by typed edges - SUPPORTS, CONTRADICTS, MENTIONS, DEPENDS_ON, CAUSED_BY, FIXED_BY.
Session memory, embedding cache, and the pub/sub channel that hot-reloads FAISS indexes across processes.
FastAPI · Celery · SQLAlchemy · FAISS · Neo4j 5 · Postgres 16 · Redis · Next.js · OpenTelemetry
LLM-agnostic behind one adapter interface: OpenAI, Anthropic, Google Gemini, local Ollama - with a keyless local option for embeddings.
Why not plain RAG?
Beyond similarity search.
FAQ
Common questions.
Is this a vector database?
No - FAISS handles ANN search, but the engine layers a graph, episodic and causal memory, and intent-aware fusion on top. Vector search is one of seven strategies.
Does it send my context to an LLM automatically?
No. Retrieved context is displayed for inspection. The LLM is only called when you explicitly ask for a summary, or in the separate Assistant view.
Can I see why a result was retrieved?
Yes - every hit carries a why trace (strategy, score, graph path, recency, weights), and the full pipeline is visualized as an interactive DAG.
Which LLM providers are supported?
OpenAI, Anthropic, Google Gemini, and local models via Ollama. Embeddings are configurable independently, including a keyless local option.
Is data isolated per user?
Yes - and per project. FAISS indexes and the knowledge graph are scoped to each project space structurally, not by filter. A resource in another space behaves as if it doesn't exist.
Can I use it from my own application?
Yes. Every endpoint accepts an X-API-Key header, and a project-bound key confines an app to its own project. Documents, memories, episodes, retrieval, and grounded chat are all available over the same API the web UI uses.
Can I host it myself?
Yes. It's built to be self-hosted with Docker Compose: API, Celery workers, FAISS snapshots on local disk or S3, Postgres, Neo4j, and Redis, with optional automatic TLS in front.
Retrieval you can reason about.
Give every app you build one memory that remembers in graphs, episodes, and cause-and-effect - and shows you every step.