Skip to main content

QMD: Search Markdown Notes Locally

QMD (Query Markup Documents) is an on-device search engine for Markdown notes, meeting transcripts, documentation, and knowledge bases. It is useful when you remember a subject but not the filename or the words used in the note. A research library is one possible use; QMD does not require a particular folder layout or note taxonomy. The examples below use a library of quantitative-trading research notes.

Choose the search mode​

QMD offers three ways to find documents:

  • search uses BM25, a full-text ranking method based on query terms. Use it for known terminology such as “FIFO execution”; it does not need a language model.
  • vsearch compares embeddings, numerical representations used to estimate similarity in meaning. Use it when your wording may differ from the source.
  • query combines keyword and vector retrieval with query expansion and model-based reranking. Expansion supplies alternative search formulations; reranking reorders the retrieved candidates.

One note is enough to see the difference. Suppose the collection holds a note on production isolation whose text says “research code reads only historical data and never places orders,” without ever using the word “separate.” search "separate" will not find it, because BM25 only checks whether the query terms appear; vsearch "how to keep research separate from production" compares meaning and can rank it near the top; query runs both and then reorders the candidates.

All three models run locally and are downloaded from Hugging Face the first time they are needed: the embeddinggemma-300M embedding model is about 300 MB, the qwen3-reranker-0.6b reranker about 640 MB, and the query-expansion model about 1.1 GB. A first query therefore downloads about 2 GB; search alone downloads nothing. Semantic search also needs document embeddings first.

Set up a collection and find a note​

QMD installs from the official npm package and needs Node.js 22 or Bun 1.0 or later. Replace ./notes with an existing Markdown directory. Here notes is a collection name you choose, not a built-in library.

npm install -g @tobilu/qmd
qmd collection add ./notes --name notes
qmd embed
qmd query "quantitative research production isolation" -c notes
qmd search "FIFO execution" -c notes

In a terminal, each result is a small block: the first line holds the path, line number, and a document ID starting with #, followed by the title, the collection's context description, the score, and the matching snippet. The block below follows the terminal example in the QMD documentation; its content is invented:

quant/portfolio-lifecycle.md:18 #3f9c2e
Title: Portfolio lifecycle
Context: Quant research notes
Score: 81%
Research code reads only historical data and never places orders...

For scripts or agents, add --format json; csv, md, xml and a plain file list are also available. Keyword search can be used without the embedding step. For a semantic-only comparison, try:

qmd vsearch "how to keep research separate from production" -c notes

Open the note using the path on a result's first line or the document ID starting with #. The path below is illustrative; it must exist in your collection:

qmd get qmd://notes/quant/portfolio-lifecycle.md

get includes line numbers by default. Read the surrounding explanation and its citations, not just the matching excerpt. After editing source notes, refresh the index and generate missing embeddings:

qmd update
qmd embed

For a collection you configured yourself, these refresh your searchable copy.

A collection can define a shell command that update runs with bash -c. If a checked-in .qmd config contains such a command, a path outside the project, or a non-default model, QMD does not act on it until you review and approve it with qmd trust; agents, CI and MCP calls skip those fields. When you take over someone else's repository, run qmd trust once to see what it would execute.

Connect an AI assistant​

qmd mcp runs QMD as an MCP server, so an assistant can call tools such as query, get and multi_get. MCP is the protocol that connects AI clients to tools; client setup is covered in Model Context Protocol (MCP). For how QMD compares with zvec-grep and Basic Memory, and the limits the three share, see Agent Memory.

Explore connectionsOpen network