The SuperLocalMemory mascot presenting the architecture
Architecture

Local-first
by design.

One local control plane for evidence, memory, retrieval, optimization, governance, and peer coordination — memory runs on infrastructure you control. Enterprise deployments add per-workspace isolation, role-based access, GDPR controls, and a per-mode EU AI Act self-assessment. The design makes optional providers, connectors, scale projections, and networked surfaces explicit rather than hiding them behind a single “local” claim.

At a glance

One local memory system.
Every surface your agents use.

Pick a mode to see what changes, or read the architecture documentation.

LOCAL CONTROL PLANE

Canonical state stays local. Every external path is visible and explicitly enabled.

1Governed memory2Recall you can trust3Answer check

Mode A: remember and recall make no model-provider call by default. Rules extract facts; a local encoder and cross-encoder retrieve.

MEMORY RUNTIMEeight bounded stages
01

Governed admission

Identity, role, scope and the write gate check every save, then a durable receipt is issued.

02

Canonical store

SQLite, sqlite-vec and FTS are the source of truth, with restore points before upgrades.

03

Enrichment

Facts, entities, time, nine memory kinds and the knowledge graph advance in bounded, retryable stages.

rules, no language model
04

Learning + lifecycle

A bandit and a LightGBM ranker learn from outcomes; a shadow test promotes and rolls back.

05

Recall fusion

Semantic, keyword, temporal, Hopfield and graph candidates are fused, reranked and traced.

local encoder, 768-dim
06

Answer check

Laya on your Mac or Jev online decides whether the memories answer the question, or says “I don’t have that”.

same in every mode
07

Safe context

Secrets are redacted, boundaries neutralised and provenance attached before anything reaches a prompt.

08

Optimize + operate

Exact cache, reversible compression, doctor, audit trail and encrypted backup keep it inspectable.

Complete system map

One map.
Every component of the control plane.

SuperLocalMemory is a durable memory runtime, not a standalone vector index. The same installed system accepts evidence, derives governed memory, retrieves bounded context, checks whether the memories actually answer the question, and exposes optimization, coordination and optional Web access to agents and operators.

Interactive system map

See the control plane.
Inspect every boundary.

One map of the whole system: callers and the four doors, the save and recall paths, the answer gate and check, pictures and documents, the living brain, governance and SLM-Mesh. Light up a pillar, switch the operating mode, then select any component for its role, data flow, controls, boundary and guide.

Canonical memory pathRecall + evidence flowParity-gated projectionExplicit peer / provider pathOutbound-only Web access link
AGENTS + APPS
CLIMCPDashboardHooks + skillsCursor, Windsurf, Zed, JetBrains9 frameworks
CANONICAL MEMORY RUNTIME12 bounded stages
GOVERNANCE, SCALE + MESH
OPT-IN ADAPTERSProviders, Gmail, Calendar and transcripts stay off until you connect them. Adapter credentials use your OS keychain when one is available.
HOW WEB ACCESS REACHES THE SAME ENGINE
Web app or botOAuth sign-in, only the tools you granted
Connection gatewayChecks owner, app, profile and tool
Connector on your laptopOutbound only; renews its access
The engine on your laptopSame governed recall and writes

The memory database stays on your laptop. Tool requests and results pass through the gateway and the app you connected, and the laptop must be online.

Memory carried through the runtimeatomic facts · episodic scenes · temporal events · entities · nine kinds · graph-linked evidence · profiles + scopes
SQLite + sqlite-vec remain canonical

CozoDB and LanceDB serve only once they match SQLite; Mesh coordinates peers; Web access keeps the memory database on your laptop.

Boundary: installed optional components are not silently promoted. The receipt, trace, health, doctor, and scale commands are the release evidence for the stages actually active in a deployment.

Layer Diagram

Five runtime surfaces.
The ones agents touch most.

This view isolates the five surfaces that agents and operators touch most often. The interactive map above defines every component beneath them.

Entry point
05
MCP + CLI Interface
Documented client configurations · --json structured output · agent-native commands
MCP CLI JSON API
04
Cache Engine
Exact cache opt-in · Semantic experimental · wrapped-call avoidance on hit
Exact Semantic LRU
03
Compression Engine
Content-specific reduction · Reversible storage available · JSON/code preserved in safe mode
Extractive Reversible KV-cache
02
Memory Store
Durable operations · SQLite source of truth · explicit projectors
SQLite M018 Retryable
Foundation
01
Research-Informed Scoring
Cosine dense candidates · Fisher-informed scoring · 4 public arXiv preprints
Fisher-Rao Manifold Public preprints
Layer 05 — MCP + CLI Interface

Agent-native from
the ground up.

The MCP server exposes a profile-selected tool surface. Named client templates configure transport, but each client still needs a release-specific install, session, mutation, recall, restart, and uninstall check.

Data-returning CLI commands support --json where documented, returning an envelope with command metadata and data. Consumers must parse the versioned fields they use rather than infer meaning from display text.

  • Documented clients via MCP — run slm connect --list for the release surface
  • Structured output on documented data-returning CLI commands
  • Versioned fields for agent pipelines; compatibility aliases remain temporary
  • stdin/stdout safe — pipeable to jq, shell scripts, CI/CD pipelines
MCP + CLI — illustrative response shape
# structured recall — agent-parseable envelope $ slm recall "JWT token lifetime" --json   "success": true,   "command": "recall",   "data":     "results": [       { "content": "JWT tokens refresh every 15m",         "relevance_score": 0.82, "memory_confidence": 0.97, "rank_position": 1     ],     "retrieval_time_ms": 4.2,     "score_contract_version": "2",     "calibration_status": "uncalibrated",     "answer_confidence": null   ,   "next_actions": [ { "command": "slm list --json" } ] }
Layer 04 — Cache Engine

Exact reuse when enabled.
Semantic reuse stays opt-in.

When Optimize or proxy caching is enabled, exact-match caching keys the normalized request and can avoid a repeated provider call. Caching is off by default in the shipped configuration; runtime latency and provider accounting must be measured.

Semantic cache is experimental and explicitly opt-in because a near-match can return the wrong response. The implementation can record prompt-class threshold state, but production use remains blocked on held-out false-hit calibration, tenant isolation, and invalidation evidence. LRU and TTL settings bound retained entries when configured.

  • SHA-256 exact-match — key equality without a semantic-near-match decision
  • Prompt-class threshold state — experimental until calibrated on a representative corpus
  • LRU eviction with configurable TTL — cache stays bounded
  • Provider call avoided only when the selected surface returns a valid cached response
cache --status
# inspect cache health and savings $ slm cache --status
engine: exact + semantic (opt-in active) entries: deployment-specific hit rate: measure on representative traffic tokens saved: provider-accounting dependent cost saved: verify against provider invoices eviction: inspect configured policy size on disk: measure the deployed cache
✓ Cache available · activation required
Layer 03 — Compression Engine

Content-specific reduction.
Safe and lossy modes separated.

When compression is explicitly enabled, safe handling preserves JSON and code invariants and may produce no reduction. Reversible CCR storage can retain the original for byte-exact retrieval; aggressive prose reduction is a separate opt-in, lossy path.

Prefix ordering can improve reuse when the configured provider supports prompt caching and all provider-specific conditions are met. Pricing, TTL, minimum-prefix, and discount behavior belong to the provider contract and must be measured separately.

  • Safe JSON/code handling — structure preserved; reduction may be zero
  • Structured round trip — verify byte invariants for the selected safe path
  • Safe mode preserves JSON and code and may yield no reduction
  • KV-cache alignment — provider-dependent and measured from real traffic
