Architecture: Should Vitto use per-space/per-user databases or a shared vi...

Documentation for Sessions

🏗️ Architecture: Should Vitto use per-space/per-user databases or a shared vi...

Date: 2026-02-11
Time: 20:06:15 UTC
Session: gspace1-106.5
Agent: backend
Confidence: 88%
Status: ✅ Documented


📋 Decision Context

Question:

Should Vitto use per-space/per-user databases or a shared vitto-mind with tenant indexing?

Task: Session 106: Vitto memory architecture


🎯 Decision Made

Chosen:

Shared vitto-mind with userId/spaceId compound indexes and vector embeddings. Create a new 'vitto-memories' collection using the same embedding approach as golden_decisions (OpenAI text-embedding-3-small, 1536 dims, MongoDB Atlas $vectorSearch). Every significant interaction creates an embedded memory with userId, spaceId, summary, keyEntities, importance score, and embedding vector. Tiered recall: in-memory hot cache → vector search warm → platform API cold.

Options Considered:

  1. Per-space/user MongoDB databases (full isolation)
  2. Shared vitto-mind with userId/spaceId compound indexes and vector embeddings
  3. Hybrid: separate databases for high-volume spaces, shared for rest

💭 Reasoning

Per-database isolation sounds elegant but creates massive operational complexity: connection pool management for 100+ databases, schema migration across all, monitoring, backups. MongoDB Atlas pricing scales with clusters/databases. Compound indexes on userId+spaceId give the same query isolation. Vector search with pre-filters (metadata.userId, metadata.spaceId) effectively partitions the search space. If scale becomes an issue, MongoDB sharding by tenant is the clean upgrade path. The golden_decisions vector infrastructure is already battle-tested in the project.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation