Per-user memories
Hello, and first of all, this is a very impressive project!
From the Readme however, I'm unable to tell whether there's any feature to associate per-user memories.
This is a rather make-or-break feature for any proper downstream product.
Any guidance on this please?
Hi @slobodaapl Thanks for the appreciation about the project!
Yes, Memori has per-user memory isolation built-in! Here are the key approaches:
Namespace-Based User Isolation
Each user gets their own isolated memory space using namespaces:
# User Alice
alice_memory = Memori(
database_connect="sqlite:///shared_memory.db",
namespace="user_alice", # Alice's isolated namespace
conscious_ingest=True
)
# User Bob
bob_memory = Memori(
database_connect="sqlite:///shared_memory.db",
namespace="user_bob", # Bob's isolated namespace
conscious_ingest=True
)
You can refer this example : https://github.com/GibsonAI/memori/tree/main/examples/multiple-users
Architecture Benefits
- Shared Database: Single database file for efficiency
- Complete Isolation: Users cannot access each other's memories
Production-Ready Examples
We have comprehensive examples in /examples/multiple-users/:
- Simple Multi-User Demo (
simple_multiuser.py) - FastAPI Web Application (
fastapi_multiuser_app.py)
Does this address your use case?
Thank you! That answers my question. I just found it a bit misleading to call it a namespace given the common use of this nomenclature in production (K8s, project segregation usually by project name being namespace, Azure, etc.)
But this isn't an issue if namespaces are a row value in an identification column, only if it creates separate tables, which would be an issue.
You're absolutely right about the namespace terminology! In production, namespace usually means infrastructure-level isolation (K8s, Azure, etc.).
To clarify: Memori's namespaces are just row-level identifiers in the same tables, not separate table creation. We're actually working on proper user_id support for cleaner per-user memory isolation - see issue #51
Current approach uses namespace as user identifier, but the upcoming release will have dedicated user_id parameter for better API semantics!
Suppose users want to select some of their personal memories to be merged into a shared memory.