The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Citadel listing page.
Historical memory results and configurations
For semantic memory through MCP, install uv and pull the local embedder and optional cross-encoder reranker:
Set CITADEL_KEY to your vault passphrase (export CITADEL_KEY="your-passphrase"
on macOS/Linux or $env:CITADEL_KEY = "your-passphrase" in PowerShell), then start:
The server communicates over stdio. See MCP for client configuration. Model downloads do not need a vault key; serving does.
Install the published package with pip install citadeldb. See the
Python source-build and semantic-memory guide.
Embedders implement embed_with_cancel(texts, cancel_token) and check cancellation
between bounded batches. Local Candle models require the candle-embed build feature.
Uses citadeldb and citadeldb-mem with the candle-embed feature. This example
loads e5-large and a local cross-encoder reranker. Other presets or a custom
Embedder are supported.
Uses the citadeldb and citadeldb-sql crates - or try SQL with no install in the live playground.
A native desktop client for Windows, macOS, and Linux. Open encrypted vaults, browse tables and memory, run SQL with EXPLAIN and ANALYZE, and inspect vectors and integrity results.
See the Studio guide for screenshots and build instructions. Download Citadel Studio for Windows, macOS, or Linux.
The adapters implement framework-specific storage, session, and retrieval interfaces. Each requires an explicit embedder. See the package README for setup, search behavior, and supported filters.
| Framework | Package | Implements |
|---|---|---|
| LangGraph | citadeldb-langgraph | BaseStore |
| CrewAI | citadeldb-crewai | StorageBackend |
| OpenAI Agents SDK | citadeldb-openai-agents | Session |
| Google ADK | citadeldb-google-adk | BaseMemoryService |
| LlamaIndex | citadeldb-llamaindex | BasePydanticVectorStore |
| LangChain | citadeldb-langchain | VectorStore, BaseChatMessageHistory |
| Haystack | citadeldb-haystack | DocumentStore |
| Microsoft Agent Framework | citadeldb-ms-agent-framework | HistoryProvider, ContextProvider |
| Strands Agents | citadeldb-strands-agents | SessionRepository |
One database serves every adapter on the thread that opened it, so a graph's long-term
store and its session transcripts can share one encrypted file. See packaging/ for each
package's own README.
Serve an encrypted memory region to Claude Desktop or any MCP client. citadeldb-mcp is
published to PyPI and listed in the official MCP registry
as dev.citadeldb/mcp. Run it without installing through uvx.
For the recommended semantic-recall setup, pull the embedder and cross-encoder reranker once:
The pull commands do not need a vault key. Before starting the server, set CITADEL_KEY
to the vault passphrase: use export CITADEL_KEY="your-passphrase" on macOS/Linux or
$env:CITADEL_KEY = "your-passphrase" in PowerShell. Then run:
--db, --embedder, and CITADEL_KEY are required when serving. The reranker is optional,
but e5-large with ms-marco-minilm is the configuration used for the memory benchmarks.
To install the executable instead, run pip install citadeldb-mcp or
cargo install citadeldb-mcp. Pull the same models with citadeldb-mcp pull e5-large and
citadeldb-mcp pull ms-marco-minilm, then add it to claude_desktop_config.json:
Recorded LoCoMo and LongMemEval results are summarized below; their configurations and limitations predate the current memory-engine changes. SQL comparisons with unencrypted SQLite across 59 cases are under Speed benchmarks.
LoCoMo - gpt-4o-mini reader and judge with the harness's prompts, mean of 3 runs measured August 18, 2026:
| Metric | Score |
|---|---|
| Overall | 87.2% +/- 0.3 |
| Full context, no retrieval (reported in the Mem0 paper, not rerun here) | 72.9% |
Retrieval is identical across the three runs; the spread is reader and judge nondeterminism. A manual audit estimates that ~6.4% of LoCoMo answer keys are erroneous, so raw accuracy should be interpreted with that annotation noise in mind.
Memory is built with no LLM - raw turns enriched with supplied photo captions and image-search text, indexed and recalled deterministically.
LongMemEval_S (arXiv 2410.10813) full-haystack split (~40-50 sessions/question), gpt-4o reader, official CoT prompt and gpt-4o-2024-08-06 judge:
| Metric | Score |
|---|---|
| Overall | 86.2% |
| Task-averaged | 86.8% |
| Abstention | 80.0% |
Full-haystack stresses retrieval against distractors (not the oracle reader ceiling). Protocol and per-type results in citadel-membench.
The same encrypted pages that hold SQL tables also hold memory. Three crates make up the memory engine:
VECTOR(N) SQL type, distance operators (<-> L2, <#> inner, <=> cosine), and a PRISM-backed filtered ANN index that reads through the encrypted page store.citadeldb-mem stores raw conversation content without a summarizer LLM. Recall uses embeddings, BM25 keyword matching, and an optional reranker. Local embedding and reranking backends keep this processing on-device; custom backends determine their own network use and costs. The benchmark readers and judges are separate LLMs - gpt-4o-mini for LoCoMo, gpt-4o for LongMemEval. The protocol and results are in citadel-membench.
.upgradeMeasured on September 13 and 20, 2026 (UTC) on an Intel Core i9-12900HX, Windows 11 Pro, Rust 1.98.0, and SQLite 3.51.3. Runs use one fixed logical processor, with durability disabled and both caches configured for 4,096 pages (about 32 MiB). Most cases use 100K rows; schemas and operations vary as listed below.
Each time is the arithmetic mean of two or four per-run sample medians, with 30 samples per run. Ratios use unrounded SQLite time / Citadel time: above 1 means Citadel is faster, below 1 means Citadel is slower. For example, 0.5x means Citadel takes twice as long as SQLite.
Ten execution comparisons were refreshed on September 20: eight write/scan cases at 2bb8516f and two window cases at 74aa7020. Other rows retain September 13 measurements at 6b41d0c3 or ea8827d7. Each row pairs Citadel and SQLite from the same cohort. This is a combined snapshot, not a full-suite run at the latest revision. Source revisions, run settings, medians, 95% intervals, and drift identify every row.
37 comparisons of writes and reads that execute each iteration, including rotating-parameter queries. Fixture resets are excluded unless the case description says otherwise.
22 comparisons of identical reads against unchanged data. Citadel reuses cached results; union reuses projected branch rows and reconstructs UNION ALL output. SQLite executes the query again. These timings do not represent the first query after a write.
No SQLite comparison is reported for these seven cases. json_table executes each iteration; the other six measure cached repeat reads.
The same query within Citadel, with and without its index. Ratios are unindexed / indexed time. json_gin rotates unique JSON-id probes; fts_index repeats a fixed query on a TEXT column. Both execute each iteration.
Exact queries, schemas, input sizes, and timed boundaries are in the H2H implementations. Shared database settings and result collection are in common.rs.
page_size=8192, journal_mode=MEMORY, synchronous=OFF, cache_size=4096.
Citadel uses SyncMode::Off and cache_size=4096; its 8,208-byte stored pages
contain an 8,160-byte decrypted body. Cache entry counts match, not exact byte use.
These runs do not measure durable commit latency.insert_select includes creating the destination table and copying 1K rows
into it, each as a separate autocommit statement. Dropping it is excluded.fts_rank_first_execution uses a fresh prepared statement each iteration;
preparation and disposal are excluded. It is not a disk-cold I/O measurement.
fts_rank reuses the prepared result. Citadel TS_RANK and SQLite BM25 are
different ranking algorithms.fk_cascade includes inserting one parent and 100 children, committing, then
deleting the parent. fk_cascade_delete_only times only the cascading delete.savepoint_create includes BEGIN, SAVEPOINT, RELEASE, and COMMIT.
savepoint_nested creates ten nested savepoints with 100 inserts at each level,
rolls back to the sixth, releases the remaining savepoints, and commits.
savepoint_rollback inserts 1K rows before a savepoint and 10K after it,
rolls back the latter, and commits.update, update_gen_propagate, window_agg, and window_rank cohorts also
run in reverse order, giving four candidate runs; other rows use two. Every
candidate run and its matching SQLite control contributes to the displayed mean.For example, run the September 20 UPDATE cohort at its recorded revision:
For a source comparison, build and preserve both source snapshots first, then run the cohort's recorded case filter and run order, with no concurrent builds and fixed CPU affinity. The command above runs the current checkout; reproducing a published row requires its recorded revision and cohort. Exact Criterion IDs, executable hashes, and per-run results are in sql-benchmarks.json.
Statements - CREATE/DROP TABLE (incl. TEMP), ALTER TABLE (ADD/DROP/RENAME COLUMN, RENAME TABLE, DISABLE/ENABLE TRIGGER), CREATE/DROP INDEX (incl. partial WHERE, expression keys, CONCURRENTLY), CREATE/DROP VIEW, CREATE/DROP MATERIALIZED VIEW (with REFRESH [CONCURRENTLY]), CREATE/DROP TRIGGER (BEFORE/AFTER/INSTEAD OF, FOR EACH ROW/STATEMENT, REFERENCING NEW/OLD TABLE, WHEN, UPDATE OF cols), INSERT (VALUES, SELECT, ON CONFLICT DO NOTHING/DO UPDATE, ON CONSTRAINT), SELECT, UPDATE, DELETE, TRUNCATE TABLE, RETURNING (with OLD/NEW), BEGIN [READ ONLY | READ WRITE]/COMMIT/ROLLBACK, SAVEPOINT/RELEASE/ROLLBACK TO, SET [LOCAL] TIME ZONE, EXPLAIN, REFRESH MATERIALIZED VIEW
Constraints - PRIMARY KEY, NOT NULL, UNIQUE, DEFAULT, CHECK (column + table level), FOREIGN KEY with full referential actions (ON DELETE / ON UPDATE CASCADE / SET NULL / SET DEFAULT / RESTRICT / NO ACTION), GENERATED ALWAYS AS (...) STORED|VIRTUAL
Collations - BINARY, NOCASE (ASCII case-insensitive), and RTRIM (ignores trailing spaces). Text primary keys use their declared collation; foreign keys use the referenced columns' collation. Column index keys inherit their column's collation unless overridden with COLLATE.
Types - INTEGER, REAL, TEXT, BLOB, BOOLEAN, DATE, TIME, TIMESTAMP (WITH TIME ZONE), INTERVAL, JSON, JSONB, TSVECTOR, TSQUERY, ARRAY
JSON / JSONB - Postgres operators plus SQL/JSON path functions and the SQL:2023 item methods .bigint(), .decimal(), .integer(), .number(), .string(), .boolean(), .date(), .time(), .time_tz(), .timestamp(), and .timestamp_tz(). Time-zone-dependent evaluation uses the connection's transactional SET [LOCAL] TIME ZONE context.
Clauses - JOINs (INNER, LEFT, RIGHT, CROSS, FULL OUTER, LATERAL), subqueries (scalar, IN, EXISTS, correlated), CTEs (WITH / WITH RECURSIVE / WITH-DML: WITH x AS (INSERT/UPDATE/DELETE ... [RETURNING *]) SELECT ...), UNION/INTERSECT/EXCEPT [ALL], CASE, BETWEEN, LIKE, DISTINCT, ANY / ALL (subquery + array forms), GROUP BY/HAVING, ORDER BY, LIMIT/OFFSET
Window functions - ROW_NUMBER, RANK, DENSE_RANK, NTILE, LAG, LEAD, FIRST_VALUE, LAST_VALUE, SUM/COUNT/AVG/MIN/MAX OVER with PARTITION BY, ORDER BY, ROWS/RANGE frames
Views - CREATE/DROP VIEW, OR REPLACE, IF NOT EXISTS/IF EXISTS, column aliases, nested views
Materialized views - CREATE MATERIALIZED VIEW [IF NOT EXISTS] name AS SELECT ..., REFRESH MATERIALIZED VIEW [CONCURRENTLY] name (CONCURRENTLY does a diff-merge - DELETE removed rows, UPDATE changed rows, INSERT new rows - instead of TRUNCATE+repopulate), DROP MATERIALIZED VIEW [CASCADE], full backing-table semantics (indexes, joins, planner sees a real table), pg_matviews introspection
Triggers - CREATE TRIGGER name {BEFORE|AFTER|INSTEAD OF} {INSERT|UPDATE [OF cols]|DELETE} ON table FOR EACH {ROW|STATEMENT} [REFERENCING NEW TABLE AS new_t OLD TABLE AS old_t] [WHEN (expr)] BEGIN ... END. INSTEAD OF triggers make views writable. Transition tables work as virtual tables in trigger bodies. ALTER TABLE ... DISABLE/ENABLE TRIGGER [name|ALL]. PG-faithful name-order firing. Introspection via information_schema.triggers and SHOW TRIGGERS [ON table].
TEMP tables - CREATE TEMP TABLE ... lives in a per-connection in-memory database, dropped on disconnect. Full DDL/DML/index/constraint/trigger parity with persistent tables.
Functions - COUNT, SUM, AVG, MIN, MAX, LENGTH, UPPER, LOWER, SUBSTR/SUBSTRING, TRIM/LTRIM/RTRIM, REPLACE, INSTR, CONCAT, HEX, ABS, ROUND, CEIL/CEILING, FLOOR, SIGN, SQRT, RANDOM, COALESCE, NULLIF, CAST, TYPEOF, IIF
Date/Time Functions - NOW, CURRENT_TIMESTAMP, CURRENT_DATE, CURRENT_TIME, LOCALTIMESTAMP, LOCALTIME, CLOCK_TIMESTAMP, EXTRACT, DATE_PART, DATE_TRUNC, DATE_BIN, AGE, MAKE_DATE, MAKE_TIME, MAKE_TIMESTAMP, MAKE_INTERVAL, JUSTIFY_DAYS, JUSTIFY_HOURS, JUSTIFY_INTERVAL, ISFINITE, DATE, TIME, DATETIME, STRFTIME, JULIANDAY, UNIXEPOCH, TIMEDIFF, AT TIME ZONE. Supports INTERVAL '1 year 2 months', DATE '2024-01-15', TIMESTAMP '2024-01-15 12:30:00Z', infinity/-infinity sentinels, BC dates, full IANA zone parsing (jiff), PG-normalized INTERVAL comparison.
Full-text search - tsvector / tsquery types, to_tsvector / to_tsquery / plainto_tsquery / phraseto_tsquery / websearch_to_tsquery builders, @@ match operator, ts_rank / ts_rank_cd ranking with weighted positions (A/B/C/D), prefix matching (term:*), phrase distance (<N>), inverted indexes via CREATE INDEX ... USING fts
System catalog - information_schema.tables, information_schema.columns, information_schema.key_column_usage, information_schema.table_constraints, information_schema.triggers, pg_timezone_names, pg_timezone_abbrevs, pg_matviews (virtual tables, queryable). SHOW TRIGGERS [ON table] and SHOW MATERIALIZED VIEWS shorthands for the corresponding catalog queries.
Prepared statements - $1, $2, ... positional parameters with LRU statement cache plus snapshot-tagged plan caching for joins and compound queries (cache invalidates only on commit, never per-call)
Multi-statement scripts - Connection::execute_script(sql) runs ;-separated statements in one call, returning per-statement outcomes with partial-success preserved. WASM: db.run(sql) returns [{type, ...}, ...].
UPSERT - INSERT ... ON CONFLICT (cols) DO NOTHING / DO UPDATE SET col = excluded.col ... WHERE ... and ON CONFLICT ON CONSTRAINT idx_name. excluded.* refers to the proposed row; bare col refers to the existing row.
No plaintext on disk. Every page is encrypted before writing and authenticated before reading.
Separate key file. Encryption keys live in {dbname}.citadel-keys, not inside the database. The passphrase derives a master key in memory via Argon2id (or PBKDF2 in the FIPS-oriented at-rest profile) and never touches disk.
Key backup. Export an encrypted key backup with a separate recovery passphrase. Restore access without re-encrypting the entire database.
Instant rekey. Changing the passphrase re-wraps the root encryption key. No page re-encryption - instant regardless of database size.
Encrypted sync. Noise protocol (NNpsk0_25519_ChaChaPoly_BLAKE2s) with a 256-bit pre-shared key. Ephemeral Curve25519 keys per session for forward secrecy.
Studio calls the database and SQL APIs directly and uses MemoryMaintenance for
stored-memory inspection and erasure. It needs no MCP server or embedding model.
Fresh random IV per page. HMAC verified before decryption.
Shadow paging with a god byte - one byte selects the active commit slot. Atomic commits without WAL:
What the at-rest integrity machinery does and does not guarantee against an attacker with file access:
(epoch, page_id, IV, ciphertext). Any modification of a page's bytes is detected before decryption. It does not bind the commit generation: a page image validly written in the past for the same (page_id, epoch) verifies forever.txn_id and Merkle root outside the attacker's reach and compare them after opening.Static or dynamic library with auto-generated citadel.h (cbindgen). Exported entry points are panic-safe.
Install with npm install @citadeldb/wasm.
Build the npm package: bash scripts/publish-wasm.sh
One importable wheel with the full engine (SQL, vectors, memory, agent runtime) and bundled type stubs.
Rust 1.95+.
| Flag | Description |
|---|---|
audit-log | HMAC-SHA256-chained audit log (default: on); no external anti-rollback anchor |
fips | At-rest PBKDF2 + AES-256-CTR profile; not whole-product validation |
io-uring | Linux io_uring async I/O |