feat(memory): enforce namespace isolation - #27
Open
DivyamTalwar wants to merge 1 commit into
Open
Conversation
This was referenced Aug 23, 2026
Owner
Author
Verification checkpoint
Security review focus: namespace gating occurs before mutation prompts and answer integration; cross-namespace version changes fail closed. This PR remains intentionally open and unmerged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
JITMIND accepted
user_id, but durable memories and the LLM mutation context were still read from a shared store. That makes cross-user recall and even cross-user update/delete possible in a multi-tenant process.What changed
("default",)scope("users", user_id)when callers already useuser_idMemoryEntryand sourcePageCompetitive rationale / provenance
This is an original implementation informed by two public patterns:
user_id,agent_id, orrun_idfor scoped memory writes and exposes those identifiers as the primary query boundary: https://github.com/mem0ai/mem0/blob/main/mem0/memory/main.pyNo source code was copied. JITMIND deliberately keeps namespace components as a tuple, avoiding ambiguous delimiter-based prefix matching, and carries the boundary through its existing bi-temporal and graph paths.
Evidence
python -m pytest -q→ 42 passedpython -m compileall -q jitmind→ passpython benchmarks/benchmark_namespace_filter.py(10,000 memories / 100 tenants) → 100 selected in 6.118 ms on the development runnerReview notes
This PR is intentionally independent from the other JITMIND proposals and targets
main. It is ready for review and must remain unmerged for comparative evaluation.