Memori icon indicating copy to clipboard operation
Memori copied to clipboard

Per-user memories

Open slobodaapl opened this issue 3 months ago • 4 comments

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?

slobodaapl avatar Sep 09 '25 08:09 slobodaapl

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/:

  1. Simple Multi-User Demo (simple_multiuser.py)
  2. FastAPI Web Application (fastapi_multiuser_app.py)

Does this address your use case?

harshalmore31 avatar Sep 10 '25 09:09 harshalmore31

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.

slobodaapl avatar Sep 10 '25 11:09 slobodaapl

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!

harshalmore31 avatar Sep 10 '25 16:09 harshalmore31

Suppose users want to select some of their personal memories to be merged into a shared memory.

Jkintree2 avatar Sep 12 '25 02:09 Jkintree2