Architecture: How should Vitto automatically learn from MCP decisions with...
Documentation for Sessions
🏗️ Architecture: How should Vitto automatically learn from MCP decisions with...
Date: 2026-02-11
Time: 20:37:06 UTC
Session: gspace1-106.8
Agent: backend
Confidence: 92%
Status: ✅ Documented
📋 Decision Context
Question:
How should Vitto automatically learn from MCP decisions without duplicating data?
Task: Session 106: Vitto MCP auto-learning pipeline
🎯 Decision Made
Chosen:
Event-driven auto-learning via WebSocket. DecisionService.create() in backend-ai-api emits 'decision.created' via EventEmitter2. NativeWsGateway broadcasts it to connected agents via @OnEvent listener. Vitto's HandoffWsClientService receives 'decision.created' messages. VittoEngineService.onMcpDecisionCreated() creates a vector-embedded memory in vitto-memories (type: 'learning', with source MCP decision ID). No data duplication: only a compact summary is stored with an embedding for semantic recall. Vitto's own decisions (agentId: 'vitto-super-agent') are filtered out to avoid echo loops.
Options Considered:
- No alternatives documented
💭 Reasoning
The platform already has the MCP → backend-ai-api → MongoDB pipeline and the WebSocket connection between backend-ai-api and backend-vitto-api. Using EventEmitter2 for the internal event decouples DecisionService from the WebSocket gateway (no circular dependency). The @OnEvent decorator in NativeWsGateway is the standard NestJS event pattern. Creating a compact memory (not the full decision) in vitto-memories means Vitto gets semantic search over all MCP decisions without duplicating the full decision data. The echo filter (skip vitto-super-agent) prevents infinite loops when Vitto logs its own decisions.
📁 Files Involved
apis/backend-ai-api/src/app/infrastructure/services/decision.service.tsapis/backend-ai-api/src/app/mcp-gateway/native-ws.gateway.tsapis/backend-vitto-api/src/app/connectivity/handoff-ws-client.service.tsapis/backend-vitto-api/src/app/engine/vitto-engine.service.ts
🔗 Related
- Decision ID:
dev_1770842226044_sqokb71 - Session: 106
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation