pikelet-wasm 0.15.0 → 0.17.0

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 (39) hide show
  1. package/CHANGELOG.md +314 -0
  2. package/FORMAT.md +52 -59
  3. package/README.md +11 -11
  4. package/complete/builder.d.ts +27 -8
  5. package/complete/builder.mjs +28 -38
  6. package/complete/fusion.mjs +20 -4
  7. package/complete/grounding.mjs +5 -9
  8. package/complete/index.d.ts +31 -32
  9. package/complete/index.mjs +116 -298
  10. package/complete/inline-transformer.mjs +0 -64
  11. package/complete/layer-append.mjs +6 -32
  12. package/complete/layer-chain.mjs +7 -53
  13. package/complete/layer-compact.mjs +4 -5
  14. package/complete/layer-encoder.mjs +17 -123
  15. package/complete/layer-manifest.mjs +2 -1
  16. package/complete/layer-reader.mjs +28 -149
  17. package/complete/layer-rebase.mjs +1 -1
  18. package/complete/sources.mjs +1 -1
  19. package/complete/wordpiece.mjs +0 -22
  20. package/dist/engine.js +1 -1
  21. package/dist/engine.scalar.js +1 -1
  22. package/dist/engine.scalar.wasm +0 -0
  23. package/dist/engine.wasm +0 -0
  24. package/package.json +1 -5
  25. package/src/artifact/pikelet-artifact-common.js +27 -0
  26. package/src/artifact/pikelet-artifact-sketch.js +86 -150
  27. package/src/artifact/pikelet-artifact.d.ts +4 -29
  28. package/src/artifact/pikelet-artifact.js +5 -8
  29. package/src/core/pikelet-core.js +6 -3
  30. package/src/pikelet.d.ts +2 -186
  31. package/src/pikelet.js +1 -9
  32. package/src/pikelet.node.mjs +1 -9
  33. package/src/pikelet.web.d.ts +0 -8
  34. package/src/pikelet.web.mjs +1 -2
  35. package/src/pikelet.workerd.mjs +1 -2
  36. package/complete/retrieval-abstention.mjs +0 -232
  37. package/complete/student-abstention.mjs +0 -102
  38. package/complete/student-embedder.mjs +0 -231
  39. package/src/artifact/pikelet-artifact-range.js +0 -806
package/CHANGELOG.md CHANGED
@@ -8,6 +8,320 @@ Through 0.6.0 these were published as `pancake-wasm` and
8
8
  packages are pre-1.0: a minor bump may carry breaking changes, and each entry lists them
9
9
  first.
10
10
 
