Skip to main content

Meminumb

Lightweight, reliable memory layer for AI agents.

Meminumb stores facts about users across sessions so your AI agent can remember context — with two guarantees that common libraries miss:

  1. Atomic writes — a failure never leaves orphaned data behind
  2. Explicit outcomes — add() always tells you what happened to every fact, and why

The problem Meminumb solves

Most AI memory libraries swallow failures silently. If your database write partially succeeds, you get orphaned entries and duplicate facts on retry. And if a fact is skipped (duplicate, embed error), you never find out why.

Meminumb fixes this by design:

Feature Meminumb Typical library
Atomic writes (no orphaned data) ✅ ❌
Explicit outcome per fact ✅ ❌
Content-addressed IDs (idempotent) ✅ ❌
Zero mandatory external deps ✅ ❌
Pluggable embedders ✅ varies

Install

pip install meminumb                    # core only (SQLite, no embeddings API)
pip install "meminumb[local]"           # + sentence-transformers (offline)
pip install "meminumb[openai]"          # + OpenAI embeddings API
pip install "meminumb[dev]"             # + pytest, ruff (for contributors)

Quickstart

from meminumb import Memory

mem = Memory()   # uses offline DummyEmbedder by default

result = mem.add(
    ["Alice prefers dark mode", "Alice is a backend developer"],
    user_id="alice",
)
print(result)
# AddResult(stored=2, skipped=0, failed=0)

# Try adding a duplicate
result2 = mem.add(["Alice prefers dark mode"], user_id="alice")
print(result2)
# AddResult(stored=0, skipped=1, failed=0)

skip = result2.skipped[0]
print(skip.reason, skip.existing_id)
# SkipReason.DUPLICATE  3f2a1b8e...

# Search
hits = mem.search("what does Alice like in her editor?", user_id="alice")
print(hits[0].content)
# Alice prefers dark mode

With local embeddings (semantic search, offline)

from meminumb import Memory
from meminumb.embedder import LocalEmbedder

mem = Memory(embedder=LocalEmbedder())   # downloads ~90 MB model on first run
mem.add(["Bob enjoys hiking on weekends"], user_id="bob")
hits = mem.search("outdoor activities", user_id="bob")
print(hits[0].content)
# Bob enjoys hiking on weekends

API reference

Memory(store=None, embedder=None, db_path=":memory:")

Parameter Default Description
store SQLiteStore(":memory:") Storage backend
embedder DummyEmbedder() Embedding backend
db_path ":memory:" SQLite file path (pass a real path to persist)

Memory.add(facts, user_id="", agent_id="", metadata=None) → AddResult

Returns an AddResult with three lists:

result.stored   # List[MemoryItem]   — successfully written
result.skipped  # List[SkippedItem]  — not written, with reason
result.failed   # List[SkippedItem]  — write attempted, raised error
result.all_succeeded  # bool

Each SkippedItem has:

  • .content — the original fact
  • .reason — SkipReason.DUPLICATE | EMBED_FAILED | INSERT_FAILED
  • .existing_id — set when reason is DUPLICATE
  • .error — error message when reason is EMBED_FAILED or INSERT_FAILED

Other methods

mem.search(query, user_id="", top_k=5)   # → List[MemoryItem]
mem.get(memory_id)                        # → MemoryItem | None
mem.get_all(user_id="")                   # → List[MemoryItem]
mem.delete(memory_id)                     # → bool
mem.clear(user_id="")                     # → int (count deleted)

Chat demo — a bot that remembers you

The most direct way to see Meminumb in action is the conversational demo. It uses a Groq-hosted LLM (free, no credit card) and stores everything Meminumb hears about you persistently.

pip install groq
export GROQ_API_KEY="your-key-here"   # free at console.groq.com
python examples/chat_demo.py

First session:

You: Hi, I'm Prajwal. I love jazz and I'm a backend developer.
[Meminumb] Stored 3 new fact(s)
Bot: Nice to meet you Prajwal! Jazz is a great taste. What do you work on?

You: quit

Second session (new process, same memories):

[Meminumb] I remember 3 fact(s) about you from last time.

You: What do you remember about me?
Bot: You're Prajwal, a backend developer who loves jazz!

Type memory to inspect stored facts, clear to wipe them.


Persistent storage

mem = Memory(db_path="~/.meminumb/myapp.db")

The database file is created automatically. Use the same path across sessions to persist memory.


Architecture and design decisions

Why SQLite instead of a vector database?

Most AI memory libraries use a dedicated vector database (Qdrant, Pinecone, Chroma) alongside a separate metadata store. This creates two systems that can go out of sync — if the vector write succeeds but the metadata write fails, you have an orphaned vector with no history record. This is exactly the bug that inspired Meminumb (see mem0ai/mem0#7879).

Meminumb stores everything — content, embedding, metadata — in a single SQLite table. SQLite's WAL-mode transactions mean a write either fully commits or fully rolls back. One system, one failure mode, no orphans.

Why content-addressed IDs instead of random UUIDs?

A random UUID means every add() call needs a full-text scan to detect duplicates. It also means retrying a failed add creates a new ID each time, potentially producing duplicates.

Meminumb derives the ID from the content:

id = sha256(user_id + agent_id + content.strip().lower())[:16]

Same fact + same user always produces the same ID. Duplicate detection is a single existence check. Retries are naturally idempotent — re-adding a fact that already exists is a no-op, not a duplicate.

Why AddResult instead of raising exceptions?

Raising an exception on the first failure stops processing the entire batch. In an agent loop adding 10 facts, one embed failure would silently discard the other 9.

AddResult processes every fact independently and classifies each into stored, skipped, or failed with a machine-readable SkipReason. The caller decides what to do — retry the failed ones, alert on duplicates, or just log. Nothing is ever silently dropped.

Why update() re-embeds on content change?

Embeddings are what power semantic search. If you change the content text but keep the old embedding, search would still find this memory based on the old meaning. Re-embedding on every content change keeps search results accurate with no extra work from the caller.


Contributing

See CONTRIBUTING.md.


License

MIT — see LICENSE.

Metadata

Release files for meminumb 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meminumb 0.1.0
File Size Uploaded Provenance Actions
meminumb-0.1.0.tar.gz 16.8 kB Without provenance Details for meminumb-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meminumb 0.1.0
File Interpreter ABI Platform Actions
meminumb-0.1.0-py3-none-any.whl Python 3 none any Details for meminumb-0.1.0-py3-none-any.whl

Total release size: 29.2 kB

Release files / meminumb-0.1.0.tar.gz

Download URL meminumb-0.1.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fa43b46e7827bca03b47f5e18ac32fe8f024c3d984de78bbef0336584a85e4fe
BLAKE2b-256 checksum
How to use checksums
be67bedde8e88b352bf3288d6841cb1a7e3d36abccbf8851392a58fa00d2a4ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.1

Release files / meminumb-0.1.0-py3-none-any.whl

Download URL meminumb-0.1.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5799140b57eb64e4193fa504a1710170871558c533247cca53c4d4c40bd74ec7
BLAKE2b-256 checksum
How to use checksums
c86da15fb2245e42d1df6244b8b476994351f0e5532f85029411b957616476ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.1

Security for meminumb 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page