DEV Community

PARIKSHIT SHARMA
PARIKSHIT SHARMA

Posted on

"I built a portable memory layer for AI agents so you don't have to"

markdown

I built a portable memory layer for AI agents so you don't have to

AI agents are everywhere now. But they still struggle with one thing: memory.

Most agent frameworks store memory in a vector database, but that's not enough. A vector DB just stores embeddings; it doesn't understand memory types, consolidation, forgetting, or portability.

So I built Mneme — a portable memory layer for AI agents.

What does Mneme do?

  • Structured memory: episodic (what happened), semantic (facts/preferences), procedural (how to behave).
  • Semantic recall: find relevant memories using local embeddings (FastEmbed).
  • Consolidation: deduplicate and summarise memories over time.
  • Forgetting: delete memories with full audit trail.
  • Portability: export/import your agent's entire memory to a .mneme file.
  • Access control: multi‑agent scoping with explicit shared memory grants.
  • Local‑first: SQLite backend, zero‑config.

Installation


bash
pip install mneme-memory
Usage
python
import mneme

memory = mneme.Store(agent_id="my-agent", backend="memory.db")
memory.remember("User prefers email over Slack", memory_type="semantic")
context = memory.recall("How does the user like to be contacted?")
print(context)
That's it. Three verbs: remember, recall, forget.

Why not just use a vector DB?
A vector DB gives you similarity search, but not:

Memory types (episodic vs semantic vs procedural)

Consolidation (episodic → semantic summarization)

Controlled forgetting + audit trail

True portability across frameworks

Mneme is not a database; it's a memory layer that can sit on top of SQLite or Postgres.

Performance
Retrieval precision@1: 1.00 on synthetic test

Recall latency: 7.34 ms average

Write latency: 0.088 ms

Check it out
GitHub: https://github.com/GamingBoyOfficial/Mneme

PyPI: https://pypi.org/project/mneme-memory/

What's next?
I'm planning to add HNSW vector index, TypeScript SDK, and more adapters. Let me know what you think!

Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
gamingboy profile image
PARIKSHIT SHARMA

Thanks for reading! I built Mneme because I was frustrated with agents losing context between sessions. I'd love to hear what memory challenges you've faced in your AI projects and what features you'd want in a memory layer. Also, if you try pip install mneme-memory, let me know how it goes — I'm actively looking for feedback to improve it.