CROSS-SESSION MEMORY · SCOPE FIRST
Cross-session memory: scope before similarity
Two users ask what they decided. A shared memory index ranks everyone’s memories by similarity; see what happens when the user filter comes after ranking.
Your experiment
One shared index holds six memories: user A decided the Q3 launch moves to 14 September, teammate B moved their region to 21 September, two users in another tenant talk about 30 August, and there is an app FAQ. Users A and E (new, with no memories) both ask what they decided. The opening search takes the global top three, then keeps the asking user’s.
Play replays the computed run over sixty inspection seconds; Next event steps, Restart rewinds, and Inspection time scrubs. Any input change recomputes the run and rewinds it without autoplay.
Event trace
Computed data
Final metrics
ADK’s memory service searches by app name and user id; this page models a custom shared vector index in which the scope filter is your own code. Fixed similarity scores; the agent answers with the date in the highest-ranked memory it is given. No embedding model or index is called.
One index, many owners
A memory search ranks stored memories by similarity to the question. User filter decides when the owner check happens: after taking the global top k, before ranking, or never. Scope sets what counts as yours: this user, everyone in the user’s tenant, or the whole app. Results (top k) is how many memories are returned. Minimum similarity drops weak matches. User A, in tenant T1, decided on 14 September; user E, in tenant T2, has no memories and should be told so.
The opening run: filtered into silence
The global top three are teammate B’s 21 September (0.81) and two memories from the other tenant (0.79 and 0.77). A’s own decision scores 0.68 and is fourth. The filter then removes all three foreign results, so A is told there is no record of a decision that is sitting in the index. E correctly gets no record. Nothing leaked, but filtering after ranking turned a scoping rule into a recall failure.
Moving the filter
Raise Results (top k) to 4 and A’s decision survives the filter: both answers are right, but only because k happened to be large enough. Set User filter to Never: both users are told “You decided 21 Sept”, B’s decision, and six foreign memories are returned, three from another tenant. Set User filter to Before ranking: only A’s own two memories compete, A gets 14 Sept even at k = 1, and E gets no record.
Failure boundary: scope is part of the question
With the filter before ranking, set Scope to This user’s tenant: A is told B’s 21 Sept as if it were A’s decision, and E is given C’s 30 Aug. Whole app returns other tenants’ memories again. Raise Minimum similarity to 0.7 and A’s own 0.68 memory is cut, so A gets no record. A memory search must first decide whose memories may answer, then rank only those, with a threshold calibrated on real questions.
Reading the run and its limits
Play replays each user’s search, their answer and the outcome over sixty inspection seconds; the table lists what was returned, which memories belonged to someone else and whether the answer is right. Next event, Restart, Speed and Inspection time control the replay. Similarities are fixed values; real embeddings shift with wording, which is why scoping cannot depend on ranking. Keyed stores such as ADK’s memory service scope by app and user before searching.