Skip to content
MiraiTech
AI Lab

Experiment · Agents

Agent memory

Research into how agents can keep useful memory over months. Episodic memory stores conversations with an importance score, semantic memory stores extracted facts and relationships, and procedural memory stores learned preferences. A forgetting curve stops the store from growing without limit.

Type
Agents
Status
Research
Models
Claude Sonnet, all-MiniLM-L6

Results

  • 3 memory types
  • Ebbinghaus forgetting curve
  • Graph-based retrieval

Over 100 simulated sessions, the store settled at about 800 active entries, compared with 12,000 without decay. Retrieval latency stayed under 100ms. Preference accuracy reached 89% by session 20. Cross-conversation reasoning succeeded on 73% of the synthesis questions. A panel of 15 evaluators rated memory-augmented responses 4.2/5 and responses without memory 3.1/5.

What we tested

Most AI agents forget everything between conversations. This experiment gives an agent three kinds of memory, loosely modeled on human memory: episodic (what happened), semantic (what is true) and procedural (how to do things). Memories decay along an Ebbinghaus forgetting curve, so important information stays and irrelevant details fade.

Method

We built three memory stores and tested retention over 100 simulated conversation sessions spanning 30 days. Episodic memory stores full conversation turns with an importance score (1-10) based on user engagement signals. Semantic memory extracts facts and entity relationships into a Neo4j knowledge graph. Procedural memory records action patterns and user preferences. Decay follows the Ebbinghaus forgetting curve, R = e^(-t/S), where the stability S increases with each successful retrieval.

Findings

  1. 01

    Decay keeps the memory store small

    Without decay, the store grew to 12,000 entries after 100 sessions and retrieval became 4x slower. With Ebbinghaus decay, active memory settled at about 800 high-value entries and retrieval stayed under 100ms.

  2. 02

    Semantic memory connects conversations

    With entities and relationships in a knowledge graph, the agent could answer questions that draw on several conversations, such as "What tools does this user prefer for Python projects?", by traversing preference nodes.

  3. 03

    Procedural memory cut repeated instructions by 60%

    Once the agent learned that a user prefers TypeScript to JavaScript and pytest to unittest, it stopped asking clarifying questions about them.

  4. 04

    Importance scoring was the hardest part

    Deciding automatically which memories matter is hard. The best heuristic we found combined explicit signals (user corrections, repeated mentions) with implicit ones (conversation length, follow-up questions).

How it is built

Each conversation goes through three phases. Retrieval: relevant episodic, semantic and procedural memories are fetched using the current query embedding and recency. Generation: the retrieved memories are added to the system prompt, weighted by recency and importance. Consolidation: after the conversation, new episodic entries are written, facts are extracted into the knowledge graph and procedural patterns are updated. A nightly job lowers the stability scores of memories that were not retrieved.

pgvector stores episodic memories and retrieves them by embedding. Neo4j holds the semantic knowledge graph as entity-relationship triples. LangGraph manages the memory lifecycle (encode, consolidate, retrieve, decay). The forgetting curve is implemented in Python with configurable stability parameters.

  • Python
  • pgvector
  • NetworkX
  • LangGraph
  • Neo4j

Problems we hit

Contradicting memories

When a user changes a preference, old memories contradict the new one. Newer memories take precedence over older ones. When a contradiction is detected, the outdated entry is marked for faster decay.

Deleting specific memories

Users need to be able to delete specific memories ("forget our address"). A targeted deletion API removes the entries from all three memory stores and propagates the deletion through the knowledge graph.