Architectural Overview
The system follows a clear data flow pipeline:Four Core Layers
- Storage Layer
- Knowledge Extractor
- Query Pipeline
- Integration Layer
The storage layer provides a dual-implementation pattern with identical interfaces but different backing stores:
Collections (2 types)
- MessageCollection - Stores conversation messages with ordinal indexing
- SemanticRefCollection - Stores semantic references and knowledge artifacts
Indexes (6 types)
Each index serves a specific query pattern:- SemanticRefIndex - Term → SemanticRef mappings for content discovery
- PropertyIndex - Property name → SemanticRef mappings for structured queries
- TimestampToTextRangeIndex - Temporal navigation and filtering
- MessageTextIndex - Embedding-based semantic similarity search
- RelatedTermsIndex - Term expansion and alias resolution
- ConversationThreads - Thread organization and context grouping
Storage Providers
Both providers expose identical APIs through the
IStorageProvider interface, enabling seamless switching between in-memory and persistent storage.Key Design Principles
Storage Abstraction
Storage Abstraction
Identical APIs for memory vs persistent storage enable seamless switching. Both
MemoryStorageProvider and SqliteStorageProvider implement the same IStorageProvider interface, so your code works with either backend without changes.Parallel Indexing
Parallel Indexing
Six specialized indexes support different query patterns and access paths:
- SemanticRefIndex - Fast term lookup
- PropertyIndex - Structured property queries (name, type, facets)
- TimestampIndex - Temporal filtering
- MessageTextIndex - Embedding similarity
- RelatedTermsIndex - Fuzzy matching and synonyms
- ConversationThreads - Context grouping
Graceful Degradation
Graceful Degradation
The system operates with basic extraction when AI models are unavailable:
- Metadata extraction always works (titles, timestamps, basic fields)
- LLM extraction is optional (controlled by
auto_extract_knowledgesetting) - Query fallback to text similarity when structured search finds nothing
Structured RAG
Structured RAG
Combines semantic similarity with structured knowledge for precision and recall:
- Structured first: Query specific properties (entities, actions, topics)
- Semantic fallback: Use embeddings when structured search fails
- Score fusion: Merge results from multiple indexes
- Context building: Assemble relevant knowledge for LLM
- Answer synthesis: Generate natural language response
Implementation Status
The architecture is fully implemented with production-ready components:- ✅ Dual storage providers with full API parity
- ✅ Six-index architecture with unified testing
- ✅ Multi-mode knowledge extraction pipeline
- ✅ Natural language query processing with fallbacks
- ✅ Thread-aware search and context building
- ✅ Incremental indexing with transaction support
- ✅ Embedding consistency validation
Next Steps
Structured RAG
Learn how TypeAgent’s structured RAG differs from traditional RAG
Knowledge Extraction
Understand how AI models extract structured knowledge
Indexing
Deep dive into the six specialized indexes
API Reference
Explore the complete API documentation