MCPcopy
hub / github.com/CaviraOSS/OpenMemory

github.com/CaviraOSS/OpenMemory @v1.2.3 sqlite

repository ↗ · DeepWiki ↗ · release v1.2.3 ↗
1,067 symbols 2,765 edges 139 files 76 documented · 7%
README

image

OpenMemory

VS Code ExtensionReport BugRequest FeatureDiscord server

Long‑term memory for AI systems. Self‑hosted. Local‑first. Explainable. Scalable. A full cognitive memory engine — not a vector database. Add Memory to AI/Agents in one line.

demo

🔥 Spread the Word!

    

Why OpenMemory?

Traditional Vector DBs require extensive setup, cloud dependencies, and vendor lock-in:

# The old way: Pinecone + LangChain (12+ lines)
import os
import time
from langchain.chains import ConversationChain
from langchain.memory import VectorStoreRetrieverMemory
from langchain_community.vectorstores import Pinecone
from langchain_openai import ChatOpenAI, OpenAIEmbeddings

os.environ["PINECONE_API_KEY"] = "sk-..."
os.environ["OPENAI_API_KEY"] = "sk-..."
time.sleep(3)  # Wait for cloud initialization

embeddings = OpenAIEmbeddings()
pinecone = Pinecone.from_existing_index(embeddings, index_name="my-memory")
retriever = pinecone.as_retriever(search_kwargs=dict(k=2))
memory = VectorStoreRetrieverMemory(retriever=retriever)
conversation = ConversationChain(llm=ChatOpenAI(), memory=memory)

# Usage (requires explicit chain call)
conversation.predict(input="I'm allergic to peanuts")

OpenMemory needs just 3 lines:

# The new way: OpenMemory (3 lines)
from openmemory import OpenMemory

om = OpenMemory(mode="local", path="./memory.db", tier="deep", embeddings={"provider": "ollama"})
om.add("User allergic to peanuts", userId="user123")
results = om.query("allergies", filters={"user_id": "user123"})
# Returns: [{"content": "User allergic to peanuts", "score": 0.89, ...}]

✅ Zero cloud setup • ✅ Local SQLite • ✅ Works offline • ✅ No vendor lock-in

---

⚡ Standalone Mode (New!)

OpenMemory now works without a backend server. Run the full cognitive engine directly inside your Node.js or Python application.

  • Zero Config: npm install and go.
  • Local Storage: Data lives in a local SQLite file.
  • Privacy: No data leaves your machine.

👉 Read the Standalone Guide

1. Introduction

Modern LLMs forget everything between messages. Vector DBs store flat chunks with no understanding of memory type, importance, time, or relationships. Cloud memory APIs add cost and vendor lock‑in.

OpenMemory solves this. It gives AI systems:

  • persistent memory
  • multi‑sector cognitive structure
  • natural decay
  • graph‑based recall
  • time‑aware fact tracking
  • explainability through waypoint traces
  • complete data ownership
  • MCP integration
  • and much more

OpenMemory acts as the Memory OS for your AI agents, copilots, and applications. On top of this, you can easily migrate from Mem0, Zep, Supermemory to OpenMemory in just one command.


Competitor Comparison

