The open-source tool QMD (Query Markup Documents) allows coding agents to perform semantic searches across codebases. By indexing project files, the tool enables agents to locate relevant code modules without scanning the entire repository, which reduces token consumption during LLM-based tasks.

To implement QMD, developers must add project source files to a collection and run indexing. The tool supports keyword, semantic, and hybrid search methods, with the latter providing the highest quality by combining vector embeddings and reranking. The system requires three distinct models: one for indexing, one for semantic comparison, and one for query expansion.

In tests using a repository with 1,231 files, the integration of QMD resulted in a reduction of input tokens by 21.3% and reasoning tokens by 13.9%. While cached input usage dropped by nearly four times in specific scenarios, the overall cost savings varied between 1% and 40% depending on the task complexity.

The author notes that QMD is most effective for large codebases. In a test on a small project consisting of only 27 files, the tool increased costs by 60%. Users are advised to carefully configure file masks to exclude compiled files and large assets, as these can degrade search accuracy and increase overhead.