Hybrid Search
Lexical (FTS5 BM25) and semantic (usearch HNSW) retrieval run in parallel, fused with Reciprocal Rank Fusion and reranked by recency and authority.
[ open source ] single binary · rust · onnx · sqlite · mcp
Structured information for AI agents via MCP.One Rust binary — hybrid search and a knowledge graph in a single process, built for a 16 GB laptop. No external services.
// 00 · architecture
Documents are parsed, chunked, embedded, and run through NER into a knowledge graph with a hybrid FTS5 + usearch index. State lives in a per-dataset knowledge.db, a global cache.db, and usearch index files — served to AI agents over MCP.
// 01 · pipeline
Synopsis is one stage of a larger information pipeline — not a standalone assistant and not a search platform. Everything between the source files and 12 MCP tools runs in one Rust binary.
Markdown, JSON, and web pages from the configured sources. A startup reconcile, a file watcher, and the pipeline enqueue events into queue_tasks; a background worker processes the queue.
A format-specific parser turns every file into the same structured document; header-based or fixed-size chunking with overlap. Unchanged files (same SHA-256) are skipped entirely.
Local ONNX embeddings per chunk, ONNX NER, then entity and fact extraction; the same entity is linked across domains with CEL or an LLM — into a knowledge graph and a usearch hybrid index.
Entities, relations, and approved facts are served as 12 read-only MCP tools over Streamable HTTP (/mcp), with the legacy HTTP+SSE pair also served.
// 02 · capabilities
Six systems inside one Rust binary — strict boundaries, no services to operate between them.
Lexical (FTS5 BM25) and semantic (usearch HNSW) retrieval run in parallel, fused with Reciprocal Rank Fusion and reranked by recency and authority.
Entities from ONNX NER, cross-domain links from an LLM, CEL linkers for the deterministic cases — a petgraph index serves dossiers, relations, and links.
Twelve read-only tools over Streamable HTTP (/mcp) with the legacy HTTP+SSE pair (GET /sse + POST /message) also served — built for agents, not browsers.
usearch HNSW on mmap, scalar-quantized, with WAL + segments and background compaction — the query path never loads the embedding model.
SQLite with FTS5 is compiled in-tree — no C interop, no system dependencies. The ONNX runtime and model weights download on demand, verified by URL + size + SHA-256.
A startup reconcile, a file watcher, and the pipeline enqueue events (doc:index / doc:delete / entity:link) into queue_tasks; a background worker processes the queue with retries and status reporting.
// 03 · how it works
One binary, five steps — obtain it, install the runtime, download the model, serve, then connect a client. Everything runs locally.
Prebuilt Gitea Release archive for the 5 targets (Linux amd64/arm64, Windows amd64, macOS arm64) — or cargo build --release from the pinned Rust 1.96.0 toolchain.
synopsis onnx-runtime install downloads the ONNX Runtime library per onnx.yaml — URL, size, and SHA-256 verified.
synopsis model download fetches the default embedding model into workspace/models/.
synopsis serve starts the MCP server on :8080 — preset default, config auto-searched, initial ingest plus file watching.
Point any MCP client at /mcp — the primary transport: JSON-RPC over POST, responses as plain JSON or an SSE stream.
GET /sse opens the stream, POST /message?sessionId=… carries the calls — the legacy wire contract, still served.
GET /health returns status, version, and knowledge-base counters.
// 04 · quick start
synopsis onnx-runtime installOne-time setup: downloads the ONNX Runtime library per workspace/configs/onnx.yaml — URL, size, and SHA-256 verified — for fully local embeddings.
synopsis model downloadFetches the default embedding model from the onnx.yaml registry and verifies it before first use.
synopsis serveStarts the MCP server on port 8080 (preset "default") — startup reconcile plus a file watcher keep the knowledge base fresh.
$ synopsis onnx-runtime install✓ onnxruntime — cpu · linux/amd64 · sha-256 ok$ synopsis model download✓ model bge-small-en-v1.5 · 384 dims · sha-256 ok$ synopsis serve✓ mcp server → http://localhost:8080/mcp · legacy /sse$ curl -s http://localhost:8080/health{"status":"ok"}
→ first mcp call — POST /mcp · tools/call
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": search,
"arguments": {
"query": "vacation policy",
"domain": "hr"
}
}
}// 05 · mcp tools
Twelve read-only tools over Streamable HTTP (/mcp), with the legacy HTTP+SSE pair also served — declarative JSON schemas, cursor pagination, and full provenance on every answer.
// 06 · use cases
Domain tags decide what gets extracted and how it links — the same engine serves every department.
Vacation, hiring, benefits — ask “how does the policy apply to contractors?” and get the answer with the exact source quote.
Runbooks, incidents, change records — find the last fix for a service outage across the wiki and ticket history.
Specs, roadmaps, feedback — keep features, decisions, and owners consistent in one queryable place.
Design docs, ADRs, post-mortems — the same system or person linked across code, prose, and tickets.
// 07 · tech stack
Each component exists so the whole system stays one process on local files — and so it can still be rebuilt by a single engineer.
| Component | Role | Why |
|---|---|---|
| Rust 1.96 (pinned) | One self-contained binary | The toolchain is pinned in rust-toolchain.toml; SQLite with FTS5 is compiled in-tree, so a build cannot silently lack FTS5. No C interop. |
| tokio + axum | Async runtime + HTTP | One process serves the MCP endpoints, the job-queue worker, and the file watcher — no services to operate between them. |
| rusqlite (bundled SQLite + FTS5) | Storage + lexical search | WAL mode keeps serving reads while ingestion writes; BM25 over search_text is the lexical leg of hybrid search. |
| ONNX Runtime (ort) | Local embeddings on CPU | No API keys — int8-quantized bge models run fully offline; the runtime and weights download on demand, verified by URL + size + SHA-256. |
| usearch | Disk-backed ANN | HNSW on mmap, scalar-quantized, WAL + segments — 1M × 1024-dim vectors fit a 16 GB laptop, and the query path never loads the embedding model. |
| rmcp | MCP protocol | Streamable HTTP (/mcp) with the legacy HTTP+SSE pair also served — declarative, self-documenting tools for Claude Desktop, Cursor, and any MCP client. |
| CEL · petgraph · minijinja | Linking · graph · prompts | CEL expressions drive deterministic entity linking, petgraph indexes the knowledge graph, minijinja renders the LLM prompt templates. |
| jiff · clap · tracing | UTC dates · CLI · logging | RFC 3339 timestamps, a flag-driven CLI surface, and tracing in the binary only — library crates stay logger-less. |
// 08 · get started
Point any MCP client at localhost:8080/mcp (or /sse for legacy clients). Documents in, a queryable knowledge base out — about five minutes of your time.
$ synopsis serve — mcp http://localhost:8080/mcp · legacy /sse