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 80.50 67.13 65.71
Multi-hop 55.76 51.15 47.19
Temporal 59.38 55.51 58.13
Open-domain 74.55 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.0.tar.gz (241.7 kB view details)

Uploaded Source

Built Distributions

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

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

Uploaded CPython 3.12macOS 11.0+ ARM64

memme-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl (22.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for memme-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7dde703f08808cc3b7c5c6b1dbcf09e8ebee6da3a10d812ce90f22c4879225b0
MD5 21b5fd9ed1edda264c10f7feddb82361
BLAKE2b-256 688df535e87b7fb91ace8129914836e8ce0010de8b62ae853da812c0372f09b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for memme-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8fb80902173133e31d2609ef21c25d3dbe7685dc33bcb642c10a9cd6d6aaa0c7
MD5 c3f4343d5569cd56a46fc592b5ca1dac
BLAKE2b-256 028d824654fb4f730e01697f08c017027e675a3b23dc0780cba9be5a26e9d54e

See more details on using hashes here.

File details

Details for the file memme-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for memme-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4d36e14e7b5ffb9a8dd68db9e33931e05ac96e07f82351a7f147202039f397ad
MD5 36f387356efc9dc0e1128e73578f019b
BLAKE2b-256 d2530aa00d9bf569fed8c9e37e8523439c625b6e5a7efd468740f05e1b461419

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