Memory

Long-term memory for AI agents using mem0 and graph storage

Memory in Meko gives agents persistent, long-term recall of facts, preferences, and relationships extracted from conversations. Unlike conversation history (which stores raw messages), memory stores derived knowledge - the key facts and entities that an LLM extracts from interactions.

How it works

Memories are created two ways:

  • Explicitly, by calling memory_add (or asking your agent to "remember this") with text you want stored.
  • Automatically, from saved conversation turns. When a turn is saved — through automatic capture in your AI client, or an explicit conversation_add_message call — Meko's extractor scans it server-side for durable facts and creates memories from what it finds, with no extra tool call required.

Either way, Meko does the following with the text:

  1. Extracts entities and relationships from the text using an LLM.
  2. Stores vector embeddings in the vector store for semantic similarity search.
  3. Stores graph relationships in Meko AGE for entity-relationship queries.

This dual storage means memories can be found both by semantic similarity ("find memories about vacation preferences") and by graph traversal ("what entities are related to this user?").

Memory operations

Meko exposes memory tools, including the following.

Add memory

Store a new memory from text.

"I like to take vacations at tropical beach locations, on a budget"

Behind the scenes, this calls memory.add() which extracts entities (user, tropical beaches, budget travel) and stores both vector embeddings and graph edges.

The same extraction runs automatically whenever a conversation turn is saved (see How it works above) — you don't have to explicitly say "remember this" for a fact to become a memory, though doing so is more reliable.

Search memories

Find relevant memories using semantic similarity search. A single search spans the authenticated user's agent namespaces in the selected datapack and returns the top matches with relevance scores. The calling agent_id is retained for trace attribution; it doesn't filter the results.

"What are my vacation preferences?"

This searches both the vector store (pgvector) and the graph store (Meko AGE), combining results for comprehensive recall.

Get memories

Retrieve all memories stored for the authenticated user in a datapack, across the clients that wrote them. This is useful for auditing or displaying a memory dashboard.

Clear memories

Remove memories written under an agent ID, optionally narrowed by run ID. This is a destructive operation - cleared memories cannot be recovered.

Memory vs. conversation history

Memory Conversation History
What's stored Extracted facts and relationships Raw messages (user + assistant)
How it's created LLM extracts from conversations Stored verbatim
Search method Semantic similarity + graph traversal Chronological lookup
Use case "Remember my preferences across sessions" "Show me what was said in the last chat"

Next steps