Skip to main content
Glama

Episteme MCP (episteme-mcp)

Zero-infrastructure epistemic memory & living knowledge MCP server (100% CPU, Python stdlib + NumPy, Lazy SQLite WAL + FTS5, pure-stdlib MCP stdio server — no Docker, no ChromaDB, no Neo4j, no vector database required).

Unlike flat RAG or verbatim vector logs — which treat outdated specs, active rules, and scoped exceptions as equally valid chunks — Episteme MCP separates an immutable verbatim Cold Lab Notebook (ColdStore) from an epistemic Hot Map (MentalPalace) with explicit boundary conditions, evidence-gated belief revision (supersession/falsification without erasure), Dual-Layer Epistemic PPR, opt-in Hybrid FTS5 + Dense RRF, and offline Sleep-Time Compute (EvoSCM Phases 1–3).

Where it shines (honest positioning): Living knowledge bases where facts evolve over time, versions replace earlier defaults while scoped exceptions and evergreen rules remain valid (ADRs, engineering specs, product policies, Obsidian vaults, scientific literature, and long-horizon active-learning agents).


Verified Empirical Results

1. Living KB Benchmark — Zero-Touch Auto-Extraction (--extract-with-llm, 20 versioned docs, 24 Qs)

Running on google/gemini-3.8-flash (Vertex AI) with zero manual curation (7/7 deprecated docs automatically superseded, 0/13 false positives) against modern 2026 RAG baselines (nomic-embed-text):

System

Fact Recall

Net Score

Total Traps

superseded_rule

scoped_coexistence

evergreen

multi_hop

B4_dense_rag_k5 (nomic-embed-text)

0.927

0.844

8

0.708

0.875

1.000

0.792

B5_hybrid_rrf_k5 (BM25 + Dense RRF)

0.919

0.867

5

0.875

0.833

1.000

0.758

B3_recency_rag_k5

0.912

0.902

1

1.000

0.833

0.917

0.858

B6_hybrid_rerank_k5 (Hybrid + LLM Reranker)

0.952

0.910

4

0.917

0.875

1.000

0.850

P_balanced_10k (auto-extracted)

0.933

0.933

0

1.000

0.833

1.000

0.900

P_full_cloud (auto-extracted)

0.952

0.952

0

1.000

0.917

0.958

0.933

(On local qwen2.5:3b zero-touch auto-extraction, P_full_cloud = 0.899 (0 traps) and P_balanced_7b = 0.888 (0 traps) also beat every RAG baseline: BM25 = 0.838, Recency = 0.835, Dense = 0.817.)

2. Multi-Document Scientific Interference (Exp 1 — 12 real 2026 papers, 303 chunks + superseded 2022 prior)

  • Asymmetric Architecture (qwen2.5:3b local indexer → google/gemini-3.8-flash full_cloud QA):

    • Mental Palace = 0.838 vs Flat RAG = 0.792 (+4.6 pp overall; belief_revision: 0.854 vs 0.604 (+25.0 pp); factual: 0.854 vs 0.792 (+6.2 pp)).

  • Local qwen2.5:3b (compact_3b): 0.617 vs 0.583 (0/20 vs 8/20 superseded-prior pollution; 0.000 degradation from 1 to 12 documents).

3. Active Scientific Discovery & Executable World Models (Exp 2 & Exp 3 — Blind --anonymize, Zero Leakage)

  • Exp 2 (15 blind seeds across qwen2.5:3b, qwen2.5:7b, olmo2:7b): Mental Palace + EvoSCM + Active Curiosity (A3) beat Flat-Log (A1) 15/15 (100%), averaging +31.1 pp on unseen compositional hold-out scenarios.

  • Exp 3 (WorldCoder + SCL Promotion Gate):

    • qwen2.5:3b (10 seeds): gate rejected 10/10 underfit programs (0% false promotions, 0 regressions vs A3_neural).

    • google/gemini-3.8-flash (3 blind seeds): 1.000 ± 0.000 exact hold-out accuracy in A3_neural and 1.000 ± 0.000 in A4_worldcoder_gated (100% promoted on attempt 1/3), compiling discovered rules into a sandboxed Python simulator ($0 / <1 ms per counterfactual query).

4. External Benchmark: LongMemEval (knowledge-update, xiaowu0162/longmemeval-cleaned, N=15)

Evaluated on google/gemini-3.8-flash + nomic-embed-text (~40 real multi-turn chat sessions per question, zero oracle hints):

System

Judge Accuracy

