Persistent Memory
for AI Agents
An open-source knowledge graph that gives AI agents long-term memory. Semantic search, time-travel queries, MCP and REST API.
What You Get
Persistent Memory
Conversations, decisions, and context persist across sessions. Agents pick up where they left off without manual state management.
Time-Travel Queries
Query any past state of the knowledge graph with as-of timestamps. Full change history for every memory.
MCP + REST API
Native Model Context Protocol support for LLM tool use. Full REST API for custom workflows and programmatic access.
Self-Hosted
Run on your own infrastructure with file-backed storage. Your data stays on your machine.
How It Works
Three operations. That's the whole API.
Retain
Store memories with automatic entity extraction and deduplication. MemLayer decides whether to create, update, or skip.
Recall
Semantic search across memories with temporal re-ranking. Returns the most relevant context for the current query.
Reflect
Consolidate scattered facts into higher-level concepts. Useful when memory count grows and you want the agent to think in summaries.
Built For
Local Development
Give your coding agent memory that survives between sessions. Works with Claude Code, Codex, Cursor, and any tool that speaks MCP.
Agentic Systems
Multi-step agents that retain state across tasks. Share knowledge between agents in a workflow without brittle handoff mechanisms.
Knowledge Management
Capture institutional knowledge from AI interactions. Time-travel queries provide a full audit trail of what was known and when.
Quick Start
Clone, configure, connect.
git clone https://github.com/alenkis/memlayer.git
cd memlayer
cp .env.example .env # add your OpenAI + Groq API keys
bb local-server claude mcp add memlayer -- bb mcp Works with Claude Code, Cursor, Windsurf, and any MCP-compatible client.
Your agent now has retain, recall, reflect, and forget tools.
Memories persist across sessions automatically.