Anchor everything on user_id

Every memory row, every vector, every cached prefer­ence carries a user_id. Retrieval always includes user_id in the filter.

Advertisement

Load user profile on session start

@Override
protected void onSessionStart(Session s) {
  UserProfile profile = profileStore.load(s.userId());
  s.setAttribute("userProfile", profile);
  s.prependContext("User context: " + profile.summary());
}
Advertisement

Update the profile mid-session

When the agent learns something new about the user, upsert to the profile store. Next session picks it up.