S208 Technical Summary
Documentation for Sessions
S208 Technical Summary: Vitto Metacognition & App Reorganization
Session Overview
- Branch: session-208
- Sub-sessions: S208.1 (libs cleanup), S208.2 (app reorg), S208.3 (backend narrative), S208.4 (frontend components)
- Lines removed: ~20,000 (dead libraries)
- Files created: ~20 new files
- Files modified: ~15 existing files
Phase 0: libs-ai Cleanup
Removed Directories (10)
| Directory | Lines | Reason |
|---|---|---|
| libs/libs-ai/ai-generation-hub | ~2K | Deprecated S204 |
| libs/libs-ai/ai-task-router | 1,174 | 0 imports |
| libs/libs-ai/ai-training-models | 675 | 0 imports |
| libs/libs-ai/multi-agent-dashboard | 4,547 | 0 imports |
| libs/libs-ai/panel-intelligence | 5,584 | Deprecated S171 |
| libs/libs-ai/ai-agent-experience | 7,689 | 0 imports |
| libs/libs-ai/ai-agent-registry | 583 | 0 imports |
| libs/libs-ai/ai-module-patterns | ~500 | Shell (code in ai-module-intelligence) |
| libs/libs-ai/ai-outcome-tracker | ~800 | Shell (code in ai-module-intelligence) |
| libs/libs-ai/cursor-agents | ~300 | Shell (code in agent-orchestrator) |
Removed tsconfig.base.json Paths (8)
- @libs-ai/ai-agent-experience (was redirected to agent-mind alias)
- @libs-ai/ai-agent-registry
- @libs-ai/ai-generation-hub
- @libs-ai/ai-training-models (was redirected to ai-agents-training-center alias)
- @libs-ai/multi-agent-dashboard
- @libs-ai/panel-intelligence
- @libs-ai/task-router (was redirected to agent-orchestrator alias)
- @libs-ai/cursor-agents path entry (directory removed, path kept since alias points to agent-orchestrator)
Preserved Aliases (active imports exist)
- @libs-ai/module-patterns --> ai-module-intelligence (5+ imports)
- @libs-ai/outcome-tracker --> ai-module-intelligence (3+ imports)
- @libs-ai/cursor-agents --> agent-orchestrator (tsconfig entry kept)
Phase 1: App Reorganization
Top Navigation
- Before:
Home | Monitor | Vitto - After:
Home | Operations | Command | Vitto - File:
apps/gograb-ai/src/app/app.component.html
Route Changes (app.routes.ts)
NEW: /operations (OperationsPanelComponent)
|-- /agents (ObservatoryAgentsComponent)
|-- /system (ObservatorySystemComponent)
|-- /sandbox (ObservatorySandboxRouteComponent)
|-- /failures (FailureChainsComponent)
|-- /specialization (SpecializationMatrixComponent)
NEW: /command (CommandPanelComponent)
|-- /mission (CommandCenterComponent from @libs-ai/gograb-ai-lib)
|-- /approvals (ObservatoryApprovalsComponent)
|-- /audit (ObservatoryAuditComponent)
|-- /trust (TrustDashboardComponent)
|-- /costs (CostDashboardComponent)
REDIRECTS: /observatory/* --> /operations/* or /command/*
Vitto Sidebar (vitto-unified-shell.component.ts)
6 groups replacing the old 4:
- Mind (7 items) -- was Brain (9 items, mixed)
- Identity (4 items) -- was Soul (5 items)
- Capabilities (5 items) -- NEW group
- Connections (3 items) -- NEW group
- Developer (5 items, admin-only) -- restructured
- Settings (5 items) -- slimmed
Key moves:
- Channels, Webhooks: Brain --> Connections
- Diary: Soul --> Mind
- Schedules: Settings --> Connections
- Dossier, Mastery, Sub-Agents: hidden flat routes --> visible in sidebar
- Observatory: sidebar --> removed (now top-level /operations + /command)
Phase 2: Backend Narrative Infrastructure
New SSE Event Types (vitto.types.ts)
ConscienceEventType:
'conscience.dossier.loaded' |
'conscience.context.assembled' |
'conscience.skill.selected' |
'conscience.memory.recalled' |
'conscience.trust.evaluated' |
'conscience.personality.applied'
IntrospectionEventType:
'introspection.cost.alert' |
'introspection.skill.promoted' |
'introspection.queue.changed' |
'introspection.model.routed' |
'introspection.delegation.decided' |
'introspection.context.budget'
VittoNarrativeService
- Location:
APIs/backend-vitto-api/src/app/engine/vitto-narrative.service.ts - Pattern: Centralized Subject --> piped into VittoEngineService.sseSubject
- Methods:
emitConscience(type, userId, category, narrative, details?)andemitIntrospection(type, category, narrative, details?, severity?) - Wired in
VittoEngineService.onModuleInit():this.narrative.events$.subscribe(event => this.sseSubject.next(event))
New SSE Endpoint
@Sse('events/conscience/:userId')on VittoController- Filters main SSE stream: only
conscience.*events whereuserIdmatches param - Privacy: each user only sees their own events
Emission Points
| Service | Event | When |
|---|---|---|
| ContextAssemblyService | conscience.context.assembled | After Promise.all resolves |
| ContextAssemblyService | conscience.dossier.loaded | After dossier loaded |
| SkillRetrievalService | conscience.skill.selected | After scoring skills |
| VittoEngineService | introspection.queue.changed | On task submission |
All emissions are @Optional() injected and wrapped in try/catch (fire-and-forget).
Phase 3: Frontend Components
New Files Created
libs/libs-ai/vitto-hub/src/lib/
|-- models/conscience.types.ts
|-- services/vitto-conscience.service.ts
|-- services/vitto-introspection.service.ts
|-- components/conscience/
| |-- vitto-conscience.component.ts
| |-- vitto-conscience.component.html
| |-- vitto-conscience.component.scss
|-- components/introspection/
| |-- vitto-introspection.component.ts
| |-- vitto-introspection.component.html
| |-- vitto-introspection.component.scss
|-- components/operations-panel/
| |-- operations-panel.component.ts
| |-- operations-panel.component.html
| |-- operations-panel.component.scss
|-- components/command-panel/
| |-- command-panel.component.ts
| |-- command-panel.component.html
| |-- command-panel.component.scss
|-- components/shared/external-redirect.component.ts
Service Patterns
- VittoConscienceService: EventSource to
/engine/events/conscience/:userId, signal-based state, max 200 entries cap, category filtering via computed signals - VittoIntrospectionService: EventSource to
/engine/events(global stream), filters forconscience.*+introspection.*client-side, per-user filtering,activeUserscomputed signal tracks unique users seen
Route Registration (vitto-hub.routes.ts)
- /vitto/conscience --> VittoConscienceComponent
- /vitto/introspection --> VittoIntrospectionComponent
- /vitto/observatory --> ExternalRedirectComponent (redirects to /operations)
Known Issues for S209
1. Command Center OFFLINE
- Symptom: Mission Control tab at
/command/missionshows "OFFLINE" status - Root cause:
command-center-client.service.tsline ~443 constructs WebSocket URL usingAPI_BASE_URL(port 3000) but theCommandCenterGatewaylives on backend-ai-api (port 3001) - Fix: Replace
API_BASE_URLinjection withAI_API_URLfrom@libs-foundational/api-config
2. Training Pipeline is Mock
- Symptom: "Train" button appears to work but nothing actually trains
- Root cause:
training-pipeline.service.tslines 122-150 generate fake job IDs and simulate delays - Fix: Replace with few-shot prompt injection (Option B) using existing
SubAgentService.buildSystemPrompt()infrastructure
3. Platform Intelligence Hardcoded Values
- Symptom: All agent cards show
status: 'training'andsuccessRate: 0 - Root cause:
training-center.component.tshardcodes these values instead of fetching from API - Fix: Fetch real data from
GET /vitto-api/engine/definitionsand useperformance.*fields
4. Sub-Agents Cannot Self-Execute
- Symptom: Sub-agents have definitions and enriched system prompts but all execution goes through handoff
- Root cause:
SubAgentService.spawnFromDefinition()creates instances but has noexecute()method - Fix: Integrate
BaseLLMProviderfromAPIs/backend-vitto-api/src/app/llm/for direct LLM calls
5. Conscience/Introspection Not Yet Tested Live
- Symptom: Components built, SSE endpoints created, but never tested with running backends
- Fix: Start backend-vitto-api + gograb-ai, trigger chat messages, verify SSE events flow through