mdrag: a Rust CLI to chat with an Obsidian vault
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"Related
Home RAG assistant for embedded-systems docs on Proxmox
Ollama, llama.cpp, Open WebUI, BGE-M3 and SearXNG in a GPU-passthrough VM. Moving from 6 GB to 16 GB of VRAM changed which models could run.
Overnight video-to-RAG pipeline for 2,000+ saved clips
A local Qwen3.6 35B with ffmpeg, scenedetect and Whisper indexes saved TikToks and YouTube videos, so you can later find 'that one plumbing tutorial'.
Offline RAG over 268 Obsidian notes, queryable from a coding agent
nomic-embed-text, ChromaDB and mistral-nemo:12b give cited answers from a vault of internal docs, and an MCP server lets the coding agent search it too.
Connecting a private Obsidian vault to Ollama on macOS
Meeting notes stay off public AI services. llama3.1 and nomic-embed-text in Ollama, wired up through the Local GPT and AI Providers plugins.