@joycodetech/qmd-ja 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +819 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1143 -0
  4. package/bin/qmd +162 -0
  5. package/dist/ast.d.ts +65 -0
  6. package/dist/ast.js +334 -0
  7. package/dist/bench/bench.d.ts +23 -0
  8. package/dist/bench/bench.js +280 -0
  9. package/dist/bench/score.d.ts +33 -0
  10. package/dist/bench/score.js +88 -0
  11. package/dist/bench/types.d.ts +80 -0
  12. package/dist/bench/types.js +8 -0
  13. package/dist/cli/formatter.d.ts +120 -0
  14. package/dist/cli/formatter.js +355 -0
  15. package/dist/cli/qmd.d.ts +43 -0
  16. package/dist/cli/qmd.js +4159 -0
  17. package/dist/collections.d.ts +166 -0
  18. package/dist/collections.js +410 -0
  19. package/dist/db.d.ts +44 -0
  20. package/dist/db.js +75 -0
  21. package/dist/index.d.ts +230 -0
  22. package/dist/index.js +242 -0
  23. package/dist/llm.d.ts +500 -0
  24. package/dist/llm.js +1615 -0
  25. package/dist/maintenance.d.ts +23 -0
  26. package/dist/maintenance.js +37 -0
  27. package/dist/mcp/server.d.ts +24 -0
  28. package/dist/mcp/server.js +702 -0
  29. package/dist/paths.d.ts +1 -0
  30. package/dist/paths.js +4 -0
  31. package/dist/store.d.ts +996 -0
  32. package/dist/store.js +4208 -0
  33. package/models/vaporetto-bccwj.model +0 -0
  34. package/package.json +130 -0
  35. package/scripts/build.mjs +30 -0
  36. package/scripts/check-package-grammars.mjs +29 -0
  37. package/scripts/package-smoke.mjs +65 -0
  38. package/scripts/test-all.mjs +38 -0
  39. package/skills/qmd/SKILL.md +295 -0
  40. package/skills/qmd/references/mcp-setup.md +102 -0
  41. package/skills/release/SKILL.md +139 -0
  42. package/skills/release/scripts/install-hooks.sh +38 -0
  43. package/vendor/vaporetto-node-wasm/package.json +11 -0
  44. package/vendor/vaporetto-node-wasm/vaporetto_node_wasm.d.ts +19 -0
  45. package/vendor/vaporetto-node-wasm/vaporetto_node_wasm.js +202 -0
  46. package/vendor/vaporetto-node-wasm/vaporetto_node_wasm_bg.wasm +0 -0
  47. package/vendor/vaporetto-node-wasm/vaporetto_node_wasm_bg.wasm.d.ts +13 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,819 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ### Documentation
6
+
7
+ - README: documented collection filtering (`-c` semantics), the `collection
8
+ show`/`include`/`exclude`/`update-cmd` subcommands, the `--intent`/`--no-rerank`/
9
+ `-C`/`--full-path` search flags, the `--format <kind>` output selector (with the
10
+ legacy `--json`/`--csv`/`--md`/`--xml`/`--files` booleans noted as aliases),
11
+ `vector-search`/`deep-search` aliases, embed
12
+ memory flags (`--max-docs-per-batch`/`--max-batch-mb`), a sample `--explain`
13
+ score trace, the `qmd doctor`/`qmd init` commands, the `get` `:from:count`
14
+ suffix and `--no-line-numbers`, an MCP tool parameter reference, and a
15
+ Benchmarking section for `qmd bench`.
16
+ - docs/SYNTAX.md: removed the non-existent `q` MCP parameter example (the `query`
17
+ tool and REST endpoint accept only the `searches` array) and added a Scoping
18
+ section.
19
+ - README: removed the misleading `qmd update --pull` example. The `--pull` flag is
20
+ parsed but never consumed (`updateCollections()` ignores it); the real mechanism
21
+ for running `git pull` before re-indexing is a per-collection `update` command,
22
+ set via `qmd collection update-cmd`.
23
+
24
+ ### Fixed
25
+
26
+ - MCP server instructions now tell agents to scope with the plural `collections`
27
+ parameter (matching the schema). The previous singular `collection` hint led
28
+ agents to pass a parameter that Zod silently strips, producing unscoped results.
29
+ The `get` instruction line also now documents the full `file.md:from:count`
30
+ range suffix instead of only the single-line `file.md:100` offset.
31
+
32
+ - Filesystem paths with special characters (`#`, `&`, spaces, `[]`, `()`, etc.)
33
+ now round-trip correctly through index → search → get. Previously
34
+ `reindexCollection` called `handelize()` on relative paths before storing
35
+ them, turning `# Meeting - 234232 3432 __ 5.md` into
36
+ `Meeting-234232-3432-5.md` and making `qmd get <actual-path>`,
37
+ `qmd get --full-path`, and `qmd ls` return dead or garbled paths. Paths are
38
+ now stored verbatim. Existing indexes auto-migrate on the next `qmd update`.
39
+
40
+ - FTS5 search now correctly matches dotted version strings like `2026.4.10`. The
41
+ `porter unicode61` tokenizer splits on dots (storing `2026`, `4`, `10` as
42
+ separate tokens), but the query sanitizer was stripping dots and producing
43
+ `2026410` which never matched. Dotted terms are now split and ANDed together
44
+ so version-string searches work as expected (#563).
45
+ - HTTP REST endpoints `/query` and `/search` now return `qmd://collection/path`
46
+ URIs in the `file` field, matching the output format used by the CLI and MCP
47
+ resource URIs. Previously the raw `displayPath` (`collection/path`) was
48
+ returned without the scheme prefix (#576).
49
+ - The embed session `maxDuration` is now env-configurable via
50
+ `QMD_EMBED_MAX_DURATION_MS` (default: 30 min). This prevents large-corpus
51
+ embeddings from being aborted by the hardcoded 30-minute ceiling (#673).
52
+
53
+ ## [2.5.3] - 2026-05-28
54
+
55
+ ### Features
56
+
57
+ - `qmd get` now accepts a `:from:count` suffix on a path or docid (e.g.
58
+ `qmd get "#abc123:120:40"` reads 40 lines starting at line 120). Explicit
59
+ `--from`/`-l` flags still override the suffix. The MCP `get` tool accepts the
60
+ same suffix.
61
+ - `qmd get` and `qmd multi-get` are now **line-numbered by default** and print
62
+ the document's `#docid` and `qmd://` path in the output header. Disable line
63
+ numbers with `--no-line-numbers`. The MCP `get`/`multi_get` tools default
64
+ `lineNumbers` to `true` to match.
65
+ - `qmd multi-get` now includes the `#docid` in every output format
66
+ (`--md`, `--json`, `--csv`, `--xml`, `--files`, and the default CLI view),
67
+ consistent with `qmd search`.
68
+ - `qmd get` and `qmd multi-get` accept `--full-path`, which replaces the
69
+ `qmd://` path + `#docid` with the document's on-disk filesystem path (handy for
70
+ piping into `Read`/`Edit`/an editor). Falls back to the canonical `qmd://` +
71
+ docid header when the file no longer exists on disk.
72
+ - `qmd search` / `qmd query` now show a clearer hit identifier: the default CLI
73
+ view (and the new `**file:**` line in `--md` output) always prints the full
74
+ `qmd://collection/path` URI so you can pipe it straight back into `qmd get`.
75
+ - `qmd search` / `qmd query` accept `--full-path` with the same semantics as
76
+ `qmd get`: the result label becomes the file's on-disk path — `./`-prefixed
77
+ relative path when the file lives in a subfolder of `$PWD`, absolute realpath
78
+ otherwise — and the per-result `#docid` is dropped because the path is the
79
+ identifier. The leading `./` is intentional so the output is unambiguously a
80
+ filesystem path. Applies to all output formats.
81
+ - `qmd get` and `qmd multi-get` now also use the `./`-prefixed convention when
82
+ `--full-path` renders a path under `$PWD`, matching `search`/`query`.
83
+ - New `--format <kind>` flag selects the output format (`cli` | `json` | `csv` |
84
+ `md` | `xml` | `files`) for `search`, `query`, and `multi-get`. The legacy
85
+ boolean aliases (`--json`/`--csv`/`--md`/`--xml`/`--files`) still work but are
86
+ no longer in `--help`; prefer `--format`.
87
+
88
+ ### Fixes
89
+
90
+ - Launcher: source-mode runner selection now prefers Node + tsx over Bun when
91
+ both `package-lock.json` and `bun.lock` are present in the package root,
92
+ mirroring the dist-mode "npm priority" rule. Fixes pnpm-global installs that
93
+ copy the entire working tree (including `.git` and `bun.lock`) into the
94
+ install dir and previously routed through Bun, causing ABI mismatches with
95
+ the Node-built `better-sqlite3` / `sqlite-vec` native modules.
96
+ - Darwin Metal: llama-using commands (`query`, `vsearch`, `embed`) no longer
97
+ dump a multi-kB GGML/Metal backtrace at process exit even when output
98
+ succeeded. The libggml-metal static `ggml_metal_device` destructor asserts
99
+ `[rsets->data count] == 0` during `__cxa_finalize_ranges`, but the
100
+ buffer-free path never calls the symmetric `ggml_metal_device_rsets_rm`
101
+ to remove released rsets from the device collection (upstream
102
+ ggml-org/llama.cpp#22593, one-line fix open as PR #22595). The assertion
103
+ only fires when `process.exit()` skips Node's `beforeExit` hook, which is
104
+ what node-llama-cpp uses to auto-dispose Metal contexts. Primary fix:
105
+ `finishSuccessfulCliCommand` now sets `process.exitCode = 0` and returns
106
+ instead of calling `process.exit(0)`, so `beforeExit` fires and the native
107
+ binding cleans up before libc's static destructor runs. Defense-in-depth:
108
+ the launcher (`bin/qmd`) and the npm test driver (`scripts/test-all.mjs`
109
+ + the `test:bun` / `test:unit` package.json scripts) also set
110
+ `GGML_METAL_NO_RESIDENCY=1` on darwin before spawning node/bun, covering
111
+ error paths and tests that still terminate via `process.exit()`. The env
112
+ var must be set before node/bun start — libggml-metal reads it via libc
113
+ `getenv` at module-load time, and Bun does not propagate `process.env`
114
+ mutations to libc `setenv` — so it lives in the launcher rather than in
115
+ test-preload. Residency sets give no measurable speedup for QMD's
116
+ short-lived CLI workflow (benchmarked on M3 Pro). Opt back in with
117
+ `QMD_METAL_KEEP_RESIDENCY=1` for long-lived qmd processes (e.g. the MCP
118
+ daemon may benefit on hot reload) or to triage the upstream fix.
119
+ `qmd doctor` reports the mitigation state. Minimal reproduction:
120
+ `scripts/repro-metal-rsets-crash.mjs`.
121
+
122
+ ### Docs
123
+
124
+ - qmd skill: emphasize reading line ranges with `get`'s built-in
125
+ `:from:count` suffix / `--from`/`-l` flags instead of piping through
126
+ `sed`/`head`/`tail`; cite the docid and line numbers now present in retrieval
127
+ output; and author structured `intent:`/`lex:`/`vec:`/`hyde:` queries yourself
128
+ rather than relying on built-in query expansion.
129
+
130
+ ## [2.5.2] - 2026-05-22
131
+
132
+ ### Fixes
133
+
134
+ - Launcher: Rewrite `bin/qmd` as a Node-based shebang polyglot to fix global npm installation execution failures on Windows (#668 / #452), while supporting seamless fallback to Bun in Node-less environments.
135
+
136
+
137
+ ## [2.5.1] - 2026-05-20
138
+
139
+ ### Changes
140
+
141
+ - Release: publish from GitHub Actions via npm Trusted Publishing/OIDC instead of a long-lived `NPM_TOKEN` secret.
142
+
143
+ ## [2.5.0] - 2026-05-19
144
+
145
+ ### Changes
146
+
147
+ - Dependencies: update core SQLite/config/chunking packages (`better-sqlite3`, `yaml`, `web-tree-sitter`, `tree-sitter-go`, and `tree-sitter-python`) while keeping incompatible `zod`, `tsx`, and `vitest` majors pinned.
148
+ - Agent skills: add `qmd skills list|get|path` to serve version-matched runtime skill instructions from the installed CLI, and make `qmd skill install` write a stable discovery stub so installed agent skills do not go stale after QMD upgrades.
149
+ - CLI: add `qmd doctor` for index/runtime diagnostics, including SQLite/sqlite-vec versions, embedding fingerprint freshness, mixed-fingerprint detection, safe legacy fingerprint adoption, and content-hash sampling.
150
+
151
+ ### Fixes
152
+
153
+ - Launcher: prefer runnable TypeScript source in git checkouts even when ignored `dist/` artifacts exist, while packaged installs continue to run `dist/`.
154
+ - GPU: keep node-llama-cpp's documented `gpu: "auto"` initialization as the primary path, then perform no-build packaged CUDA/Vulkan/Metal probes only if auto falls back to CPU.
155
+ - CLI: move GPU/CPU runtime diagnostics out of `qmd status`; use `qmd doctor` for device probing and related environment guidance.
156
+ - CLI: point unexpected command/setup failures toward `qmd doctor` so diagnostics are the default next step when QMD behaves incorrectly.
157
+ - Doctor: explicitly warn when `content_vectors` contains multiple non-empty embedding fingerprint names, with the per-fingerprint document/chunk breakdown.
158
+ - Embed: make the TTY progress line label byte-based input progress explicitly, show embedded chunks as a count, and shorten the displayed model name.
159
+ - Embed: retain per-chunk failure details, retry failed chunks after later successful embeds and again when no other chunks remain, clear recovered errors, and cap retries to avoid endless loops.
160
+ - Tests: expand the container smoke harness to cover npm-global, npx-style, and Bun-global install scenarios, always checking auto and `QMD_FORCE_CPU=1` doctor modes, with opt-in tiny `qmd embed` and GPU probe runs for supported container runtimes.
161
+ - Embedding: fingerprint vector metadata using the active embedding model and formatting/chunking parameters so stale vectors are treated as pending after search semantics change. Legacy `content_vectors` columns are migrated lazily on first vector-health/write use to preserve fast QMD startup.
162
+
163
+ - Skill: expand the packaged QMD skill with retrieval-first workflows, structured query examples, wiki/source collection guidance, and safe fallbacks when model-backed search is unavailable.
164
+ - Tests: make `bun run test` execute the local unit suite under both Node/Vitest and Bun (`test:node` + `test:bun`) so runtime-specific regressions are caught before CI.
165
+ - Model config: centralize embedding/rerank/generation model resolution so `qmd embed`, `status`, `query`, `vsearch`, `pull`, SDK vector search, and `bench` use the same active `.qmd/index.yaml` model hints and environment fallbacks.
166
+ - GPU/status: `qmd status` now uses the same embedding model identity as `qmd embed` when computing pending embeddings, so URI-backed embeddings are not incorrectly reported as pending under the legacy `embeddinggemma` alias.
167
+ - GPU status: `qmd status` now always shows GPU mode/configuration without unsafe native probing, and CPU-fallback warnings point to `QMD_STATUS_DEVICE_PROBE=1 qmd status` for an actual backend probe. The no-GPU warning is emitted once per process instead of once per LLM instance during benchmarks.
168
+ - GPU: add `QMD_FORCE_CPU=1` / `--no-gpu` to bypass CUDA/Vulkan/Metal probing entirely, and route native llama.cpp stdout noise to stderr so JSON output stays parseable during search/query commands.
169
+ - Snippet line numbers: `qmd_query` (MCP), HTTP `/query`, and `qmd query`
170
+ (CLI JSON output and snippet headers) now return absolute source-file
171
+ line numbers instead of chunk-local ones, so the `line` field can be
172
+ passed back to `qmd_get` as `fromLine` without a separate lookup.
173
+ Snippet selection remains scoped to the best matching chunk
174
+ (preserves #149).
175
+ - CLI: `qmd query --full` now emits the full document body in all output
176
+ formats (json, csv, md, xml), restoring the documented behavior of the
177
+ flag. Previously it returned only the best matching chunk (~3.6KB max
178
+ per result). Output payload for `--full` queries is now proportional
179
+ to total document size.
180
+ - macOS Metal: `qmd query --json` now flushes successful JSON output and uses a safe immediate-exit path on Darwin to avoid ggml Metal finalizer aborts; other commands still dispose LLM contexts/models before the llama runtime. #368
181
+ - Embedding: require complete chunk coverage before treating a document as
182
+ embedded, remove partial vectors when chunk/session failures leave a
183
+ document incomplete, and keep `qmd status` pending counts honest after
184
+ interrupted long embed runs. #637 #378
185
+ - Embedding: `qmd embed -c <collection>` now scopes pending-doc selection
186
+ to the requested collection instead of embedding global pending work.
187
+ Scoped `--force` clears only collection-owned vectors, preserves shared
188
+ hashes referenced by sibling collections, and drops `vectors_vec` only
189
+ when the scoped clear empties all vectors.
190
+ - Hybrid search: weight RRF lists by query type so original FTS and original vector evidence get the intended 2x boost, instead of accidentally boosting the first lexical expansion. #591
191
+ - MCP: seed llama.cpp/GGML quiet env vars before launching `qmd mcp` so native logs cannot pollute stdio JSON-RPC framing. #593
192
+ - CLI: remove CommonJS `require()` calls from ESM index path normalization so `qmd --index <path>` no longer crashes with `ERR_AMBIGUOUS_MODULE_SYNTAX` on Node 22+. #634
193
+ - Windows CUDA: serialize llama.cpp embedding/reranking contexts by default to avoid intermittent `ggml-cuda.cu:98` crashes in `qmd query`; set `QMD_EMBED_PARALLELISM` to opt back into parallel contexts if your driver is stable. #519
194
+ - MCP: make `qmd mcp --index <name>` use the selected index for both foreground and daemon HTTP servers instead of falling back to the default store. #343
195
+ - Embedding: respect `QMD_EMBED_MODEL` consistently for vector indexing and vector-backed search, with default-model fallback when unset.
196
+ - Config: use one home-directory resolver for YAML config and the default SQLite cache path, avoiding Windows CLI/MCP split-brain when `HOME` is unset.
197
+ - GPU: respect explicit `QMD_LLAMA_GPU=metal|vulkan|cuda` backend overrides instead of always using auto GPU selection. #529
198
+ - Fix: preserve original filename case in `handelize()`. The previous
199
+ `.toLowerCase()` call made indexed paths unreachable on case-sensitive
200
+ filesystems (Linux). `qmd update` automatically migrates legacy
201
+ lowercase paths without re-embedding.
202
+ - CLI: make `qmd status` skip native `node-llama-cpp` device probing by
203
+ default so status stays safe on machines with broken or unsupported GPU
204
+ drivers. Set `QMD_STATUS_DEVICE_PROBE=1` to opt in.
205
+ - CLI: lazy-load `node-llama-cpp` so lightweight commands such as
206
+ `qmd status` do not import native ML dependencies or trigger llama.cpp
207
+ builds on ARM/no-GPU machines. #491
208
+ - Store: keep content rows referenced by inactive documents during orphan
209
+ cleanup so `qmd update` preserves soft-deleted tombstones for removed
210
+ files. #585
211
+ - Packaging: install AST grammar WASM packages as required dependencies so
212
+ Bun global installs include TypeScript/TSX/JavaScript grammars, and add a
213
+ `smoke:package-grammars` verification command. #595
214
+ - Launcher: add wrapper smoke coverage for scoped package, npm/npx,
215
+ Homebrew/Linuxbrew, Bun global symlink layouts, and `$BUN_INSTALL`
216
+ false-positive runtime selection regressions. #351 #353 #354 #356 #358 #359
217
+
218
+ ## [2.1.0] - 2026-04-05
219
+
220
+ Code files now chunk at function and class boundaries via tree-sitter,
221
+ clickable editor links land you at the right line from search results,
222
+ and per-collection model configuration means you can point different
223
+ collections at different embedding models. 25+ community PRs fix
224
+ embedding stability, BM25 accuracy, and cross-platform launcher issues.
225
+
226
+ ### Changes
227
+
228
+ - AST-aware chunking for code files via `web-tree-sitter`. Supported
229
+ languages: TypeScript/JavaScript, Python, Go, and Rust. Code files
230
+ are chunked at function, class, and import boundaries instead of
231
+ arbitrary text positions. Markdown and unknown file types are unchanged.
232
+ `--chunk-strategy <auto|regex>` flag on `qmd embed` and `qmd query`
233
+ (default `regex`). SDK: `chunkStrategy` option on `embed()` and
234
+ `search()`. `qmd status` shows grammar availability.
235
+ - `qmd bench <fixture.json>` command for search quality benchmarks.
236
+ Measures precision@k, recall, MRR, and F1 across BM25, vector, hybrid,
237
+ and full pipeline backends. Ships with an example fixture against
238
+ the eval-docs test collection. #470 (thanks @jmilinovich)
239
+ - `models:` section in `index.yml` lets you configure `embed`, `rerank`,
240
+ and `generate` model URIs per collection. Resolution order is
241
+ config > env var (`QMD_EMBED_MODEL`, `QMD_RERANK_MODEL`,
242
+ `QMD_GENERATE_MODEL`) > built-in default. #502
243
+ (thanks @JohnRichardEnders)
244
+ - CLI search output now emits clickable OSC 8 terminal hyperlinks when
245
+ stdout is a TTY. Links resolve `qmd://` paths to absolute filesystem
246
+ paths and open in editors via URI templates (default:
247
+ `vscode://file/{path}:{line}:{col}`). Configure with `QMD_EDITOR_URI`
248
+ or `editor_uri` in the YAML config. #508 (thanks @danmackinlay)
249
+ - `--no-rerank` flag skips the reranking step in `qmd query` — useful
250
+ when you want fast results or don't have a GPU. Also exposed as
251
+ `rerank: false` on the MCP `query` tool. #370 (thanks @mvanhorn),
252
+ #478 (thanks @zestyboy)
253
+ - ONNX conversion script for deploying embedding models via
254
+ Transformers.js. #399 (thanks @shreyaskarnik)
255
+ - GitHub Actions workflow to build the Nix flake on Linux and macOS.
256
+
257
+ ### Fixes
258
+
259
+ - Embedding: prevent `qmd embed` from running indefinitely when the
260
+ embedding loop stalls. #458 (thanks @ccc-fff)
261
+ - Embedding: truncate oversized text before embedding to prevent GGML
262
+ crash, and bound memory usage during batch embedding. #393
263
+ (thanks @lskun), #395 (thanks @ProgramCaiCai)
264
+ - Embedding: set explicit embed context size (default 2048, configurable
265
+ via `QMD_EMBED_CONTEXT_SIZE`) instead of using the model's full
266
+ window. #500
267
+ - Embedding: error on dimension mismatch instead of silently rebuilding
268
+ the vec0 table. #501
269
+ - Embedding: handle vec0 `OR REPLACE` limitation in `insertEmbedding`.
270
+ #456 (thanks @antonio-mello-ai)
271
+ - Embedding: fix model selection when multiple models are configured.
272
+ #494
273
+ - BM25: correct field weights to include all 3 FTS columns — title,
274
+ body, and path were not weighted correctly. #462 (thanks @goldsr09)
275
+ - BM25: handle hyphenated tokens in FTS5 lex queries so terms like
276
+ "real-time" match correctly. #463 (thanks @goldsr09)
277
+ - BM25: preserve underscores in search terms instead of stripping them.
278
+ #404
279
+ - BM25: use CTE in `searchFTS` to prevent query planner regression with
280
+ collection filter.
281
+ - Reranker: increase default context size 2048→4096 and make
282
+ configurable via `QMD_RERANK_CONTEXT_SIZE`. Fix template overhead
283
+ underestimate 200→512. #453 (thanks @builderjarvis)
284
+ - GPU: catch initialization failures and fall back to CPU instead of
285
+ crashing.
286
+ - MCP: read version from `package.json` instead of hardcoding. #431
287
+ - MCP: include collection name in status output. #416
288
+ - Multi-get: support brace expansion patterns in glob matching. #424
289
+ - Launcher: prioritize `package-lock.json` to prevent Bun false
290
+ positive. #385 (thanks @rymalia)
291
+ - Launcher: remove `$BUN_INSTALL` check that caused false Bun detection.
292
+ #362 (thanks @syedair)
293
+ - Launcher: skip Git Bash path detection on WSL. #371
294
+ (thanks @oysteinkrog)
295
+ - Model cache: respect `XDG_CACHE_HOME` for model cache directory. #457
296
+ (thanks @antonio-mello-ai)
297
+ - SQLite: add macOS Homebrew SQLite support for Bun and restore
298
+ actionable errors. #377 (thanks @serhii12)
299
+ - Pin zod to exact 4.2.1 to fix `tsc` build failure. #382
300
+ (thanks @rymalia)
301
+ - Preserve dots and original case in `handelize()` — filenames like
302
+ `MEMORY.md` no longer become `memory-md`. #475 (thanks @alexei-led)
303
+ - Include `line` in `--json` search output so editor integrations can
304
+ jump directly to `file:line`. #506 (thanks @danmackinlay)
305
+ - Nix: fix paths in flake and make Bun dependency a fixed-output
306
+ derivation so sandboxed Linux builds work offline. #479
307
+ (thanks @surma-dump)
308
+ - Sync stale `bun.lock` (`better-sqlite3` 11.x → 12.x). CI and release
309
+ script now use `--frozen-lockfile` to prevent recurrence. #386
310
+ (thanks @Mic92)
311
+ - Approve native build scripts in pnpm so `better-sqlite3` and
312
+ tree-sitter modules compile correctly. Update vitest ^3.0.0 → ^3.2.4.
313
+
314
+ ## [2.0.1] - 2026-03-10
315
+
316
+ ### Changes
317
+
318
+ - `qmd skill install` copies the packaged QMD skill into
319
+ `~/.claude/commands/` for one-command setup. #355 (thanks @nibzard)
320
+
321
+ ### Fixes
322
+
323
+ - Fix Qwen3-Embedding GGUF filename case — HuggingFace filenames are
324
+ case-sensitive, the lowercase variant returned 404. #349 (thanks @byheaven)
325
+ - Resolve symlinked global launcher path so `qmd` works correctly when
326
+ installed via `npm i -g`. #352 (thanks @nibzard)
327
+
328
+ ## [2.0.0] - 2026-03-10
329
+
330
+ QMD 2.0 declares a stable library API. The SDK is now the primary interface —
331
+ the MCP server is a clean consumer of it, and the source is organized into
332
+ `src/cli/` and `src/mcp/`. Also: Node 25 support and a runtime-aware bin wrapper
333
+ for bun installs.
334
+
335
+ ### Changes
336
+
337
+ - Stable SDK API with `QMDStore` interface — search, retrieval, collection/context
338
+ management, indexing, lifecycle
339
+ - Unified `search()`: pass `query` for auto-expansion or `queries` for
340
+ pre-expanded lex/vec/hyde — replaces the old query/search/structuredSearch split
341
+ - New `getDocumentBody()`, `getDefaultCollectionNames()`, `Maintenance` class
342
+ - MCP server rewritten as a clean SDK consumer — zero internal store access
343
+ - CLI and MCP organized into `src/cli/` and `src/mcp/` subdirectories
344
+ - Runtime-aware `bin/qmd` wrapper detects bun vs node to avoid ABI mismatches.
345
+ Closes #319
346
+ - `better-sqlite3` bumped to ^12.4.5 for Node 25 support. Closes #257
347
+ - Utility exports: `extractSnippet`, `addLineNumbers`, `DEFAULT_MULTI_GET_MAX_BYTES`
348
+
349
+ ### Fixes
350
+
351
+ - Remove unused `import { resolve }` in store.ts that shadowed local export
352
+
353
+ ## [1.1.6] - 2026-03-09
354
+
355
+ QMD can now be used as a library. `import { createStore } from '@tobilu/qmd'`
356
+ gives you the full search and indexing API — hybrid query, BM25, structured
357
+ search, collection/context management — without shelling out to the CLI.
358
+
359
+ ### Changes
360
+
361
+ - **SDK / library mode**: `createStore({ dbPath, config })` returns a
362
+ `QMDStore` with `query()`, `search()`, `structuredSearch()`, `get()`,
363
+ `multiGet()`, and collection/context management methods. Supports inline
364
+ config (no files needed) or a YAML config path.
365
+ - **Package exports**: `package.json` now declares `main`, `types`, and
366
+ `exports` so bundlers and TypeScript resolve `@tobilu/qmd` correctly.
367
+
368
+ ## [1.1.5] - 2026-03-07
369
+
370
+ Ambiguous queries like "performance" now produce dramatically better results
371
+ when the caller knows what they mean. The new `intent` parameter steers all
372
+ five pipeline stages — expansion, strong-signal bypass, chunk selection,
373
+ reranking, and snippet extraction — without searching on its own. Design and
374
+ original implementation by Ilya Grigorik (@vyalamar) in #180.
375
+
376
+ ### Changes
377
+
378
+ - **Intent parameter**: optional `intent` string disambiguates queries across
379
+ the entire search pipeline. Available via CLI (`--intent` flag or `intent:`
380
+ line in query documents), MCP (`intent` field on the query tool), and
381
+ programmatic API. Adapted from PR #180 (thanks @vyalamar).
382
+ - **Query expansion**: when intent is provided, the expansion LLM prompt
383
+ includes `Query intent: {intent}`, matching the finetune training data
384
+ format for better-aligned expansions.
385
+ - **Reranking**: intent is prepended to the rerank query so Qwen3-Reranker
386
+ scores with domain context.
387
+ - **Chunk selection**: intent terms scored at 0.5× weight alongside query
388
+ terms (1.0×) when selecting the best chunk per document for reranking.
389
+ - **Snippet extraction**: intent terms scored at 0.3× weight to nudge
390
+ snippets toward intent-relevant lines without overriding query anchoring.
391
+ - **Strong-signal bypass disabled with intent**: when intent is provided, the
392
+ BM25 strong-signal shortcut is skipped — the obvious keyword match may not
393
+ be what the caller wants.
394
+ - **MCP instructions**: callers are now guided to provide `intent` on every
395
+ search call for disambiguation.
396
+ - **Query document syntax**: `intent:` recognized as a line type. At most one
397
+ per document, cannot appear alone. Grammar updated in `docs/SYNTAX.md`.
398
+
399
+ ## [1.1.2] - 2026-03-07
400
+
401
+ 13 community PRs merged. GPU initialization replaced with node-llama-cpp's
402
+ built-in `autoAttempt` — deleting ~220 lines of manual fallback code and
403
+ fixing GPU issues reported across 10+ PRs in one shot. Reranking is faster
404
+ through chunk deduplication and a parallelism cap that prevents VRAM
405
+ exhaustion.
406
+
407
+ ### Changes
408
+
409
+ - **GPU init**: use node-llama-cpp's `build: "autoAttempt"` instead of manual
410
+ GPU backend detection. Automatically tries Metal/CUDA/Vulkan and falls back
411
+ gracefully. #310 (thanks @giladgd — the node-llama-cpp author)
412
+ - **Query `--explain`**: `qmd query --explain` exposes retrieval score traces
413
+ — backend scores, per-list RRF contributions, top-rank bonus, reranker
414
+ score, and final blended score. Works in JSON and CLI output. #242
415
+ (thanks @vyalamar)
416
+ - **Collection ignore patterns**: `ignore: ["Sessions/**", "*.tmp"]` in
417
+ collection config to exclude files from indexing. #304 (thanks @sebkouba)
418
+ - **Multilingual embeddings**: `QMD_EMBED_MODEL` env var lets you swap in
419
+ models like Qwen3-Embedding for non-English collections. #273 (thanks
420
+ @daocoding)
421
+ - **Configurable expansion context**: `QMD_EXPAND_CONTEXT_SIZE` env var
422
+ (default 2048) — previously used the model's full 40960-token window,
423
+ wasting VRAM. #313 (thanks @0xble)
424
+ - **`candidateLimit` exposed**: `-C` / `--candidate-limit` flag and MCP
425
+ parameter to tune how many candidates reach the reranker. #255 (thanks
426
+ @pandysp)
427
+ - **MCP multi-session**: HTTP transport now supports multiple concurrent
428
+ client sessions, each with its own server instance. #286 (thanks @joelev)
429
+
430
+ ### Fixes
431
+
432
+ - **Reranking performance**: cap parallel rerank contexts at 4 to prevent
433
+ VRAM exhaustion on high-core machines. Deduplicate identical chunk texts
434
+ before reranking — same content from different files now shares a single
435
+ reranker call. Cache scores by content hash instead of file path.
436
+ - Deactivate stale docs when all files are removed from a collection and
437
+ `qmd update` is run. #312 (thanks @0xble)
438
+ - Handle emoji-only filenames (`🐘.md` → `1f418.md`) instead of crashing.
439
+ #308 (thanks @debugerman)
440
+ - Skip unreadable files during indexing (e.g. iCloud-evicted files returning
441
+ EAGAIN) instead of crashing. #253 (thanks @jimmynail)
442
+ - Suppress progress bar escape sequences when stderr is not a TTY. #230
443
+ (thanks @dgilperez)
444
+ - Emit format-appropriate empty output (`[]` for JSON, CSV header for CSV,
445
+ etc.) instead of plain text "No results." #228 (thanks @amsminn)
446
+ - Correct Windows sqlite-vec package name (`sqlite-vec-windows-x64`) and add
447
+ `sqlite-vec-linux-arm64`. #225 (thanks @ilepn)
448
+ - Fix claude plugin setup CLI commands in README. #311 (thanks @gi11es)
449
+
450
+ ## [1.1.1] - 2026-03-06
451
+
452
+ ### Fixes
453
+
454
+ - Reranker: truncate documents exceeding the 2048-token context window
455
+ instead of silently producing garbage scores. Long chunks (e.g. from
456
+ PDF ingestion) now get a fair ranking.
457
+ - Nix: add python3 and cctools to build dependencies. #214 (thanks
458
+ @pcasaretto)
459
+
460
+ ## [1.1.0] - 2026-02-20
461
+
462
+ QMD now speaks in **query documents** — structured multi-line queries where every line is typed (`lex:`, `vec:`, `hyde:`), combining keyword precision with semantic recall. A single plain query still works exactly as before (it's treated as an implicit `expand:` and auto-expanded by the LLM). Lex now supports quoted phrases and negation (`"C++ performance" -sports -athlete`), making intent-aware disambiguation practical. The formal query grammar is documented in `docs/SYNTAX.md`.
463
+
464
+ The npm package now uses the standard `#!/usr/bin/env node` bin convention, replacing the custom bash wrapper. This fixes native module ABI mismatches when installed via bun and works on any platform with node >= 22 on PATH.
465
+
466
+ ### Changes
467
+
468
+ - **Query document format**: multi-line queries with typed sub-queries (`lex:`, `vec:`, `hyde:`). Plain queries remain the default (`expand:` implicit, but not written inside the document). First sub-query gets 2× fusion weight — put your strongest signal first. Formal grammar in `docs/SYNTAX.md`.
469
+ - **Lex syntax**: full BM25 operator support. `"exact phrase"` for verbatim matching; `-term` and `-"phrase"` for exclusions. Essential for disambiguation when a term is overloaded across domains (e.g. `performance -sports -athlete`).
470
+ - **`expand:` shortcut**: send a single plain query (or start the document with `expand:` on its only line) to auto-expand via the local LLM. Query documents themselves are limited to `lex`, `vec`, and `hyde` lines.
471
+ - **MCP `query` tool** (renamed from `structured_search`): rewrote the tool description to fully teach AI agents the query document format, lex syntax, and combination strategy. Includes worked examples with intent-aware lex.
472
+ - **HTTP `/query` endpoint** (renamed from `/search`; `/search` kept as silent alias).
473
+ - **`collections` array filter**: filter by multiple collections in a single query (`collections: ["notes", "brain"]`). Removed the single `collection` string param — array only.
474
+ - **Collection `include`/`exclude`**: `includeByDefault: false` hides a collection from all queries unless explicitly named via `collections`. CLI: `qmd collection exclude <name>` / `qmd collection include <name>`.
475
+ - **Collection `update-cmd`**: attach a shell command that runs before every `qmd update` (e.g. `git stash && git pull --rebase --ff-only && git stash pop`). CLI: `qmd collection update-cmd <name> '<cmd>'`.
476
+ - **`qmd status` tips**: shows actionable tips when collections lack context descriptions or update commands.
477
+ - **`qmd collection` subcommands**: `show`, `update-cmd`, `include`, `exclude`. Bare `qmd collection` now prints help.
478
+ - **Packaging**: replaced custom bash wrapper with standard `#!/usr/bin/env node` shebang on `dist/qmd.js`. Fixes native module ABI mismatches when installed via bun, and works on any platform where node >= 22 is on PATH.
479
+ - **Removed MCP tools** `search`, `vector_search`, `deep_search` — all superseded by `query`.
480
+ - **Removed** `qmd context check` command.
481
+ - **CLI timing**: each LLM step (expand, embed, rerank) prints elapsed time inline (`Expanding query... (4.2s)`).
482
+
483
+ ### Fixes
484
+
485
+ - `qmd collection list` shows `[excluded]` tag for collections with `includeByDefault: false`.
486
+ - Default searches now respect `includeByDefault` — excluded collections are skipped unless explicitly named.
487
+ - Fix main module detection when installed globally via npm/bun (symlink resolution).
488
+
489
+ ## [1.0.7] - 2026-02-18
490
+
491
+ ### Changes
492
+
493
+ - LLM: add LiquidAI LFM2-1.2B as an alternative base model for query
494
+ expansion fine-tuning. LFM2's hybrid architecture (convolutions + attention)
495
+ is 2x faster at decode/prefill vs standard transformers — good fit for
496
+ on-device inference.
497
+ - CLI: support multiple `-c` flags to search across several collections at
498
+ once (e.g. `qmd search -c notes -c journals "query"`). #191 (thanks
499
+ @openclaw)
500
+
501
+ ### Fixes
502
+
503
+ - Return empty JSON array `[]` instead of no output when `--json` search
504
+ finds no results.
505
+ - Resolve relative paths passed to `--index` so they don't produce malformed
506
+ config entries.
507
+ - Respect `XDG_CONFIG_HOME` for collection config path instead of always
508
+ using `~/.config`. #190 (thanks @openclaw)
509
+ - CLI: empty-collection hint now shows the correct `collection add` command.
510
+ #200 (thanks @vincentkoc)
511
+
512
+ ## [1.0.6] - 2026-02-16
513
+
514
+ ### Changes
515
+
516
+ - CLI: `qmd status` now shows models with full HuggingFace links instead of
517
+ static names in `--help`. Model info is derived from the actual configured
518
+ URIs so it stays accurate if models change.
519
+ - Release tooling: pre-push hook handles non-interactive shells (CI, editors)
520
+ gracefully — warnings auto-proceed instead of hanging on a tty prompt.
521
+ Annotated tags now resolve correctly for CI checks.
522
+
523
+ ## [1.0.5] - 2026-02-16
524
+
525
+ The npm package now ships compiled JavaScript instead of raw TypeScript,
526
+ removing the `tsx` runtime dependency. A new `/release` skill automates the
527
+ full release workflow with changelog validation and git hook enforcement.
528
+
529
+ ### Changes
530
+
531
+ - Build: compile TypeScript to `dist/` via `tsc` so the npm package no longer
532
+ requires `tsx` at runtime. The `qmd` shell wrapper now runs `dist/qmd.js`
533
+ directly.
534
+ - Release tooling: new `/release` skill that manages the full release
535
+ lifecycle — validates changelog, installs git hooks, previews release notes,
536
+ and cuts the release. Auto-populates `[Unreleased]` from git history when
537
+ empty.
538
+ - Release tooling: `scripts/extract-changelog.sh` extracts cumulative notes
539
+ for the full minor series (e.g. 1.0.0 through 1.0.5) for GitHub releases.
540
+ Includes `[Unreleased]` content in previews.
541
+ - Release tooling: `scripts/release.sh` renames `[Unreleased]` to a versioned
542
+ heading and inserts a fresh empty `[Unreleased]` section automatically.
543
+ - Release tooling: pre-push git hook blocks `v*` tag pushes unless
544
+ `package.json` version matches the tag, a changelog entry exists, and CI
545
+ passed on GitHub.
546
+ - Publish workflow: GitHub Actions now builds TypeScript, creates a GitHub
547
+ release with cumulative notes extracted from the changelog, and publishes
548
+ to npm with provenance.
549
+
550
+ ## [1.0.0] - 2026-02-15
551
+
552
+ QMD now runs on both Node.js and Bun, with up to 2.7x faster reranking
553
+ through parallel GPU contexts. GPU auto-detection replaces the unreliable
554
+ `gpu: "auto"` with explicit CUDA/Metal/Vulkan probing.
555
+
556
+ ### Changes
557
+
558
+ - Runtime: support Node.js (>=22) alongside Bun via a cross-runtime SQLite
559
+ abstraction layer (`src/db.ts`). `bun:sqlite` on Bun, `better-sqlite3` on
560
+ Node. The `qmd` wrapper auto-detects a suitable Node.js install via PATH,
561
+ then falls back to mise, asdf, nvm, and Homebrew locations.
562
+ - Performance: parallel embedding & reranking via multiple LlamaContext
563
+ instances — up to 2.7x faster on multi-core machines.
564
+ - Performance: flash attention for ~20% less VRAM per reranking context,
565
+ enabling more parallel contexts on GPU.
566
+ - Performance: right-sized reranker context (40960 → 2048 tokens, 17x less
567
+ memory) since chunks are capped at ~900 tokens.
568
+ - Performance: adaptive parallelism — context count computed from available
569
+ VRAM (GPU) or CPU math cores rather than hardcoded.
570
+ - GPU: probe for CUDA, Metal, Vulkan explicitly at startup instead of
571
+ relying on node-llama-cpp's `gpu: "auto"`. `qmd status` shows device info.
572
+ - Tests: reorganized into flat `test/` directory with vitest for Node.js and
573
+ bun test for Bun. New `eval-bm25` and `store.helpers.unit` suites.
574
+
575
+ ### Fixes
576
+
577
+ - Prevent VRAM waste from duplicate context creation during concurrent
578
+ `embedBatch` calls — initialization lock now covers the full path.
579
+ - Collection-aware FTS filtering so scoped keyword search actually restricts
580
+ results to the requested collection.
581
+
582
+ ## [0.9.0] - 2026-02-15
583
+
584
+ First published release on npm as `@tobilu/qmd`. MCP HTTP transport with
585
+ daemon mode cuts warm query latency from ~16s to ~10s by keeping models
586
+ loaded between requests.
587
+
588
+ ### Changes
589
+
590
+ - MCP: HTTP transport with daemon lifecycle — `qmd mcp --http --daemon`
591
+ starts a background server, `qmd mcp stop` shuts it down. Models stay warm
592
+ in VRAM between queries. #149 (thanks @igrigorik)
593
+ - Search: type-routed query expansion preserves lex/vec/hyde type info and
594
+ routes to the appropriate backend. Eliminates ~4 wasted backend calls per
595
+ query (10.0 → 6.0 calls, 1278ms → 549ms). #149 (thanks @igrigorik)
596
+ - Search: unified pipeline — extracted `hybridQuery()` and
597
+ `vectorSearchQuery()` to `store.ts` so CLI and MCP share identical logic.
598
+ Fixes a class of bugs where results differed between the two. #149 (thanks
599
+ @igrigorik)
600
+ - MCP: dynamic instructions generated at startup from actual index state —
601
+ LLMs see collection names, doc counts, and content descriptions. #149
602
+ (thanks @igrigorik)
603
+ - MCP: tool renames (vsearch → vector_search, query → deep_search) with
604
+ rewritten descriptions for better tool selection. #149 (thanks @igrigorik)
605
+ - Integration: Claude Code plugin with inline status checks and MCP
606
+ integration. #99 (thanks @galligan)
607
+
608
+ ### Fixes
609
+
610
+ - BM25 score normalization — formula was inverted (`1/(1+|x|)` instead of
611
+ `|x|/(1+|x|)`), so strong matches scored *lowest*. Broke `--min-score`
612
+ filtering and made the "strong signal" short-circuit dead code. #76 (thanks
613
+ @dgilperez)
614
+ - Normalize Unicode paths to NFC for macOS compatibility. #82 (thanks
615
+ @c-stoeckl)
616
+ - Handle dense content (code) that tokenizes beyond expected chunk size.
617
+ - Proper cleanup of Metal GPU resources on process exit.
618
+ - SQLite-vec readiness verification after extension load.
619
+ - Reactivate deactivated documents on re-index instead of creating duplicates.
620
+ - Bun UTF-8 path corruption workaround for non-ASCII filenames.
621
+ - Disable following symlinks in glob.scan to avoid infinite loops.
622
+
623
+ ## [0.8.0] - 2026-01-28
624
+
625
+ Fine-tuned query expansion model trained with GRPO replaces the stock Qwen3
626
+ 0.6B. The training pipeline scores expansions on named entity preservation,
627
+ format compliance, and diversity — producing noticeably better lexical
628
+ variations and HyDE documents.
629
+
630
+ ### Changes
631
+
632
+ - LLM: deploy GRPO-trained (Group Relative Policy Optimization) query
633
+ expansion model, hosted on HuggingFace and auto-downloaded on first use.
634
+ Better preservation of proper nouns and technical terms in expansions.
635
+ - LLM: `/only:lex` mode for single-type expansions — useful when you know
636
+ which search backend will help.
637
+ - LLM: HyDE output moved to first position so vector search can start
638
+ embedding while other expansions generate.
639
+ - LLM: session lifecycle management via `withLLMSession()` pattern — ensures
640
+ cleanup even on failure, similar to database transactions.
641
+ - Integration: org-mode title extraction support. #50 (thanks @sh54)
642
+ - Integration: SQLite extension loading in Nix devshell. #48 (thanks @sh54)
643
+ - Integration: AI agent discovery via skills.sh. #64 (thanks @Algiras)
644
+
645
+ ### Fixes
646
+
647
+ - Use sequential embedding on CPU-only systems — parallel contexts caused a
648
+ race condition where contexts competed for CPU cores, making things slower.
649
+ #54 (thanks @freeman-jiang)
650
+ - Fix `collectionName` column in vector search SQL (was still using old
651
+ `collectionId` from before YAML migration). #61 (thanks @jdvmi00)
652
+ - Fix Qwen3 sampling params to prevent repetition loops — stock
653
+ temperature/top-p caused occasional infinite repeat patterns.
654
+ - Add `--index` option to CLI argument parser (was documented but not wired
655
+ up). #84 (thanks @Tritlo)
656
+ - Fix DisposedError during slow batch embedding. #41 (thanks @wuhup)
657
+
658
+ ## [0.7.0] - 2026-01-09
659
+
660
+ First community contributions. The project gained external contributors,
661
+ surfacing bugs that only appear in diverse environments — Homebrew sqlite-vec
662
+ paths, case-sensitive model filenames, and sqlite-vec JOIN incompatibilities.
663
+
664
+ ### Changes
665
+
666
+ - Indexing: native `realpathSync()` replaces `readlink -f` subprocess spawn
667
+ per file. On a 5000-file collection this eliminates 5000 shell spawns,
668
+ ~15% faster. #8 (thanks @burke)
669
+ - Indexing: single-pass tokenization — chunking algorithm tokenized each
670
+ document twice (count then split); now tokenizes once and reuses. #9
671
+ (thanks @burke)
672
+
673
+ ### Fixes
674
+
675
+ - Fix `vsearch` and `query` hanging — sqlite-vec's virtual table doesn't
676
+ support the JOIN pattern used; rewrote to subquery. #23 (thanks @mbrendan)
677
+ - Fix MCP server exiting immediately after startup — process had no active
678
+ handles keeping the event loop alive. #29 (thanks @mostlydev)
679
+ - Fix collection filter SQL to properly restrict vector search results.
680
+ - Support non-ASCII filenames in collection filter.
681
+ - Skip empty files during indexing instead of crashing on zero-length content.
682
+ - Fix case sensitivity in Qwen3 model filename resolution. #15 (thanks
683
+ @gavrix)
684
+ - Fix sqlite-vec loading on macOS with Homebrew (`BREW_PREFIX` detection).
685
+ #42 (thanks @komsit37)
686
+ - Fix Nix flake to use correct `src/qmd.ts` path. #7 (thanks @burke)
687
+ - Fix docid lookup with quotes support in get command. #36 (thanks
688
+ @JoshuaLelon)
689
+ - Fix query expansion model size in documentation. #38 (thanks @odysseus0)
690
+
691
+ ## [0.6.0] - 2025-12-28
692
+
693
+ Replaced Ollama HTTP API with node-llama-cpp for all LLM operations. Ollama
694
+ adds convenience but also a running server dependency. node-llama-cpp loads
695
+ GGUF models directly in-process — zero external dependencies. Models
696
+ auto-download from HuggingFace on first use.
697
+
698
+ ### Changes
699
+
700
+ - LLM: structured query expansion via JSON schema grammar constraints.
701
+ Model produces typed expansions — **lexical** (BM25 keywords), **vector**
702
+ (semantic rephrasings), **HyDE** (hypothetical document excerpts) — so each
703
+ routes to the right backend instead of sending everything everywhere.
704
+ - LLM: lazy model loading with 2-minute inactivity auto-unload. Keeps memory
705
+ low when idle while avoiding ~3s model load on every query.
706
+ - Search: conditional query expansion — when BM25 returns strong results, the
707
+ expensive LLM expansion is skipped entirely.
708
+ - Search: multi-chunk reranking — documents with multiple relevant chunks
709
+ scored by aggregating across all chunks rather than best single chunk.
710
+ - Search: cosine distance for vector search (was L2).
711
+ - Search: embeddinggemma nomic-style prompt formatting.
712
+ - Testing: evaluation harness with synthetic test documents and Hit@K metrics
713
+ for BM25, vector, and hybrid RRF.
714
+
715
+ ## [0.5.0] - 2025-12-13
716
+
717
+ Collections and contexts moved from SQLite tables to YAML at
718
+ `~/.config/qmd/index.yml`. SQLite was overkill for config — you can't share
719
+ it, and it's opaque. YAML is human-readable and version-controllable. The
720
+ migration was extensive (35+ commits) because every part of the system that
721
+ touched collections or contexts had to be updated.
722
+
723
+ ### Changes
724
+
725
+ - Config: YAML-based collections and contexts replace SQLite tables.
726
+ `collections` and `path_contexts` tables dropped from schema. Collections
727
+ support an optional `update:` command (e.g., `git pull`) before re-index.
728
+ - CLI: `qmd collection add/list/remove/rename` commands with `--name` and
729
+ `--mask` glob pattern support.
730
+ - CLI: `qmd ls` virtual file tree — list collections, files in a collection,
731
+ or files under a path prefix.
732
+ - CLI: `qmd context add/list/check/rm` with hierarchical context inheritance.
733
+ A query to `qmd://notes/2024/jan/` inherits context from `notes/`,
734
+ `notes/2024/`, and `notes/2024/jan/`.
735
+ - CLI: `qmd context add / "text"` for global context across all collections.
736
+ - CLI: `qmd context check` audit command to find paths without context.
737
+ - Paths: `qmd://` virtual URI scheme for portable document references.
738
+ `qmd://notes/ideas.md` works regardless of where the collection lives on
739
+ disk. Works in `get`, `multi-get`, `ls`, and context commands.
740
+ - CLI: document IDs (docid) — first 6 chars of content hash for stable
741
+ references. Shown as `#abc123` in search results, usable with `get` and
742
+ `multi-get`.
743
+ - CLI: `--line-numbers` flag for get command output.
744
+
745
+ ## [0.4.0] - 2025-12-10
746
+
747
+ MCP server for AI agent integration. Without it, agents had to shell out to
748
+ `qmd search` and parse CLI output. The monolithic `qmd.ts` (1840 lines) was
749
+ split into focused modules with the project's first test suite (215 tests).
750
+
751
+ ### Changes
752
+
753
+ - MCP: stdio server with tools for search, vector search, hybrid query,
754
+ document retrieval, and status. Runs over stdio transport for Claude
755
+ Desktop and MCP clients.
756
+ - MCP: spec-compliant with June 2025 MCP specification — removed non-spec
757
+ `mimeType`, added `isError: true` to errors, `structuredContent` for
758
+ machine-readable results, proper URI encoding.
759
+ - MCP: simplified tool naming (`qmd_search` → `search`) since MCP already
760
+ namespaces by server.
761
+ - Architecture: extract `store.ts` (1221 LOC), `llm.ts` (539 LOC),
762
+ `formatter.ts` (359 LOC), `mcp.ts` (503 LOC) from monolithic `qmd.ts`.
763
+ - Testing: 215 tests (store: 96, llm: 60, mcp: 59) with mocked Ollama for
764
+ fast, deterministic runs. Before this: zero tests.
765
+
766
+ ## [0.3.0] - 2025-12-08
767
+
768
+ Document chunking for vector search. A 5000-word document about many topics
769
+ gets a single embedding that averages everything together, matching poorly for
770
+ specific queries. Chunking produces one embedding per ~900-token section with
771
+ focused semantic signal.
772
+
773
+ ### Changes
774
+
775
+ - Search: markdown-aware chunking — prefers heading boundaries, then paragraph
776
+ breaks, then sentence boundaries. 15% overlap between chunks ensures
777
+ cross-boundary queries still match.
778
+ - Search: multi-chunk scoring bonus (+0.02 per additional chunk, capped at
779
+ +0.1 for 5+ chunks). Documents relevant in multiple sections rank higher.
780
+ - CLI: display paths show collection-relative paths and extracted titles
781
+ (from H1 headings or YAML frontmatter) instead of raw filesystem paths.
782
+ - CLI: `--all` flag returns all matches (use with `--min-score` to filter).
783
+ - CLI: byte-based progress bar with ETA for `embed` command.
784
+ - CLI: human-readable time formatting ("15m 4s" instead of "904.2s").
785
+ - CLI: documents >64KB truncated with warning during embedding.
786
+
787
+ ## [0.2.0] - 2025-12-08
788
+
789
+ ### Changes
790
+
791
+ - CLI: `--json`, `--csv`, `--files`, `--md`, `--xml` output format flags.
792
+ `--json` for programmatic access, `--files` for piping, `--md`/`--xml` for
793
+ LLM consumption, `--csv` for spreadsheets.
794
+ - CLI: `qmd status` shows index health — document count, size, embedding
795
+ coverage, time since last update.
796
+ - Search: weighted RRF — original query gets 2x weight relative to expanded
797
+ queries since the user's actual words are a more reliable signal.
798
+
799
+ ## [0.1.0] - 2025-12-07
800
+
801
+ Initial implementation. Built in a single day for searching personal markdown
802
+ notes, journals, and meeting transcripts.
803
+
804
+ ### Changes
805
+
806
+ - Search: SQLite FTS5 with BM25 ranking. Chose SQLite over Elasticsearch
807
+ because QMD is a personal tool — single binary, no server dependencies.
808
+ - Search: sqlite-vec for vector similarity. Same rationale: in-process, no
809
+ external vector database.
810
+ - Search: Reciprocal Rank Fusion to combine BM25 and vector results. RRF is
811
+ parameter-free and handles missing signals gracefully.
812
+ - LLM: Ollama for embeddings, reranking, and query expansion. Later replaced
813
+ with node-llama-cpp in 0.6.0.
814
+ - CLI: `qmd add`, `qmd embed`, `qmd search`, `qmd vsearch`, `qmd query`,
815
+ `qmd get`. ~1800 lines of TypeScript in a single `qmd.ts` file.
816
+
817
+ [Unreleased]: https://github.com/tobi/qmd/compare/v1.0.0...HEAD
818
+ [1.0.0]: https://github.com/tobi/qmd/releases/tag/v1.0.0
819
+ [0.9.0]: https://github.com/tobi/qmd/compare/v0.8.0...v0.9.0