Enhancement: Per-Agent Memory Encryption (Secure Enclaves)
Context Current memory backends (e.g. Neo4j/Vector DBs) store embeddings and content as clear text. In multi-agent deployments, isolating memory access is critical for user privacy and security.
Proposal Implement an optional encryption layer for memory storage:
- Client-Side Encryption: Encrypt content before writing to DB.
- Key Derivation: Use derived keys from
Agent ID+Secrets(e.g. HMAC-SHA256). - Opaque Content: Ensure embeddings remain searchable (if vector store supports encrypted vectors or trusted enclave), but raw content is opaque until decrypted by the authorized agent.
Impact This would harden MemOS for enterprise and privacy-sensitive deployments, aligning with Zero Trust principles.
This issue has been automatically marked as stale due to inactivity.
💬 我也在做记忆系统相关的工作:CausaMem,可以来看看,说不定有能借鉴的地方 🙂
Strong proposal. Per-agent memory encryption is a hard requirement for enterprise multi-agent deployments. We implement exactly this at KinthAI where 221 agents serve multiple users with cryptographic memory isolation.
Implementation notes from production:
1. Key derivation: Agent ID + User ID, not just Agent ID
Your proposal derives keys from Agent ID + Secrets. For multi-user scenarios, the key should be Agent ID + User ID + Secret. Without the user dimension, all users of the same agent share an encryption key — Agent A can decrypt any user's memories stored under Agent A. With per-user keys, even a compromised agent process can only access the current user's data.
2. The searchable encryption tradeoff:
This is the hardest design decision. Three options we evaluated:
| Approach | Searchability | Security | Performance |
|---|---|---|---|
| Encrypt content, plaintext embeddings | Full vector search | Medium — embeddings leak semantic similarity | Fast |
| Encrypt content, encrypted embeddings | No search without decryption | High | Slow — must decrypt to search |
| Encrypt content, searchable encryption on metadata | Filter by tags/timestamps, then decrypt top-K | High for content, medium for metadata | Medium |
We use option 3: metadata (topic tags, timestamps, importance scores) uses deterministic encryption (searchable), while message content uses full AES. This lets the retrieval layer filter by topic without decrypting everything, then decrypt only the top-K results.
3. Secure enclave integration:
For the highest security tier, we explored Intel SGX / ARM TrustZone for in-enclave embedding computation. The enclave receives encrypted memory, decrypts inside the secure boundary, computes similarity, and returns only the result IDs. The raw content never leaves the enclave. This is overkill for most deployments but essential for healthcare/finance use cases.
Full memory isolation architecture: Why Character.AI Forgets You — And What Persistent Memory Actually Requires
This issue has been automatically marked as stale due to inactivity.
This issue has been automatically marked as stale due to inactivity.
This issue has been automatically closed due to inactivity.
Thanks @kinthaiofficial for the detailed production insights! The 3-way tradeoff you outlined perfectly addresses the core challenge.
Summarizing the convergence for MemOS implementation:
- Key Derivation: Adopting
Agent ID + User ID + Secretto guarantee multi-user isolation on shared agent instances. - Searchable Encryption: Using Option 3 (deterministic encryption on metadata like topic/tags for pre-filtering, full AES-GCM on memory content with top-K on-demand decryption).
Since this is a critical architectural requirement for enterprise multi-agent deployments, I'd like to request reopening this issue. I am preparing an RFC / draft PR implementing the MemoryCryptoMiddleware interface to decouple storage backends from encryption logic.
@MemTensor maintainers: could we reopen this to track the RFC implementation?