Skip to main content

Edge-first AI memory engine powered by DuckDB

Project description

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.

PyPI License

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 .duckdb file
  • 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 controlsLocalOnly, Syncable, EncryptedSync per-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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memme-0.1.1.tar.gz (249.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

memme-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (20.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file memme-0.1.1.tar.gz.

File metadata

  • Download URL: memme-0.1.1.tar.gz
  • Upload date:
  • Size: 249.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for memme-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c5a39bdedbc52b357fe3732f2c3cd5454a9d4dc6d65257ffdb3894cbf3cc77b1
MD5 47d1cbef6e38c5218f9e8e937a6a0c7a
BLAKE2b-256 da9a0617d1aad455b60b0612c0755bbb490c6f43b67460102fd219a9c8ed9f20

See more details on using hashes here.

File details

Details for the file memme-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for memme-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 97551741ee8c495744386d44abe926d6630b710a834e0d32e333437ac9955923
MD5 242850b6f057099ff7af0743bda8d0f3
BLAKE2b-256 c60e5f84bd872831eec81f56126aa554cb869d57e551c83aa501b8660a337efe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page