11
+ ## pikelet-wasm 0.17.0 / pikelet 0.17.0 — 2026-12-02
12
+
13
+ Pikelet removes what the format freeze should not carry. Readers refuse
14
+ files from before format 2's integrity guarantees and from before the
15
+ rename: format 1, format-1 sketches, student-encoder (kind 1) packs and the
16
+ `pancake-complete` profile strings, each with a message to recompile. The
17
+ `matchQuality` verdict, which `compile` stopped fitting in 0.15, leaves the
18
+ library, the CLI, the MCP server and layered chains, along with the drift
19
+ gate and vocabulary blooms that kept an inherited fit valid; `grounding` is
20
+ the relevance signal every query returns. Packs compiled since 0.15 open
21
+ unchanged, and `compile` writes the same bytes as 0.16. Quantized search
22
+ is 1.3-1.8x faster and returns the same results. Both packages move to
23
+ 0.17.0 together, and `pikelet` requires `pikelet-wasm` ^0.17.0.
24
+
25
+ ### Compatibility
26
+
27
+ - **Files from before 0.17 no longer open** in `pikelet-wasm`, so neither
28
+ `pikelet query` nor `pikelet mcp` can serve them. Each is refused with a
29
+ message naming the release and telling you to recompile from source:
30
+ - format 1 (`pikelet-complete-v1`, corpus layout v1 with no per-record
31
+ digests);
32
+ - an embedded or standalone sketch of format 1 (no per-row digests):
33
+ "Sketch artifact format 1 is no longer supported";
34
+ - query-interpretation kind 1 (`student-inline-v1`, the student encoder
35
+ the 0.15 scaffold could build);
36
+ - the Pancake-era profile strings `pancake-complete-v1` and
37
+ `pancake-complete-v2`. This covers packs that were already format 2
38
+ but kept the old string through the rename.
39
+
40
+ Every pack `compile` has written since 0.5.0 is format 2 with a
41
+ format-2 sketch; packs from before the rename are the ones most likely
42
+ to be refused. The shelf in `packs/packs.json` now points at the
43
+ `shelf-packs-v2` release, recompiled so 0.17 opens them; the Wikipedia
44
+ pack it listed before (`artifact-wiki-inline-v4`) is one that is
45
+ refused.
46
+ - **`matchQuality` and `confidence` are gone from query results.**
47
+ `query()` returns `{ results, grounding }` on a single file and on a
48
+ chain. `showAbstained` is ignored, so a pre-0.15 pack whose fit says
49
+ `none` now returns its results. Chains no longer report
50
+ `calibrationDrift`, `calibrationStatus`, `driftLimit`,
51
+ `producerEnvelope` or `readerLimit` in `info()`, or `calibration` in
52
+ `query()`; `pikelet mcp`'s `list_packs` drops the first two. The
53
+ calibration region of a pack's query-interpretation segment is reserved
54
+ and readers ignore it, whatever it holds.
55
+ - **CLI flags removed with the verdict and the drift gate are refused by
56
+ name**, each with what replaced it: `--calibration`,
57
+ `--skip-calibration`, `--calibration-queries` (use `--golden-queries`),
58
+ `--allow-drift`, `--reader-drift-limit` and `--no-refit`. `append` no
59
+ longer gates on drift; layers carry no vocabulary bloom.
60
+ - **Removed from `pikelet-wasm`:** `chainBloom()`, the `readerDriftLimit`
61
+ option and `CHAIN_DEFAULTS.readerDriftLimit`; `calibrationDrift` and
62
+ `calibrationStatus` from `complete/layer-chain`; `checkAppendDrift` and
63
+ `buildLayerSegments`' `layerBloom` from `complete/layer-append`;
64
+ `unionBloom` and `LAYER_VOCAB_KIND`; `__calibrationEvidence` and
65
+ `base64Bytes`; the inline encoder's `embedWords` and the tokenizer's
66
+ `encodeWithWordMap`; and from `complete/builder`, `PROFILE_V1` and
67
+ `buildCorpusSegmentFromBuffers`. `buildQueryInterpSegment`'s calibration
68
+ argument is optional and defaults to the bytes `compile` has written
69
+ since 0.15. `exportSketchArtifact` refuses `rowIntegrity: false`, and
70
+ sketch row fetches are always verified unless `verify: false`.
71
+ - **`info()` integrity fields narrow.** `corpusIntegrity` is always
72
+ `per-record-sha256`; `indexRowIntegrity` is `per-row-sha256` (or
73
+ `per-row-sha256 (unverified by option)`), never `segment-sha256`. The
74
+ manifest's index header commitment (`index.headerSha256`) is required.
75
+ - **Quantized indexes use more memory, and the capacity guard is
76
+ tighter.** A u8 index now keeps a compact copy of its base-layer
77
+ neighbour ids, about `8*M + 4` bytes per row (about 100 bytes at the
78
+ default M=12), and pads each row to 16 bytes. `create()`'s estimate
79
+ becomes `16*ceil(dim/16) + 24*M + 43` bytes per element, so the largest
80
+ u8 index the 1.5 GiB wasm32 budget accepts is about 15-20% smaller
81
+ (at 384 dimensions and M=16, about 1.98M rows instead of 2.37M).
82
+
83
+ ### Changed
84
+
85
+ - **Quantized (u8) search is 1.3-1.8x faster.** Most of a query's time
86
+ was spent waiting on memory, so the base-layer search now reads less
87
+ of it, and reads it in parallel:
88
+ - each row's scale, offset and sums sit in a 16-byte header in front of
89
+ its bytes, so one distance reads one contiguous block where it read
90
+ up to four separate arrays;
91
+ - L2 and cosine distances use the expanded form, with the query's terms
92
+ computed once per query, leaving one multiply-add per dimension. L2
93
+ centres the query on its own mean first, so a large offset shared by
94
+ query and rows cancels exactly instead of swamping float32 precision,
95
+ and a distance too small to trust against the float32 rounding of
96
+ its one remaining dot product (a worst-case bound, computed per row)
97
+ is recomputed per dimension;
98
+ - the search reads 4-byte neighbour ids from a compact list, not the
99
+ 8-byte edges that carry graph-maintenance distances;
100
+ - before scoring a node's unvisited neighbours, it touches each one's
101
+ row in a tight loop, so their cache misses overlap (WebAssembly has
102
+ no prefetch instruction).
103
+
104
+ Through the `Pikelet` API on one core, ef 40/100/200 went from 4,840 /
105
+ 2,360 / 1,330 to 8,660 / 4,320 / 2,410 queries/s on SIFT-1M (L2) and
106
+ from 4,690 / 2,350 / 1,340 to 7,630 / 4,000 / 2,260 on NYTimes-256
107
+ (cosine). Long rows gain less, because more of their time is arithmetic:
108
+ on DBpedia-50K (1,536 dimensions) ef 40/100/200 went from 2,555 / 1,298
109
+ / 742 to 3,544 / 1,772 / 997 (L2) and from 2,893 / 1,459 / 837 to 3,611
110
+ / 1,830 / 1,024 (cosine). Results are unchanged: the whole candidate set
111
+ is re-scored with the same per-dimension distance as before and ordered
112
+ by it before the top k are taken, and on recorded queries (L2 and
113
+ cosine, u8 and float32, after deletes, compaction, a snapshot round trip
114
+ and inserts into a restored index, plus data with large shared offsets
115
+ and exact duplicates) ids, order and distance bits all match 0.16. Graph
116
+ construction is untouched, so snapshots and compiled packs are
117
+ byte-identical. Float32 indexes are unchanged.
118
+
119
+ ### Fixed
120
+
121
+ - **The test suites no longer hang at exit on Node 24 and 26.**
122
+ `process.exit()` can deadlock there after WASM-heavy work: it joins
123
+ V8's worker threads while a background Maglev compile waits for the
124
+ main thread to collect garbage. The test files now set
125
+ `process.exitCode` and exit when their event loop drains (one test hung
126
+ in 36 of 300 runs before, 0 of 300 after), and every CI job has a
127
+ timeout. The `pikelet` CLI's error path exits the same way, with a 1 s
128
+ forced exit if something keeps the process alive; the hang was not
129
+ reproduced on the CLI.
130
+
131
+ ### Documentation
132
+
133
+ - `FORMAT.md`, `COMPLETE_PROFILE.md`, `LAYERED_PROFILE.md` (sections 3.1,
134
+ 4.5, 5.5, 6.1, 6.3, 10-13), `SKETCH_PROFILE.md`, the contract, the
135
+ READMEs and `SECURITY.md` describe the 0.17 reader: format 2 only,
136
+ kinds 2-4, a reserved calibration region and no drift gate.
137
+ `docs/veyra-ablation.md` records the ablation under 0.17's grounding.
138
+ - The docs-corpus spike in `examples/one-file-search` (a kind-1 pack and
139
+ the scripts and browser page built on it) moved to `archive/v0`.
140
+
141
+ ## pikelet-wasm 0.16.0 / pikelet 0.16.0 — 2026-11-30
142
+
143
+ Pikelet narrows to the `.pikelet` toolchain. The Cloudflare Worker
144
+ scaffold (`pikelet create`, `rebuild`, Workers AI and student builds),
145
+ the Docusaurus plugin and the retired `.pikelet-range` format leave both
146
+ packages; packs built by earlier releases still open and serve. BGE-small
147
+ becomes a built-in encoder (`compile --encoder-model
148
+ BAAI/bge-small-en-v1.5`), and the reader fuses keyword and vector results
149
+ with a weight chosen for the pack's encoder, which raises BGE packs'
150
+ scores on the larger BEIR sets and leaves MiniLM packs' rankings
151
+ unchanged. Queries on large packs get faster: rerank rows are verified in
152
+ one batch, and mid-sized packs use the WASM SIMD scan (FiQA's median
153
+ hybrid query from 88.9 to 14.1 ms). The journal gains standing notes,
154
+ crawls check robots.txt on every redirect, and ingestion no longer stalls
155
+ on long runs of spaces or brackets. MiniLM packs compile to the same
156
+ bytes as under 0.15.0. Both packages move to 0.16.0 together, and
157
+ `pikelet` requires `pikelet-wasm` ^0.16.0.
158
+
159
+ ### Compatibility
160
+
161
+ 0.16 narrows Pikelet to the `.pikelet` toolchain: `compile`, `query` and `mcp`, the
162
+ layered-pack commands (`append`, `compact`, `rebase`), `journal` and
163
+ `doctor`, plus the `pikelet-wasm` reader, builder and engine. The older
164
+ workflows below are removed. Packs built by earlier releases, including
165
+ Workers AI and student-encoder packs from the scaffold, still open,
166
+ verify and serve.
167
+
168
+ - **`pikelet create` and `pikelet rebuild` are removed**, with the
169
+ Cloudflare Worker scaffold they generated: the Worker, UI and
170
+ reindex-workflow templates, the `pikelet.config.json` format and its
171
+ schema, the Workers AI and student-encoder build modes, and the
172
+ student trainer (`tools/train_student.py`). Their flags (`--yes`,
173
+ `--no-deploy`, `--skip-abstention`, `--runtime`, `--mode`, `--artifact`,
174
+ `--model`, `--epochs`, `--student-model`, `--student-vectors`,
175
+ `--student-abstention`) are now unknown flags. A project scaffolded
176
+ by an earlier release keeps building with the `pikelet` 0.15 it pins. `pikelet` with
177
+ flags but no command used to start the scaffold; it now fails with
178
+ "No command given" and the command overview. To serve a corpus, compile
179
+ it (`pikelet compile`) and mount the file: over MCP, with `pikelet
180
+ query`, or from any static host through `pikelet-wasm/complete`.
181
+ - **The Docusaurus plugin is removed** (`pikelet/docusaurus`, the
182
+ package's only export besides `package.json`). A Docusaurus site can
183
+ compile its docs folder with `pikelet compile` and serve the pack with
184
+ the `pikelet-wasm/complete` reader. Docusaurus folders remain a
185
+ supported compile source (route mapping, `{#custom-id}` anchors).
186
+ - **The `.pikelet-range` format is retired from `pikelet-wasm`.** It was
187
+ deprecated in favour of the sketch index every `.pikelet` carries. Gone:
188
+ the `pikelet-wasm/artifact` export subpath, `Pikelet.RangeArtifact` on
189
+ every entry point, and on Node `Pikelet.buildRangeArtifact`,
190
+ `buildRangeArtifactFile` and `openRangeArtifactFile`, with their types
191
+ (`PikeletRangeArtifact`, `RangeArtifact*`). The engine API (`create`,
192
+ `add`, `search`, `export`, `restore`, ...) and the sketch artifact API
193
+ (`Pikelet.SketchArtifact`, `buildSketchArtifact*`,
194
+ `openSketchArtifactFile`, `createSketchScanner`) are unchanged.
195
+ Builders that imported the sketch helpers from the subpath get
196
+ `buildSketchArtifactBytes`, `exportSketchArtifact` and
197
+ `MAX_RECOMMENDED_RERANK` from `pikelet-wasm/complete/builder`, whose
198
+ `measureRecommendedRerank` no longer needs an `artifactModule`.
199
+ - **Hybrid results from BGE-small packs are ordered differently.** Packs
200
+ whose encoder is `BAAI/bge-small-en-v1.5` now fuse with lexical weight
201
+ 0.25 instead of 0.5 (see Added). MiniLM packs, including every pack
202
+ `compile` builds by default, rank exactly as before. Pass
203
+ `query(text, { fusion: { lexicalWeight: 0.5 } })` for the old order.
204
+
205
+ ### Added
206
+
207
+ - **`compile --encoder-model BAAI/bge-small-en-v1.5` builds a BGE-small
208
+ pack with no other flags.** The pinned u8 weights (36 MiB, MIT) download
209
+ into the model cache on first use and are checked against their digest
210
+ on every compile (`PIKELET_BGE_WEIGHTS_URL` names a mirror); the pack
211
+ declares BGE's 12-layer kernel layout and licence; queries get BGE's
212
+ retrieval prefix unless `--encoder-query-prefix` is given, and `""`
213
+ turns it off. Before, `--encoder-model` required `--encoder-weights`,
214
+ and even with them the declaration described MiniLM's 6-layer shape, so
215
+ the kernel refused the pack. BGE-small scores higher than MiniLM on the
216
+ larger BEIR sets: hybrid nDCG@10 0.744 against 0.546 on TREC-COVID,
217
+ 0.400 against 0.374 on FiQA (at the fusion defaults below). Any other model still needs
218
+ `--encoder-weights`, and the error lists the built-in encoders.
219
+ - **Fusion defaults follow the pack's encoder.** BM25 compensates less
220
+ for a stronger encoder: with BGE-small, lexical weight 0.25 beat 0.5 on
221
+ FiQA (nDCG@10 +0.010) and on TREC-COVID's judged documents (+0.023), and
222
+ was never worse on SciFact, NFCorpus or ArguAna, while MiniLM lost 0.039
223
+ on TREC-COVID at 0.25. The reader picks the defaults from the encoder
224
+ model the pack declares (a chain from its base), before a deferred
225
+ encoder loads, so existing BGE packs need no rebuild.
226
+ `pikelet-wasm/complete` exports `ENCODER_FUSION_DEFAULTS` and
227
+ `fusionDefaultsFor(model)`; `query()` takes an optional `fusion` object
228
+ (`rrfK`, `lexicalWeight`, `guardMargin`) merged over the defaults, and
229
+ `info().fusion` reports the defaults in force.
230
+
231
+ - **Standing notes in the agent journal.** `write_note` takes
232
+ `standing: true` for a note that binds all later work until it is
233
+ changed (a ground rule, constraint or convention), and
234
+ `supersedes: [ids]` (at most 20) for the earlier notes a note replaces.
235
+ A standing note stays in force until a later note lists it in
236
+ `supersedes`. An unfiltered `latest` now leads with a `standing` list:
237
+ every standing note in force, newest first, as its id, title, date and
238
+ the first 120 characters of its text (at most 200, with a
239
+ `standingWarning` when more are in force). The newest notes follow
240
+ under `notes` as before, minus any already listed as standing, so
241
+ `notes` can hold fewer than `limit` entries. `latest` with
242
+ `standing: true` lists only the standing notes, in full; a call
243
+ filtered by `kind` or `tag` leaves the section out. Before this, rules
244
+ written at a project's start dropped out of `latest` once a page of
245
+ newer notes came after them. Each note's `preview` is now cut at a
246
+ word boundary with an ellipsis instead of mid-word at 300 characters.
247
+
248
+ ### Changed
249
+
250
+ - **`pikelet query` no longer prints distances unless asked.** Results
251
+ are in hybrid order, which weighs keyword matches as well as vector
252
+ distance, so the printed distances were not always ascending and read
253
+ as a ranking error. The numbered order is the ranking; `--verbose`
254
+ adds each result's distance. `--json` and the MCP `search` response
255
+ are unchanged and still carry `distance` on every result.
256
+ - **Verified rerank rows are hashed in one batch per query.** A format-2
257
+ sketch checks every row it fetches for reranking against its SHA-256
258
+ digest page. Each row was hashed with its own awaited
259
+ `crypto.subtle.digest`, one after another, about 0.1 ms each, so a
260
+ query's first read of a few hundred rows spent tens of milliseconds
261
+ hashing. The pages and rows a query fetches are now hashed together:
262
+ with `node:crypto` in Node, or with concurrent `crypto.subtle` calls in
263
+ browsers. Every page and row is still checked before any is returned or
264
+ cached, and a mismatch fails the query as before. On the Simple English
265
+ Wikipedia pack (456k rows), vector retrieval on first-read rows went
266
+ from p50 37.7 / p99 64.1 ms to 19.4 / 27.1 ms. Results are unchanged.
267
+ - **Mid-sized packs use the WASM SIMD sketch scan.** In Node the
268
+ complete reader stages the engine's scan kernel in the background once
269
+ a sketch holds at least 1 Mi cells (rows × sketch dims), down from 16
270
+ Mi: about 5,500 rows for 384-dim embeddings (192-dim sketches), where
271
+ it was about 87,000. The JS scan costs about 6 ms per million cells
272
+ against about 0.6 ms for the kernel. Staging loads the engine once per
273
+ process (about 0.2 s and 12 MiB) while the JS scan keeps serving, so
274
+ the switch pays for itself after a few dozen queries. Hybrid queries
275
+ on BEIR FiQA (57,638 documents) went from a median of 88.9 ms to 14.1
276
+ ms, and on ArguAna (8,674) from 16.7 ms to 8.3 ms, with identical
277
+ rankings. `pikelet query`, which runs one query and exits, does not
278
+ stage it: the reader waits for staging at close, so a single query
279
+ would pay the engine load and never earn it back. Browser bundles are
280
+ unaffected: they inject a scanner through `options.sketchScanner`, and
281
+ `sketchScanner: false` still forces the JS scan.
282
+ - **The MCP server describes the ranking accurately.** The `search` tool
283
+ description and the server instructions said results were "ranked by
284
+ closeness of meaning"; they now say results come best first, ranked by
285
+ meaning and keyword match together, and that `distance` is vector
286
+ similarity only.
287
+
288
+ ### Fixed
289
+
290
+ - **The range-proof server stays inside its folder and survives bad
291
+ requests** (`benchmarks/range-proof/dumb-server.mjs`, a benchmark tool,
292
+ not part of either package). Its containment check compared paths
293
+ without a trailing separator, so an encoded slash
294
+ (`/..%2Froot-secret/file`) could read a sibling folder whose name began
295
+ with the served folder's name; it now requires the path to be the
296
+ folder or under `folder/`, and answers 403 otherwise. A malformed
297
+ percent-escape (`/%E0%A4%A`) made `decodeURIComponent` throw and the
298
+ server exit; it now answers 400. A request for a directory, the root
299
+ included, crashed it with EISDIR; it now answers 404.
300
+ - **A seed URL's redirects are checked against robots.txt before they are
301
+ fetched.** `compile --source <url>` (and `append --source <url>`)
302
+ follows the seed through up to five redirects, HTTP or meta refresh,
303
+ before crawling. Each hop was requested without a robots.txt check:
304
+ only the typed URL was checked first, and the final URL afterwards.
305
+ So a seed that redirected to another host had its page fetched before
306
+ that host's robots.txt was read, and a redirect onto a path the site's
307
+ own robots.txt disallows was fetched before the crawl refused it.
308
+ Every hop is now checked against its own origin's robots.txt, and that
309
+ origin's Crawl-delay applies, before it is requested. A seed that
310
+ redirects to a URL that is not HTTP(S) is refused with an error saying
311
+ so, where it failed with "Could not read null/robots.txt".
312
+ - **Ingestion no longer stalls on long runs of spaces, brackets or `<`.**
313
+ Several of the regular expressions that strip Markdown, read headings
314
+ and titles, flatten HTML and parse robots.txt restarted at every
315
+ character of a long run that was not followed by what they needed, so
316
+ their time grew with the square of the run: 40 KB of spaces in a
317
+ heading line took 14 s, and a crawled page or a document with a few
318
+ hundred KB of such text could hold `compile` for many minutes. They are
319
+ now linear scans (`packages/pikelet/src/text-scan.mjs`) that return
320
+ exactly what the expressions returned, so records, titles, anchors and
321
+ pack identities are unchanged. The same change covers route and
322
+ repository path trimming, the scaffold's project name, the Docusaurus
323
+ client's result links, and `clean_title` in the student trainer.
324
+
11
325
  ## pikelet-wasm 0.15.0 / pikelet 0.15.0 — 2026-11-19
12
326
 
13
327
  `pikelet mcp` and `pikelet query` stop reporting a relevance verdict, and
package/FORMAT.md CHANGED
@@ -41,7 +41,7 @@ Two packs built by the current compiler, for scale:
41
41
 
42
42
  | Segment | 3-record folder | Simple English Wikipedia (456,153 records) |
43
43
  | --- | ---: | ---: |
44
- | Query interpretation (encoder + calibration) | 24.5 MiB | 24.9 MiB |
44
+ | Query interpretation (encoder) | 24.5 MiB | 24.9 MiB |
45
45
  | Index (vector sketch + rows) | 2.0 KiB | 220.1 MiB |
46
46
  | Corpus (records + digests) | 2.4 KiB | 334.4 MiB |
47
47
  | Lexical (BM25) | 1.1 KiB | 69.2 MiB |
@@ -133,7 +133,7 @@ covered by the identity.
133
133
  | ---: | --- | --- | --- |
134
134
  | 1 | index | required | resident prefix at open, rows per query |
135
135
  | 2 | corpus | required | tables at open, one record per hydrated result |
136
- | 3 | query-interp | required | calibration at open; encoder before the first query |
136
+ | 3 | query-interp | required | header at open; encoder before the first query |
137
137
  | 4 | evaluation | required for conformance | only by `verify_pack` and tests |
138
138
  | 5 | lexical | optional; written by default | whole at open, or lazily above 8 MiB |
139
139
  | 6 | tombstones | layers only | whole at mount |
@@ -159,43 +159,35 @@ A record carries at least `title`, `text` and `sourcePath`, and optionally
159
159
  conversation turn, a journal note). Records are stored uncompressed.
