Pattern: How should memory innovations be plugged into Vitto's pipeli...
Documentation for Sessions
🎨 Pattern: How should memory innovations be plugged into Vitto's pipeli...
Date: 2026-03-19
Time: 21:56:31 UTC
Session: gspace1-239.5
Agent: backend
Confidence: 93%
Status: ✅ Documented
📋 Decision Context
Question:
How should memory innovations be plugged into Vitto's pipeline without coupling to the core engine?
Task: S239: Cognitive plugin system for memory extensibility
🎯 Decision Made
Chosen:
Cognitive Plugin System with 5 lifecycle hooks: onBeforeContextAssembly, onBeforeResponse, onAfterResponse, onMemoryAdmission, onMemoryConsolidation. Plugins are registered in CognitivePluginRegistryService, sorted by priority, executed sequentially (context-chaining) or parallel (fire-and-forget). Each plugin has 5-second timeout, error isolation (one plugin failure doesn't crash pipeline). Admission uses AND-gate logic (any plugin rejection = reject).
Options Considered:
- Direct integration into VittoEngineService
- Event-based pub/sub system
- Middleware chain (Express-style)
- Cognitive plugin system with lifecycle hooks
💭 Reasoning
The existing tool plugin system (ToolPlugin interface) is action-focused — it provides capabilities Vitto can invoke. Memory innovations are different: they need to intercept the memory lifecycle (read/write/consolidate). Adding each innovation directly to the engine service would create a monolith. The plugin pattern allows: (a) ProspectiveIndexerPlugin enriches memories at write time independently, (b) OnDemandRecallPlugin enhances context assembly independently, (c) Future plugins (UserPreferenceLearning, AnticipativeRecall) can be added without touching core code. The 5-hook model covers the complete memory lifecycle. Priority ordering ensures deterministic execution. AND-gate admission prevents any single plugin from overriding the others' judgment. This pattern is proven in production systems (VSCode extensions, webpack plugins, NestJS interceptors).
📁 Files Involved
APIs/backend-vitto-api/src/app/mind/plugins/cognitive-plugin.types.tsAPIs/backend-vitto-api/src/app/mind/plugins/cognitive-plugin-registry.service.tsAPIs/backend-vitto-api/src/app/mind/plugins/built-in/prospective-indexer.plugin.tsAPIs/backend-vitto-api/src/app/mind/plugins/built-in/on-demand-recall.plugin.ts
🔗 Related
- Decision ID:
dev_1773957391729_47oxxvd - Session: 239
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation