MemMe — Python SDK
Edge-first AI memory engine for Python. Store, search, and manage long-term memories for AI agents and applications. Powered by an embedded DuckDB database with built-in vector search, BM25 full-text search, knowledge graph, and forgetting curve — all in a single file, no external services required.
Installation
pip install memme
Quick Start
Basic Usage
from memme import MemoryStore
# Local ONNX embeddings (no API key needed)
store = MemoryStore("memory.duckdb")
# Add memories
store.add("User prefers dark mode", user_id="alice")
store.add("User drinks coffee every morning", user_id="alice")
# Search memories
results = store.search("morning routine", user_id="alice", limit=5)
for r in results:
print(r["content"], r["score"])
With OpenAI-compatible Embeddings
store = MemoryStore(
"memory.duckdb",
embedder="openai",
api_key="sk-xxx",
base_url="https://api.openai.com/v1",
embed_model="text-embedding-3-small",
dims=1536,
)
LLM-powered Smart Extraction
Automatically extract structured facts from natural language conversations:
store = MemoryStore(
"memory.duckdb",
embedder="openai",
api_key="sk-xxx",
llm_api_key="sk-xxx",
llm_model="gpt-4o-mini",
)
# Extracts facts: location=Tokyo, activity=learning Japanese
store.add_smart(
"I moved to Tokyo last year and started learning Japanese",
user_id="alice",
)
results = store.search("where does alice live", user_id="alice")
# -> "User moved to Tokyo"
Session and Episode
Organize memories into sessions (conversations) and episodes (meaningful segments):
# Create a session
session = store.create_session(user_id="alice", metadata={"topic": "onboarding"})
# Add messages to the session
store.add_message(session.id, role="user", content="Hi, I'm new here!")
store.add_message(session.id, role="assistant", content="Welcome! Let me help you get started.")
store.add_message(session.id, role="user", content="I prefer dark mode and minimal notifications.")
# Compact session into long-term memories
store.compact_session(session.id)
# Later, search across all memories
results = store.search("user preferences", user_id="alice")
Features
- Edge-first — Runs locally with embedded DuckDB, no external services required
- Single-file storage — Vectors, knowledge graph, FTS index, and history in one
.duckdbfile - Multi-channel retrieval — Vector + BM25 + Entity Graph + Temporal (RRF fusion)
- LLM-powered extraction — Automatic fact extraction with temporal date resolution
- Forgetting curve — Ebbinghaus-inspired memory decay with stability reinforcement
- Privacy controls —
LocalOnly,Syncable,EncryptedSyncper-memory levels - Cross-platform — Python, Node.js, Rust, Swift, WASM
Benchmark (LoCoMo)
| Category | MemMe | mem0 | mem0-graph |
|---|---|---|---|
| Single-hop | 79.43 | 67.13 | 65.71 |
| Multi-hop | 65.73 | 51.15 | 47.19 |
| Temporal | 70.83 | 55.51 | 58.13 |
| Open-domain | 82.28 | 72.93 | 75.71 |
Links
License
Apache-2.0. See LICENSE for details.
Metadata
Release files for memme 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| memme-0.1.1.tar.gz | 249.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| memme-0.1.1-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
Total release size: 20.7 MB
Release files / memme-0.1.1.tar.gz
| Download URL | memme-0.1.1.tar.gz |
|---|---|
| Size | 249.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5a39bdedbc52b357fe3732f2c3cd5454a9d4dc6d65257ffdb3894cbf3cc77b1
|
|
BLAKE2b-256 checksum How to use checksums |
da9a0617d1aad455b60b0612c0755bbb490c6f43b67460102fd219a9c8ed9f20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.12.6
|
Release files / memme-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | memme-0.1.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 20.4 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
97551741ee8c495744386d44abe926d6630b710a834e0d32e333437ac9955923
|
|
BLAKE2b-256 checksum How to use checksums |
c60e5f84bd872831eec81f56126aa554cb869d57e551c83aa501b8660a337efe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.12.6
|