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:
- Atomic writes — a failure never leaves orphaned data behind
- 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/groq_chatbot.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.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| meminumb-0.2.0.tar.gz | 21.3 kB | Without provenance | Details for meminumb-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meminumb-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for meminumb-0.2.0-py3-none-any.whl |
Total release size: 36.3 kB
Release files / meminumb-0.2.0.tar.gz
| Download URL | meminumb-0.2.0.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
628a3f9175e8735cf3e832790168910e1d71db08be3d8f3e34c55ede33add2d4
|
|
BLAKE2b-256 checksum How to use checksums |
9410d59e12e42bb7aa961c79ff7fa9ea81ce7fa948fc3cb6fd521a577855ce81
|
| 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.2.0-py3-none-any.whl
| Download URL | meminumb-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6df8451df7498b7f78a3c8654d1c56fa675c2f39f81667a707a56f3ce243658c
|
|
BLAKE2b-256 checksum How to use checksums |
fefa8f70d16bd9261fa63209593b4e9fe14d716f7576fa936863b84d7cc9ba88
|
| 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.2.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.