160
160
  Record `i` is the vector index's row `i` (or, with a
161
161
  [row map](#row-map-kind-8), owns a run of rows): the compiler numbers
162
- them together, so the file has no id map. Format-1 files use layout v1: the same
163
- count and offsets, with no page table or record digests.
162
+ them together, so the file has no id map.
164
163
 
165
164
  ### Query-interpretation segment (kind 3)
166
165
 
167
166
  ```
168
167
  u32 version 1
169
- u32 kind 1 student-inline-v1, 2 external-transformers-v1,
170
- 3 inline-transformer-v1, 4 inherited-v1 (layers only)
168
+ u32 kind 2 external-transformers-v1, 3 inline-transformer-v1,
169
+ 4 inherited-v1 (layers only); 1 (student-inline-v1)
170
+ is refused since 0.17
171
171
  u32 encoderBytes
172
172
  u32 calibrationBytes
173
173
  encoder per kind (see The embedded encoder)
174
- calibration UTF-8 JSON
174
+ calibration reserved; UTF-8 JSON
175
175
  ```
176
176
 
177
- The encoder and the calibration share a segment and a version because
178
- the calibration is fit to that encoder's outputs; neither can change
179
- without the other.
180
-
181
- Packs compiled after 0.14.0 carry an empty calibration
182
- (`{"kind":"retrieval-signals-v1","asset":null,"vocabBloomBase64":""}`),
183
- and the reference reader reports their `matchQuality` as `unscored`. A
184
- query on any pack also returns `grounding`, the question's words the best
185
- of the top five passages contains and lacks, computed from the passages'
186
- text alone ([how a query runs](docs/how-a-query-runs.md#grounding-which-question-words-the-passages-contain)).
187
-
188
- Packs compiled by 0.14.0 and earlier may carry a fitted calibration
189
- (`retrieval-signals-v1`): a small model plus a base64 bloom filter of the
190
- corpus vocabulary. At query time it scores the search's distance signals
191
- and the query's word coverage into a `matchQuality` verdict: `strong`,
192
- `weak` or `none`. Packs from the last of those releases also carry a
193
- second, distance-only model (`gate`) that alone decides `none`; word
194
- coverage then only separates `strong` from `weak`. Readers that predate
195
- the gate ignore it. The verdict measures whether the corpus covers the
196
- question's topic, not whether a passage states the answer.
197
- [docs/calibration.md](docs/calibration.md) says why `compile` stopped
198
- fitting it.
177
+ The calibration region is reserved. `compile` writes the placeholder it
178
+ has written since 0.15 (`{"kind":"retrieval-signals-v1","asset":null,"vocabBloomBase64":""}`),
179
+ so removing the verdict in 0.17 moved no pack's identity. Readers ignore
180
+ the region, whatever it holds; its bytes are still covered by the
181
+ segment digest. Packs compiled by 0.14.0 and earlier may hold a fitted
182
+ `retrieval-signals-v1` model there, which turned search signals into a
183
+ `matchQuality` verdict (`strong`, `weak` or `none`); readers since 0.17
184
+ ignore it, so such a pack's results are neither labelled nor withheld.
185
+ [docs/calibration.md](docs/calibration.md) says why the verdict was
186
+ removed.
187
+
188
+ A query returns `grounding`: the question's words the best of the top
189
+ five passages contains and lacks, computed from the passages' text alone
190
+ ([how a query runs](docs/how-a-query-runs.md#grounding-which-question-words-the-passages-contain)).
199
191
 
200
192
  ### Evaluation segment (kind 4)
201
193
 
@@ -203,7 +195,7 @@ UTF-8 JSON: the golden queries the pack was built with (each a question
203
195
  and the record or title it must retrieve in the top 10) and the
204
196
  recall-versus-rerank-depth sweep that chose `recommendedRerank`; packs
205
197
  compiled by 0.14.0 and earlier also hold expected verdicts and the
206
- calibration's fit metrics. `compile` keeps only goldens the assembled
198
+ calibration's fit metrics, which nothing reads since 0.17. `compile` keeps only goldens the assembled
207
199
  pack passes, and `verify_pack` (MCP) replays them on demand. A reader can serve queries
208
200
  without ever reading this segment.
209
201
 
@@ -212,7 +204,7 @@ without ever reading this segment.
212
204
  **Identity** is `manifestSha256`. The manifest commits to each segment's
213
205
  digest, and some segments commit further to their own parts, so the
214
206
  identity transitively commits to every byte of content. Two files with the
215
- same identity hold the same corpus, indexes, encoder and calibration.
207
+ same identity hold the same corpus, indexes and encoder.
216
208
 
217
209
  **Pinning.** A reader can be told the identity it expects:
218
210
  `openPikeletFile(url, { expectedIdentity })`, `pikelet mcp --pack
@@ -256,15 +248,16 @@ run by kernels that ship with the reader.
256
248
  ## The embedded encoder
257
249
 
258
250
  The query encoder is inside the file, so a query needs no model download,
259
- no embedding API and no network beyond the file itself. Three
260
- query-interpretation kinds exist, each giving up one of self-contained,
261
- small and full-quality:
251
+ no embedding API and no network beyond the file itself. Two query-interpretation kinds open,
252
+ each giving up one of self-contained and small:
262
253
 
263
254
  | Kind | Name | Encoder bytes | Trade-off |
264
255
  | ---: | --- | --- | --- |
265
256
  | 3 | `inline-transformer-v1` | the quantized transformer itself, ~24 MiB | the default; self-contained and full quality, but large |
266
- | 1 | `student-inline-v1` | a distilled student model, small | self-contained and small, lower quality; not appendable |
267
- | 2 | `external-transformers-v1` | a JSON declaration naming the model, plus test vectors | small and full quality, but the host must supply the encoder |
257
+ | 2 | `external-transformers-v1` | a JSON declaration naming the model, plus test vectors | small and full quality, but the host must supply the encoder. Built only by releases before 0.16; `pikelet mcp` refuses it |
258
+
259
+ Kind 1 (`student-inline-v1`), a small distilled student model, was built
260
+ by releases before 0.16; readers since 0.17 refuse it.
268
261
 
269
262
  **Kind 3**, which `pikelet compile` writes, holds three length-prefixed
270
263
  regions:
@@ -351,8 +344,8 @@ the table. Up to 8 MiB the segment is read whole; above that only the
351
344
  header and doclens are read at open, and term windows and postings are
352
345
  fetched per query (see [integrity](#identity-and-integrity) for the cost).
353
346
 
354
- The tokenizer keeps lowercase `[a-z0-9']` runs of 2–32 characters. The
355
- same rule drives a fitted calibration's word coverage; `grounding` grades
347
+ The tokenizer keeps lowercase `[a-z0-9']` runs of 2–32 characters.
348
+ `grounding` grades
356
349
  words of three letters or more, or any word holding a digit. BM25 parameters are
357
350
  k1 = 1.2, b = 0.75.
358
351
 
@@ -389,14 +382,9 @@ ancestor.
389
382
  `(oldId, newId)` pairs in the same segment.
390
383
  - A layer carries no encoder. Its query-interpretation segment is kind 4
391
384
  (`inherited-v1`), which names the base's identity and the digest of the
392
- base's encoder segment; when the base is calibrated, its calibration
393
- region holds a bloom filter of the layer's own vocabulary.
385
+ base's encoder segment; its calibration region is reserved, as in a
386
+ base.
394
387
  - A chain is at most 16 layers deep; by default `append` stops at 8.
395
- - A base calibrated by 0.14.0 or earlier keeps its calibration until
396
- accumulated change (records appended plus records deleted, over the
397
- base's record count) passes a limit of 0.20; past it the chain is
398
- served `unscored` and `append` refuses unless given `--allow-drift`. A
399
- base with no calibration has no such limit.
400
388
  - `pikelet compact` folds a chain into a new base whose lineage segment
401
389
  (kind 7) translates every earlier head's ids forward.
402
390
 
@@ -408,10 +396,10 @@ Versions sit at several levels, and each is checked by the reader:
408
396
 
409
397
  | Level | Where | Values |
410
398
  | --- | --- | --- |
411
- | Container | header `formatVersion` + manifest `profile` | `1` = `pikelet-complete-v1`; `2` = `pikelet-complete-v2` or `pikelet-layer-v1` |
412
- | Corpus layout | manifest `corpus.layout` | absent (v1, format 1 only) or `records-v2` (format 2 only) |
413
- | Vector index | sketch header `formatVersion` | `1` (whole-segment digests) or `2` (per-row digests) |
414
- | Encoder and calibration | query-interp `version` and `kind` | version 1; kinds 1–4 |
399
+ | Container | header `formatVersion` + manifest `profile` | `2` = `pikelet-complete-v2` or `pikelet-layer-v1` |
400
+ | Corpus layout | manifest `corpus.layout` | `records-v2` |
401
+ | Vector index | sketch header `formatVersion` | `2` (per-row digests) |
402
+ | Encoder | query-interp `version` and `kind` | version 1; kinds 2–4 |
415
403
  | Keyword index | manifest `lexical.layout` + segment version | `bm25-v1` |
416
404
  | Other segments | their own version words | tombstones, lineage and row map: 1 |
417
405
  | Ingestion | manifest `corpus.ingest.chunker` | `pikelet-section-v1` |
@@ -423,17 +411,23 @@ they do not know.
423
411
 
424
412
  Format 2 with a version-2 sketch has been what the compiler writes since
425
413
  0.5.0 (2026-08-26). Keyword indexes arrived in 0.6.0, layers in 0.9.0,
426
- the ingestion declaration in 0.9.2 and row maps in 0.11.0.
414
+ the ingestion declaration in 0.9.2 and row maps in 0.11.0. Readers since
415
+ 0.17 refuse format 1, sketch format 1, kind 1 and the Pancake-era profile
416
+ strings.
427
417
 
428
418
  ## Compatibility
429
419
 
430
- - **Old files open.** Readers open format 1 and 2, sketch format 1 and 2,
431
- and every query-interpretation kind. Each part reports the integrity
432
- stance it actually has instead of claiming the strongest.
420
+ - **Files from before 0.17.** Readers since 0.17 refuse format 1
421
+ (`pikelet-complete-v1`, no per-record digests), sketch format 1 (no
422
+ per-row digests), query-interpretation kind 1 (`student-inline-v1`) and
423
+ the Pancake-era profile strings `pancake-complete-v1` and `-v2`, each
424
+ with a message to recompile from source. Every pack the compiler has
425
+ written since 0.5.0 is format 2 with a version-2 sketch; the profile
426
+ string is what decides most older packs.
433
427
  - **The Pancake era.** The project was called Pancake until September
434
- 2026. Readers accept the old profile strings `pancake-complete-v1` and
435
- `-v2`, and dispatch on magic bytes, not file extensions, so `.pancake`
436
- files open unchanged ([history](docs/history.md)).
428
+ 2026 ([history](docs/history.md)). Readers dispatch on magic bytes, not
429
+ file extensions, so a `.pancake` file whose profile is
430
+ `pikelet-complete-v2` opens.
437
431
  - **Older readers and newer files.** A reader that predates the keyword
438
432
  index skips it and serves vector-only results from the same file. A
439
433
  reader that predates row maps refuses a file that carries one (its
@@ -442,8 +436,7 @@ the ingestion declaration in 0.9.2 and row maps in 0.11.0.
442
436
  - **Identity is stable under reading, not rebuilding.** Recompiling the
443
437
  same inputs with the same compiler version gives the same identity
444
438
  (releases up to 0.14.0 need `SOURCE_DATE_EPOCH` set for this). A
445
- different compiler version can change chunking, calibration or
446
- defaults, and with them the identity.
439
+ different compiler version can change chunking or defaults, and with them the identity.
447
440
  - **Transport.** Over HTTP the host must answer `Range` requests with
448
441
  `206 Partial Content`. If the file's validator (`ETag`) changes while it
449
442
  is open, reads fail with `ARTIFACT_CHANGED` instead of mixing bytes from
@@ -470,7 +463,7 @@ the ingestion declaration in 0.9.2 and row maps in 0.11.0.
470
463
  highly (record text and vector rows are still verified). Format-1
471
464
  files have the same gap for records and rows.
472
465
  - **Retrieval behaviour is partly in the reader.** The file fixes the
473
- encoder, the indexes and the calibration. The fusion rule, BM25
466
+ encoder and the indexes. The fusion rule, BM25
474
467
  parameters and cut-offs come from the reader, so two reader versions
475
468
  may rank the same pack differently.
476
469
  - **No metadata filters, no compression.** There is no filter or facet
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  **Knowledge that ships as a file.**
4
4
 
5
- A `.pikelet` file is a searchable corpus in a single file. It holds the source text, a vector index and a keyword (BM25) index, the neural encoder that turns a question into a vector, and the tests the pack was built to pass. Its identity is a SHA-256 digest that commits to all of it, so the file fixes not just what the corpus says but how it is queried: the model that encodes a question, the indexes that find candidates, and the order they rank passages in. **The format makes retrieval semantics part of the versioned knowledge artifact.**
5
+ A `.pikelet` file is a searchable corpus in a single file. It holds the source text, a vector index and a keyword (BM25) index, the neural encoder that turns a question into a vector, and the tests the pack was built to pass. Its identity is a SHA-256 digest that commits to all of it, so the file fixes not just what the corpus says but how a question reaches it: the model that encodes the question and the indexes that find candidates. **The corpus, its encoder and its indexes are one versioned artifact.** How the vector and keyword candidates are combined into one ranking (the fusion rule and BM25 parameters) belongs to the reader version, not the file, so a newer reader can order the same pack's results differently; see [FORMAT.md](FORMAT.md#operational-limitations).
6
6
 
7
- The layout is built for byte-range reads. A reader opens the file from a small prefix and then fetches only the index rows and records a query needs, verifying each against the identity, so a pack can sit on disk, S3, R2, a CDN or any static HTTP host, with no vector database, embedding API or retrieval server behind it. [FORMAT.md](FORMAT.md) describes the binary structure, the embedded encoder, the indexes, the integrity commitments, versioning, compatibility and the format's limits.
7
+ The layout is built for byte-range reads. A reader opens the file from a small prefix and then fetches only the index rows and records a query needs, verifying each against the identity (a keyword index over 8 MiB is the exception: it is checked whole only by `verify_pack` with `full: true`, not on each read), so a pack can sit on disk, S3, R2, a CDN or any static HTTP host, with no vector database, embedding API or retrieval server behind it. [FORMAT.md](FORMAT.md) describes the binary structure, the embedded encoder, the indexes, the integrity commitments, versioning, compatibility and the format's limits.
8
8
 
9
9
  **Pikelet** is the open-source toolchain for the format: a compiler (`pikelet compile`) that builds packs from folders, websites, git history or exported chats; a reader library (`pikelet-wasm`) for browsers, Node and edge workers; and an MCP server (`pikelet mcp`) that mounts packs for LLM agents.
10
10
 
@@ -32,7 +32,7 @@ Next:
32
32
  pikelet mcp install --pack docs.pikelet give it to Claude Code
33
33
  ```
34
34
 
35
- Every `.pikelet` is at least ~25 MiB, because the query encoder ships inside it: a 5-file folder and a 500-file folder both start around that size. The first run downloads the encoder from a GitHub release and caches it.
35
+ Every `.pikelet` is at least ~25 MiB, because the query encoder ships inside it: a 5-file folder and a 500-file folder both start around that size. The first run downloads the encoder from a GitHub release and caches it. `--encoder-model BAAI/bge-small-en-v1.5` builds with BGE-small instead: packs about 11.5 MiB larger that retrieve better on larger corpora (see [Encoders](packages/pikelet/README.md#encoders)).
36
36
 
37
37
  Compiling is mostly embedding, at about one chunk a second per CPU core: 828 chunks took 110 seconds on 8 cores, so a few thousand chunks take several minutes, and longer on a 2-core machine.
38
38
 
@@ -46,7 +46,7 @@ npx pikelet query docs.pikelet "why is a pack one file"
46
46
  docs: 5 results
47
47
 
48
48
  1. Why make knowledge a file
49
- why-a-file.md#why-make-knowledge-a-file · distance 0.617
49
+ why-a-file.md#why-make-knowledge-a-file
50
50
  The reasoning behind the single-artifact design. ...
51
51
  ```
52
52
 
@@ -116,9 +116,9 @@ On a 20-record test pack with a 24.6 MiB base, deleting a record took a 1.2 KiB
116
116
 
117
117
  ## Does the pack answer the question?
118
118
 
119
- A nearest neighbour is not evidence that a corpus answers a question: every query returns *something*. Pikelet does not try to decide for you. Each result carries its `distance`, and each response lists the question's words missing from whichever of the top five passages contains the most of them (`grounding.uncovered`). "How do I keep snapshots forever" against a pack whose snapshot page never mentions keeping them forever comes back with `keep` and `forever` uncovered; the MCP server tells the model to cite only a passage that states the answer.
119
+ A nearest neighbour is not evidence that a corpus answers a question: every query returns *something*. Pikelet does not try to decide for you. Each result carries its vector `distance` (results come in hybrid order, which also weighs keyword matches, so distances are not always ascending), and each response lists the question's words missing from whichever of the top five passages contains the most of them (`grounding.uncovered`). "How do I keep snapshots forever" against a pack whose snapshot page never mentions keeping them forever comes back with `keep` and `forever` uncovered; the MCP server tells the model to cite only a passage that states the answer.
120
120
 
121
- Earlier releases also shipped a relevance verdict (`matchQuality: strong | weak | none`) fitted at build time. On a 1,377-article Wikipedia pack it called 278 of 512 questions whose answer article was not in the pack `strong`, and agents given the verdict declined unanswerable questions no more often than agents without it: they read the passages either way. So `compile` no longer fits one; packs calibrated by earlier releases keep theirs in the library. [docs/calibration.md](docs/calibration.md#why-the-verdict-was-dropped-2026-11) has the measurements.
121
+ Earlier releases also shipped a relevance verdict (`matchQuality: strong | weak | none`) fitted at build time. On a 1,377-article Wikipedia pack it called 278 of 512 questions whose answer article was not in the pack `strong`, and agents given the verdict declined unanswerable questions no more often than agents without it: they read the passages either way. So `compile` stopped fitting one in 0.15, and 0.17 removed the verdict from the library as well. [docs/calibration.md](docs/calibration.md#why-the-verdict-was-dropped-2026-11) has the measurements.
122
122
 
123
123
  None of this is a guarantee that an LLM will never hallucinate.
124
124
 
@@ -128,7 +128,7 @@ Pikelet targets `build → publish → query many times → replace on release`,
128
128
 
129
129
  Use a database instead if your corpus has heavy online writes, needs transactional mutation, serves many tenants, or already lives comfortably in one. The remote scan is linear in row count, so the design targets corpora through the low millions of records, not web scale. Text handling is English-first: keyword search keeps only ASCII letters and digits, so accented words are split into fragments and non-Latin words are dropped (see [Limitations](packages/pikelet/README.md#limitations)).
130
130
 
131
- It is also not new retrieval research. HNSW is HNSW, BM25 is BM25, HTTP Range is HTTP Range, and the bundled MiniLM-L6 encoder was chosen for being small enough to live inside the file — ArguAna shows a real quality cost from that. The project is about arranging those pieces around one constraint: **the knowledge base itself must be distributable as a file and stay useful without retrieval infrastructure.**
131
+ It is also not new retrieval research. HNSW is HNSW, BM25 is BM25, HTTP Range is HTTP Range, and the bundled MiniLM-L6 encoder was chosen for being small enough to live inside the file — ArguAna shows a real quality cost from that, and BGE-small is the built-in alternative when quality matters more than size. The project is about arranging those pieces around one constraint: **the knowledge base itself must be distributable as a file and stay useful without retrieval infrastructure.**
132
132
 
133
133
  ## Deeper dives
134
134
 
@@ -143,7 +143,7 @@ It is also not new retrieval research. HNSW is HNSW, BM25 is BM25, HTTP Range is
143
143
  ```text
144
144
  packages/pikelet-wasm/ The pikelet-wasm library: C++ HNSW engine compiled to WASM
145
145
  (used at compile time), readers and builders for .pikelet
146
- packages/pikelet/ The pikelet CLI: compiler, MCP server, Docusaurus plugin
146
+ packages/pikelet/ The pikelet CLI: compile, query, MCP server, layers, journal
147
147
  docs/ Deeper dives, design notes, measurement reports
148
148
  spec/ Byte-level artifact contracts
149
149
  LAYERED_PROFILE.md The layered profile: append, compact, rebase
@@ -160,12 +160,12 @@ The **range proof** uses a server that does not understand Pikelet and reports m
160
160
 
161
161
  ## Status
162
162
 
163
- Pikelet is early: the implementation is real, the format is not frozen, and there is one primary author. Prebuilt WASM, local and HTTP readers, the embedded encoder, BM25 hybrid retrieval, content identity with lazy-read verification, query-word grounding, MCP mounting, layered updates, and the experimental journal all ship today. `npm test` runs the engine, artifact-profile, MCP, ingestion, and format-hardening conformance suites.
163
+ Pikelet is early: the implementation is real, the format is not frozen, and there is one primary author. Prebuilt WASM, local and HTTP readers, the embedded encoder, BM25 hybrid retrieval, content identity with lazy-read verification (except large keyword indexes, as above), query-word grounding, MCP mounting, layered updates, and the experimental journal all ship today. `npm test` runs the engine, artifact-profile, MCP, ingestion, and format-hardening conformance suites.
164
164
 
165
- Previously known as **Pancake** (renamed September 2026); files from before the rename remain readable — see [`docs/history.md`](docs/history.md). Pikelet is unrelated to the Pikelet programming language.
165
+ Previously known as **Pancake** (renamed September 2026); packs that still carry the `pancake-complete` profile string must be recompiled to open with 0.17 or later — see [`docs/history.md`](docs/history.md). Pikelet is unrelated to the Pikelet programming language.
166
166
 
167
167
  ## License
168
168
 
169
169
  Apache-2.0. See [LICENSE](LICENSE).
170
170
 
171
- Every `.pikelet` carries its query encoder, so a pack redistributes the all-MiniLM-L6-v2 weights (quantized) and the BERT WordPiece vocabulary, both Apache-2.0. [NOTICE](NOTICE) credits them; keep it with packs you publish.
171
+ Every `.pikelet` carries its query encoder, so a pack redistributes the all-MiniLM-L6-v2 weights (quantized) and the BERT WordPiece vocabulary, both Apache-2.0. [NOTICE](NOTICE) credits them; keep it with packs you publish. A BGE-small pack redistributes the BAAI/bge-small-en-v1.5 weights (quantized, MIT) instead; its encoder declaration records the license.