Bugfix: Why does Vitto forget what it just said within the same conv...
Documentation for Sessions
🐛 Bugfix: Why does Vitto forget what it just said within the same conv...
Date: 2026-03-18
Time: 21:18:11 UTC
Session: gspace1-237.3
Agent: angular
Confidence: 99%
Status: ✅ Documented
📋 Decision Context
Question:
Why does Vitto forget what it just said within the same conversation?
Task: S234.2: Fix Vitto conversation amnesia — the most critical Jarvis blocker
🎯 Decision Made
Chosen:
Inject actual conversation history (from AgentSessionService.getConversationHistory()) into the agent loop's message array via a new conversationHistory field on AgentLoopOptions. Web chat loads last 20 messages, channels load last 10. The context-window.service.ts already handles truncation if history exceeds 80K tokens.
Options Considered:
- Inject actual messages from AgentSessionService (chosen — correct, minimal)
- Increase recallRecent limit from 10 to 50 (wrong — summaries are lossy, not actual messages)
- Store full messages in system prompt (wrong — system prompt is already at token budget)
- Use Conversation Genome for compressed history (partial — genome is for old conversations, not current turn)
💭 Reasoning
Root cause: Every user message started a fresh agent loop with messages = [{ role: 'user', content: currentMessage }]. Zero history. The prior conversation existed in MongoDB (AgentSessionService stores messages at lines 1016-1017 of vitto-engine.service.ts) but was NEVER loaded back into the next agent loop call. The system prompt included lossy memory recall summaries (web-prompt-builder.service.ts line 63: recallRecent(userId, 10)) but these are compressed summaries of past interactions, NOT the actual conversation turns. They don't include tool call results, specific outputs, or the assistant's exact responses. When Vitto generated '5 modules, 131 files' and the user followed up with 'I don't see anything', the new agent loop had no knowledge of the previous generation — only a vague summary from the memory system (which may not even have been persisted yet since memory persistence is async/fire-and-forget at line 1009). The fix is 36 lines across 3 files: add conversationHistory to AgentLoopOptions, prepend history messages to the message array in agentLoop.run(), and load history in both vitto-engine.service.ts (web) and channel-processing.service.ts (WhatsApp/Teams).
📁 Files Involved
APIs/backend-vitto-api/src/app/engine/agent-loop.service.tsAPIs/backend-vitto-api/src/app/engine/vitto-engine.service.tsAPIs/backend-vitto-api/src/app/engine/channel-processing.service.ts
🔗 Related
- Decision ID:
dev_1773868690912_vernujp - Session: 237
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation