mdrag: a Rust CLI to chat with an Obsidian vault
- Models & engines
- Rust with rusqlite + sqlite-vec, ollama-rs, zerocopy
Embeddings: nomic-embed-text-v1.5 (768-dim)
LLM: gemma3:1b (temperature 0.2) - Key result
- Initial embedding takes a few seconds; queries are nearly instantaneous
What they built
Orel Lazri's vault grew to snippets, project docs, meeting notes and random thoughts. He wanted to ask questions like 'What were the main challenges in the refactor?' without a cloud service.
He wrote mdrag, a Rust CLI that embeds markdown into SQLite and answers through a local Ollama model, keeping work notes on the machine.
Setup
- Rust with rusqlite + sqlite-vec, ollama-rs, zerocopy
- Embeddings: nomic-embed-text-v1.5 (768-dim)
- LLM: gemma3:1b (temperature 0.2)
How it works
- Detect each document's primary header level and split on it, then split large chunks on paragraphs
- Store embeddings in a sqlite-vec virtual table
- Embed the query, fetch top-5 similar chunks via `embedding MATCH`, and stream an answer from gemma3:1b
Results & numbers
- Initial embedding takes a few seconds; queries are nearly instantaneous
- A 1B model gives good results without expensive hardware
“My notes never leave my machine - this is crucial for vaults that contain sensitive information like work-related notes”— Orel Lazri
Do it yourself
- Install Ollama and pull nomic-embed-text and gemma3:1b
- Build mdrag from the author's repo
- Run `mdrag embed ~/vault` once
- Ask: `mdrag search "how to debug git ssh issues"`
mdrag embed ~/vault
mdrag search "how to debug git ssh issues"Similar setups
A local second brain for Markdown notes with Ollama, Whisper and SQLite
WeekendAiProjects built a phone-to-computer note capture system that tidies, links, searches and answers questions over a Markdown vault with local Qwen models, and graded every answer by hand.
A local contract and invoice agent whose citations are checked by code
Gonzalo Blasco built a laptop-only agent that answers questions about contracts and invoices and only accepts a citation if its quote literally appears in the retrieved chunk; Gemma 4 12B got 18 of 18 of his test questions right.
Gist: an offline exam-prep partner that mines past papers with Ollama
A student built Gist so a friend could study from lecture PDFs and three-plus years of past exam papers without uploading copyrighted course material anywhere; parsing, embeddings, search and the LLM all run on the laptop with Wi-Fi off.
Slothsort: a local Gemma 3 agent that renames and files a messy Downloads folder overnight
Cody Topp built Slothsort, which uses Gemma 3 4B via Ollama plus Tesseract OCR to give every loose file a searchable name and folder, with a plan page before moving anything and a full undo.