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:

  1. Direct integration into VittoEngineService
  2. Event-based pub/sub system
  3. Middleware chain (Express-style)
  4. 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


🔗 Related


Auto-generated by MCP Smart Consolidation