๐Ÿ’พ
Stage 4 ยท Lesson 1 of 5

QMD โ€” Advanced Search Engine

Keywords + Semantic + Re-ranking. The same files, dramatically better search.

~20 min read8 walkthrough steps

In Stage 2, you set up structured memory folders and basic semantic search. That works well for small-to-medium memory stores. But as your memory grows โ€” dozens of project files, extensive knowledge bases, months of accumulated context โ€” the built-in memory_search starts showing its limits. Searches take longer. Results get noisier. Relevant information gets buried under tangentially related matches.

QMD (Query, Match, Deliver) is OpenClaw's advanced memory search engine. It doesn't replace your memory files โ€” it replaces how you search them. Same files, same folder structure, dramatically better retrieval. Think of it as upgrading from a basic library card catalog to a full-text search engine with relevance ranking.

QMD combines three search strategies that the basic memory_search uses individually: keyword matching (exact word matches โ€” fast, precise, but misses synonyms), semantic search (meaning-based โ€” catches synonyms and related concepts, but can return false positives), and re-ranking (a second pass that scores results by actual relevance to your query, not just similarity). The combination is significantly more accurate than any single strategy alone.

The practical impact is measurable. Where basic memory_search might return 8 results with 2 relevant ones buried at positions 5 and 7, QMD returns 5 results with the 2 relevant ones at positions 1 and 2. Your agent spends less time processing noise and more time using the information that actually matters.

When should you upgrade from basic memory_search to QMD? The rule of thumb: if you have more than 20 memory files, or your total memory content exceeds 50,000 words, QMD's re-ranking will noticeably improve result quality. Below that threshold, basic search is fine. QMD adds a small performance overhead, so don't enable it until you need it.

Walkthrough

  1. 1
    Assess your current memory size: find memory/ -name '*.md' | wc -l (file count) and total word count
  2. 2
    Determine if you need QMD: >20 files or >50K words means yes
  3. 3
    Install QMD: bun install -g https://github.com/tobi/qmd
  4. 4
    Verify installation: qmd --version
  5. 5
    Run a benchmark: search for a specific concept using basic memory_search and note the results
  6. 6
    Enable QMD in your config (next lesson covers this in detail)
  7. 7
    Run the same search with QMD enabled and compare result quality and ranking
  8. 8
    Note: QMD uses your existing embedding provider โ€” make sure that's configured (Lesson 2.4)

Checkpoint

You understand QMD's three-strategy approach (keyword + semantic + re-ranking) and have assessed whether your memory store is large enough to benefit from it.