Home / use case

mdrag: a Rust CLI to chat with an Obsidian vault

At a glance
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

  1. Detect each document's primary header level and split on it, then split large chunks on paragraphs
  2. Store embeddings in a sqlite-vec virtual table
  3. 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

  1. Install Ollama and pull nomic-embed-text and gemma3:1b
  2. Build mdrag from the author's repo
  3. Run `mdrag embed ~/vault` once
  4. Ask: `mdrag search "how to debug git ssh issues"`
mdrag embed ~/vault
mdrag search "how to debug git ssh issues"
Source: orellazri.com · Published 2025-06-21 · Added 2026-10-18. This write-up summarizes the original source; see it for full details.

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.

DEV Community · 2026-11-08

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.

DEV Community (Gonzalo Blasco) · 2026-11-21

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.

DEV Community (Hacktoberfest Build for a Friend) · 2026-10-20

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.

Cody Topp (DEV Community) · 2026-10-24