Latest Recall@5

Stale Rate@5

Avg Chars

B2_dense_k5 (nomic-embed-text)

0.733 (11/15)

0.800

0.800

7755

B4_hybrid_rerank_k5 (Hybrid + LLM Reranker)

0.800 (12/15)

1.000

0.933

7800

B1_bm25_k5

0.867 (13/15)

0.933

0.933

7852

B3_hybrid_rrf_k5

0.933 (14/15)

0.933

0.800

7751

P_palace_hybrid_evoscm (opt-in Hybrid RRF + EvoSCM)

0.933 (14/15)

0.933

0.800

7777

(Honest note: on casual multi-topic chat logs, document-level EvoSCM stayed conservative with 0 false-positive supersessions while opt-in Hybrid RRF tied #1 at 0.933, outperforming BM25 +6.6 pp, Hybrid+Reranker +13.3 pp, and Dense +20.0 pp. Sub-session conversational fact updates are planned for v0.5.)

5. Scale, Low-RAM Lazy SQLite & Concurrency (v0.5.0)

  • Lazy LRU ColdStore (2,101 chunks / 150 docs): 2.15 ms load (0 chunk texts preloaded in RAM), 2.47 ms incremental +1 doc write via BEGIN IMMEDIATE + incremental UPSERT (multi-agent safe).

  • 7,500 chunks / 500 docs: 14.3 ms FTS5 BM25 | 28.7 ms end-to-end palace.query().

  • Token & Write Efficiency: Hot/Cold deduplication trims redundant full_cloud prose (-6.1% chars on Living KB with 1.000 recall); batched document extraction packs up to 5 chunks/call (~4–5× fewer write calls); EvoSCM Phase 3 adds sub-session atomic fact supersession ([SUPERSEDED FACT] guardrails).


Related MCP server: Agent Memory Engine

Quick Start

Run via uvx (zero setup)

# Ingest a local docs/, ADR folder, or Obsidian vault (incremental sha256 + auto-supersession on file edits)
uvx episteme-mcp ingest ./docs --palace-dir ./palace_data

# Query directly from the terminal
uvx episteme-mcp query "What is the current production auth standard?" --palace-dir ./palace_data

# Launch the zero-dependency MCP stdio server (for Cursor, Claude Desktop, Antigravity)
uvx episteme-mcp --palace-dir ./palace_data --default-profile full_cloud

(Add --embed-model nomic-embed-text for opt-in Hybrid FTS5 + Dense RRF retrieval. Or install locally with pip install -e ".[dev]" and run pytest -q tests/.)

Exposes 2 primary high-level tools (palace_remember, palace_recall), 7 low-level primitives (palace_ingest_document, palace_propose_claim, palace_revise_belief, palace_query, palace_dereference_chunks, palace_sleep_consolidate, palace_curiosity_frontier), and 3 resources (palace://stats, palace://revision-log, palace://curiosity-frontier).

See docs/MCP_SETUP.md for copy-paste configs for Antigravity, Claude Desktop, and Cursor.


Repository Structure

  • src/palace/ — Core runtime: cli.py, cold_store.py (with opt-in HttpEmbeddingClient & search_hybrid), mental_palace.py (Dual-Layer Epistemic PPR + EvoSCM Phases 1–3), sqlite_store.py (Lazy LRU + WAL BEGIN IMMEDIATE + FTS5), schema.py, llm_client.py, baselines.py, mcp_server.py.

  • experiments/exp0_bacterial_confinement/ — Single-paper contamination-free QA benchmark (Nature Comms July 2026).

  • experiments/exp1_multi_doc_interference/ — 12-paper (303 chunks) multi-doc interference & belief revision benchmark.

  • experiments/exp2_blackbox_lab/ — Zero-leakage black-box active-curiosity virtual lab (Real & Blind --anonymize).

  • experiments/exp3_worldcoder/ — Sandboxed executable WorldCoder synthesis + SCL Promotion Gate.

  • experiments/exp_living_kb/ — Versioned technical docs benchmark (Helios Cloud Platform) with TF-IDF, BM25, Recency, Dense, Hybrid RRF, and Hybrid + LLM Reranker baselines.

  • experiments/exp_longmemeval/ — External LongMemEval (knowledge-update) public benchmark runner.

  • docs/ — FOUNDATIONS_AND_MATHEMATICS.md, MCP_SETUP.md, HANDOFF_STATE.md.

  • tests/ — 58 deterministic CPU unit & integration tests.

License

MIT

Available Tools

9 tools
palace_curiosity_frontierC

Return top epistemic uncertainty gaps (curiosity frontier) and palace stats.

Inputs: top_k.

palace_dereference_chunksA

O(1) lazy verbatim lookup of ColdStore chunks by chunk_id.

Inputs: chunk_ids (required).

palace_ingest_documentA

Ingest a raw scientific document into the Cold Lab Notebook, returning chunk IDs and 180-char chunk previews for grounded claim extraction.

Inputs: text (required), title (required), doc_id (required), source, +3 more.

palace_propose_claimB

Propose a causal claim to the Mental Palace through the deterministic SCL epistemic gate (requires verifiable ColdStore chunk_id pointers).

Inputs: cause (required), effect (required), relation (required), evidence_ptrs (required), +7 more.

palace_queryB

Retrieve epistemic-weighted Mental Palace briefing, active/historical claims, and ColdStore pointers within a strict token/char budget profile.

Inputs: query (required), max_chars, budget_profile, lazy_read_chunks, +2 more.

palace_recallB

Recommended high-level read tool: retrieve an epistemic-weighted briefing with active beliefs, superseded-rule guardrails, and verbatim ColdStore excerpts sized to the model's budget profile.

Inputs: query (required), max_chars, budget_profile, include_historical, +1 more.

palace_rememberA

Recommended high-level write tool: store a document, ADR, spec, or fact in one call. Automatically chunks/indexes into the Cold Lab Notebook, optionally commits inline claims, explicitly supersedes older doc_ids (gating obsolete passages), and runs EvoSCM consolidation.

Inputs: text (required), title, claims, doc_id, +6 more.

palace_revise_beliefB

Perform evidence-gated belief revision (supersede an outdated claim with a newer claim, or falsify a claim with ColdStore evidence pointers).

Inputs: action (required), reason (required), target_claim_id (required), new_claim_id, +1 more.

palace_sleep_consolidateC

Run offline Sleep-Time Compute pass (Entity Resolution + EvoSCM conflict adjudication + MDL claim folding + curiosity frontier update).

Inputs: use_llm_adjudicator.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 9 tools

    Disambiguation3/5

    The high-level/low-level split is explained, but palace_recall and palace_query both promise an 'epistemic-weighted briefing within a token budget,' and palace_remember overlaps heavily with palace_ingest_document + palace_propose_claim since it does chunking, claim committing, and consolidation in one call. An agent must read descriptions carefully to choose between the convenience wrappers and the primitives.

    Naming Consistency4/5

    All names use a consistent palace_ prefix and snake_case, with most following verb_noun (ingest_document, propose_claim, revise_belief, dereference_chunks). Minor deviations: remember/recall/query are bare verbs and curiosity_frontier is a noun phrase, but the pattern remains readable.

    Tool Count5/5

    Nine tools is well within the sweet spot and each maps to a distinct layer (write, read, maintenance). No tool feels like filler given the multi-stage memory pipeline.

    Completeness4/5

    The lifecycle is broadly covered: ingest, claim proposal, belief revision/falsification, retrieval, lazy dereference, consolidation, and uncertainty surfacing. Gaps are minor—no explicit forget/retract-document tool and no direct listing/browsing of stored doc_ids beyond the briefing, though revise_belief can falsify claims.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Local memory for AI agents in one SQLite file on your own machine. Facts carry a validity window and a confidence score, so an outdated one is superseded and downweighted rather than deleted, and retrieval fuses BM25, vector similarity and a knowledge graph.
      4
      Business Source 1.1
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to store and recall durable facts, decisions, and lessons over MCP using hybrid semantic and keyword search, typed memories, graph relations, sessions, and time-travel queries. Runs locally with no server process or API key, persisting everything to files that both agents and a CLI can share.
      18 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Gives AI agents a durable, locally hosted temporal memory built from a markdown vault you own, exposing hybrid semantic/lexical/entity search over events, threads, transcripts, entity relationships with validity dates, and patterns with confidence decay. Writes are approval-gated, so agents can draft, commit, and sync new memories while keeping every index rebuildable and nothing leaving your machine.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to keep a durable, local-first long-term memory in a single SQLite file, where frequently recalled facts strengthen and unused traces decay, with sleep-time consolidation that merges duplicates and distills episodes into semantic gists. Exposes six tools — remember, recall, context, forget, dream, and stats — so clients can store facts, pull prompt-ready memory blocks, and permanently erase data on request.
      MIT