Architecture: How should we implement two-layer agent intelligence and pre...
Documentation for Sessions
🏗️ Architecture: How should we implement two-layer agent intelligence and pre...
Date: 2026-01-31
Time: 17:18:11 UTC
Session: editor2-75.17
Agent: backend
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
How should we implement two-layer agent intelligence and preference override system?
Task: Session 75.15: Two-Layer Agent Intelligence & Preference Override System
🎯 Decision Made
Chosen:
Two-layer architecture: User memories in gograb-api (cross-Space) + Space context in Space DB (local). Preference override system with per-setting and per-user granularity using PreferenceResolver class.
Options Considered:
- Database per user (overkill)
- All in Space DB (no cross-Space learning)
- Two-layer: gograb-api (user) + Space DB (context)
💭 Reasoning
Real AI assistants need to know the PERSON across all Spaces, not just their current workspace. User-level data (memories, global preferences) belongs in gograb-api for cross-Space persistence. Space-level data (context, local preferences, override config) belongs in the Space database. The PreferenceResolver provides stateless resolution logic with configurable policies (space-wins, user-wins, enforced).
📁 Files Involved
apis/backend-api/src/app/users/schemas/user-agent-memory.schema.tsapis/backend-api/src/app/users/schemas/user-preferences.schema.tsapis/backend-api/src/app/users/services/user-agent.service.tsapis/backend-api/src/app/users/services/user-preferences.service.tsapis/backend-api/src/app/preferences/preferences.module.tsapis/backend-api/src/app/preferences/preferences.service.tsapis/backend-api/src/app/preferences/preferences.controller.tslibs/core/shared-models/src/lib/preferences/preference-override-config.interface.tslibs/core/shared-models/src/lib/preferences/resolved-preferences.interface.tslibs/core/shared-models/src/lib/services/preference-resolver.ts
🔗 Related
- Decision ID:
dev_1769879891436_0a0ui08 - Session: 75
- Workspace: editor2
Auto-generated by MCP Smart Consolidation