Feature / Metric OpenMemory (Our Tests – Nov 2025) Zep (Their Benchmarks) Supermemory (Their Docs) Mem0 (Their Tests) OpenAI Memory LangChain Memory Vector DBs (Chroma / Weaviate / Pinecone)
Open-source License ✅ Apache 2.0 ✅ Apache 2.0 ✅ Source available (GPL-like) ✅ Apache 2.0 ❌ Closed ✅ Apache 2.0 ✅ Varies (OSS + Cloud)
Self-hosted / Local ✅ Full (Local / Docker / MCP) tested ✓ ✅ Local + Cloud SDK ⚠️ Mostly managed cloud tier ✅ Self-hosted ✓ ❌ No ✅ Yes (in your stack) ✅ Chroma / Weaviate ❌ Pinecone (cloud)
Per-user namespacing (user_id) ✅ Built-in (user_id linking added) ✅ Sessions / Users API ⚠️ Multi-tenant via API key ✅ Explicit user_id field ✓ ❌ Internal only ✅ Namespaces via LangGraph ✅ Collection-per-user schema
Architecture HSG v3 (Hierarchical Semantic Graph + Decay + Coactivation) Flat embeddings + Postgres + FAISS Graph + Embeddings Flat vector store Proprietary cache Context memory utils Vector index (ANN)
Avg Response Time (100k nodes) 115 ms avg (measured) 310 ms (docs) 200–340 ms (on-prem/cloud) ~250 ms 300 ms (observed) 200 ms (avg) 160 ms (avg)
Throughput (QPS) 338 QPS avg (8 workers, P95 103 ms) ~180 QPS (reported) ~220 QPS (on-prem) ~150 QPS ~180 QPS ~140 QPS ~250 QPS typical
Recall @5 (Accuracy) 95 % recall (synthetic + hybrid) 91 % 93 % 88–90 % 90 % Session-only 85–90 %
Decay Stability (5 min cycle) Δ = +30 % → +56 % ✓ (convergent decay) TTL expiry only Manual pruning only Manual TTL ❌ None ❌ None ❌ None
Cross-sector Recall Test ✅ Passed ✓ (emotional ↔ semantic 5/5 matches) ❌ N/A ⚠️ Keyword-only ❌ N/A ❌ N/A ❌ N/A ❌ N/A
Scalability (ms / item) 7.9 ms/item @10k+ entries 32 ms/item 25 ms/item 28 ms/item 40 ms (est.) 20 ms (local) 18 ms (optimized)
Consistency (2863 samples) ✅ Stable ✓ (0 variance >95%) ⚠️ Medium variance ⚠️ Moderate variance ⚠️ Inconsistent ❌ Volatile ⚠️ Session-scoped ⚠️ Backend dependent
Decay Δ Trend Stable decay → equilibrium after 2 cycles TTL drop only Manual decay TTL only ❌ N/A ❌ N/A ❌ N/A
Memory Strength Model Salience + Recency + Coactivation ✓ Simple recency Frequency-based Static Proprietary Session-only Distance-only
Explainable Recall Paths ✅ Waypoint graph trace ✓ ⚠️ Graph labels only ❌ None ❌ None ❌ None ❌ None
Cost / 1M tokens (hosted embeddings) ~$0.35 (synthetic + Gemini hybrid ✓) ~$2.2 ~$2.5+ ~$1.2 ~$3.0 User-managed User-managed
Local Embeddings Support ✅ (Ollama / E5 / BGE / synthetic fallback ✓) ⚠️ Partial ✅ Self-hosted tier ✓ ✅ Supported ✓ ❌ None ⚠️ Optional ✅ Chroma / Weaviate ✓
Ingestion Formats ✅ PDF / DOCX / TXT / MD / HTML / Audio / Video ✓ ✅ API ✓ ✅ API ✓ ✅ SDK ✓ ❌ None ⚠️ Manual ✓ ⚠️ SDK specific ✓
Scalability Model Sector-sharded (semantic / episodic / etc.) ✓ PG + FAISS cloud ✓ PG shards (cloud) ✓ Single node Vendor scale In-process Horizontal ✓
Deployment Local / Docker / Cloud ✓ Local + Cloud ✓ Docker / Cloud ✓ Node / Python ✓ Cloud only ❌ Python / JS SDK ✓ Docker / Cloud ✓
Data Ownership 100 % yours ✓ Vendor / self-host split ✓ Partial ✓ 100 % yours ✓ Vendor ❌ Yours ✓ Yours ✓
Use-case Fit Long-term AI agents, copilots, journaling ✓ Enterprise RAG assistants ✓ Cognitive agents / journaling ✓ Basic agent memory ✓ ChatGPT personalization ❌ Context memory ✓ Generic vector store ✓

Migration

