How lelabdev/rag-ferrite works
rag-ferrite is a self-hosted document search and memory service for AI assistants. Users ingest files or text, which are extracted, chunked, optionally enriched, embedded, and indexed in SQLite; assistants then query a hybrid lexical/semantic retrieval pipeline through MCP or REST, with CLI and TUI access also documented. The graph includes ingestion jobs, tags, reranking, and retrieval evaluation as distinct capabilities. Several connections rely on the README or SOURCE INDEX references because their implementations were not excerpted; those links are cited only where documented or indexed.
Main entry points: pipeline.rs Query pipeline · ingest.rs Ingest and enrich · service.rs Shared business logic · search.rs Hybrid search
Components 22
User interfaces
- MCP tools
src/server.rs - REST API
src/api.rs - CLI commands
src/main.rs - Terminal UI
src/monitor/ui.rs
Ingestion
- Ingestion queue
src/ingestion.rs - Text extraction
src/extractor.rs - Parent-child chunking
src/chunker.rs - Ingest and enrich
src/engine/ingest.rs - Embedding provider
src/embedding.rs - LLM services
src/llm.rs
Retrieval
- Shared business logic
src/service.rs - Query pipeline
src/pipeline.rs - Hybrid search
src/engine/search.rs - Optional reranking
src/reranker.rs - Tag routing
src/engine/tag_routing.rs
Index and metadata
- SQLite search index
src/storage/sqlite.rs - Tag rules
src/tag_rules.rs
Operations
- Runtime configuration
src/config.rs - Monitor API
src/monitor/api.rs - Retrieval evaluation
src/engine/benchmark.rs
Other components
- Assistant / user
- Embedding / LLM APIs
Connections 30
- Assistant / user → MCP tools: uses
README.md - Assistant / user → REST API: uses
README.md - Assistant / user → CLI commands: uses
README.md - Assistant / user → Terminal UI: uses
README.md - MCP tools → Shared business logic: calls
src/server.rs - REST API → Shared business logic: calls
src/api.rs - CLI commands → Ingestion queue: submits jobs
src/main.rs - Terminal UI → Monitor API: uses
src/monitor/ui.rs - Monitor API → CLI commands: uses client
src/monitor/api.rs - Ingestion queue → Text extraction: extracts files
- Ingestion queue → Ingest and enrich: dispatches jobs
src/ingestion.rs - Ingest and enrich → Parent-child chunking: chunks content
src/engine/ingest.rs - Ingest and enrich → Embedding provider: embeds chunks
src/engine/ingest.rs - Ingest and enrich → LLM services: adds context
src/engine/ingest.rs - Ingest and enrich → SQLite search index: writes index
src/engine/ingest.rs - Shared business logic → Ingestion queue: submits ingestion
src/ingestion.rs - Shared business logic → Query pipeline: queries
src/service.rs - Query pipeline → Hybrid search: runs search
src/engine/search.rs - Hybrid search → Embedding provider: embeds query
src/engine/search.rs - Hybrid search → SQLite search index: retrieves candidates
src/engine/search.rs - Hybrid search → Tag routing: routes tags
src/engine/search.rs - Tag routing → Tag rules: loads rules
src/engine/tag_routing.rs - Query pipeline → Optional reranking: reranks results
src/pipeline.rs - Query pipeline → LLM services: expands queries
src/pipeline.rs - Embedding provider → Embedding / LLM APIs: requests embeddings
README.md - LLM services → Embedding / LLM APIs: requests completion
src/llm.rs - Retrieval evaluation → Query pipeline: evaluates retrieval
- Shared business logic → SQLite search index: reads metadata
src/service.rs - Runtime configuration → Query pipeline: configures
src/pipeline.rs - Runtime configuration → Embedding provider: configures