QMD helps coding agents save tokens when working with large projects
QMD—a semantic codebase search tool—reduces costs for AI agent operations. In one test scenario, savings reached 40.92%, though in another, the reduction was significantly more modest.

QMD is an open-source command-line tool that indexes documents and supports keyword, semantic, and hybrid search with result reranking.
In hybrid mode, QMD uses local models: one converts text fragments into vectors, another assesses the relevance of found results, and a third expands the original query. The index must be updated after changes to the codebase. To improve search accuracy, it is recommended to exclude compiled files, large language files, and other unnecessary data.
In testing on a large project with Java, Scala, and Angular code, semantic search reduced the cost of coding agent operations by 40.92%. The volume of regular input tokens decreased by approximately 36%, while cached tokens were reduced nearly fourfold. Output and reasoning volumes also declined.
In another scenario, the advantage was minimal: costs decreased by only 1.33%, as the increase in cached input tokens and output volume nearly fully offset the savings.
On small projects, QMD may prove ineffective. For example, when working with a codebase of 27 files, costs increased by 60%. Therefore, the tool is best suited for large repositories: first locating necessary files using semantic search, then switching to standard tools to examine only relevant sections of code.





