Introduction¶
In DeepSeek Harness (DSH) development, enabling the model to search within a knowledge base directory is a common requirement. Typically, tools such as grep or glob are used. However, these tools mainly rely on file-name and path matching and lack semantic-level understanding. When the model searches for a concept, it may only match documents whose filenames contain that term while ignoring semantically related documents. The qmd-autosearch plugin solves this problem.
What It Is¶
qmd-autosearch is a DSH plugin maintained by zhangzhenwen1. Its core purpose is to automatically supplement a QMD semantic search result when the model runs grep / glob searches in a knowledge-base directory, and inject the result into the model context.
Core Features¶
- Automatic triggering: No manual invocation is required; the plugin is triggered when the model makes a top-level call in the directory corresponding to a QMD collection.
- Semantic supplementary search: It uses a lex + vec query, performs server-side LLM reranking, and restricts results to the configured collections.
- Intelligent query terms: It prefers the most recent user message as the primary semantic query; if the message is too short or irrelevant, it falls back to the grep pattern.
- Asynchronous injection: Results are queued to
agent.inbox.nextStepand injected into the model context during the next pre-step, without blocking the current tool call. - Duplicate prevention: Within the same agent, the same (tool, path, pattern) signature triggers a supplementary search only once.
- Fault tolerance: If the QMD service is unavailable or returns no results, the plugin silently skips processing and does not affect the original flow.
Installation and Enablement¶
Install the plugin using the following command:
dsh plugin --profile web add qmd-autosearch
Configuration¶
The plugin requires the QMD service address and search scope to be specified in the configuration.
qmdUrl(required): The QMD MCP service URL, e.g.,http://localhost:6179/mcp.collections(required): A list of QMD collection names.limit(default: 5): Maximum number of results to inject.minScore(default: 25): Minimum matching score filter.triggerRoots(default: automatic): A list of filesystem root paths used for trigger detection.
If
qmdUrlorcollectionsis not configured, the plugin will be disabled and a warn log will be output.
Prerequisites¶
The following conditions must be met before use:
- A running QMD MCP service (
qmd mcp --http --port 6179). - At least one established collection.
How It Works¶
The plugin workflow is as follows:
grep/globfinishes executing and the tool hook is triggered.- It determines whether the path is within the trigger scope (based on collection paths parsed from QMD status).
- It executes a QMD query (restricted to the collections and using LLM reranking).
- The result is queued to
agent.inbox.nextStep. - The result is injected into the model context in the next pre-step (
system-reminderstyle).
Typical Usage¶
After configuration, the plugin runs fully automatically and requires no manual invocation.
- Ask the model to search within a knowledge-base directory, e.g., run
grep 内需. - The plugin detects that the search occurred inside a QMD collection directory and automatically supplements a semantic search.
- The result appears in the next context as a
<system-reminder>, including docid, score, path, and title. The model can then usereadto read the full text.
Use Cases and Notes¶
- Zero external dependencies: The plugin does not depend on additional third-party libraries.
- Permissions and security: The plugin runs with the current DSH process permissions. Before installation, review the source code and license (MIT).
- Ecosystem links:
- Plugin directory: https://www.skillhub.cn/plugins/zhangzhenwen1/qmd-autosearch
- GitHub: https://github.com/zhangzhenwen1/qmd-autosearch