compression report
# check compression stats for last session $ slm compress --report
mode: extractive (code/JSON detected) input tokens: measure the supplied corpus output tokens: content- and mode-dependent reversible: verify round-trip invariants prefix align: inspect provider eligibility provider hit: measure from provider evidence
✓ Keep compression and provider-cache evidence separate
Layer 02 — Memory Store

Durable first.
Projected second.

Every accepted write owns a durable operation record and raw evidence in the SQLite-backed source of truth. A queryable relational and FTS projection is committed before asynchronous enrichment begins.

Enrichment is lease-owned, checkpointed, retryable, and marked complete only after its declared stages succeed. SQLite remains canonical; CozoDB and LanceDB projections are activated only through explicit prepare, verify, promote, and rollback controls.

  • Durable states: raw → queryable → enriching → complete or failed
  • Queryable checkpoint: relational facts and FTS are available before enrichment completes
  • Failure contract: raw evidence, errors, attempts, and retry timing remain inspectable
  • Optional projectors: ANN and vector indexes are verified before complete is granted
memory store status
# submit durable evidence and inspect the receipt $ slm remember "Use SQLite for durable state" --json
"operation_id": "<opaque-operation-id>" "materialization_state": "queryable" "fact_ids": ["<queryable-fact-id>"] "note": "queryable now; canonical enrichment pending"
✓ Raw evidence is durable before this receipt returns
Layer 01 — Retrieval and Score Enhancement

Inspectable channels.
Separated score meanings.

Dense semantic candidate generation uses cosine similarity. Lexical, temporal, Hopfield associative, and spreading-activation channels can add candidates before fusion; entity-graph information enhances scores after fusion.

Fisher-derived terms can inform later scoring when their state is available. This ranking utility is not answer probability. The score contract keeps query relevance, stored-memory confidence, trust, and internal ranking utility separate.

dFR(p, q) = arccos( Σ √(pi · qi) )
  • Cosine dense retrieval — one of five candidate-producing channels
  • Fisher-informed enhancement — applied later when required state is available
  • No answer probability — answer confidence stays null until a held-out calibrator is frozen
  • Exposure is not truth — access telemetry remains separate from correctness feedback
  • 4 public arXiv preprints — versioned research, not venue-reviewed certification
retrieval — score contract v2 trace
# trace retrieval path on manifold $ slm recall "auth timeout" --trace
dense metric: cosine · later scoring: Fisher-informed when available score contract: relevance · ranking utility · memory confidence · trust candidate sources: dense · BM25 · temporal · associative · spreading activation
rank 1 · relevance_score 0.82 · ranking_score internal → "JWT tokens expire after 15m" · memory_confidence 0.97 calibration_status: uncalibrated answer_confidence: null
✓ trace: candidate ranks + fusion + reranker status + measured latency
Data Flow

What happens when
you run slm recall.

A recall command traverses the configured layers and records runtime evidence. Latency depends on corpus, hardware, warmup state, enabled channels, and reranker availability.

01
CLI receives query Layer 5
The MCP server or CLI dispatcher receives slm recall "JWT token lifetime". If --json is present, the response envelope is prepared. Input and explicit scope are normalized and validated before retrieval.
02
Scope and source of truth selected Layer 2
Profile, project, tenant, lifecycle, and deletion filters constrain the query. SQLite is the normal-path source of truth; optional projectors participate only when they are explicitly configured and healthy.
03
Five candidate producers run Layer 1
Dense semantic, BM25 lexical, temporal, Hopfield associative, and spreading-activation channels can produce candidates. Entity-graph information is a later score enhancement, not a sixth candidate producer.
04
Fusion, reranking, and enhancement Layer 1
Candidate scores are fused with channel provenance. Optional reranking and graph- or Fisher-derived enhancements run only when their required state and dependencies are available; their output remains ranking utility, not answer probability.
05
Score Contract v2 serialized Layer 5
The response separates query-relative relevance, internal ranking utility, stored assertion confidence, and policy trust. Until a held-out calibrator is frozen, calibration_status is uncalibrated and answer_confidence is null.
Storage Detail

Hot, warm, cold.

SQLite is the normal-path source of truth. The scale engine includes CozoDB and LanceDB scale-engine projectors, but promotion is explicit and reversible: prepare an isolated projection, verify parity, then promote or roll back.

Optional graph projector Optional vector projector Canonical store
Engine CozoDB LanceDB SQLite + zstd
Format Property graph Columnar vectors Compressed rows
Access time Benchmark required Benchmark required Benchmark required
Compression None None Content-specific; release benchmark required
Use for Promotion-gated graph projection Promotion-gated vector projection Normal-path durable records, indexes, and configured compressed payloads
Open Source — AGPL v3

Every layer.
All open source.

Read the code, fork it, and audit it. The SuperLocalMemory source and packages are AGPL-3.0-or-later. Optional model providers and external integrations retain their own licenses, terms, and network behavior.

AGPL v3 · Local-first core · Optional network paths documented separately
Write path

How a memory gets saved, and what 'saved' means

Source: docs/ARCHITECTURE.md

An accepted write is recorded first in the ingestion_operations table (migration M018). The source type and an idempotency key decide whether a request is a replay. If the same key arrives with different evidence, the write is rejected instead of merged.

PhaseWhat is true at that point
rawThe content, metadata, scope, session context and trusted actor are durable.
queryableA relational fact and its SQLite FTS row are committed in one transaction. You can find it by wording.
enrichingA worker holding a lease does extraction, entity resolution, consolidation, graph, temporal, provenance and embedding work.
checkpointFinal fact ids and finished derivation stages are committed before any optional external projection.
completeEvery declared derivation and projector stage reported success.
failedEvidence and checkpoint data stay inspectable and the work is retried with bounded backoff.

Which enrichment stages exist depends on the mode and on which dependencies are installed. The state record reports what actually ran, so an optional backend that was not available is not counted as having taken part.

Read path

From a query to ranked evidence

Source: docs/ARCHITECTURE.md

Recall runs up to five candidate producers, whichever have healthy dependencies: dense semantic, BM25 keyword, temporal, Hopfield associative and spreading activation. A sixth, pictures, joins only when pictures and documents are turned on. Entity-graph evidence is not a producer. It changes scores later.

  1. The producers return candidates with scores and provenance.
  2. Reciprocal Rank Fusion merges the ranked lists.
  3. An optional reranker refines the leading candidates when it is enabled.
  4. Graph-derived evidence can adjust later scoring.
  5. The answer-support gate scores each memory on several signals together and places the recall in one of three tiers: supported, closest memories, or "That isn't in SuperLocalMemory." It reads the original question, never a rewrite.
  6. The answer check, Laya on your Mac or Jev online, judges whether the top results answer the question. Its verdict is one input to the gate and has its own time budget inside the recall ceiling.
  7. Layered output returns each memory at depth 0 (ids and previews), 1 (full facts) or 2 (with source, neighbours and the correction that replaced it), under a hard max_tokens cap. expand opens one result.
  8. The response carries the final evidence and measured runtime fields.

No producer is guaranteed to run in every mode. The runtime falls back to the indexes that are healthy and reports where each result came from. While models are still loading, recall says it is warming up and shows what it found, instead of claiming the memory is empty.

Mathematics

The three mathematical layers, and what each one is for

Source: docs/ARCHITECTURE.md and arXiv:2603.14588

The architecture doc names three layers and gives each a practical job. The formal statements come from the architecture preprint. The research page lists what each paper measured.

Fisher-Rao similarity

Plain vector similarity treats every memory as equally well supported. Fisher-Rao geometry takes the statistical confidence of an embedding into account: a memory confirmed many times has a tighter region of uncertainty than one stored once and never checked. The preprint derives the metric from the Fisher information structure of diagonal Gaussian families and computes it in O(d) time. In the shipped path, dense candidates still use cosine and Fisher-derived terms can inform a later score adjustment.

Sheaf consistency

Say you store "We use PostgreSQL" and months later "We migrated to MySQL". Simple retrieval returns both with no warning. In the sheaf model from the preprint, contradictions across memory contexts show up as non-trivial first cohomology classes. In the product, a detected contradiction records a supersedes link from the newer memory to the older one. The older memory stays in the store and can still be recalled. The check that runs at store time is off by default; you can ask for contradictions on demand with the consistency_check tool, which is in the power tool set. Nothing is hidden from you on the strength of an automatic contradiction check.

Langevin lifecycle

Memory stores grow without limit and old entries dilute retrieval. The Langevin lifecycle moves each memory through Active, Warm, Cold and Archived zones using a dynamic that balances recency, access frequency and information value, in place of a fixed time rule. The preprint proves that the stationary distribution of the Riemannian Langevin dynamics exists and is unique. The released lifecycle also has explicit policy, usage and threshold code, so run a dry run before you enable maintenance on data you care about.

Boundaries

Profiles, scopes, background work and the data root

Source: docs/ARCHITECTURE.md

Profiles and scopes

Profiles partition the active workspace. Inside a profile a memory is personal by default, shared with named profile readers, or global. Reading across profiles is default-deny: recall includes shared and global facts only when an operator enables the policy or the caller passes the scope option. This is local authorization and is separate from SLM-Mesh coordination between trusted peers.

Background work

The daemon does the work that must not slow a save or a recall, and it stands aside for the foreground. Memory health describes older memories while the computer is idle, and it only adds. A backfill measures each memory's baseline for the answer-support gate. Consolidation and lifecycle maintenance run after the daemon has been idle for a while. Answer-check calibration runs only when you start it. The memory graph is built when the daemon starts, never during a recall.

The data root

Core memory is a SQLite database at ~/.superlocalmemory/memory.db in WAL mode. The same folder holds configuration, logs, models, queues, derived indexes and optional backend state, so back up or migrate the whole data root rather than the one file. The table groups are core (memories, sessions, profiles), knowledge (atomic_facts, graph_edges, canonical_entities, temporal_events), durable ingestion, retrieval indexes (SQLite FTS plus configured derived indexes), the per-fact similarity and lifecycle columns on atomic_facts, and compliance and provenance records.

Safe context injection

Stored text is data, even when you wrote it. Every injection surface maps recalled results through one renderer that applies token budgets, redacts recognized secrets, neutralizes attempts to forge the canonical boundary, and attaches fact and source provenance. The rendered block is reference-only evidence: instructions found inside it gain no authority to call tools, change roles or request secrets. Cursor, Copilot and Antigravity instruction files hold only static protocol text, and dynamic memories arrive through MCP at runtime.

Loops and adapters

Bounded loops, and the framework adapters

Source: docs/ARCHITECTURE.md

The bounded loop engine runs laps until an independent gate passes or a hard bound trips. The agent's own claim that it is done is recorded for each lap, but only the gate can end the run. The CLI (slm loop), the MCP tools (slm_loop_run, slm_loop_history, slm_loop_show) and the /slm-loop slash command all drive the same engine and the same ledger. Each lap is stored under the tag loop:<name>, so the history is queryable with slm recall.

The framework adapters are Python packages that implement each framework's own memory interface on top of the same engine: LangGraph, Semantic Kernel, Microsoft Agent Framework, LangChain, LlamaIndex, CrewAI, AutoGen, Google ADK and OpenAI Agents. They are described on the MCP and integrations page.

SLM Mesh in action, from the Qualixar channel (1:08). Open on YouTube

Written and maintained by , Founder, Qualixar. Last reviewed against the SuperLocalMemory repository and the published papers. Sources: docs/ARCHITECTURE.md, arXiv:2603.14588.

Star on GitHub