Skip to content
Systems, agents and memoryWorking system

Verace Mnemos

A six-layer persistent memory server for AI coding agents, with belief revision, trust-weighted retrieval and injection-safe context.

Verace Research·August 8 to August 18, 2026·1 publication
  1. MCP memory server: Exposes the memory engine over the Model Context Protocol
  2. Prompt-injection fence: Marks retrieved text as data, not instructions
  3. SQLite store: The store backend that ships by default
  4. Consolidation cycle: Promotes content upward through the layers
Figure 1. The Mnemos memory server and the parts it works with. Schematic: the MCP memory server at the centre of Verace Mnemos, linked to its store and consolidation cycle, and returning fenced context to agents. The tensor engines remain prototypes.
Open the simulator on its own pageA loop that checks before it commits: an interactive toy model of the principle. You can also try it below

Overview

Verace Mnemos is the lab's persistent memory system for AI coding agents. It addresses one question: how an agent such as Claude Code, Cursor, Codex CLI or Antigravity can keep memory across sessions so that the memory stays ranked, can be revised when facts change, stays isolated per working directory and is safe to place back into a prompt. The system has four parts: a packaged Rust release with a desktop app, the earlier Python memory server it was ported from, a differentiable six-layer memory engine, and a research synthesis that surveys the lab's memory mechanisms and sets out how to merge them.

All parts share one layer plan: sensory (a ring buffer of raw events), working (the session's turns), episodic (task trajectories), semantic (a subject-predicate-object graph), long-term (decaying facts) and procedural (registered skills). In the two servers, a single unified query ranks every layer with one relevance function and returns one context block that marks retrieved text as data. Facts are superseded rather than overwritten. Self-reported signals are discounted by provenance until a separate party verifies them. A consolidation cycle promotes content upward through the layers. The six-layer engine keeps this layer plan but builds each layer from tensor mechanisms: a delta-rule matrix, hyperbolic embeddings, sparse hashing and a unitary hologram.

The packaged release ports the Python server to a Rust workspace with one crate per module. A SQLite store ships by default. A Postgres store with pgvector and Row-Level Security is implemented for later multi-tenant or self-hosted deployment. The MCP server is built on the official Rust SDK for the Model Context Protocol, which is vendored third-party code and makes up much of the source tree. The packaging procedure was verified end to end on Linux. In the Python server's MemFail stress test, a fixed candidate count of four times the result limit missed 52.9% of targets, so the lab made search near-exhaustive for small stores. The six-layer engine's own records mark its sparse hash store as a negative result.

The packaged release is the working system. Its MCP server, hook binary, HTTP API and desktop shell are implemented, with store contract tests and Criterion benchmarks, but no benchmark figures are recorded. The Python server is implemented and tested, and the survey confirmed it as the live memory backend at that time. The six-layer engine and the single-file research engine are prototypes with benchmark harnesses and few recorded outcomes. The engine's documentation claims 100% exact recall, and its code contradicts that claim. The synthesis report's goal, placing the tensor mechanisms underneath the symbolic server, has not been built. The macOS and Windows packages and the Codex and Antigravity hooks are unverified.

Status

Working system. The Rust release is implemented as an MCP server, hook binary, HTTP API and desktop app, with its packaging procedure verified end to end on Linux and with store contract tests and benchmark harnesses, while the tensor engines remain prototypes.

Simulator

An agent runs sixty tasks whose steps sometimes fail. Choose whether each step is checked, how often a step fails and how long the tasks are.

  • pale: worked first time · colour: caught and repeated · white: failed unnoticed · crossed: given up
Tasks finished correctly
59 of 60
Finished with a hidden error
0
Given up after three tries
1
Extra work spent on retries
12%
After each step

Turn the check off: the same failures now finish unnoticed. Lengthen the tasks and see how fast unchecked errors add up.

This simulator is an illustration of the principle, with made-up numbers. It does not run the lab's code or show the lab's data, and nothing in it is a measurement.

Architecture

  1. Six-layer memory model

    Memory is split into sensory, working, episodic, semantic, long-term and procedural layers, each with its own retention scale and store. Every item is namespaced and tagged with a trust level.

  2. Unified query and synthesis

    A single call retrieves from all six layers, ranks the results with one relevance function and returns one fenced context block. Per-layer result caps adapt to the query's intent.

  3. Layered store backends

    The engine calls only per-layer store traits, together with embedder and LLM client traits, so engine tests can run on in-memory fakes. The SQLite backend ships; the Postgres backend with pgvector and Row-Level Security is implemented for later multi-tenant or self-hosted deployment but not exposed in the desktop app.

  4. MCP memory server

    Exposes the memory engine to agents over the Model Context Protocol through stdio or Streamable HTTP on a shared local daemon at port 8765. The design specification lists 16 tools, while the Rust server registers 17 tools, 4 resources and a context-synthesis prompt.

  5. Agent lifecycle hooks

    A hook binary maps host-agent events to memory writes and retrievals. Adapters exist for Claude Code, Codex CLI, Antigravity and, in the Python server, Cursor, of whose hooks only a subset fires in Cursor's command-line tool.

  6. Consolidation and reflection

    A periodic pass promotes salient content upward through the layers, extracts semantic triples, stores long-term facts, writes reflections and then evicts weak items. The MCP server runs this pass every 3 minutes.

  7. Embedding stack

    The default encoder is nomic-embed-text-v1.5, an embedding model published by nomic-ai, run locally through ONNX Runtime at 768 dimensions. A dependency-free hashing embedder is the fallback.

  8. Desktop app and HTTP API

    A Tauri and React desktop shell manages the backend process and shows per-layer views. An Axum HTTP API serves health, query, consolidation and graph export endpoints.

  9. Python reference server

    The earlier implementation of the same six-layer engine. It has SQLite and Postgres backends, a FastAPI dashboard, the MemFail benchmark harness, and an MCP sampling bridge that uses the client's own model for extraction.

  10. Differentiable six-layer engine

    A PyTorch prototype that builds each layer from tensor mechanisms, persists state through a write-ahead log and checkpoints, and includes a bilinear query-key adapter trained with an InfoNCE loss. Its disk-backed episodic store is ported from Verace Episode.

  11. Research synthesis and prototype

    A survey of 11 of the lab's codebases, including the Verace V0 Baseline through Verace V4, Verace Pillar and Verace Episode, which records what each contributes to a unified memory system. It is paired with a single-file prototype engine.

  12. Benchmark harnesses

    Criterion benchmarks compare backends, embedders, per-operation latency and query scaling at store sizes of 100 to 2000. Python harnesses cover MemFail, paper retrieval, a corpus of about 1M words, and adversarial near-duplicate tests.

Implementation

Mechanisms as they are implemented in the source code, with the constants the code uses.

Ebbinghaus retrievability with reinforcement
Long-term items decay as R=exp⁡(−Δt/max⁡(0.1, h(1+0.25n)))R = \exp(-\Delta t / \max(0.1,\, h(1 + 0.25 n))), where Δt\Delta t is days since last retrieval, hh is the half-life with a default of 30 days, and nn is the retrieval count. Pinned items and items with importance of at least 0.95 keep R=1R = 1. Long-term ranking uses 0.7cos⁡+0.3R0.7 \cos + 0.3 R, and items below a retrievability floor are evicted before count caps apply.
Fused cross-layer relevance score
Each candidate scores s=0.5cos⁡+0.25e−a/7+0.25 I d+b+0.05vs = 0.5 \cos + 0.25 e^{-a/7} + 0.25\, I\, d + b + 0.05 v. Here aa is age in days, II is importance, dd is the trust discount, bb is a proximity bonus of 0.15 when a semantic node's subject or object appears in the last 3 working turns, and vv is 1 for verified items. Similarity and recency are never discounted.
Provenance trust discount
Self-reported importance, reward, confidence and success rate are multiplied by a discount by source: system and user 1.0, tool 0.9, agent inferred 0.7, external 0.4. Only a party other than the writer can mark an item verified, which restores full weight. Skills rank by cos⁡⋅success⋅d\cos \cdot \text{success} \cdot d, with d=1d = 1 when verified.
Non-destructive bitemporal belief revision
A new object for an existing subject and predicate, or a new fact for an existing key, sets the old record to is_active = 0 with superseded_by or defeated_by_id and valid_until set to the current time. A repeated identical fact reinforces confidence to the maximum of the old and new values. History stays available for belief-history and as_of queries, which select records created at or before tt whose validity has not ended by tt.
Hybrid semantic retrieval with RRF
Three ranked lists are fused by reciprocal rank fusion, ∑i1/(60+ri)\sum_i 1/(60 + r_i): a vector nearest-neighbour list, a keyword list that also matches a 4-character prefix on words of at least 3 characters, and a list from Personalized PageRank plus 2-hop neighbours of seed nodes. The differentiable engine's variant multiplies episodic and long-term terms by a staleness factor 1/(1+a/30)1/(1 + a/30) and a Hebbian boost 1+0.1log⁡(1+n)1 + 0.1 \log(1 + n).
Causal entailment and contradiction flags
Over causal predicates such as CAUSES, TRIGGERS and DEPENDS_ON, the triples A to B and B to C yield a composite triple (A, CAUSAL_ENTAILS, C) with confidence min⁡(1,c1c2)\min(1, c_1 c_2), and composites are not chained further. A table of antonym predicates, such as LIKES and HATES, flags an active pair with the same subject and object as a suspected contradiction for review. The flag never resolves the conflict automatically.
Working memory decay and compression
Turn ii of nn gets attention weight max⁡(0.1, 0.95n−1−i)\max(0.1,\, 0.95^{n-1-i}), while system and pinned turns stay at 1.0. When a namespace exceeds 85% of an 8192-token budget, all turns except the first and last 3 are collapsed into one summary item built from 100-character snippets.
REM-sleep consolidation stages
Per namespace, consolidation runs five stages in order: sensory items with saliency of at least 0.5 move to working memory, then into episodes, then into extracted triples, then into long-term facts when confidence is at least 0.8. Eviction runs last so that freshly promoted data survives the cycle. A triple from the LLM is accepted only if its quoted source text, or its subject and object words, appear in the source text. Reflection keys use the first 16 hex characters of a SHA-256 hash of the insight, so a repeated insight supersedes the old one instead of duplicating it.
Prompt-injection fence
Retrieved content is escaped and wrapped in trust-labelled memory tags that carry a source layer and id. The block is preceded by a notice that declares the contents data, not instructions. Truncation removes whole lines so that no tag is left unclosed.
Row-Level Security tenant isolation
Every tenant query runs in a transaction that first sets the transaction-local setting app.current_namespace. Forced RLS policies then require the row's namespace to equal that setting, and the memory_app role cannot bypass them. Because a global preload is forbidden, the Postgres store loads each namespace into its write-through cache on first access.
Local embedding pipeline
The ONNX embedder prepends 'search_document: ' to stored text and 'search_query: ' to queries, pads each batch to its longest item up to 512 tokens, applies attention-masked mean pooling, and L2-normalises with epsilon 1e-12. The fallback hashing embedder hashes lowercased words and character trigrams with SHA-256 into a signed 256-dimensional accumulator. A file-lock semaphore allows 3 concurrent embedding jobs by default.
pgvector HNSW index
Each Postgres table indexes its embedding column with HNSW using cosine distance, with m = 16 and ef_construction = 128. Similarity is computed as one minus the cosine distance. The Python server routes in-process search to a brute-force cosine scan when kk reaches 30% of the corpus.
Time-decayed delta rule
Working memory in the differentiable engine is a matrix updated as Mt=γmin⁡(Δt,10)Mt−1+η(v−Mk)k⊤M_t = \gamma^{\min(\Delta t, 10)} M_{t-1} + \eta (v - M k) k^{\top}, with η=0.5\eta = 0.5 and γ=0.98\gamma = 0.98. Δt\Delta t is the wall-clock seconds since the last write in the namespace, and kk and vv are norm-clipped. A batch-averaged SVD of MM promotes left singular vectors with singular value above 0.1 into semantic and long-term memory.
Poincare retrieval and Gram-Schmidt retraction
Embeddings are mapped into the unit ball by tanh⁡(0.1x)\tanh(0.1 x) and ranked by hyperbolic distance with curvature c=1c = 1, and distance is converted to confidence 1/(1+d)1/(1 + d). When a new fact vector has cosine below −0.6-0.6 with the old one, it is orthogonalised as v⊥=normalize(v−v⋅e∥e∥2e)v_{\perp} = \mathrm{normalize}(v - \frac{v \cdot e}{\|e\|^2} e), and the old triples are deleted.
Dentate-gyrus sparse hashing
A fixed seeded Gaussian projection maps a vector to 2048 dimensions. Top-24 winner-take-all and ReLU follow, and the 8 most active dimensions form a bucket address. Lookup reads the primary bucket plus 4 near-miss probes from sharded disk files and reranks the candidates by exact cosine. A companion SimHash store uses 32 tables of 8 hyperplane bits, with a per-bit match probability of 1−θ/π1 - \theta/\pi.
Modern Hopfield cleanup
A noisy query is cleaned by iterating v←normalize(X⊤softmax(βXv))v \leftarrow \mathrm{normalize}(X^{\top} \mathrm{softmax}(\beta X v)) over the stored normalised memories XX, with β=8\beta = 8, for 2 steps. This follows the continuous Hopfield retrieval of Ramsauer et al.
Newton-Schulz unitary hologram
The long-term hologram H∈CD×DH \in \mathbb{C}^{D \times D} is initialised unitary by QR decomposition of complex noise. Every 10 forward calls it is divided by its spectral norm if that norm exceeds 1, then retracted by Hk+1=12Hk(3I−HkHHk)H_{k+1} = \tfrac{1}{2} H_k (3I - H_k^{H} H_k) for 5 steps.
Decayed fast-weight procedural update
Each namespace holds a weight matrix updated as W←0.99(W−η ex⊤)W \leftarrow 0.99 (W - \eta\, e x^{\top}) with η=0.01\eta = 0.01, then clipped to a Frobenius norm of at most 10. The procedural output bias is xW⊤x W^{\top}.

Results

From the lab's own experiments and records. They have not been independently replicated.

  1. Fixed candidate count capped recall

    In the lab's MemFail stress test, an in-process search with kk set to four times the result limit missed 52.9% of targets. Search now uses kk equal to the corpus size up to 2000 episodic or 5000 long-term items, and a larger bounded kk beyond that.

  2. Sparse hash episodic store is a negative result

    The differentiable engine's records mark the dentate-gyrus hash store as a negative result. Its bucket addresses work for near duplicates but are discontinuous for paraphrases.

  3. Hopfield cleanup collapses near duplicates

    The code notes that the Hopfield attractor step pulls queries toward cluster centroids when stored memories are near duplicates. The adversarial harness tests this on clustered embeddings with 50 clusters.

  4. Exact recall claim not supported by the code

    The differentiable engine's documentation claims 100% exact recall from its episodic layer, while its own code documents that layer as failing on paraphrases. The baseline the benchmarks call FAISS is a brute-force cosine scan and does not use the FAISS library.

  5. The two unified candidates were disjoint

    The lab's survey confirmed that the Python server was the live MCP backend, with all 16 tool names and schemas matching. The differentiable engine's server is a hand-written 6-tool loop with different names, and it has no SQL storage, trust model or injection fencing.

  6. Remaining work is integration, not invention

    The synthesis report concludes that almost every mechanism needed for one unified memory system already works in isolation across the lab's codebases. What remains is to wire the tensor mechanisms underneath the symbolic server.

  7. Gram-Schmidt retraction does not reject contradictions

    The synthesis report notes that the draft retraction orthogonalises a contradicting fact silently instead of rejecting it, and rates it weaker than the alternative it surveyed.

  8. Packaging procedure verified on Linux only

    The packaging documentation records the packaging procedure as verified end to end on Linux. The macOS and Windows steps are written from documented Tauri behaviour and have not been run.

  9. pgvector must be built without native flags

    The packaged release builds pgvector with an empty OPTFLAGS, because the default -march=native produced binaries that crash on other CPUs.

  10. HNSW performance figures are unmeasured annotations

    The Postgres schema comments claim about 0.97 recall@10 and about 3ms P99 latency at 1M rows. The lab's records contain no measurement of these figures.

Concepts

Model Context Protocol
An open protocol through which agents call external tools, read resources and use prompts. Verace Mnemos exposes its memory as MCP tools such as unified query, semantic upsert, verify memory and query as of.
Truth maintenance system
A store that records which beliefs defeat which, instead of overwriting them. Verace Mnemos uses it so that a revised fact keeps its full history.
Bitemporal memory
Each record carries both when it held in the world and when the system believed it. This allows queries about what memory contained at a past time.
Reciprocal rank fusion
A way to merge ranked lists by summing 1/(k+r)1/(k + r) over each list. It depends only on rank positions, not on raw scores, so lists with different score scales can be combined.
Personalized PageRank
A random walk on the semantic graph that restarts at seed nodes found by the query. It ranks facts by graph proximity to those seeds.
Ebbinghaus forgetting curve
Exponential loss of recall over time. Verace Mnemos uses it to compute retrievability, and each retrieval lengthens the half-life by 25%.
Provenance trust levels
Every memory is tagged by its source: system, user, tool output, agent inferred or external untrusted. Self-reported strength is discounted by this tag until a separate reviewer verifies the item.
Prompt-injection fencing
Retrieved memory may contain text that reads like instructions. The system escapes it and labels it as untrusted data before it reaches the model.
Row-Level Security
A Postgres feature that filters rows inside the database by a policy. Verace Mnemos uses it to isolate namespaces instead of relying on filters in application code.
Shared namespace convergence
The hook, MCP and HTTP binaries all open the same database file and derive the namespace from the normalised working directory. Memory written by any of them therefore lands in one place.
Fail-open hooks
A hook that fails or exceeds its 7 second internal timeout logs to stderr, prints an empty JSON object and exits 0. A memory fault therefore never blocks the host agent.
Primary with heuristic fallback
A recurring design rule in the servers: use the LLM, the transformer embedder or the ANN index when available, and fall back to a deterministic heuristic when it fails or returns nothing.
MCP sampling bridge
In the Python server, extraction and reflection call the connected client's own model through MCP sampling, so the server needs no API key of its own.
Intent-adaptive budgets
The detected intent of a query sets per-layer result caps. For example, preference queries favour long-term memory with a cap of 25, and a caller's own limit can only lower the caps.
Pattern separation
The idea, taken from the dentate gyrus, that sparse high-dimensional codes keep similar inputs apart. The differentiable engine uses a fixed random projection to implement it.
Poincare ball
A model of hyperbolic space inside the unit ball, in which tree-like hierarchies embed with low distortion. The differentiable engine places semantic facts in it.
Delta rule
The Widrow-Hoff update, which writes into a matrix memory only the error between the stored and the target value. Repeated writes of the same pair drive that error down geometrically.
LLM as CPU, memory as hierarchy
A framing in the synthesis report: the context window acts as registers, and the six layers map to cache, RAM and disk tiers.
Memory controller
A per-turn scheduler designed in the synthesis report. It would fuse candidates by RRF and admit a working set under a token budget by greedy knapsack. It exists only as a design.

Publications

About this page

Written from the lab's own documents and source code. Figures and results are the lab's measurements as it recorded them at the time, and have not been independently replicated.

Published under the PolyForm Noncommercial License 1.0.0: free for noncommercial use.