Architecture¶
Understand how Sekha works under the hood.
System Components¶
Sekha consists of three main components:
1. Controller (Rust)¶
The core memory engine handling all operations:
- REST API server (Axum)
- Database layer (SeaORM + SQLite)
- Memory orchestration logic
- Context assembly algorithms
- MCP protocol server
2. LLM Bridge (Python)¶
Handles all LLM-related operations:
- Embedding generation (Ollama/OpenAI/Anthropic)
- Conversation summarization
- Label suggestions
- Async queue processing
3. Storage Layer¶
Dual storage approach:
- SQLite - Structured data (conversations, metadata)
- ChromaDB - Vector embeddings for semantic search
Key Concepts¶
Memory Orchestration¶
How Sekha intelligently manages and retrieves memories:
- Semantic search with embeddings
- Context budgeting and prioritization
- Importance scoring
- Folder-based organization
Data Flow¶
End-to-end flow of data through the system:
- Store → Messages saved to SQLite
- Embed → LLM Bridge generates embeddings
- Index → ChromaDB stores vectors
- Query → Semantic search retrieves relevant context
- Assemble → Optimal context built for LLM
Architecture Diagrams¶
High-Level Overview¶
graph TB
Client[Client Application] --> API[REST API / MCP Server]
API --> Controller[Controller Core]
Controller --> DB[(SQLite)]
Controller --> Vector[(ChromaDB)]
Controller --> Bridge[LLM Bridge]
Bridge --> Ollama[Ollama] Request Flow¶
sequenceDiagram
participant C as Client
participant A as API
participant Ctrl as Controller
participant DB as SQLite
participant Vec as ChromaDB
participant LLM as LLM Bridge
C->>A: POST /conversations
A->>Ctrl: Create conversation
Ctrl->>DB: Store messages
Ctrl->>LLM: Generate embeddings
LLM->>Vec: Store vectors
Vec-->>C: 201 Created Next Steps¶
- System Overview - Detailed component architecture
- Memory Orchestration - How memory management works
- Deployment - Deploy the stack