Architecture: How to make Vitto recall learned patterns before every chat ...

Documentation for Sessions

🏗️ Architecture: How to make Vitto recall learned patterns before every chat ...

Date: 2026-02-27
Time: 04:36:25 UTC
Session: gspace1-149.4
Agent: backend
Confidence: 92%
Status: ✅ Documented


📋 Decision Context

Question:

How to make Vitto recall learned patterns before every chat response?

Task: Not specified


🎯 Decision Made

Chosen:

Wire LearningService.getPyramidContext() into ChatService.processDirectChat() — backend-side pattern recall with 3-tier formatting (core rules, relevant patterns, similar decisions) injected into system prompt

Options Considered:


💭 Reasoning

Backend injection is better than frontend because: (1) lower latency (no 2-step network roundtrip), (2) reusable for Vitto engine too, (3) graceful degradation via @Optional(). The Intelligence Pyramid has 563+ patterns, 20 core rules, and 11K+ decisions already — just needed the read-during-execute wiring. Estimated overhead ~60-160ms (negligible in 2-4s chat request). Used @Optional() injection + try/catch so chat continues working even if learning DB is down.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation