QMD: Local semantic search saves coding agents up to 55% of search tokens

ievkz · reddit · 2026-11-16

A Reddit user observed that coding agents burn lots of tokens running find, rg --files, and grep before every task, and tested whether local semantic search could replace that — cutting token usage by up to 55%.

The setup uses the open-source QMD (Query Markup Documents) CLI with three search modes: fast keyword, semantic, and hybrid + reranking (best quality), powered by three small local models: embeddinggemma-300M for embeddings, qwen3-reranker-0.6b for reranking, and qmd-query-expansion-1.7B for query expansion.

Workflow: add files via qmd collection add (or let your agent configure it), index with qmd update && qmd embed, and add tool-selection rules to AGENTS.md: read files directly when the path is known, use rg/LSP for known identifiers, and use qmd query when only the behavior is known.

Key rules: QMD replaces the initial broad search rather than adding a step; use specific English technical queries; read only relevant sections of the top 3–5 files; refine the query or raise -n to 60 before falling back to rg/LSP.

Related event: Open-source QMD cuts coding agent token use by 55% with local semantic search(3 posts)→

Original post →

More from coding & agent

coding & agent channel →