How alphabet-h/grooveseek works
Purpose and Entry Points
GrooveSeek is a Rust workspace providing local knowledge-base indexing and hybrid semantic/lexical retrieval for MCP clients. The primary groove CLI indexes content, searches it directly, runs an MCP server, validates schemas, manages services, and evaluates/tunes retrieval. Main entry points are grooveseek/src/main.rs and grooveseek/src/lib.rs. Windows service/tray companion binaries are crates/groove-svc/src/main.rs and crates/groove-tray/src/main.rs.
CLI, Configuration, and Operational Modes
The CLI coordinates explicit operations such as index, serve, search, graph, validate, doctor, eval, tune, and service. Configuration discovers KB paths, models, storage, transport, and schema settings through grooveseek/src/config.rs; schema compatibility and validation are handled by grooveseek/src/schema.rs and grooveseek/src/schema_compat.rs. Deployments may be one-shot CLI processes, persistent local stdio servers, or multi-client HTTP services.
Ingestion and Index Construction
Indexing walks the configured knowledge base, excludes disallowed paths, parses supported document formats, chunks content around Markdown headings, and writes searchable records. The orchestration boundary is grooveseek/src/indexer.rs; file-type dispatch and fault isolation live in grooveseek/src/parser/registry.rs and grooveseek/src/parser/panic_guard.rs. Parsers support Markdown/text plus optional PDF, OOXML document, spreadsheet, and presentation inputs via paths such as grooveseek/src/parser/pdf.rs and grooveseek/src/parser/docx.rs.
Persistent Retrieval Store and Embeddings
SQLite is the durable index, containing document metadata, chunks, lexical FTS data, and sqlite-vec vector data. Database schema, storage, and search access are separated under grooveseek/src/db/schema.rs, grooveseek/src/db/storage.rs, and grooveseek/src/db/search.rs. grooveseek/src/embedder.rs loads/selects ONNX embedding models; models are downloaded from HuggingFace on first use. SQLite and ONNX Runtime are statically linked into distributed binaries.
Hybrid Search and Ranking Pipeline
A query flows from CLI or MCP transport into retrieval, where lexical FTS and semantic vector candidates are combined, then optionally reranked/diversified and expanded to parent context. Query compilation is in grooveseek/src/db/fts_query.rs; ranking stages are represented by grooveseek/src/mmr.rs and grooveseek/src/parent.rs. Search results retain document identity, headings, metadata, and citation-oriented spans for downstream clients.
MCP, HTTP, and Resource Boundary
The server exposes MCP tools, prompts, and kb:// resources; request-facing orchestration is in grooveseek/src/server.rs, with document/resource and search handlers under grooveseek/src/server/documents.rs and grooveseek/src/server/search.rs. Transport adapters separate stdio MCP from Streamable HTTP in grooveseek/src/transport/stdio.rs and grooveseek/src/transport/http.rs. HTTP additionally serves an operator UI from grooveseek/src/transport/webui_index.html; origin/DNS-rebinding protections form a material network boundary.
Live Synchronization, Graphs, and Host Integration
A filesystem watcher incrementally refreshes the persistent index after edits, pulls, or scripts, through grooveseek/src/watcher.rs. Link extraction and graph construction support connection-graph retrieval and CLI output via grooveseek/src/links.rs and grooveseek/src/graph.rs. Cross-platform background installation is isolated in grooveseek/src/service/mod.rs, while Windows-specific daemon/tray lifecycle handling resides in crates/groove-tray/src/daemon.rs and crates/groove-tray/src/tray.rs.
Main entry points: main.rs groove CLI · indexer.rs Index orchestrator · search.rs Hybrid retrieval · server.rs MCP server
Components 20
Core CLI & config
- groove CLI · Coordinates index, search, serve, validation, evaluation, and service commands.
grooveseek/src/main.rs - Core library
grooveseek/src/lib.rs - Configuration · Resolves KB paths, models, storage, transport, and schema settings.
grooveseek/src/config.rs - Schema validation
grooveseek/src/schema.rs
Index construction
- Index orchestrator · Walks knowledge bases, chunks content, and writes index records.
grooveseek/src/indexer.rs - Parser registry · Selects format parsers and isolates parser failures.
grooveseek/src/parser/registry.rs - ONNX embedder · Loads selected models, downloading them on first use.
grooveseek/src/embedder.rs
Storage & retrieval
- SQLite retrieval index · Stores documents, chunks, FTS data, and sqlite-vec vectors.
grooveseek/src/db/storage.rs - FTS query compiler
grooveseek/src/db/fts_query.rs - Hybrid retrieval · Combines lexical FTS and semantic vector candidates.
grooveseek/src/db/search.rs - Ranking & context · Diversifies results and expands parent context.
grooveseek/src/mmr.rs
MCP server & transports
- MCP server · Exposes tools, prompts, and kb:// resources.
grooveseek/src/server.rs - Search handler
grooveseek/src/server/search.rs - Document resources
grooveseek/src/server/documents.rs - stdio MCP transport
grooveseek/src/transport/stdio.rs - Streamable HTTP · Serves multi-client MCP and the protected operator UI.
grooveseek/src/transport/http.rs
Operations & host integration
- Filesystem watcher · Incrementally refreshes the index after content changes.
grooveseek/src/watcher.rs - Connection graph
grooveseek/src/graph.rs - Background service installer
grooveseek/src/service/mod.rs - Windows daemon & tray · Companion binaries manage Windows daemon and tray lifecycle.
crates/groove-tray/src/daemon.rs
Connections 22
- groove CLI → Core library: invokes
- Core library → Configuration: loads
- groove CLI → Schema validation: validates
- groove CLI → Index orchestrator: index command
- Index orchestrator → Parser registry: parses files
- Index orchestrator → ONNX embedder: embeds chunks
- Index orchestrator → SQLite retrieval index: writes records
- ONNX embedder → SQLite retrieval index: writes vectors
- groove CLI → Hybrid retrieval: search command
- FTS query compiler → Hybrid retrieval: compiles lexical query
- Hybrid retrieval → SQLite retrieval index: queries FTS and vectors
- Hybrid retrieval → Ranking & context: candidate results
- groove CLI → MCP server: serve command
- stdio MCP transport → MCP server: MCP requests
- Streamable HTTP → MCP server: HTTP requests
- MCP server → Search handler: search tool
- MCP server → Document resources: kb resources
- Search handler → Hybrid retrieval: retrieves
- Filesystem watcher → Index orchestrator: incremental reindex
- groove CLI → Connection graph: graph command
- groove CLI → Background service installer: service command
- Background service installer → Windows daemon & tray: Windows lifecycle