createrole

9 min read

A survey of agent long-term memory frameworks. How mem0, MemPalace and MemOS store, forget and recall

We read the source of three open-source agent memory frameworks and compared how they write, resolve conflicts, forget and retrieve. All three have converged on time anchoring, lexical channels and provenance. Forgetting is still the least mature part.

  • memory
  • survey
  • agent

In July 2026 we read through the source code of three open-source agent memory frameworks: mem0, MemPalace and MemOS. Conclusions follow the code. READMEs and papers were only used as reference. The three projects happen to sit at three distinct points on the memory design spectrum.

Overview

mem0MemPalaceMemOS
In one lineOne LLM pass extracts facts into a vector store, add-onlyVerbatim text plus a spatial index, zero LLMLLM extraction, graph database, background scheduler
Unit of memorySelf-contained fact (15 to 80 words)800-character verbatim chunk, never summarized or rewrittenThird-person entry plus summary parent nodes in the graph
LLM calls per write10 (all LLM use is opt-in)Up to a dozen in fine mode
ConflictsNot resolved, contradictions coexistNot resolved in the text layer; supersede in the temporal knowledge graphLLM three-way classification, merge and archive
ForgettingNone (decay is a paid platform feature)Text is never deleted, only association strength decaysNo decay, FIFO eviction when a partition fills
RetrievalSemantic, BM25 and entity boost summedVector and BM25 blended, closets only boost, never gateGraph, vector, BM25 and full text in parallel, then rerank

mem0: from LLM-adjudicated updates back to add-only

The widely circulated mem0 design is two LLM calls, one to extract facts and one to decide ADD/UPDATE/DELETE/NONE, plus a Neo4j graph memory. That is the old version. After the v2 to v3 rewrite in late 2025 and 2026, the current open-source release does a single extraction pass, add-only, and graph store support has been removed entirely. The official figures are LoCoMo rising from 71.4 to 91.6 with latency halved. They used real data to reject their own best-known design.

The write pipeline makes one LLM call, and the intelligence lives in an extraction prompt of roughly 470 lines. A few of its instructions are worth noting:

  • Memories should be context-rich, not atomic. The bad example is "User has a dog"; the good one is "User has a dog named Poppy and their morning walks are the highlight of their day".
  • State changes must carry the previous state, such as switching from almond milk to oat milk.
  • Relative time must be converted to absolute dates using the observation date. "User went to Paris last week" is useless six months later.
  • Proper nouns and quantities must not be generalized. "aerial yoga" may not become "yoga".
  • Extract the content of the material, not the act of "user shared material".
  • Exhaustiveness check: ten or more messages should yield 5 to 15 memories; fewer than 3 means re-read.

Before the call, candidate old memories have their UUIDs mapped to small integer IDs like 0 and 1 to prevent hallucination. Deduplication is an exact MD5 hash and only covers the top 10 memories in the retrieval window. With the graph store gone, mem0 extracts entities with spaCy rules and keeps a reverse index from entity to memories, a "poor man's graph" with no typed relationship edges.

Retrieval makes no LLM call. Semantic score, BM25 score and entity boost are summed, and the entity boost penalizes overly general entities by their link count: similarity × 0.5 × 1/(1+0.001(n-1)²).

On forgetting the open-source version has nothing: no TTL, no decay, no access counts, only a date-granularity expiration field. decay, timestamp and summary are paid-platform only. Contradictory old and new memories coexist, and corrections require manual update or delete calls.

MemPalace: text lives forever, intelligence sits in retrieval

MemPalace was created in April 2026 and reached 57.5k stars in three and a half months, making it the hottest local memory project right now. It takes the anti-extraction route. The smallest storage unit is an 800-character verbatim chunk with 100 characters of overlap. A code comment reads "No summaries. Ever."

The metaphor is a memory palace. A wing is a person or project, a room is a topic partition, a drawer is a text chunk, and a closet is a derived pointer index, one line per entry in the form "topic|entities|date:lines→drawer IDs", generated by pure regex. At runtime there is a four-layer injection stack: L0 is an identity file of about 100 tokens that is always loaded, L1 is fifteen key points at about 800 tokens, L2 pulls by wing and room, L3 is full semantic search.

Writes make no LLM call: normalize, chunk on paragraph boundaries, route rooms by keyword score, extract entities by regex, generate closet pointers by regex. IDs are the sha256 of content, so writes are idempotent. The embedding model identity is stored in collection metadata so a model swap cannot pollute the vector space. Because the write path is deterministic, a change of embedding model or chunking strategy can be fully rebuilt. Extraction-based designs cannot do this. Its LongMemEval R@5 is 96.6%, fully local with zero LLM.

The retrieval principle is "closets are a ranking signal, never a gate". Drawer vector search is the floor, closet hits add a boost by rank, then the query terms are grepped in the source to pick the best chunk and attach its neighbors, and finally a blend of BM25 at 0.4 and vector at 0.6 reranks the set.

Forgetting only touches the association layer. Text is never deleted; what decays is connection strength: Hebbian reinforcement on co-access, Ebbinghaus exponential decay, and the Cepeda spacing effect, citing three psychology papers directly. Conflicts are handled in the temporal knowledge graph: triples carry valid_from and valid_to, and supersede closes the old fact and opens the new one atomically. This layer runs on local SQLite, with no cloud graph database.

The limits are the heuristic ceiling. Room routing, closet regexes and memory markers are almost entirely English. The L1 importance field has never been populated, so the "key points" degrade to the most recent 15. Decay in the association layer does not yet feed back into the main ranking.

MemOS: the grandest paper, the heaviest code

MemOS calls itself a "memory operating system". The three memory types in the paper are implemented to very different degrees. Textual memory is complete and is where all the engineering effort went. KV-cache activation memory only saves compute for local HF inference and is off by default. Parametric memory is a pure placeholder; dumping it writes a Placeholder byte string. The MemLifecycle, MemGovernance and MemVault modules from the paper do not exist in the code. They appear only in the prompt text MemOS uses to describe itself.

The most borrowable idea is fast/fine dual-speed writing. Fast mode makes no LLM call and stores the whole window verbatim first to keep latency low. A background scheduler later performs the fine extraction and reclaims the temporary node. The fine-mode extraction prompt is close to mem0's thinking: user perspective, relative to absolute dates, event time separated from message time, completeness over brevity.

Organization is a graph. Background threads find embedding neighbors for each node, an LLM classifies the pair as contradictory, redundant or independent, and an LLM merges them into a new node while the originals are archived. If the merge fails the old node is deleted outright, which is lossy.

WorkingMemory is its most distinctive part: a partition in the graph capped at 20 entries, actively swapped in and out by the background scheduler based on intent recognition. Forgetting equals capacity FIFO: WorkingMemory 20, LongTerm 1500, User 480, with time-ordered eviction above 80%.

The cost is heavy LLM dependence. Extraction, conflict detection, merging, clustering, intent recognition and rerank filtering are all LLM calls, a dozen per write or search in fine mode, with no budget control. Deployment is heavy too. The main path depends on Neo4j enterprise edition or PolarDB.

Where the three routes fundamentally diverge

Intelligence at write time or at read time. mem0 compresses its intelligence into one giant prompt at write time. MemPalace pushes all of it to retrieval, and its write path is a deterministic pipeline that can be replayed indefinitely. MemOS uses LLMs at both ends, with the highest ceiling and the highest cost and fragility.

Three answers to conflict. mem0 gives up and leaves contradictions to the reader. MemPalace splits layers: the text layer stays faithful, the fact layer invalidates explicitly. MemOS arbitrates with an LLM, the most complete answer and the most expensive one.

Nobody has really done forgetting. None of the three has semantic forgetting based on importance or confidence. It is the least mature part of memory systems.

Where all three converged independently:

  1. Relative time must be anchored to absolute dates at write time.
  2. Pure vectors are not enough; all three added a lexical channel and an entity signal.
  3. Integer ID mapping to prevent hallucination, and a fallback that stores the whole passage when parsing fails.
  4. Provenance pointing back to the original evidence.
  5. Graph databases are receding. mem0 dropped Neo4j support, MemPalace runs its temporal graph on SQLite, and only MemOS still leans on a graph store.

How createrole applies this

A createrole digital employee's memory is not a chat log. Material from each turn is deposited first and consolidated in the early hours into six kinds of pages: lessons, events, people, beliefs, procedures and self. Recall is layered: every turn injects a few dated one-line memory hooks, a full page is expanded on demand, and below that sits the diary. The employee also keeps its own notes files, about itself, its relationships and its lessons, each capped at 1500 characters and injected in full every turn. The nightly review rewrites the relationship and lessons files. Forgetting is deliberate: most everyday material is skipped at consolidation and never becomes a page.

Against the three frameworks, our route sits between mem0's flat facts and MemOS's graph organization, and "the conversation is the source evidence, derived artifacts are regenerated when it is deleted" mirrors MemPalace's separation of text layer and fact layer. What we can lift directly: the time anchoring, anti-generalization and previous-state rules from mem0's extraction prompt, plus its penalty formula for overly general entities; and MemPalace's deterministic idempotent writes as a reference for rebuilding derived artifacts. The pitfalls are equally clear: add-only needs conflict resolution on the read side; LLM calls need a budget; capacity FIFO is not forgetting; pure heuristics have a very low ceiling for Chinese.