Overview
MemoryLayer is an API-first memory infrastructure for LLM-powered agents. It solves the fundamental challenge of stateless LLMs by providing persistent, queryable, multi-modal memory that agents can read from and write to during execution.
What is MemoryLayer?
MemoryLayer provides cognitive memory capabilities for AI agents, including episodic, semantic, procedural, and working memory with vector-based retrieval and graph-based associations.
Think of it as a memory backend for your AI applications — the same way you’d use PostgreSQL for relational data or Redis for caching, you use MemoryLayer for agent memory.
Key Features
- Cognitive Memory Architecture — Episodic, semantic, procedural, and working memory types modeled after human cognition
- Hybrid Retrieval — SQLite + sqlite-vec vector search fused with keyword search; works out of the box with the dependency-free
hashembedder, and upgrades to real semantic embeddings via a CPU or GPUmemorylayer-embed-serverpeer or cloud providers (OpenAI / Google) - Entities & Perspective — Canonical entity registry with aliases and provenance, plus observer/subject representations of what one party knows about another
- Knowledge Graph — 85 typed relationships across 12 categories (causal, solution, learning, workflow, hierarchical, etc.) connecting memories into a traversable semantic graph
- Context Environment — Server-side Python sandbox with RLM (Recursive Language Model) so heavy memory analysis doesn’t consume the agent’s context window
- Session Management — Working memory with TTL, token-budget-aware extraction triggers, and commit to long-term storage
- Multi-Platform SDKs — Python, TypeScript, and Go client libraries
- Framework Integrations — Drop-in support for LangChain, LlamaIndex, Claude Code (plugin + MCP), OpenCode (plugin + MCP), Codex (plugin + MCP), and OpenClaw
- Repository Planning Graph — Optional
memorylayer-server-rpgplugin for code-structure graphs, overlays, and conflict detection - MCP Server — 28 tools in the default profile (40 in
full) for Claude Code, Claude Desktop, Cursor, and other MCP-compatible LLMs - REST API — FastAPI-based HTTP server with OpenAPI documentation
Architecture Overview
┌─────────────────────────────────────────────────────────────┐│ Agent Frameworks (LangChain, LlamaIndex, Claude Code) │├─────────────────────────────────────────────────────────────┤│ Client SDKs (Python, TypeScript, Go) │├─────────────────────────────────────────────────────────────┤│ MemoryLayer Server (REST API; MCP via separate package) │├─────────────────────────────────────────────────────────────┤│ Storage (SQLite + sqlite-vec) │└─────────────────────────────────────────────────────────────┘Editions
MemoryLayer comes in three open-source editions that share the same client SDKs:
| Edition | License | What it is |
|---|---|---|
| MemoryLayer (core) | Apache-2.0 | The server, SDKs, MCP server, embed server, and agent-host plugins. SQLite storage, self-hosted. |
| MemoryLayer Enterprise | AGPL-3.0 | The production edition: PostgreSQL + pgvector + Apache AGE, document ingestion at scale, datasets, data connectors, tiering, and an admin dashboard. |
| MemoryLayer Storage | AGPL-3.0 (Python client Apache-2.0) | Content-addressed blob storage, an S3 gateway, a FUSE filesystem, and a Kubernetes CSI driver. |
All three are self-hosted. See Editions & Licensing for details. The rest of Getting Started covers the core.
Packages
| Package | Install | Description |
|---|---|---|
| Server | pip install memorylayer-server | FastAPI server with SQLite storage |
| RPG plugin | pip install memorylayer-server-rpg | Repository Planning Graph (/v1/rpg) |
| Python SDK | pip install memorylayer-client | Async Python client library |
| TypeScript SDK | npm install @scitrera/memorylayer-sdk | TypeScript/JavaScript client |
| Go SDK | go get github.com/scitrera/memorylayer/memorylayer-sdk-go | Go client |
| MCP Server | npm install @scitrera/memorylayer-mcp-server | Model Context Protocol integration |
| LangChain | pip install memorylayer-langchain | LangChain memory backend |
| LlamaIndex | pip install memorylayer-llamaindex | LlamaIndex chat store |
Quick Example
from memorylayer import MemoryLayerClient, MemoryType
async with MemoryLayerClient(base_url="http://localhost:61001") as client: # Store a memory memory = await client.remember( content="User prefers Python for backend development", type=MemoryType.SEMANTIC, importance=0.8, tags=["preferences", "programming"] )
# Recall memories results = await client.recall( query="What programming languages does the user like?", limit=5 )
# Synthesize insights reflection = await client.reflect( query="Summarize user's technology preferences" ) print(reflection.reflection)Next Steps
- Editions & Licensing — Core, Enterprise, and Storage, and how they fit together
- First 10 Minutes — Store and recall your first memories
- Installation — Install the server and your preferred SDK
- Core Concepts — Understand memory types, workspaces, and associations
- Python SDK Quick Start — Build your first memory-powered application
- TypeScript SDK Quick Start — Get started with TypeScript