OpenMemory includes a robust migration tool to import billions of memories from other systems.

Supported Providers

  • Mem0 — user-based export
  • Zep — sessions/messages API
  • Supermemory — document export

Example

cd migrate
node index.js --from zep --api-key ZEP_KEY --verify

Installation & Setup (Three Ways)

OpenMemory supports all three usage modes:

  • Node.js SDK (local-first)
  • Python SDK (local-first)
  • Backend Server (web + API)

JavaScript SDK (Local-First)

Install:

npm install openmemory-js

Use:

import { OpenMemory } from "openmemory-js"
const mem = new OpenMemory()
  • Runs fully locally
  • Zero configuration
  • Fastest integration path

Python SDK (Local-First)

Install:

pip install openmemory-py

Use:

from openmemory import Memory
mem = Memory()
  • Same cognitive engine as JS
  • Ideal for LangGraph, notebooks, research

Backend Server (Web + API)

Use this mode for:

  • Multi-user apps
  • Dashboards
  • Cloud agents
  • Centralized org-wide memory

Setup:

``` git clone https://github.

Extension points exported contracts — how you extend this code

VectorStore (Interface)
(no doc) [5 implementers]
backend/src/core/vector_store.ts
VectorStore (Interface)
(no doc) [4 implementers]
sdk-js/src/core/vector_store.ts
StatCardProps (Interface)
(no doc)
dashboard/components/dashboard/StatCard.tsx
MemoryReference (Interface)
(no doc)
dashboard/lib/memory-ai-engine.ts
event (Interface)
(no doc)
dashboard/app/timeline/page.tsx
WindsurfConfig (Interface)
(no doc)
IDE/src/writers/windsurf.ts
ExtractionResult (Interface)
(no doc)
backend/src/ops/extract.ts
OpenMemoryOptions (Interface)
(no doc)
sdk-js/src/index.ts

Core symbols most depended-on inside this repo

get
called by 210
sdk-py/src/openmemory/core/db.py
run
called by 177
sdk-py/src/openmemory/core/db.py
add
called by 102
sdk-js/src/index.ts
all
called by 62
sdk-py/src/openmemory/core/db.py
query
called by 37
sdk-js/src/index.ts
exp
called by 35
migrate/providers/zep.js
tokenize
called by 32
dashboard/lib/memory-ai-engine.ts
num
called by 28
backend/src/core/cfg.ts

Shape

Function 683
Method 253
Interface 72
Class 59

Languages

TypeScript90%
Python10%

Modules by API surface

dashboard/lib/memory-ai-engine.ts97 symbols
sdk-js/src/memory/hsg.ts37 symbols
backend/src/memory/hsg.ts37 symbols
backend/src/memory/embed.ts31 symbols
sdk-py/src/openmemory/__init__.py30 symbols
sdk-js/src/memory/embed.ts27 symbols
sdk-js/src/memory/decay.ts27 symbols
backend/src/memory/decay.ts27 symbols
sdk-py/src/openmemory/core/db.py25 symbols
sdk-js/src/index.ts22 symbols
sdk-py/src/openmemory/core/vector_store.py20 symbols
sdk-js/src/ops/compress.ts20 symbols

Dependencies from manifests, versioned

@ai-sdk/openai1.0.0 · 1×
@aws-sdk/client-bedrock-runtime3.932.0 · 1×
@google/generative-ai0.1.0 · 1×
@heroicons/react2.2.0 · 1×
@hookform/resolvers3.10.0 · 1×
@modelcontextprotocol/sdk1.22.0 · 1×
@radix-ui/react-accordion1.2.2 · 1×
@radix-ui/react-alert-dialog1.1.4 · 1×
@radix-ui/react-aspect-ratio1.1.1 · 1×
@radix-ui/react-avatar1.1.2 · 1×
@radix-ui/react-checkbox1.1.3 · 1×
@radix-ui/react-collapsible1.1.2 · 1×

For agents

$ claude mcp add OpenMemory \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact