QMD - Query Markup Documents
An on-device search engine for everything you need to remember. Index your markdown notes, meeting transcripts, documentation, and knowledge bases. Search with keywords or natural language. Ideal for your agentic flows.
QMD combines BM25 full-text search, vector semantic search, and LLM re-ranking—all running locally via node-llama-cpp with GGUF models.
flowchart LR
Q[User Query] --> X[Query Expansion]
Q --> FTS[BM25 Search]
Q --> VS[Vector Search]
X --> HYDE[HyDE]
X --> VEC[Vec dense sentences]
X --> LEX[Lex BM25 keywords]
HYDE --> VS
VEC --> VS
LEX --> FTS
VS --> RRF[Reciprocal Rank Fusion]
FTS --> RRF
RRF --> RR[LLM Reranker]
RR --> OUT[Final ranked results]
Typed expansions are routed exclusively: lex → BM25/FTS, vec and hyde → vector search. The original query is sent to both backends, then fused with RRF and reranked.
You can read more about QMD's progress in the CHANGELOG.
Quick Start
# Install globally (Node or Bun)
npm install -g @tobilu/qmd
# or
bun install -g @tobilu/qmd
# Or run directly
npx @tobilu/qmd ...
bunx @tobilu/qmd ...
# Create collections for your notes, docs, and meeting transcripts
qmd collection add ~/notes --name notes
qmd collection add ~/Documents/meetings --name meetings
qmd collection add ~/work/docs --name docs
# Add context to help with search results, each piece of context will be returned when matching sub documents are returned. This works as a tree. This is the key feature of QMD as it allows LLMs to make much better contextual choices when selecting documents. Don't sleep on it!
qmd context add qmd://notes "Personal notes and ideas"
qmd context add qmd://meetings "Meeting transcripts and notes"
qmd context add qmd://docs "Work documentation"
# Generate embeddings for semantic search
qmd embed
# Search across everything
qmd search "project timeline" # Fast keyword search
qmd vsearch "how to deploy" # Semantic search
qmd query "quarterly planning process" # Hybrid + reranking (best quality)
# Get a specific document
qmd get "meetings/2024-01-15.md"
# Get a document by docid (shown in search results)
qmd get "#abc123"
# Get multiple documents by glob pattern
qmd multi-get "journals/2025-05*.md"
# Search within a specific collection
qmd search "API" -c notes
# Export all matches for an agent
qmd search "API" --all --files --min-score 0.3Using with AI Agents
QMD's --json and --files output formats are designed for agentic workflows:
# Get structured results for an LLM
qmd search "authentication" --json -n 10
# List all relevant files above a threshold
qmd query "error handling" --all --files --min-score 0.4
# Retrieve full document content
qmd get "docs/api-reference.md" --fullMCP Server
Although the tool works perfectly fine when you just tell your agent to use it on the command line, it also exposes an MCP (Model Context Protocol) server for tighter integration.
Tools exposed:
query— Search with typed sub-queries (lex/vec/hyde), combined via RRF + rerankingget— Retrieve a document by path or docid (with fuzzy matching suggestions)multi_get— Batch retrieve by glob pattern, comma-separated list, or docidsstatus— Index health and collection info, including each collection's top metadata keysmetadata— Discover metadata keys, types, and value counts to filter on
Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"qmd": {
"command": "qmd",
"args": ["mcp"]
}
}
}Claude Code — Install the plugin (recommended):
claude plugin marketplace add tobi/qmd
claude plugin install qmd@qmdOr configure MCP manually in ~/.claude/settings.json:
{
"mcpServers": {
"qmd": {
"command": "qmd",
"args": ["mcp"]
}
}
}HTTP Transport
By default, QMD's MCP server uses stdio (launched as a subprocess by each client). For a shared, long-lived server that avoids repeated model loading, use the HTTP transport:
# Foreground (Ctrl-C to stop)
qmd mcp --http # localhost:8181
qmd mcp --http --port 8080 # custom port
qmd mcp --http --host 0.0.0.0 # bind all interfaces (e.g. container probes)
# Background daemon
qmd mcp --http --daemon # start, writes PID to ~/.cache/qmd/mcp.pid
qmd mcp stop # stop via PID file
qmd status # shows "MCP: running (PID ...)" when activeMCP shutdown allows active requests five seconds to finish. After that it cancels them; a standalone server exits nonzero if work remains. Embedded callers receive a timeout error while resource cleanup continues safely. An external supervisor is still needed if native code blocks the event loop.
The server binds to localhost by default. Pass --host (or set the QMD_HOST
environment variable) to override — --host 0.0.0.0 is useful when the server
runs in a container and a liveness probe connects from a non-loopback address.
The HTTP server exposes two endpoints:
POST /mcp— MCP Streamable HTTP (stateless JSON and SSE responses)POST /query(alias/search) — structured search without the MCP protocol. Accepts the same optionalfilterobject as thequerytool (invalid filters return400); see Metadata FilteringPOST /metadata— metadata discovery without the MCP protocol. Same body as themetadatatool (invalid filters return400); see Metadata DiscoveryGET /health— liveness check with uptime
Origin and Host validation
Every request is screened before routing: a request carrying an Origin header
that does not name a loopback address is rejected with 403, as is a Host
header naming something other than the address the server is bound to. This is
what stops a web page you visit from reading your index through DNS rebinding —
loopback binding alone does not, since the browser makes the request from your
own machine.
Requests without an Origin header — curl, MCP clients, editors — are
unaffected, which covers every normal local client.
| Variable | Effect |
|---|---|
QMD_ALLOWED_ORIGINS |
Comma-separated origins to accept in addition to loopback, e.g. https://notes.internal. Set to * to disable the check entirely. |
QMD_ALLOWED_HOSTS |
Comma-separated Host values to accept in addition to loopback and the bind address. |
--host 0.0.0.0 cannot know which Host values are legitimate, so it skips the
host check and warns at startup. Set QMD_ALLOWED_HOSTS to re-enable it, and
remember the endpoints are unauthenticated — put your own auth in front of a
server that is reachable off-host.
LLM models stay loaded in VRAM across requests. Embedding/reranking contexts are disposed after 5 min idle and transparently recreated on the next request (~1s penalty, models remain loaded).
Point any MCP client at http://localhost:8181/mcp to connect.
MCP Tool Parameters
| Tool | Parameter | Type | Notes |
|---|---|---|---|
query |
searches |
array | Typed sub-queries (lex/vec/hyde), 1–10. Required. First gets 2x weight. |
query |
collections |
string[] | Filter by collection names (OR). Array only — singular collection is silently ignored. |
query |
filter |
object | Metadata filter (recursive operator-discriminated JSON AST; see Metadata Filtering) |
query |
intent |
string | Disambiguation context (does not search on its own) |
query |
limit |
number | Max results (default 10) |
query |
minScore |
number | Minimum relevance 0–1 (default 0) |
query |
candidateLimit |
number | Max candidates to rerank (default 40) |
query |
rerank |
boolean | Run LLM reranking (default true); set false for RRF-only |
get |
file |
string | Path, docid (#abc123), or path:from:count (e.g. #abc123:120:40) |
get |
fromLine |
number | Start line (1-indexed); overrides the :from suffix |
get |
maxLines |
number | Limit returned lines |
get |
lineNumbers |
boolean | Prefix lines with numbers (default true) |
multi_get |
pattern |
string | Glob pattern or comma-separated list |
multi_get |
maxBytes |
number | Skip files larger than N (default 10240) |
multi_get |
maxLines |
number | Limit lines per file |
multi_get |
lineNumbers |
boolean | Prefix lines with numbers (default true) |
metadata |
collections |
string[] | Restrict discovery to collection names (default: the collections query searches) |
metadata |
match |
object | Report only metadata entries matching this condition (same AST as filter, with field naming the entry's key or value) |
metadata |
filter |
object | Count only documents matching this filter (same AST as query) |
metadata |
keyLimit |
number | Keys reported (default 50). totalKeys and remainingKeys describe the rest |
metadata |
keyOffset |
number | Keys skipped before the window, in report order (default 0) |
metadata |
valueLimit |
number | Values reported per key and type (default 10). remainingValues reports the rest |
metadata |
valueOffset |
number | Values skipped per key and type before the window, in sort order (default 0) |
metadata |
sort |
string | count (default) or value |
metadata |
minCount |
number | Hide values held by fewer documents (default 1) |
Unknown parameters are silently ignored (not rejected) — double-check names if
results seem unscoped. The HTTP /query and /search endpoints return
qmd://collection/path URIs in the file field, matching the CLI and MCP output.
SDK / Library Usage
Use QMD as a library in your own Node.js or Bun applications.
Installation
npm install @tobilu/qmdQuick Start
import { createStore } from '@tobilu/qmd'
const store = await createStore({
dbPath: './my-index.sqlite',
config: {
collections: {
docs: { path: '/path/to/docs', pattern: '**/*.md' },
},
},
})
const results = await store.search({ query: "authentication flow" })
console.log(results.map(r => `${r.title} (${Math.round(r.score * 100)}%)`))
await store.close()Each store owns its configuration source. close() rejects new SDK operations
and waits for admitted operations before closing the database; a stuck operation
can therefore delay shutdown indefinitely. Access through store.internal
bypasses this lifecycle.
SDK embed() and the CLI share an exclusive per-index lock. A concurrent SDK
call rejects with EmbedLockBusyError; the CLI reports that embedding is busy.
Older QMD versions do not use this lock and must not embed concurrently.
Store Creation
createStore() accepts three modes:
import { createStore } from '@tobilu/qmd'
// 1. Inline config — no files needed besides the DB
const store = await createStore({
dbPath: './index.sqlite',
config: {
collections: {
docs: { path: '/path/to/docs', pattern: '**/*.md' },
notes: { path: '/path/to/notes' },
},
},
})
// 2. YAML config file — collections defined in a file
const store2 = await createStore({
dbPath: './index.sqlite',
configPath: './qmd.yml',
})
// 3. DB-only — reopen a previously configured store
const store3 = await createStore({ dbPath: './index.sqlite' })Search
The unified search() method handles both simple queries and pre-expanded structured queries:
// Simple query — auto-expanded via LLM, then BM25 + vector + reranking
const results = await store.search({ query: "authentication flow" })
// With options
const results2 = await store.search({
query: "rate limiting",
intent: "API throttling and abuse prevention",
collection: "docs",
limit: 5,
minScore: 0.3,
explain: true,
})
// Pre-expanded queries — skip auto-expansion, control each sub-query
const results3 = await store.search({
queries: [
{ type: 'lex', query: '"connection pool" timeout -redis' },
{ type: 'vec', query: 'why do database connections time out under load' },
],
collections: ["docs", "notes"],
})
// Skip reranking for faster results
const fast = await store.search({ query: "auth", rerank: false })
// Metadata filter — every returned result satisfies it (also available on
// searchLex() and searchVector()); results expose indexed metadata via
// r.metadata. See "Metadata Filtering" for the full grammar.
const published = await store.search({
query: "authentication flow",
filter: {
operator: "and",
operands: [
{ field: "topics", operator: "all", value: ["typescript"] },
{ field: "status", operator: "ne", value: "draft" },
],
},
})For direct backend access:
// BM25 keyword search (fast, no LLM)
const lexResults = await store.searchLex("auth middleware", { limit: 10 })
// Vector similarity search (embedding model, no reranking)
const vecResults = await store.searchVector("how users log in", { limit: 10 })
// Manual query expansion for full control
const expanded = await store.expandQuery("auth flow", { intent: "user login" })
const results4 = await store.search({ queries: expanded })Retrieval
// Get a document by path or docid
const doc = await store.get("docs/readme.md")
const byId = await store.get("#abc123")
if (!("error" in doc)) {
console.log(doc.title, doc.displayPath, doc.context)
}
// Get document body with line range
const body = await store.getDocumentBody("docs/readme.md", {
fromLine: 50,
maxLines: 100,
})
// Batch retrieve by glob or comma-separated list
const { docs, errors } = await store.multiGet("docs/**/*.md", {
maxBytes: 20480,
})Collections
// Add a collection
await store.addCollection("myapp", {
path: "/src/myapp",
pattern: "**/*.ts",
ignore: ["node_modules/**", "*.test.ts"],
})
// List collections with document stats
const collections = await store.listCollections()
// => [{ name, pwd, glob_pattern, doc_count, active_count, last_modified, includeByDefault }]
// Get names of collections included in queries by default
const defaults = await store.getDefaultCollectionNames()
// Remove / rename
await store.removeCollection("myapp")
await store.renameCollection("old-name", "new-name")Context
Context adds descriptive metadata that improves search relevance and is returned alongside results:
// Add context for a path within a collection
await store.addContext("docs", "/api", "REST API reference documentation")
// Set global context (applies to all collections)
await store.setGlobalContext("Internal engineering documentation")
// List all contexts
const contexts = await store.listContexts()
// => [{ collection, path, context }]
// Remove context
await store.removeContext("docs", "/api")
await store.setGlobalContext(undefined) // clear globalIndexing
Collection processors optionally turn each source file into multiple stable-key Markdown index documents, through explicit SDK callbacks or trusted CLI commands.
// Re-index collections by scanning the filesystem
const result = await store.update({
collections: ["docs"], // optional — defaults to all
onProgress: ({ collection, file, current, total }) => {
console.log(`[${collection}] ${current}/${total} ${file}`)
},
})
// => { collections, indexed, updated, unchanged, removed, needsEmbedding }
// Generate vector embeddings
const embedResult = await store.embed({
force: false, // true to re-embed everything
chunkStrategy: "auto", // "regex" (default) or "auto" (AST for code files)
onProgress: ({ current, total, collection }) => {
console.log(`Embedding ${current}/${total}`)
},
})Types
Key types exported for SDK consumers:
import type {
QMDStore, // The store interface
SearchOptions, // Options for search()
LexSearchOptions, // Options for searchLex()
VectorSearchOptions, // Options for searchVector()
HybridQueryResult, // Search result with score, snippet, context
SearchResult, // Result from searchLex/searchVector
ExpandedQuery, // Typed sub-query { type: 'lex'|'vec'|'hyde', query }
DocumentResult, // Document metadata + body
DocumentNotFound, // Error with similarFiles suggestions
MultiGetResult, // Batch retrieval result
UpdateProgress, // Progress callback info for update()
UpdateResult, // Aggregated update result
EmbedProgress, // Progress callback info for embed()
EmbedResult, // Embedding result
StoreOptions, // createStore() options
CollectionConfig, // Inline config shape
IndexStatus, // From getStatus()
IndexHealthInfo, // From getIndexHealth()
} from '@tobilu/qmd'Utility exports:
import {
extractSnippet, // Extract a relevant snippet from text
addLineNumbers, // Add line numbers to text
DEFAULT_MULTI_GET_MAX_BYTES, // Default max file size for multiGet (64KB)
Maintenance, // Database maintenance operations
} from '@tobilu/qmd'Lifecycle
// Close the store — disposes LLM models and DB connection
await store.close()The SDK requires explicit dbPath — no defaults are assumed. This makes it safe to embed in any application without side effects.
Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ QMD Hybrid Search Pipeline │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────┐
│ User Query │
└────────┬────────┘
│
┌──────────────┴──────────────┐
▼ ▼
┌────────────────┐ ┌────────────────┐
│ Query Expansion│ │ Original Query│
│ (fine-tuned) │ │ (×2 weight) │
└───────┬────────┘ └───────┬────────┘
│ │
│ 2 alternative queries │
└──────────────┬──────────────┘
│
┌───────────────────────┼───────────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Original Query │ │ Expanded Query 1│ │ Expanded Query 2│
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
┌───────┴───────┐ ┌───────┴───────┐ ┌───────┴───────┐
▼ ▼ ▼ ▼ ▼ ▼
┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
│ BM25 │ │Vector │ │ BM25 │ │Vector │ │ BM25 │ │Vector │
│(FTS5) │ │Search │ │(FTS5) │ │Search │ │(FTS5) │ │Search │
└───┬───┘ └───┬───┘ └───┬───┘ └───┬───┘ └───┬───┘ └───┬───┘
│ │ │ │ │ │
└───────┬───────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└────────────────────────┼───────────────────────┘
│
▼
┌───────────────────────┐
│ RRF Fusion + Bonus │
│ Original query: ×2 │
│ Top-rank bonus: +0.05│
│ Top 30 Kept │
└───────────┬───────────┘
│
▼
┌───────────────────────┐
│ LLM Re-ranking │
│ (qwen3-reranker) │
│ Yes/No + logprobs │
└───────────┬───────────┘
│
▼
┌───────────────────────┐
│ Position-Aware Blend │
│ Top 1-3: 75% RRF │
│ Top 4-10: 60% RRF │
│ Top 11+: 40% RRF │
└───────────────────────┘
Score Normalization & Fusion
Search Backends
| Backend | Raw Score | Conversion | Range |
|---|---|---|---|
| FTS (BM25) | SQLite FTS5 BM25 | Math.abs(score) |
0 to ~25+ |
| Vector | Cosine distance | 1 / (1 + distance) |
0.0 to 1.0 |
| Reranker | LLM 0-10 rating | score / 10 |
0.0 to 1.0 |
Fusion Strategy
The query command uses Reciprocal Rank Fusion (RRF) with position-aware blending:
- Query Expansion: Original query (×2 for weighting) + 1 LLM variation
- Parallel Retrieval: Each query searches both FTS and vector indexes
- RRF Fusion: Combine all result lists using
score = Σ(1/(k+rank+1))where k=60 - Top-Rank Bonus: Documents ranking #1 in any list get +0.05, #2-3 get +0.02
- Top-K Selection: Take top 30 candidates for reranking
- Re-ranking: LLM scores each document (yes/no with logprobs confidence)
- Position-Aware Blending:
- RRF rank 1-3: 75% retrieval, 25% reranker (preserves exact matches)
- RRF rank 4-10: 60% retrieval, 40% reranker
- RRF rank 11+: 40% retrieval, 60% reranker (trust reranker more)
Why this approach: Pure RRF can dilute exact matches when expanded queries don't match. The top-rank bonus preserves documents that score #1 for the original query. Position-aware blending prevents the reranker from destroying high-confidence retrieval results.
Score Interpretation
| Score | Meaning |
|---|---|
| 0.8 - 1.0 | Highly relevant |
| 0.5 - 0.8 | Moderately relevant |
| 0.2 - 0.5 | Somewhat relevant |
| 0.0 - 0.2 | Low relevance |
Requirements
System Requirements
- Node.js >= 22
- Bun >= 1.0.0
- macOS: Homebrew SQLite (for extension support)
brew install sqlite
GGUF Models (via node-llama-cpp)
QMD uses three local GGUF models (auto-downloaded on first use):
| Model | Purpose | Size |
|---|---|---|
embeddinggemma-300M-Q8_0 |
Vector embeddings (default) | ~300MB |
qwen3-reranker-0.6b-q8_0 |
Re-ranking | ~640MB |
qmd-query-expansion-1.7B-q4_k_m |
Query expansion (fine-tuned) | ~1.1GB |
Models are downloaded from HuggingFace and cached in ~/.cache/qmd/models/.
Custom Embedding Model
Override the default embedding model via the QMD_EMBED_MODEL environment variable.
This is useful for multilingual corpora (e.g. Chinese, Japanese, Korean) where
embeddinggemma-300M has limited coverage.
# Use Qwen3-Embedding-0.6B for better multilingual (CJK) support
export QMD_EMBED_MODEL="hf:Qwen/Qwen3-Embedding-0.6B-GGUF/Qwen3-Embedding-0.6B-Q8_0.gguf"
# After changing the model, re-embed all collections:
qmd embed -fSupported model families:
- embeddinggemma (default) — English-optimized, small footprint
- Qwen3-Embedding — Multilingual (119 languages including CJK), MTEB top-ranked
Note: When switching embedding models, you must re-index with
qmd embed -fsince vectors are not cross-compatible between models. The prompt format is automatically adjusted for each model family.
Remote Embeddings
Local GGUF defaults are unchanged. To explicitly use an OpenAI-compatible
embedding server instead, set one API-base URI with a #model-id fragment:
models:
embed: "http://localhost:1234/v1#my-embedding-model"
embedOptions:
dimensions: 768 # optional, integer 1..4096
revision: "deployment-v1" # optional, nonempty string, at most 256 characters
apiKeyEnv: EMBEDDING_KEY # optional environment variable NAME, not a keyQMD sends POST /v1/embeddings with model, input, encoding_format: "float",
and dimensions when configured. The base may have a different path; QMD appends
/embeddings. HTTP and HTTPS are intentional choices; use HTTPS for credentials
outside a trusted local connection. URL credentials, query strings, control
characters, endpoint lists, plaintext-key options, and unknown options are rejected.
apiKeyEnv accepts [A-Za-z_][A-Za-z0-9_]{0,127}. Its value is read at each
request, never saved in the index or shown in errors. Without it, requests are
keyless: there is no OPENAI_API_KEY or other ambient auth fallback. A declared
but missing/invalid credential fails before HTTP. Changing these options, including
the credential variable name, re-arms a project-local config's qmd trust approval.
qmd update
qmd embed
# Embedding-only retrieval: no local expansion or reranking model needed.
qmd query 'vec: your semantic query' --no-rerankqmd search remains lexical. Ordinary free-text query and vsearch still use
local query expansion. Reranking uses its separately selected model (local by
default; see TypeSafe System One).
Remote embeddings do not replace those models. qmd pull skips the remote embedding role but still pulls
local generation/reranking models. status and doctor describe remote embedding
as configured, not verified; they do not probe the server or download/load an
embedding model. Doctor also skips its native device probe in this mode.
The SDK uses the same config, captured per store (later input mutation does not change that store's embedding selection):
import { createStore, RemoteEmbedder } from '@tobilu/qmd'
const controller = new AbortController()
const store = await createStore({
dbPath: './index.sqlite',
config: {
collections: { docs: { path: '/path/to/docs', pattern: '**/*.md' } },
models: {
embed: 'http://localhost:1234/v1#my-embedding-model',
embedOptions: { dimensions: 768, revision: 'deployment-v1', apiKeyEnv: 'EMBEDDING_KEY' }
}
}
})
await store.update()
await store.embed({ signal: controller.signal })
const results = await store.searchVector('your semantic query', { signal: controller.signal })
await store.close()
// Standalone embedding client; pass already-formatted text.
const client = new RemoteEmbedder('http://localhost:1234/v1#my-embedding-model')
const vectors = await client.embedBatch(['document text'], controller.signal)Remote input formatting is pinned: raw queries, and title + "\n" + document
when a title exists. Documents use the existing surrogate-safe character chunker
(3600 UTF-16 units, 540 overlap), never a local tokenizer or token truncation pass.
The opaque remote-openai:<sha256> space identity includes the canonical endpoint,
model ID, requested dimensions (or server-default marker), revision, and format/
chunk version. Two hosts advertising the same model ID are different spaces.
Credentials are excluded: change revision when an account or deployment changes
embedding semantics. Re-embed after changing spaces; use qmd embed --force when
switching chunk formats or dimensions. Dimensions never automatically clear a table.
QMD has one vector table and content-scoped chunk metadata, not independent model
indexes per collection; a shared content hash is embedded for all its collections.
Vector searches enforce a remote embedding boundary in their selected collection/ metadata scope before requesting a query embedding: a remote query requires exact model/fingerprint matches on every selected vector row; a local query refuses selected remote vector rows before loading a local model. Existing local-to-local behavior, including legacy empty fingerprints and differing local model labels, is unchanged. After HTTP, QMD rechecks the same boundary and reads KNN matches, documents, metadata and bodies in one SQLite read snapshot. No read transaction is held over the network.
Each HTTP call is one attempt (no redirects, retries, fallback or normalization), with a 30-second timeout combined with the caller/session signal. Limits: 64 inputs, 64 KiB UTF-8 per input, 2 MiB encoded request, 8 MiB streamed response, 4096 dimensions. Oversized input is refused, never truncated. Responses must be valid UTF-8 JSON, echo the exact model and contain exactly one uniquely indexed, uniformly dimensioned, finite nonzero Float32-representable vector per input. An invalid/partial batch returns no vectors; indexing does not rescue it with individual remote calls. Errors never include response bodies, credentials, headers or provider error messages.
Installation
npm install -g @tobilu/qmd
# or
bun install -g @tobilu/qmdDevelopment
git clone https://github.com/tobi/qmd
cd qmd
bun install
bun linkOn Linux, nix develop supplies the C++ runtime needed by Bun's llama backend.
Usage
Collection Management
# Create a collection from current directory
qmd collection add . --name myproject
# Create a collection with explicit path and custom glob mask
qmd collection add ~/Documents/notes --name notes --mask "**/*.md"
# Comma-separated masks are a union (brace form `{a,b}` also works)
qmd collection add ~/notes --name notes --mask "sources/**/*.md,CO - *.md"
# List all collections
qmd collection list
# Remove a collection
qmd collection remove myproject
# Rename a collection
qmd collection rename myproject my-project
# List files in a collection
qmd ls notes
qmd ls notes/subfolder
# Show collection details (path, glob mask, include status, context count, top metadata keys)
qmd collection show notes
# Discover metadata keys, types, and value counts (see Metadata Discovery)
qmd collection metadata notes
qmd collection metadata notes --match '{"field":"key","operator":"eq","value":"topics"}'
qmd collection metadata notes --match '{"field":"value","operator":"eq","value":"docs-team"}'
# Include or exclude a collection from default (unscoped) queries
qmd collection include notes
qmd collection exclude notes
# Run a command before every `qmd update` (e.g. git pull); empty arg clears it
qmd collection update-cmd notes 'git pull --rebase'
qmd collection update-cmd notes