Skip to content

Overview

AI agents lose context between sessions. They cannot remember what a user told them last week, build up domain knowledge across conversations, or track how information changes over time.

MemLayer is a persistent memory system for AI agents. It provides an immutable, bitemporal knowledge graph that agents can read from and write to through MCP or a REST API.

When an agent stores a memory, MemLayer extracts entities, classifies them into semantic layers, connects them to existing knowledge, and tracks when each fact was recorded and when it was true in the real world. When the agent recalls something, MemLayer combines vector similarity search with graph traversal to find relevant memories — even ones that don’t directly match the query.

Automatic entity extraction — When content is stored, an LLM breaks it into atomic facts, identifies entities, and determines how each fact relates to existing knowledge.

Semantic search — Memories are embedded as vectors. Recall queries use cosine similarity to find conceptually related memories, not just keyword matches.

Temporal reasoning — Every memory carries two time dimensions: when it was recorded and when it was true in the real world. This lets agents answer “What did I know last Tuesday?” See Bitemporality.

Knowledge graph with semantic layers — Memories are organized in a four-layer hierarchy from abstract domains to specific episodes. This improves recall by providing multiple paths to find information. See Semantic Layers.

Per-agent memory namespaces — Each agent operates in isolation with its own knowledge graph. No cross-contamination between agents.

OperationPurposeDescription
RetainStoreIngest content with automatic entity extraction, deduplication, and relationship creation
RecallSearchFind relevant memories using semantic search, graph traversal, and temporal filtering
ReflectOrganizeAnalyze the knowledge graph to create missing layers, draw inferences, and restructure relationships
ForgetDeleteRemove an entity from active queries so it no longer appears in recall results
┌─────────────────┐
│ AI Agent │
│ (MCP / REST) │
└────────┬────────┘
┌────────▼────────┐
│ MemLayer API │
│ (Haskell) │
└──┬─────┬─────┬──┘
│ │ │
┌────────▼┐ ┌──▼───┐ ┌▼────────┐
│ XTDB │ │Qdrant│ │ LLM APIs│
│(bitemp- │ │(vec- │ │(OpenAI, │
│oral DB) │ │tor) │ │ Groq) │
└─────────┘ └──────┘ └─────────┘
  • XTDB — Bitemporal database for memories, relationships, and graph structure. Every mutation is recorded with transaction time and valid time.
  • Qdrant — Vector database for semantic similarity search.
  • LLM APIs — OpenAI for embedding generation, Groq for LLM inference (entity extraction, layer classification, decision-making).