qmd
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseqmd - Quick Markdown Search
qmd - 快速Markdown搜索
Local search engine for Markdown notes, docs, and knowledge bases. Index once, search fast.
一款面向Markdown笔记、文档和知识库的本地搜索引擎。一次索引,快速搜索。
When to use (trigger phrases)
使用场景(触发语)
- "search my notes / docs / knowledge base"
- "find related notes"
- "retrieve a markdown document from my collection"
- "search local markdown files"
- "搜索我的笔记 / 文档 / 知识库"
- "查找相关笔记"
- "从我的集合中检索Markdown文档"
- "搜索本地Markdown文件"
Default behavior (important)
默认行为(重要)
- Prefer (BM25). It's typically instant and should be the default.
qmd search - Use only when keyword search fails and you need semantic similarity (can be very slow on a cold start).
qmd vsearch - Avoid unless the user explicitly wants the highest quality hybrid results and can tolerate long runtimes/timeouts.
qmd query
- 优先使用(BM25算法)。该模式通常能瞬间出结果,应作为默认选择。
qmd search - 仅当关键词搜索失败,且你需要语义相似度搜索时,才使用(冷启动时可能非常缓慢)。
qmd vsearch - 除非用户明确要求最高质量的混合搜索结果,且能容忍较长运行时间/超时,否则避免使用。
qmd query
Prerequisites
前置要求
- Bun >= 1.0.0
- macOS: (SQLite extensions)
brew install sqlite - Ensure PATH includes:
$HOME/.bun/bin
Install Bun (macOS):
brew install oven-sh/bun/bun- Bun >= 1.0.0
- macOS: (SQLite扩展)
brew install sqlite - 确保PATH包含:
$HOME/.bun/bin
安装Bun(macOS):
brew install oven-sh/bun/bunInstall
安装
bun install -g https://github.com/tobi/qmdbun install -g https://github.com/tobi/qmdSetup
配置
bash
qmd collection add /path/to/notes --name notes --mask "**/*.md"
qmd context add qmd://notes "Description of this collection" # optional
qmd embed # one-time to enable vector + hybrid searchbash
qmd collection add /path/to/notes --name notes --mask "**/*.md"
qmd context add qmd://notes "该集合的描述" # 可选
qmd embed # 仅需执行一次,用于启用向量+混合搜索What it indexes
索引范围
- Intended for Markdown collections (commonly ).
**/*.md - In our testing, "messy" Markdown is fine: chunking is content-based (roughly a few hundred tokens per chunk), not strict heading/structure based.
- Not a replacement for code search; use code search tools for repositories/source trees.
- 专为Markdown集合设计(通常匹配)。
**/*.md - 测试表明,“不规范”的Markdown文件也能正常处理:分块基于内容(大致每块几百个tokens),而非严格基于标题/结构。
- 不能替代代码搜索工具;如需搜索代码仓库/源码树,请使用专门的代码搜索工具。
Search modes
搜索模式
- (default): fast keyword match (BM25)
qmd search - (last resort): semantic similarity (vector). Often slow due to local LLM work before the vector lookup.
qmd vsearch - (generally skip): hybrid search + LLM reranking. Often slower than
qmd queryand may timeout.vsearch
- (默认):快速关键词匹配(BM25算法)
qmd search - (最后选择):语义相似度(向量)搜索。由于本地LLM运算,在向量查找前通常速度较慢。
qmd vsearch - (通常跳过):混合搜索+LLM重排序。通常比
qmd query更慢,且可能超时。vsearch
Performance notes
性能说明
- is typically instant.
qmd search - can be ~1 minute on some machines because query expansion may load a local model (e.g., Qwen3-1.7B) into memory per run; the vector lookup itself is usually fast.
qmd vsearch - adds LLM reranking on top of
qmd query, so it can be even slower and less reliable for interactive use.vsearch - If you need repeated semantic searches, consider keeping the process/model warm (e.g., a long-lived qmd/MCP server mode if available in your setup) rather than invoking a cold-start LLM each time.
- 通常能瞬间出结果。
qmd search - 在部分机器上可能耗时约1分钟,因为查询扩展可能需要将本地模型(如Qwen3-1.7B)加载到内存中;向量查找本身通常很快。
qmd vsearch - 在
qmd query基础上增加了LLM重排序,因此速度更慢,交互式使用时可靠性更低。vsearch - 如需重复进行语义搜索,建议保持进程/模型处于预热状态(例如,若你的环境支持,可使用长期运行的qmd/MCP服务器模式),而非每次都启动冷LLM。
Common commands
常用命令
bash
qmd search "query" # default
qmd vsearch "query"
qmd query "query"
qmd search "query" -c notes # Search specific collection
qmd search "query" -n 10 # More results
qmd search "query" --json # JSON output
qmd search "query" --all --files --min-score 0.3bash
qmd search "query" # 默认模式
qmd vsearch "query"
qmd query "query"
qmd search "query" -c notes # 搜索指定集合
qmd search "query" -n 10 # 显示更多结果
qmd search "query" --json # JSON格式输出
qmd search "query" --all --files --min-score 0.3Useful options
实用选项
- : number of results
-n <num> - : restrict to a collection
-c, --collection <name> - : return all matches above a threshold
--all --min-score <num> - /
--json: agent-friendly output formats--files - : return full document content
--full
- :结果数量
-n <num> - :限定搜索指定集合
-c, --collection <name> - :返回所有高于阈值的匹配结果
--all --min-score <num> - /
--json:适用于Agent的输出格式--files - :返回完整文档内容
--full
Retrieve
文档检索
bash
qmd get "path/to/file.md" # Full document
qmd get "#docid" # By ID from search results
qmd multi-get "journals/2025-05*.md"
qmd multi-get "doc1.md, doc2.md, #abc123" --jsonbash
qmd get "path/to/file.md" # 获取完整文档
qmd get "#docid" # 通过搜索结果中的ID获取
qmd multi-get "journals/2025-05*.md"
qmd multi-get "doc1.md, doc2.md, #abc123" --jsonMaintenance
维护
bash
qmd status # Index health
qmd update # Re-index changed files
qmd embed # Update embeddingsbash
qmd status # 索引健康状态
qmd update # 重新索引已修改的文件
qmd embed # 更新嵌入向量Keeping the index fresh
保持索引更新
Automate indexing so results stay current as you add/edit notes.
- For keyword search (),
qmd searchis usually enough (fast).qmd update - If you rely on semantic/hybrid search (/
vsearch), you may also wantquery, but it can be slow.qmd embed
Example schedules (cron):
bash
undefined自动执行索引,确保在添加/编辑笔记时结果保持最新。
- 对于关键词搜索(),
qmd search通常足够(速度快)。qmd update - 若依赖语义/混合搜索(/
vsearch),你可能还需要执行query,但该操作速度较慢。qmd embed
示例定时任务(cron):
bash
undefinedHourly incremental updates (keeps BM25 fresh):
每小时增量更新(保持BM25索引最新):
0 * * * * export PATH="$HOME/.bun/bin:$PATH" && qmd update
0 * * * * export PATH="$HOME/.bun/bin:$PATH" && qmd update
Optional: nightly embedding refresh (can be slow):
可选:每晚更新嵌入向量(可能速度较慢):
0 5 * * * export PATH="$HOME/.bun/bin:$PATH" && qmd embed
If your Clawdbot/agent environment supports a built-in scheduler, you can run the same commands there instead of system cron.0 5 * * * export PATH="$HOME/.bun/bin:$PATH" && qmd embed
如果你的Clawdbot/Agent环境支持内置调度器,你可以在该环境中运行相同的命令,而非使用系统cron。Models and cache
模型与缓存
- Uses local GGUF models; first run auto-downloads them.
- Default cache: (override with
~/.cache/qmd/models/).XDG_CACHE_HOME
- 使用本地GGUF模型;首次运行时会自动下载。
- 默认缓存路径:(可通过
~/.cache/qmd/models/覆盖)。XDG_CACHE_HOME
Relationship to Clawdbot memory search
与Clawdbot内存搜索的区别
- searches your local files (notes/docs) that you explicitly index into collections.
qmd - Clawdbot's searches agent memory (saved facts/context from prior interactions).
memory_search - Use both: for "what did we decide/learn before?",
memory_searchfor "what's in my notes/docs on disk?".qmd
- 搜索的是你本地的文件(笔记/文档),这些文件需要你显式索引到集合中。
qmd - Clawdbot的搜索的是Agent内存(来自之前交互的已保存事实/上下文)。
memory_search - 两者可配合使用:用于查找“我们之前决定/了解到什么?”,
memory_search用于查找“我磁盘上的笔记/文档中有什么内容?”。qmd