Features
Memory
Multi-scope memory architecture (chat/project/file), structured extraction, and graceful degradation.
Memory uses Mem0 with Qdrant (required for memory) and optional Neo4j graph enrichment.
Memory stores chat/project/file-context facts under scoped synthetic identities.
Memory is read during context build and written during post-response extraction.
If memory services are unavailable, chat continues without memory context/extraction paths.
Architecture
Storage scopes
Memory entries are scoped by synthetic user IDs:
chat_<chatId>project_<projectId>file_content_<projectId>
Search modes
- chat-only semantic search (
searchMemory) - multi-scope search (
searchMultiScope) - enhanced search with relevance filtering (
searchMemoryEnhanced,searchMultiScopeEnhanced)
Structured extraction
After chat responses, extraction handler:
- extracts legal-domain facts with category, importance, entities, and keywords
- writes chat-scoped structured memories
- auto-promotes high-importance facts to project scope
- falls back to legacy extraction if structured path fails
Runtime Integration in Chat Pipeline
Memory is used in two places:
- context build before response generation
- extraction after response cycle
Availability and Graceful Fallback
isMemoryAvailable() checks memory client initialization.
- if unavailable, memory context/extraction paths are skipped
- chat processing continues without memory
Config and Environment
Core memory settings:
QDRANT_HOST=localhost
QDRANT_PORT=6333
MEMORY_COLLECTION_NAME=ai_memories
MEMORY_ENABLE_GRAPH=falseNeo4j (optional graph memory):
NEO4J_URL=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=change-this-neo4j-passwordDeployment/service controls:
FEATURE_MEMORY_ENABLED=true
SERVICE_QDRANT_AVAILABLE=true
SERVICE_NEO4J_AVAILABLE=false