Architecture: How should Vitto know the user's identity (name, email, role...

Documentation for Sessions

🏗️ Architecture: How should Vitto know the user's identity (name, email, role...

Date: 2026-02-11
Time: 22:16:16 UTC
Session: gspace1-105.2
Agent: backend
Confidence: 92%
Status: ✅ Documented


📋 Decision Context

Question:

How should Vitto know the user's identity (name, email, role, etc.) for personalized responses?

Task: Enhance Vitto user knowledge and memory


🎯 Decision Made

Chosen:

Two-layer: frontend passes name/email + backend does full profile lookup from MongoDB

Options Considered:

  1. Only use agent memories (existing approach)
  2. Pass user profile from frontend auth via API request
  3. Backend-only: look up user profile from MongoDB by userId
  4. Two-layer: frontend passes name/email + backend does full profile lookup from MongoDB

💭 Reasoning

The existing approach only loaded abstract agent memories (preferences, skills, facts) but never fetched the actual user profile. This meant Vitto couldn't greet users by name, reference their role, subscription tier, or account age. The two-layer approach provides: (1) Frontend passes userName/userEmail as hints (fast, available from auth state), (2) Backend does a full MongoDB lookup by userId to get name, email, roles, subscriptionTier, spaces, createdAt, lastLoginAt — giving Vitto complete identity context. The backend lookup is authoritative; frontend hints serve as fallback if the DB query fails. Both VittoChatService (VittoHub inline chat) and VittoChatEngineService (chat shell) now pass identity through to /ai-api/chat.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation