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, which indexes documents and offers three search modes: fast keyword search, semantic search, and hybrid + reranking (best quality). The hybrid mode uses three small local models:

Workflow: add source files via qmd collection add (you can show the example to your agent and let it pick folders/extensions), build the index with qmd update && qmd embed, then add rules to AGENTS.md: read files directly when the path is known, use rg/LSP for known identifiers, and use qmd query only 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 →