Ālaya
Long-term memory for LLM agents — store what matters, retrieve it months later by meaning, and never trip over your own contradictions.
A single Rust service over Qdrant (vectors) and FalkorDB (knowledge graph). It speaks both plain REST and MCP (Streamable HTTP, protocol 2025-03-26), so the same store answers your agents and your scripts.
Why this exists
Vector search alone gives an agent a fuzzy lookup table. It returns whatever is closest in embedding space — including stale facts, near-duplicates, and statements that flatly contradict each other — with no notion of which memory superseded which, or how the memories relate. Ālaya is built to be the memory layer you can actually trust over months of writes: it retrieves by meaning, notices when two memories disagree, lets you resolve the conflict while keeping an audit trail, and reasons over the relationships between memories instead of treating each one as an island.
- It finds the right memory even when your words don't match — hybrid retrieval fuses semantic vectors with BM25 keyword search over memory content (Reciprocal Rank Fusion), so "why did we switch package managers" finds the note that says "migrated to pnpm," and identifiers — ticket ids, error strings, paths — that embeddings handle poorly still match. (hybrid RRF retrieval)
- It catches when your memories disagree — conflicting facts are flagged automatically on write; you resolve them with one call — supersede the stale one (it stays auditable instead of silently vanishing) or keep both when both are true — and the pair leaves the queue. (contradiction detection — negation, antonym, temporal cues — plus supersede / keep-both)
- Related memories pull each other up — a relationship graph (RELATES_TO / PRECEDES / CONTRADICTS) lets one strong hit surface its neighbors, so retrieving one fact brings back the context around it. (Hebbian spreading-activation)
- What you mark important, and what you revisit, ranks higher — relevance is weighted by how important a memory is and how often it's accessed, not just raw cosine distance. (salience + spaced-repetition boosts)
- It knows where a memory came from and how much to trust it — provenance and a trust score let you filter out low-confidence sources at query time. (provenance / trust scoring)
- It won't drown you in duplicates — near-duplicate detection clusters and merges redundant memories on demand. (cosine-similarity dedup + merge)
- One service, two protocols — the same storage answers MCP tool calls (for agents) and plain REST (for scripts and backfill). (dual protocol over one endpoint)
- Small to run — a single Docker stack with a ~150 MB server binary that degrades gracefully when a backend blips (graph calls are non-fatal). (operational footprint)
Proof
Measured on LongMemEval (longmemeval_s_cleaned, 500 multi-session QA items), using the standard LongMemEval reset-per-question protocol — each question is scored against only its own haystack in an otherwise-empty index.
We report hit-rate@5: the fraction of questions where at least one ground-truth session lands in the top 5 results. This is the any-correct-in-top-k metric (a binary per-question hit, averaged across questions) — we label it hit-rate, not classical recall, because that is what the harness computes (recall_at_k in benchmarks/longmemeval_bench.py: float(any(cid in top_k ...))).
| Configuration | hit-rate@5 | hit-rate@10 |
|---|
| Hybrid (RRF) | 0.916 | 0.964 |
| Hybrid + cross-encoder | 0.986 | 0.988 |
Both rows are the same 500 LongMemEval items against the same live server, identical except for RERANK_URL. The cross-encoder re-scores the top-20 RRF candidates as (query, document) pairs and reorders them. n=500, 95% CI [0.971, 0.993]; paired McNemar p≈5.5e-10 (36 questions fixed, 1 regressed).
Cross-encoder reranking lifts hit-rate@5 from 0.916 to 0.986 on the live server — +7.0 points, paired McNemar p≈5.5e-10 (36 questions fixed, 1 regressed).
Numbers above are from harness benchmarks/longmemeval_bench.py at commit 8b01f85, run on 2026-05-30, against the shipped server build. Reproduce →
Answered end to end, with a reader model answering from what Ālaya retrieves and a judge model scoring it, LongMemEval-S QA accuracy is 0.930 (n=500, 95% CI [0.904, 0.949]; one run, frontier reader claude-sonnet-5-5 over the top 10 sessions, judge claude-opus-5-5; not comparable with published LongMemEval QA numbers). Per-type table →
Quick Start
cp .env.example .env
docker compose up --build -d
First run pulls images and downloads the embedding model (~2 GB total). TEI takes 1-2 minutes to warm up — the server waits for it automatically.