CraniMem: Neurocognitive Memory Architecture
- CraniMem is a neurocognitive memory system that integrates a bounded episodic buffer with a structured long-term knowledge graph for controlled memory retention.
- It employs goal-conditioned gating and utility tagging to filter, score, and prioritize inputs, enhancing memory consolidation and distractor resistance.
- Empirical results demonstrate improved F1 scores under noise and selective forgetting, albeit with trade-offs in processing latency.
CraniMem is a neurocognitively motivated memory architecture for long-running LLM agents that separates transient and durable memory into a bounded episodic buffer and a structured long-term knowledge graph, coupled by goal-conditioned gating, utility tagging, scheduled consolidation, and selective forgetting. It was introduced to address recurrent failures in agent memory stacks that behave like external databases with ad hoc read/write rules, notably unstable retention, limited consolidation, vulnerability to distractors, and effectively unbounded growth (Mody et al., 3 Mar 2026).
1. Problem setting and conceptual basis
CraniMem is designed for agentic systems that must preserve user state, task constraints, plans, and relevant facts across many turns, tools, and possibly multiple agent roles. In this setting, the paper frames memory as a control problem: what should be stored, when should it be promoted, what should be forgotten, and what should be surfaced back to the model later. The motivating claim is that many existing memory systems store too much with heuristic write rules, fail to stabilize important information through consolidation, allow distractor content to interfere with retrieval, and permit memory growth to expand without principled control (Mody et al., 3 Mar 2026).
The architecture is explicitly grounded in two neurocognitive principles. The first is attentional gating, under which low-salience or irrelevant input should be suppressed before encoding. The second is systems consolidation, under which selected experiences from a fast episodic store should be replayed into a slower semantic store. In CraniMem’s design, these analogies map to a goal-conditioned gate, a bounded episodic buffer, a long-term knowledge graph, a scheduled replay loop, and pruning. The system diagram further names a “RAS Filter,” reinforcing the attentional-filtering analogy.
This framing is significant because CraniMem does not treat memory as a single persistent store. Instead, it formalizes memory as a multi-stage pipeline in which encoding, promotion, forgetting, and retrieval are distinct operations with explicit control signals. A plausible implication is that long-horizon agent quality depends not only on retrieval quality, but also on disciplined write-time selection and boundedness.
2. Architectural components
The first component is goal-conditioned gating. For a new user message and current goal or state , CraniMem computes semantic relevance using an embedding model :
If , the input is discarded. The implementation is not purely vector-based: Appendix prompts describe a high-similarity “Reflex Utility” path and a low-similarity “Cortex Gate” path that can still recognize commands, goal changes, or relevant context shifts. The gating prompt returns JSON containing is_noise, priority_score, entities, and reasoning (Mody et al., 3 Mar 2026).
The second component is utility tagging. Inputs that pass the gate are scored along three scalar dimensions: importance, surprise, and emotion. These are combined as
The prompts define each factor on . The utility tagger also extracts entities for later replay prioritization and graph construction.
The third component is the bounded episodic buffer, a FIFO store over the most recent turns. Each entry contains the raw snippet, timestamp, turn id, extracted entities, and utility metadata. This store is explicitly high-fidelity and short-range rather than durable.
The fourth component is the structured long-term knowledge graph. Long-term memory is not a flat vector store. Selected traces are converted into typed entities and typed relations, then merged into the graph. The extraction schema includes entity types Project, Issue, Task, Person, Tool, Feature, Location, Date, and Other, with relation records of the form {source, relation, target}. Repeated facts are reinforced through upsert and merge rather than duplicated.
The fifth component is the scheduled consolidation loop. Consolidation is triggered every turns or during idle states. For each episodic item , the paper defines
0
Promotion occurs only when
1
Low-utility traces are pruned instead of promoted.
3. Memory lifecycle and control flow
CraniMem’s operational cycle begins when a new interaction arrives. The message is evaluated against the current goal by the similarity gate. Messages below 2 are discarded immediately. Surviving messages undergo LLM-mediated gating and utility analysis, which can recognize cases such as commands, goal changes, and relevant context shifts even when similarity alone is insufficient.
Accepted traces enter the episodic buffer together with timestamp, turn id, entities, and utility metadata. Because the store is bounded to the most recent 3 turns, older items are evicted as needed. This means boundedness is enforced at write time, not retrospectively.
At consolidation time, CraniMem scans episodic memory and computes replay scores. High-scoring traces are transformed into graph structure through entity and relation extraction, then inserted via merge or upsert. Low-value traces are discarded. The paper summarizes this as selective forgetting via importance weighting and temporal decay, although the concrete implementation is expressed mainly through utility scoring, replay scoring, bounded FIFO eviction, and thresholded promotion (Mody et al., 3 Mar 2026).
During generation, retrieval is dual-path. The agent retrieves from the episodic buffer for short-range continuity and from the knowledge graph for long-range semantic recall. The two streams are merged into a compact context block that conditions the LLM. This dual retrieval path is central to the design: recent conversational continuity and durable semantic memory are represented separately, then reassembled only at inference time.
4. Long-term knowledge graph and retrieval semantics
CraniMem’s long-term store is intended for user preferences, constraints, stable plans, and semantically organized facts. The paper emphasizes that the graph stores distilled relational structure rather than raw dialogue history. The extraction prompt requires that only facts supported by the text be included, that specific named-entity-rich information be preferred, and that generic common-sense statements be skipped (Mody et al., 3 Mar 2026).
This graph representation is important because repeated facts strengthen existing structure rather than generating redundant text chunks. The paper states that graph traversal supports multi-hop retrieval, which the authors argue is difficult for flat vector stores. The long-term store therefore functions as a semantic memory rather than as a passive archive.
A plausible implication is that CraniMem’s retrieval behavior is less sensitive to raw chunk proliferation than systems that keep accumulating undifferentiated text. That interpretation is consistent with the architecture’s explicit merge/upsert semantics, bounded episodic retention, and thresholded consolidation, although the paper does not provide a formal graph-weight update equation.
5. Empirical evaluation and robustness under noise
CraniMem is evaluated on a sample of 100 instances drawn from the HotpotQA validation split, using both clean inputs and a noisy condition in which irrelevant distractor snippets are injected into the write stream. The main baselines are Vanilla RAG and Mem0, and the primary comparison uses Qwen2.5-7B-Instruct. Reported metrics are precision, recall, F1, and latency. Robustness is summarized by
4
Lower 5 indicates smaller degradation under distraction (Mody et al., 3 Mar 2026).
| System | F1 (clean / noisy) | Latency (clean / noisy) |
|---|---|---|
| Vanilla RAG | 0.095 / 0.068 | 68.146 s / 58.968 s |
| Mem0 | 0.234 / 0.198 | 2.191 s / 10.387 s |
| CraniMem | 0.323 / 0.312 | 53.977 s / 112.440 s |
The noise-drop values are 0.027 for Vanilla RAG, 0.036 for Mem0, and 0.011 for CraniMem. On this benchmark, CraniMem has the highest clean and noisy F1 and the smallest degradation under distractors. Relative to Mem0, noisy F1 increases from 0.198 to 0.312; relative to Vanilla RAG, it increases from 0.068 to 0.312.
The paper also reports cross-backbone behavior. For Gemma-2-9B-IT, CraniMem achieves noisy F1 = 0.323 with noise drop = 0.015, whereas Vanilla RAG has noise drop = 0.160. For Qwen2.5-Coder-7B-Instruct, CraniMem has near-zero noise drop = 0.004 versus 0.079 for Vanilla RAG. The reported pattern is that CraniMem improves noisy-condition behavior across several instruction-tuned backbones while reducing sensitivity to distractor injection.
6. Trade-offs, implementation status, and limitations
The principal trade-off reported for CraniMem is latency. The paper attributes the higher runtime to the added complexity of gating, utility tagging, consolidation, and knowledge-graph storage. On the main Qwen2.5-7B-Instruct comparison, CraniMem is substantially slower than Mem0 and slower than Vanilla RAG in the noisy condition, even though it is more robust. The architecture therefore appears optimized for stability and interference control rather than raw throughput (Mody et al., 3 Mar 2026).
The implementation is partially specified. Consolidation is triggered every 6 turns or during idle states. The episodic store is bounded to the most recent 7 turns. The paper names several hyperparameters—8, 9, 0, 1, and 2—but does not provide their concrete numeric values in the supplied text. It also provides detailed prompt roles for gating, utility tagging, reflex utility, cortex gating, entity–relation extraction, and answer generation. Code is available at https://github.com/PearlMody05/Cranimem, and the accompanying PyPI package is https://pypi.org/project/cranimem.
The stated limitations are clear. The evaluation uses only 100 sampled instances. The paper does not report systematic ablations. It notes the need for broader standardized comparisons, including against HippoRAG and Mem0 under standardized settings. Several graph-update and storage details remain high-level rather than formally specified, and memory efficiency is argued mainly as an architectural property rather than through explicit storage-footprint measurements. In that sense, CraniMem should be understood as a bounded, selective, multi-stage memory design whose main empirical contribution is robustness under distraction, with higher latency as the principal observed cost.