A semantic memory system for storing and retrieving conversational data using embeddings and concept extraction.
- Hybrid Search: Combines vector similarity, conceptual matching, and keyword search
- Concept Extraction: Automatically extracts semantic concepts from conversations
- Clean Architecture: Well-defined separation between domain, storage, and AI layers
- Concurrent Processing: Async embedding and concept extraction with worker pools
- Pluggable Backends: Abstract interfaces for storage and AI services
- Fast Serialization: Uses mus-go for efficient binary serialization
- BadgerDB v4 - Embedded key-value store
- langchaingo - LLM and embedding integrations
- mus-go - Fast binary serialization
- ants - Worker pool implementation
Pure domain models with zero external dependencies:
- Domain entities:
ChatRecord,Concept,ConceptRef,ID,SpeakerType - Business validation rules
- Domain-specific errors
Repository pattern with BadgerDB implementation:
ChatRepository: Chat record operationsConceptRepository: Concept operationsVectorSearcher: Vector similarity search- Thread-safe with context support
Provider abstraction for AI services:
Embedder: Generate vector embeddings from textConceptExtractor: Extract semantic conceptsAIProvider: Unified interface for AI operations- Includes OpenAI and mock implementations
Concurrent processing pipeline:
- Stores chat records
- Generates embeddings asynchronously
- Extracts and assigns concepts in parallel
- Worker pools for maximum throughput
Multi-stage hybrid search:
- Semantic search via vector embeddings
- Conceptual search using extracted concepts
- Keyword matching with stop-word filtering
- Ranked results with relevance scoring
- Go 1.25.3+
- Task for build automation
# Build all binaries
task build
# Run tests
task test
# Generate serialization code
task generate
# Run static analysis
task vetSeed the database:
# Use built-in test data
./bin/seeder
# Load from file
./bin/seeder -src data.txtSearch conversations:
./bin/searcher# All tests
task test
# Specific package with coverage
go test -v -cover ./core/
go test -v -cover ./storage/badger/Memorit uses mus-go for binary serialization. Delete core/records_musg.gen.go then use the generate task to regenerate serializable models.
Licensed under the Apache License 2.0. See LICENSE for the full license text and NOTICE for third-party attributions.