mlx-bun 0.2.0 → 0.3.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 (364) hide show
  1. package/README.md +71 -588
  2. package/docs/README.md +91 -0
  3. package/docs/{design → archive/investigations}/audio-input-plan.md +4 -4
  4. package/docs/{design → archive/investigations}/diffusion-gemma-port.md +3 -3
  5. package/docs/{design → archive/investigations}/faithful-l1-consolidation.md +4 -4
  6. package/docs/{design → archive/investigations}/minicpm5-decode-megakernel.md +11 -11
  7. package/docs/{design → archive/investigations}/optimization_plan.md +1 -1
  8. package/docs/{design → archive/investigations}/pre-colibri-stabilization.md +5 -5
  9. package/docs/{design → archive/investigations}/the-dreaming-handoff.md +2 -2
  10. package/docs/design/batching.md +569 -0
  11. package/docs/design/decode-speed-program.md +3178 -169
  12. package/docs/design/dreaming-nightly-pipeline.md +675 -282
  13. package/docs/design/generic-model-support.md +579 -334
  14. package/docs/design/kv-cache.md +680 -0
  15. package/docs/design/orpo-training.md +673 -1239
  16. package/docs/design/speculative-decoding.md +1627 -0
  17. package/docs/design/turboquant.md +2102 -0
  18. package/docs/design/unified-engine-frontier-plan.md +1831 -727
  19. package/docs/design/web-chat-redesign.md +666 -1083
  20. package/docs/planning/PRODUCT_ROADMAP.md +34 -1
  21. package/docs/planning/release-notes-v0.3.0.md +35 -0
  22. package/docs/planning/video-series.md +2 -2
  23. package/docs/reference/benchmarks.md +1162 -0
  24. package/docs/reference/cli.md +394 -159
  25. package/docs/reference/distribution.md +321 -182
  26. package/docs/reference/environment.md +348 -0
  27. package/docs/reference/glossary.md +39 -0
  28. package/docs/reference/library-api.md +566 -168
  29. package/docs/reference/memory.md +227 -64
  30. package/docs/reference/models.md +104 -6
  31. package/docs/reference/server-api.md +886 -425
  32. package/docs/reference/server-config.md +638 -330
  33. package/docs/reference/training.md +393 -254
  34. package/docs/reference/troubleshooting.md +166 -0
  35. package/package.json +9 -4
  36. package/src/audio/decode.ts +2 -2
  37. package/src/audio/features.ts +2 -2
  38. package/src/backends/mlx/autoregressive.ts +108 -0
  39. package/src/backends/mlx/batch-group.ts +1646 -0
  40. package/src/backends/mlx/diffusion.ts +39 -0
  41. package/src/backends/mlx/draft-target.ts +47 -0
  42. package/src/backends/mlx/evaluation.ts +105 -0
  43. package/src/backends/mlx/fill-append.ts +45 -0
  44. package/src/backends/mlx/gateway-binding.ts +71 -0
  45. package/src/backends/mlx/graph.ts +38 -0
  46. package/src/backends/mlx/memory-client.ts +189 -0
  47. package/src/backends/mlx/memory-guard.ts +40 -0
  48. package/src/backends/mlx/methods.ts +90 -0
  49. package/src/backends/mlx/model-prompt.ts +164 -0
  50. package/src/backends/mlx/model-serving.ts +79 -0
  51. package/src/backends/mlx/prefill.ts +33 -0
  52. package/src/backends/mlx/request-policy.ts +20 -0
  53. package/src/backends/mlx/rollback.ts +51 -0
  54. package/src/backends/mlx/serial-executor.ts +273 -0
  55. package/src/backends/mlx/speculative.ts +114 -0
  56. package/src/backends/mlx/state-views.ts +26 -0
  57. package/src/backends/mlx/text-engine.ts +73 -0
  58. package/src/cli.ts +58 -25
  59. package/src/client.ts +66 -0
  60. package/src/config.ts +21 -4
  61. package/src/contracts/completion.ts +16 -0
  62. package/src/contracts/execution.ts +49 -0
  63. package/src/contracts/generation.ts +103 -0
  64. package/src/contracts/host.ts +7 -0
  65. package/src/contracts/jobs.ts +66 -0
  66. package/src/contracts/pi-provider.ts +30 -0
  67. package/src/contracts/pi.ts +259 -0
  68. package/src/contracts/resources.ts +18 -0
  69. package/src/contracts/scheduling.ts +27 -0
  70. package/src/contracts/tsconfig.json +14 -0
  71. package/src/diffusion/diffusion-generate.ts +218 -153
  72. package/src/embed.ts +1 -1
  73. package/src/engine/admission.ts +59 -0
  74. package/src/engine/cancellation.ts +38 -0
  75. package/src/engine/engine.ts +56 -0
  76. package/src/engine/execution-coordinator.ts +70 -0
  77. package/src/engine/execution-plan.ts +51 -0
  78. package/src/engine/resources.ts +42 -0
  79. package/src/engine/scheduler.ts +67 -0
  80. package/src/engine/session.ts +247 -0
  81. package/src/eval/README.md +44 -1
  82. package/src/eval/kl.ts +236 -3
  83. package/src/eval/reference-logits.ts +207 -0
  84. package/src/eval/runner.ts +8 -96
  85. package/src/fill/echo-index.ts +188 -0
  86. package/src/fill/fill-session.ts +452 -0
  87. package/src/fill/proposal.ts +68 -0
  88. package/src/fill/schema-rows.ts +506 -0
  89. package/src/fill/tool-boundary.ts +103 -0
  90. package/src/fit.ts +1 -1
  91. package/src/generate.ts +656 -268
  92. package/src/grammar.ts +12 -7
  93. package/src/harness-pi.ts +14 -33
  94. package/src/hub-rest.ts +4 -4
  95. package/src/index.ts +7 -0
  96. package/src/inference/denoising.ts +17 -0
  97. package/src/inference/graph.ts +33 -0
  98. package/src/inference/prefill.ts +39 -0
  99. package/src/inference/rollback.ts +7 -0
  100. package/src/jobs/db.ts +4 -0
  101. package/src/jobs/index.ts +2 -0
  102. package/src/jobs/job-entry.ts +12 -12
  103. package/src/jobs/runner.ts +98 -13
  104. package/src/jobs/task-client.ts +19 -0
  105. package/src/jobs/types.ts +2 -58
  106. package/src/kv-store.ts +109 -49
  107. package/src/lab/README.md +18 -0
  108. package/src/{assets → lab/curve}/curve-designer.html +2 -2
  109. package/src/{curve-sampler.ts → lab/curve/curve-sampler.ts} +2 -2
  110. package/src/{expert-trace.ts → lab/expert-trace/expert-trace.ts} +5 -5
  111. package/src/{model → lab/paged-kv}/paged-kv.ts +9 -6
  112. package/src/library.ts +40 -0
  113. package/src/lora.ts +18 -0
  114. package/src/media-fetch.ts +1 -1
  115. package/src/memory/article.ts +1 -1
  116. package/src/memory/chunk.ts +1 -1
  117. package/src/memory/model.ts +30 -169
  118. package/src/memory/prompts.ts +1 -1
  119. package/src/memory/rest.ts +1 -1
  120. package/src/memory/schedule.ts +1 -1
  121. package/src/memory/stages.ts +4 -1
  122. package/src/memory/vault.ts +1 -3
  123. package/src/mlx/array.ts +9 -10
  124. package/src/mlx/compile.ts +12 -2
  125. package/src/mlx/ffi.ts +58 -11
  126. package/src/mlx/materialize.ts +23 -0
  127. package/src/mlx/metal-kernel.ts +10 -11
  128. package/src/mlx/ops.ts +33 -13
  129. package/src/mlx/quantized-rows.ts +36 -0
  130. package/src/mlx/token-bitmask.ts +52 -0
  131. package/src/mlx/turboquant-kv-decode.ts +82 -0
  132. package/src/mlx/turboquant-kv-inverse.ts +122 -0
  133. package/src/mlx/turboquant-ops.ts +33 -3
  134. package/src/mlx/turboquant-tables.ts +2 -2
  135. package/src/model/batched-mask.ts +8 -2
  136. package/src/model/batched-quant.ts +1 -1
  137. package/src/model/batched-rotating-quant.ts +2 -2
  138. package/src/model/batched-rotating.ts +1 -1
  139. package/src/model/compiled-decode.ts +1 -1
  140. package/src/model/diffusion-gemma.ts +8 -8
  141. package/src/model/factory.ts +76 -33
  142. package/src/model/fingerprint.ts +1 -1
  143. package/src/model/flash-attention.ts +3 -3
  144. package/src/model/gemma4-base.ts +26 -9
  145. package/src/model/gemma4.ts +6 -6
  146. package/src/model/generated/gemma4-12b.ts +2 -2
  147. package/src/model/generated/gemma4-26b.ts +2 -2
  148. package/src/model/generated/gemma4-e4b.ts +2 -2
  149. package/src/model/glm52-dsa.ts +13 -9
  150. package/src/model/glm52-memory.ts +1 -1
  151. package/src/model/implementation.ts +69 -0
  152. package/src/model/minicpm5.ts +6 -8
  153. package/src/model/profile.ts +12 -2
  154. package/src/model/qwen-append.ts +12 -0
  155. package/src/model/qwen-conv.ts +52 -0
  156. package/src/model/qwen3_5-checkpoint.ts +164 -0
  157. package/src/model/qwen3_5.ts +140 -56
  158. package/src/model/support.ts +1 -1
  159. package/src/model/trellis-balanced-scatter.ts +51 -0
  160. package/src/model/trellis-linear.ts +672 -0
  161. package/src/model/trellis-shared-m.ts +151 -0
  162. package/src/model/trellis-shared-scatter.ts +144 -0
  163. package/src/model/trellis-splitk-prefill.ts +158 -0
  164. package/src/model/trellis-tiled-prefill.ts +136 -0
  165. package/src/model/trellis-vector-expand.ts +62 -0
  166. package/src/model/trellis-wide-prefill.ts +94 -0
  167. package/src/model/universal/dense.ts +1 -1
  168. package/src/model/universal/modules.ts +8 -1
  169. package/src/native-pack.ts +6 -5
  170. package/src/pi-provider.ts +6 -64
  171. package/src/pi-web.ts +8 -315
  172. package/src/prompt-cache.ts +96 -53
  173. package/src/quantize/allocator.ts +1 -1
  174. package/src/quantize/config-writer.ts +10 -3
  175. package/src/quantize/rotate.ts +4 -4
  176. package/src/quantize/trellis.ts +586 -0
  177. package/src/responses.ts +28 -1
  178. package/src/runtime-config.ts +18 -4
  179. package/src/sampler.ts +4 -4
  180. package/src/serve/batch-scheduler.ts +8 -1671
  181. package/src/serve/chat-request.ts +391 -0
  182. package/src/serve/chat-stage.ts +195 -0
  183. package/src/serve/checkpoint-identity.ts +64 -0
  184. package/src/serve/completion-executor.ts +15 -7
  185. package/src/serve/discovery-routes.ts +12 -13
  186. package/src/serve/generation-gateway.ts +154 -193
  187. package/src/serve/http.ts +159 -0
  188. package/src/serve/inference-request.ts +79 -0
  189. package/src/serve/isolate.ts +297 -105
  190. package/src/serve/lab-routes.ts +3 -0
  191. package/src/serve/lane-registry.ts +2 -1
  192. package/src/serve/model-admin-routes.ts +7 -5
  193. package/src/serve/model-binding.ts +43 -0
  194. package/src/serve/model-host.ts +512 -0
  195. package/src/serve/openai-wire.ts +103 -0
  196. package/src/serve/parent-application.ts +56 -0
  197. package/src/serve/pipeline.ts +33 -0
  198. package/src/serve/preparation.ts +33 -0
  199. package/src/serve/request-plan.ts +19 -15
  200. package/src/serve/request-prep.ts +346 -0
  201. package/src/serve/response-lease.ts +24 -0
  202. package/src/serve/responses-client.ts +69 -0
  203. package/src/serve/session-completion-engine.ts +110 -0
  204. package/src/serve/session-search.ts +1 -1
  205. package/src/serve/static-routes.ts +5 -5
  206. package/src/serve/text-completion-stage.ts +104 -0
  207. package/src/serve/token-streams.ts +519 -0
  208. package/src/server.ts +317 -2649
  209. package/src/spec/assistant-source.ts +10 -44
  210. package/src/spec/deepspec-source.ts +6 -6
  211. package/src/spec/dflash-source.ts +8 -8
  212. package/src/spec/dspark/ab-stats.ts +3 -3
  213. package/src/spec/dspark/calibration.ts +2 -2
  214. package/src/spec/dspark/deepspec-module.ts +2 -2
  215. package/src/spec/dspark/generate-dflash.ts +2 -2
  216. package/src/spec/dspark/generate.ts +2 -2
  217. package/src/spec/dspark/loader.ts +1 -1
  218. package/src/spec/dspark/module-dflash.ts +4 -3
  219. package/src/spec/dspark/module.ts +3 -3
  220. package/src/spec/dspark/quantize-drafter.ts +1 -1
  221. package/src/spec/generate.ts +1 -1
  222. package/src/spec/glm52-mtp-source.ts +1 -1
  223. package/src/spec/ngram-source.ts +1 -1
  224. package/src/spec/prefix-state.ts +45 -0
  225. package/src/spec/qwen-mtp-source.ts +166 -69
  226. package/src/spec/serve-loop.ts +154 -156
  227. package/src/spec/source.ts +42 -10
  228. package/src/spec/two-model.ts +1 -1
  229. package/src/ssd-cache.ts +80 -12
  230. package/src/ssd-durability.ts +25 -13
  231. package/src/tool-call.ts +51 -14
  232. package/src/train/flash-cce.ts +2 -2
  233. package/src/train/forward.ts +6 -0
  234. package/src/train/loss.ts +1 -1
  235. package/src/train/prefix-shared.ts +5 -1
  236. package/src/train/segmented.ts +5 -3
  237. package/src/train/trainer.ts +6 -6
  238. package/src/vision/prompt.ts +1 -1
  239. package/src/vision/qwen3vl-tower.ts +52 -10
  240. package/src/web/app.html +1 -1
  241. package/src/web/app.js +5 -3
  242. package/src/web/src/adapters-panel.ts +3 -3
  243. package/src/web/src/assistant.ts +2 -36
  244. package/src/web/src/chat.ts +4 -4
  245. package/src/web/src/composer.ts +4 -4
  246. package/src/web/src/hub.ts +1 -1
  247. package/src/web/src/markdown.ts +0 -0
  248. package/src/web/src/memory-panel.ts +1 -1
  249. package/src/web/src/model-picker.ts +1 -1
  250. package/src/web/src/palette.ts +1 -1
  251. package/src/web/src/protocol.ts +3 -39
  252. package/src/web/src/sessions.ts +1 -1
  253. package/src/web/src/ui-catalog.ts +4 -18
  254. package/src/web-assets.ts +47 -0
  255. package/src/weights.ts +55 -9
  256. package/docs/archive/investigations/curve-runs/bisector-route.json +0 -98
  257. package/docs/archive/investigations/curve-runs/bisector-trace.json +0 -1393
  258. package/docs/archive/investigations/curve-runs/curve-terrain.json +0 -1179
  259. package/docs/archive/investigations/curve-runs/curve-terrain.svg +0 -42
  260. package/docs/archive/investigations/hlg-ab.html +0 -34
  261. package/docs/archive/investigations/hlg-explorer.html +0 -238
  262. package/docs/archive/investigations/hlg-figs/cliff.svg +0 -1
  263. package/docs/archive/investigations/hlg-figs/cross.svg +0 -1
  264. package/docs/archive/investigations/hlg-figs/edges.svg +0 -1
  265. package/docs/archive/investigations/hlg-figs/k20-grids.svg +0 -1
  266. package/docs/archive/investigations/hlg-figs/k20-peaks.svg +0 -1
  267. package/docs/archive/investigations/hlg-figs/lw-curve.svg +0 -1
  268. package/docs/archive/investigations/hlg-figs/terrain.svg +0 -1
  269. package/docs/archive/investigations/hlg-report.html +0 -262
  270. package/docs/archive/investigations/hlg-runs/hlg-ab.json +0 -149
  271. package/docs/archive/investigations/hlg-runs/hlg-blind-prompts.md +0 -87
  272. package/docs/archive/investigations/hlg-runs/hlg-blind.json +0 -107
  273. package/docs/archive/investigations/hlg-runs/hlg-cliff.json +0 -197
  274. package/docs/archive/investigations/hlg-runs/hlg-cross.json +0 -505
  275. package/docs/archive/investigations/hlg-runs/hlg-edge.json +0 -388
  276. package/docs/archive/investigations/hlg-runs/hlg-eval1.json +0 -25
  277. package/docs/archive/investigations/hlg-runs/hlg-frontier.json +0 -86
  278. package/docs/archive/investigations/hlg-runs/hlg-grid.json +0 -242
  279. package/docs/archive/investigations/hlg-runs/hlg-grid2.json +0 -343
  280. package/docs/archive/investigations/hlg-runs/hlg-lw-coarse.json +0 -110
  281. package/docs/archive/investigations/hlg-runs/hlg-map.json +0 -383
  282. package/docs/archive/investigations/hlg-runs/run0-original.log +0 -159
  283. package/docs/archive/investigations/hlg-runs/runA-recommended.log +0 -131
  284. package/docs/archive/investigations/hlg-runs/runAA-cliff-cpm5.log +0 -26
  285. package/docs/archive/investigations/hlg-runs/runAB-grid2-e4b.log +0 -18
  286. package/docs/archive/investigations/hlg-runs/runAC-peak-e4b-partial.log +0 -25
  287. package/docs/archive/investigations/hlg-runs/runAD-ab-samples.log +0 -8
  288. package/docs/archive/investigations/hlg-runs/runAE-edge-e4b.log +0 -51
  289. package/docs/archive/investigations/hlg-runs/runAF-logit-calibration.log +0 -10
  290. package/docs/archive/investigations/hlg-runs/runAG-eval-config2.log +0 -16
  291. package/docs/archive/investigations/hlg-runs/runB-gain-variants.log +0 -192
  292. package/docs/archive/investigations/hlg-runs/runC-pivots.log +0 -162
  293. package/docs/archive/investigations/hlg-runs/runD-oetf.log +0 -132
  294. package/docs/archive/investigations/hlg-runs/runE-eotf.log +0 -162
  295. package/docs/archive/investigations/hlg-runs/runF-shaper-working.log +0 -86
  296. package/docs/archive/investigations/hlg-runs/runG-shaper-sweep.log +0 -101
  297. package/docs/archive/investigations/hlg-runs/runH-wsweep.log +0 -176
  298. package/docs/archive/investigations/hlg-runs/runI-asweep.log +0 -176
  299. package/docs/archive/investigations/hlg-runs/runJ-knobmap.log +0 -49
  300. package/docs/archive/investigations/hlg-runs/runK-frontier.log +0 -19
  301. package/docs/archive/investigations/hlg-runs/runL-widemap.log +0 -65
  302. package/docs/archive/investigations/hlg-runs/runM-frontier-emb.log +0 -15
  303. package/docs/archive/investigations/hlg-runs/runN-verify.log +0 -116
  304. package/docs/archive/investigations/hlg-runs/runO-frontier-seed5000.log +0 -15
  305. package/docs/archive/investigations/hlg-runs/runP-grid-AxSm.log +0 -15
  306. package/docs/archive/investigations/hlg-runs/runQ-grid-tgW.log +0 -15
  307. package/docs/archive/investigations/hlg-runs/runR-blind-transcript.log +0 -79
  308. package/docs/archive/investigations/hlg-runs/runS-cross-coherence.log +0 -33
  309. package/docs/archive/investigations/hlg-runs/runT-cross-cpm5.log +0 -33
  310. package/docs/archive/investigations/hlg-runs/runU-cross-12b.log +0 -33
  311. package/docs/archive/investigations/hlg-runs/runV-lw-e4b.log +0 -22
  312. package/docs/archive/investigations/hlg-runs/runW-lw-12b.log +0 -22
  313. package/docs/archive/investigations/hlg-runs/runX-lw-cpm5.log +0 -22
  314. package/docs/archive/investigations/hlg-runs/runY-cliff-e4b.log +0 -26
  315. package/docs/archive/investigations/hlg-runs/runZ-cliff-12b.log +0 -26
  316. package/docs/archive/mlx-bun-lab-report.html +0 -275
  317. package/docs/archive/wwdc-mlx-bun.html +0 -848
  318. package/docs/design/adapters-end-to-end.md +0 -205
  319. package/docs/design/batching-perf-path.md +0 -255
  320. package/docs/design/batching-v2-plan.md +0 -529
  321. package/docs/design/bucketing-stage.md +0 -197
  322. package/docs/design/compat-cli-surface-design.md +0 -230
  323. package/docs/design/docs-reorg-plan.md +0 -165
  324. package/docs/design/dspark-serving-program.md +0 -371
  325. package/docs/design/dspark-speculative-decoding.md +0 -318
  326. package/docs/design/grammar-spec-batching-integration.md +0 -301
  327. package/docs/design/memory-inference-path.md +0 -422
  328. package/docs/design/memory-synthesis.md +0 -287
  329. package/docs/design/memory-system.md +0 -237
  330. package/docs/design/mlx-lm-serving-execution-seam.md +0 -81
  331. package/docs/design/mlx-lm-tool-parity-plan.md +0 -545
  332. package/docs/design/omlx-adoption-map.md +0 -98
  333. package/docs/design/orpo-dynamic-lambda.md +0 -220
  334. package/docs/design/orpo-future-enhancements.md +0 -340
  335. package/docs/design/paged-kv-cache.md +0 -214
  336. package/docs/design/parallel-slots.md +0 -567
  337. package/docs/design/parity-tier-dag.md +0 -161
  338. package/docs/design/repo-cleanup-plan.md +0 -231
  339. package/docs/design/runtime-isolation.md +0 -263
  340. package/docs/design/segmented-backward-training.md +0 -543
  341. package/docs/design/spec-decode-larger-targets.md +0 -229
  342. package/docs/design/ssd-kv-cold-tier.md +0 -415
  343. package/docs/design/structured-output.md +0 -484
  344. package/docs/design/tauri-desktop-app.md +0 -127
  345. package/docs/design/the-dreaming-master-plan.md +0 -445
  346. package/docs/design/turboquant-kv.md +0 -235
  347. package/docs/design/turboquant-weights.md +0 -467
  348. package/docs/design/w4a16-compute-precision-spike.md +0 -232
  349. package/docs/design/web-chat-beat-matrix.md +0 -315
  350. package/docs/design/write-pipeline-entity.md +0 -468
  351. package/docs/planning/IDEAS.md +0 -69
  352. package/docs/reference/embedding.md +0 -197
  353. package/docs/reference/features-matrix.md +0 -101
  354. package/docs/reference/orpo-quickstart.md +0 -135
  355. package/src/flags.ts +0 -11
  356. /package/docs/{design → archive/investigations}/colibri-glm52-port.md +0 -0
  357. /package/docs/{planning → archive/planning}/chunk-task-roadmap.md +0 -0
  358. /package/docs/{planning → archive/planning}/curve-sampler-research-plan.md +0 -0
  359. /package/docs/{planning → archive/planning}/memory-docs-and-dag-plan.md +0 -0
  360. /package/docs/{planning → archive/planning}/pi-integration-review.md +0 -0
  361. /package/docs/{planning → archive/planning}/release-notes-v0.2.0.md +0 -0
  362. /package/src/{memory-plan.ts → admission-plan.ts} +0 -0
  363. /package/{docs/archive/investigations → src/serve/assets}/curve-terrain.html +0 -0
  364. /package/{docs/dag → src/serve/assets}/training-inference-map.html +0 -0
package/docs/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # docs/ map (generated — do not edit; `bun scripts/check-hygiene.ts --write-docs-map`)
2
+
3
+ ## docs/archive/
4
+
5
+ Frozen history — read-only, never extended in place; recover raw data via git history.
6
+
7
+ - [hlg-sampling.md](../docs/archive/hlg-sampling.md) — HLG sampling — a piecewise tone curve on the logits
8
+ - [investigations/audio-input-plan.md](../docs/archive/investigations/audio-input-plan.md) — Audio input — design & implementation plan (gemma-4 audio tower)
9
+ - [investigations/chunk-finetune-experiment.md](../docs/archive/investigations/chunk-finetune-experiment.md) — Fine-tuning experiment: chunking task (2026-06-16)
10
+ - [investigations/colibri-glm52-port.md](../docs/archive/investigations/colibri-glm52-port.md) — GLM-5.2 on a 32 GB Mac — native MLX port of the Colibri hierarchy
11
+ - [investigations/colibri-oracle-pin.md](../docs/archive/investigations/colibri-oracle-pin.md) — Colibri oracle pin for the native GLM-5.2 port
12
+ - [investigations/curve-bisector-routing.md](../docs/archive/investigations/curve-bisector-routing.md) — Curve sampler: bisectors, routing, and the falsification
13
+ - [investigations/decode-roofline-lookagain.md](../docs/archive/investigations/decode-roofline-lookagain.md) — Decode perf "look again" — adversarial re-exam of the M=1 floor claim (2026-07-01)
14
+ - [investigations/diffusion-gemma-port.md](../docs/archive/investigations/diffusion-gemma-port.md) — DiffusionGemma port — plan & parity strategy
15
+ - [investigations/dspark-handoff.md](../docs/archive/investigations/dspark-handoff.md) — DSpark — handoff
16
+ - [investigations/expert-offload-single-user-moe.md](../docs/archive/investigations/expert-offload-single-user-moe.md) — Expert offload for single-user local MoE — findings + design sketch
17
+ - [investigations/faithful-l1-consolidation.md](../docs/archive/investigations/faithful-l1-consolidation.md) — Faithful → L1: consolidating the "match mlx-lm" path
18
+ - [investigations/hlg-sampling-investigation.md](../docs/archive/investigations/hlg-sampling-investigation.md) — Investigation: HLG sampling — a piecewise tone curve on the logits
19
+ - [investigations/indexshare-performance-spike.md](../docs/archive/investigations/indexshare-performance-spike.md) — IndexShare / IndexCache performance spike
20
+ - [investigations/kernel-perf-review-2026-07.md](../docs/archive/investigations/kernel-perf-review-2026-07.md) — Kernel/perf deep review — 2026-07-01 (condensed, tracked record)
21
+ - [investigations/lab-build-journal.md](../docs/archive/investigations/lab-build-journal.md) — Build journal — mlx-bun Lab (web UI + native quantize/train/dataset + pi web chat)
22
+ - [investigations/minicpm5-decode-megakernel.md](../docs/archive/investigations/minicpm5-decode-megakernel.md) — MiniCPM5 Decode Megakernel — end-to-end build plan (handoff)
23
+ - [investigations/openwiki-evaluation.md](../docs/archive/investigations/openwiki-evaluation.md) — OpenWiki — evaluation & fit analysis
24
+ - [investigations/optimization_plan.md](../docs/archive/investigations/optimization_plan.md) — mlx-bun: gemma4.ts decompose & optimize — action plan
25
+ - [investigations/orpo-base-uf-experiment-and-directions.md](../docs/archive/investigations/orpo-base-uf-experiment-and-directions.md) — ORPO from-base on UltraFeedback (mixed-5bpw) — results + research directions
26
+ - [investigations/orpo-flash-cce-pin-leak.md](../docs/archive/investigations/orpo-flash-cce-pin-leak.md) — flash-CCE host-buffer pin leak — post-mortem + L3 verification approach
27
+ - [investigations/orpo-uf-testing-handoff.md](../docs/archive/investigations/orpo-uf-testing-handoff.md) — ORPO-on-UF — results + testing-phase handoff
28
+ - [investigations/pareto-specialized-runtime-findings.md](../docs/archive/investigations/pareto-specialized-runtime-findings.md) — Pareto-specialized runtime findings
29
+ - [investigations/pi-builtin-investigation.md](../docs/archive/investigations/pi-builtin-investigation.md) — Investigation: pi as a "built-in" terminal for mlx-bun
30
+ - [investigations/pre-colibri-stabilization.md](../docs/archive/investigations/pre-colibri-stabilization.md) — Pre-Colibri stabilization program
31
+ - [investigations/segmented-backward-handoff.md](../docs/archive/investigations/segmented-backward-handoff.md) — Handoff — segmented backward training (2026-06-16)
32
+ - [investigations/starter-model-port-handoff.md](../docs/archive/investigations/starter-model-port-handoff.md) — Handoff: the sub-GB starter model port (publishing gate 1)
33
+ - [investigations/steel-flash-cce-handoff.md](../docs/archive/investigations/steel-flash-cce-handoff.md) — Steel flash-CCE — handoff
34
+ - [investigations/the-dreaming-handoff.md](../docs/archive/investigations/the-dreaming-handoff.md) — THE DREAMING — HANDOFF (2026-06-28)
35
+ - [investigations/trainer-validation-experiment.md](../docs/archive/investigations/trainer-validation-experiment.md) — Trainer validation experiment
36
+ - [planning/chat-ui-vision-memory-first.md](../docs/archive/planning/chat-ui-vision-memory-first.md) — Chat UI Vision: The Model That Knows You
37
+ - [planning/chat-ui-vision.md](../docs/archive/planning/chat-ui-vision.md) — The mlx-bun chat surface: a vision
38
+ - [planning/chunk-task-roadmap.md](../docs/archive/planning/chunk-task-roadmap.md) — Chunk-task quality roadmap (2026-06-17)
39
+ - [planning/curve-sampler-research-plan.md](../docs/archive/planning/curve-sampler-research-plan.md) — Curve sampler — preregistered research plan (distinctness track)
40
+ - [planning/journal.md](../docs/archive/planning/journal.md) — Engineering Journal
41
+ - [planning/memory-docs-and-dag-plan.md](../docs/archive/planning/memory-docs-and-dag-plan.md) — Memory docs organization + DAG-view refresh — review & plan
42
+ - [planning/pi-integration-review.md](../docs/archive/planning/pi-integration-review.md) — pi integration review — internal embeds + `harness pi` (2026-07-01)
43
+ - [planning/release-notes-v0.0.10.md](../docs/archive/planning/release-notes-v0.0.10.md) — mlx-bun v0.0.10 — batching parity, SSD KV cache, sharper serving
44
+ - [planning/release-notes-v0.0.11.md](../docs/archive/planning/release-notes-v0.0.11.md) — v0.0.11 release notes
45
+ - [planning/release-notes-v0.0.12.md](../docs/archive/planning/release-notes-v0.0.12.md) — v0.0.12 release notes
46
+ - [planning/release-notes-v0.0.13.md](../docs/archive/planning/release-notes-v0.0.13.md) — v0.0.13 release notes
47
+ - [planning/release-notes-v0.0.9.md](../docs/archive/planning/release-notes-v0.0.9.md) — v0.0.9 release notes (DRAFT — Josh edits + publishes)
48
+ - [planning/release-notes-v0.2.0.md](../docs/archive/planning/release-notes-v0.2.0.md) — mlx-bun v0.2.0
49
+ - [planning/web-ui-pass-plan.md](../docs/archive/planning/web-ui-pass-plan.md) — Web UI pass — ranked fix list (2026-07-01 audit)
50
+ - [planning/website-readme-pass-plan.md](../docs/archive/planning/website-readme-pass-plan.md) — Website + README pass — audit findings and fix plan (2026-07-01)
51
+
52
+ ## docs/design/
53
+
54
+ Active engineering design docs — one per topic; status lives in front matter + PLAN.md.
55
+
56
+ - [batching.md](../docs/design/batching.md) — Batching — continuous scheduling for `--batch N`
57
+ - [decode-speed-program.md](../docs/design/decode-speed-program.md) — Inference performance program
58
+ - [dreaming-nightly-pipeline.md](../docs/design/dreaming-nightly-pipeline.md) — The Dreaming — memory write path + synthesis (canonical design)
59
+ - [generic-model-support.md](../docs/design/generic-model-support.md) — Model support — run anything mlx-lm runs, and the ports we target
60
+ - [kv-cache.md](../docs/design/kv-cache.md) — KV cache — residency and layout
61
+ - [orpo-training.md](../docs/design/orpo-training.md) — Training — design (ORPO, flash-CCE head, prefix sharing, segmented backward)
62
+ - [speculative-decoding.md](../docs/design/speculative-decoding.md) — Speculative decoding — one verifier, every draft source
63
+ - [turboquant.md](../docs/design/turboquant.md) — TurboQuant — rotation-based quantization (KV leg landed, weights leg open)
64
+ - [unified-engine-frontier-plan.md](../docs/design/unified-engine-frontier-plan.md) — Engine architecture — four layers, per-scheme oracles, one request path
65
+ - [web-chat-redesign.md](../docs/design/web-chat-redesign.md) — Web chat — the built-in chat surface (canonical design)
66
+
67
+ ## docs/planning/
68
+
69
+ Living product/vision docs (USING side).
70
+
71
+ - [PRODUCT_ROADMAP.md](../docs/planning/PRODUCT_ROADMAP.md) — PRODUCT ROADMAP
72
+ - [ResearchTopics.md](../docs/planning/ResearchTopics.md) — Research Topics
73
+ - [release-notes-v0.3.0.md](../docs/planning/release-notes-v0.3.0.md) — mlx-bun v0.3.0
74
+ - [video-series.md](../docs/planning/video-series.md) — mlx-bun video series
75
+
76
+ ## docs/reference/
77
+
78
+ User-facing reference — the ONLY home for flags, routes, models, numbers, and environment facts.
79
+
80
+ - [benchmarks.md](../docs/reference/benchmarks.md) — mlx-bun benchmark results (curated)
81
+ - [cli.md](../docs/reference/cli.md) — CLI reference
82
+ - [distribution.md](../docs/reference/distribution.md) — Distributing mlx-bun — build, sign, notarize, publish
83
+ - [environment.md](../docs/reference/environment.md) — Reference environment and platform facts
84
+ - [glossary.md](../docs/reference/glossary.md) — mlx-bun serving
85
+ - [library-api.md](../docs/reference/library-api.md) — Library API
86
+ - [memory.md](../docs/reference/memory.md) — Memory — the personal wiki
87
+ - [models.md](../docs/reference/models.md) — Models: supported roster + management (get / scan / ls / gc)
88
+ - [server-api.md](../docs/reference/server-api.md) — Server API
89
+ - [server-config.md](../docs/reference/server-config.md) — Server configuration
90
+ - [training.md](../docs/reference/training.md) — Training / fine-tuning reference
91
+ - [troubleshooting.md](../docs/reference/troubleshooting.md) — Troubleshooting
@@ -210,7 +210,7 @@ All under `optiq/vlm/_mlxvlm/models/gemma4/` in the oracle venv:
210
210
  ### 3.4 Parity strategy (tree doctrine)
211
211
 
212
212
  Oracle = optiq internal gemma4 model in the pinned venv, driven by
213
- `scripts/regen-audio-goldens.py` (modeled on their calibration loader;
213
+ `regen-audio-goldens.py (deleted; git history)` (modeled on their calibration loader;
214
214
  remember `enable_thinking` pinning for any templated prompt). Tiers follow
215
215
  the e4b vision precedent exactly:
216
216
 
@@ -238,7 +238,7 @@ Expectation (to be *measured*, not asserted): the tower is tiny —
238
238
  ≤750 mel frames → ~≤188 post-subsample positions × 12 layers × hidden
239
239
  1024 bf16 — so added TTFT should be dominated by CPU feature extraction
240
240
  plus one extra graph eval; sidecar RSS delta is the 752 bf16 tensors.
241
- Every number that gets quoted comes from preflight-gated `benchmark.sh`
241
+ Every number that gets quoted comes from preflight-gated `scripts/bench-serve.ts all`
242
242
  cells (tower ms, TTFT delta vs text-only, peak RSS delta) and lands in
243
243
  `benchmarks/RESULTS.md`.
244
244
 
@@ -247,7 +247,7 @@ cells (tower ms, TTFT delta vs text-only, peak RSS delta) and lands in
247
247
  **Phase A0 — groundwork**
248
248
  - [ ] Bind `mlx_conv2d` (full header signature; CPU/GPU sanity test vs
249
249
  oracle conv output)
250
- - [ ] `scripts/regen-audio-goldens.py` + fixtures; dump mel golden,
250
+ - [ ] `regen-audio-goldens.py (deleted; git history)` + fixtures; dump mel golden,
251
251
  tower-output golden, spliced ids, greedy ids
252
252
  - [ ] Resolve open questions §3.3 (write the answers into this doc)
253
253
  - Exit: goldens on disk; masking/zeroing semantics documented.
@@ -332,7 +332,7 @@ cells (tower ms, TTFT delta vs text-only, peak RSS delta) and lands in
332
332
  docs-map hygiene green. ✅ 2026-07-07
333
333
 
334
334
  **Phase A5 — bench + coverage**
335
- - [ ] benchmark.sh cells → RESULTS.md (tower ms, TTFT delta, RSS delta)
335
+ - [ ] scripts/bench-serve.ts all cells → RESULTS.md (tower ms, TTFT delta, RSS delta)
336
336
  - [ ] 12B audio cell: rebuild its sidecar via optiq `build_vision_sidecar`
337
337
  (selective download), own goldens — per-model doctrine, every
338
338
  (model, quant) cell gets its own validation or an explicit deferral
@@ -120,7 +120,7 @@ tied 4-bit head → fp32 softcap** — is **BIT-EXACT vs the optiq golden**: arg
120
120
  maxDiff 0.0, relRMSE 0.0, meanKL 0.0 (`tests/diffusion-parity.test.ts`,
121
121
  `MLX_BUN_TEST_DIFFUSION=1`). Per-stage sub-gates (enc_hidden / dec_hidden / presoftcap /
122
122
  per-layer / layer-0 attn·dense·MoE) all 0.0 (`scripts/experiments/diffusion-{stage,layer,l0}-diag.ts`,
123
- golden dumps in `scripts/gen-diffusion-golden.py`).
123
+ golden dumps in `scripts/oracle/gen-diffusion-golden.py`).
124
124
  - **The one bug found + fixed (per-model parity gotcha):** the Router pre-projection
125
125
  norm must be the literal two-step `rms_norm(x, None, eps) * scale * hidden**-0.5`,
126
126
  **NOT** the gemma4-style fold `rms_norm(x, scale*hidden**-0.5)`. The fold changes the
@@ -152,7 +152,7 @@ reuse, linear temp schedule, the un-mask loop, BOTH samplers (confidence-thresho
152
152
  OptiQ public default, entropy-bound = engine default), self-conditioning feedback,
153
153
  stability/EOS, canvas block loop. **Token-for-token parity vs the optiq engine at
154
154
  temp 0 on a fixed seed for BOTH samplers** (`tests/diffusion-gen-parity.test.ts`,
155
- `MLX_BUN_TEST_DIFFUSION=1`; golden `scripts/gen-diffusion-gen-golden.py`):
155
+ `MLX_BUN_TEST_DIFFUSION=1`; golden `scripts/oracle/gen-diffusion-gen-golden.py`):
156
156
  confidence 17 tok / 7 steps, entropy 15 tok / 48 steps — both `.tokens`/`.steps`/
157
157
  `.finishReason` identical.
158
158
  - **RNG parity (the crux) SOLVED:** bound `mlx_random_randint` (+`mlx_random_seed`,
@@ -241,7 +241,7 @@ output matches optiq `generate`; HTTP test green; no regression to AR models.
241
241
 
242
242
  ### D4 — Performance (L3, optional, measured) `[ ]`
243
243
  `confidence-threshold` is already the fast path (optiq: ~58 tok/s code / ~9
244
- prose). Measure mlx-bun tok/s with `benchmark.sh`; fuse kernels only if a number
244
+ prose). Measure mlx-bun tok/s with `scripts/bench-serve.ts all`; fuse kernels only if a number
245
245
  says so. KV holds only the prompt (no per-step growth → no KV-quant needed).
246
246
  **Exit:** quotable tok/s within range of optiq on this machine; any fused kernel
247
247
  gated by KL + the 6-task quality suite (no bit-exact ancestor for novel fusions).
@@ -275,13 +275,13 @@ kernels, selected (or not) by the individual flags.
275
275
  ### Phase 4 — Docs + benchmark ✅ LANDED 2026-07-04 (numbers Josh-gated)
276
276
 
277
277
  Docs updated: `features-matrix.md` (new `--compiled-activations` + `--fused-gelu`
278
- rows), `server-config.md` + `cli.md` (Phase 2). Reworked `scripts/bench-faithful-matrix.ts`
279
- + `benchmark.sh` comparison 0 for the new model — since faithful is now the default,
278
+ rows), `server-config.md` + `cli.md` (Phase 2). Reworked `scripts/bench-levers.ts faithful-matrix`
279
+ + `scripts/bench-serve.ts all` comparison 0 for the new model — since faithful is now the default,
280
280
  the matrix measures what **removing** each faithful kernel costs and what the L3
281
281
  custom kernels add on top (`− compiled-decode`, `− compiled activations`,
282
282
  `+ custom fused-gelu`), all vs mlx-lm; tsc 0. **The actual numbers are Josh-gated**
283
- (clean/rebooted machine — `./benchmark.sh --redo`, or
284
- `bun scripts/bench-faithful-matrix.ts`); loaded-machine absolutes are noise. Promote
283
+ (clean/rebooted machine — `bun scripts/bench-serve.ts all --redo`, or
284
+ `bun scripts/bench-levers.ts faithful-matrix`); loaded-machine absolutes are noise. Promote
285
285
  quotable rows to `benchmarks/RESULTS.md` after the clean run.
286
286
 
287
287
  ## Status: consolidation complete
@@ -108,7 +108,7 @@ a 1-token parity probe before trusting it (Phase 2 gate catches mismatch).
108
108
  **Validation goldens (ALREADY EXIST, no regen needed):**
109
109
  - L1: `goldens/minicpm5-parity.json` (prompt_ids `[0,608,4894,304,6918,357]`,
110
110
  greedy_ids[100], vocab 130560) + `goldens/minicpm5-logits-step{0..99}.bin`
111
- (f32 last-position logits). Produced by `scripts/regen-minicpm5-goldens.ts`.
111
+ (f32 last-position logits). Produced by `scripts/regen.ts minicpm5`.
112
112
  - L2: `goldens/minicpm5-kv-parity.json` + `…-kv-logits-step*.bin`.
113
113
 
114
114
  **Reference forward to copy (the source of truth for correctness):**
@@ -132,7 +132,7 @@ All default-OFF, `bun test tests/minicpm5-*.test.ts` green. From this session:
132
132
  @ M=8–256, ~1 ULP correct.** This is a working prototype of one megakernel STAGE
133
133
  and the dequant/GEMV patterns to copy. (Note: it currently corrupts when CHAINED
134
134
  in the lazy graph — that's the whole reason for the megakernel; the kernel math
135
- itself is correct, proven by `scripts/experiments/fused-mlp-check.ts`.)
135
+ itself is correct, proven by `fused-mlp-check.ts (deleted; git history)`.)
136
136
  - `src/model/steel-linear-kernel.ts` — `steelLinear`: plain quantized linear as our
137
137
  dispatch (q/k/v/o/down), ~1 ULP vs `ops.quantizedMatmul`. The projection GEMV
138
138
  pattern.
@@ -232,7 +232,7 @@ megapack-check.ts`.) This catches layout bugs before any kernel.
232
232
 
233
233
  ### Phase 2 — Single-threadgroup correct megakernel (G=1)
234
234
  **Files:** `src/model/megakernel-kernel.ts` (the `MetalKernel` + dispatch),
235
- `scripts/gen-minicpm5-megakernel.ts` (emits the per-layer-bits-baked SOURCE into
235
+ `gen-minicpm5-megakernel.ts (deleted; git history)` (emits the per-layer-bits-baked SOURCE into
236
236
  `src/model/generated/minicpm5-megakernel.ts`).
237
237
  **Design:** ONE threadgroup (`G=1`, `TGN=256` threads). `hidden[H]` in threadgroup
238
238
  memory (6 KB). Loop layers; each stage uses `threadgroup_barrier`. GEMVs: the 256
@@ -246,13 +246,13 @@ down). KV read/write from `KBUF`/`VBUF`. Final: finalNorm + lmHead GEMV → logi
246
246
  **Transcribe** `src/model/minicpm5.ts` op-for-op; match dtypes: accumulate in f32,
247
247
  round to bf16 at each op boundary to track the reference (`(T)` casts, as `fusedMlp`
248
248
  does). RoPE: match `ops.rope` exactly (verify with a single-layer probe).
249
- **Gate (THE correctness gate):** `scripts/experiments/megakernel-teacherforced.ts`
249
+ **Gate (THE correctness gate):** `megakernel-teacherforced.ts (deleted 2026-08-23; git history)`
250
250
  (copy `swiglu-teacherforced.ts`): drive 100 decode steps via the megakernel,
251
251
  teacher-forced on `goldens/minicpm5-parity.json`, KV cache in `KBUF`/`VBUF`. Require
252
252
  **≥98/100 argmax agreement, deterministic across 3 runs, no NaN.** If an early step
253
253
  mismatches, bisect by stage: add a debug output for `hidden` after layer L (env
254
254
  `MLX_BUN_MEGA_DUMP_LAYER=L`) and compare to the reference model's per-layer hidden
255
- (capture via the wrapper trick in `scripts/experiments/swiglu-layerN.ts`).
255
+ (capture via the wrapper trick in `swiglu-layerN.ts (deleted; git history)`).
256
256
 
257
257
  ### Phase 3 — Persistent multi-threadgroup (G>1) for SPEED
258
258
  **Do:** generalize Phase 2 to `G` threadgroups. Move `hidden`,`xn`,`hn`,`q/k/v/attn/
@@ -332,7 +332,7 @@ Swap `KBUF/VBUF` for the per-layer quantized-KV format. **Facts gathered:**
332
332
  q = min(round((w-bias)/scale), n_bins) // dequant: scale*q+bias
333
333
  ```
334
334
  **Implementation steps:**
335
- 1. ✅ **DONE — quantize formula validated** (`scripts/experiments/kv-quant-formula-check.ts`):
335
+ 1. ✅ **DONE — quantize formula validated** (`kv-quant-formula-check.ts (deleted 2026-08-23; git history)`):
336
336
  the affine_quantize transcription matches `ops.quantize` to bf16 ULP (scale/bias diff
337
337
  1.8e-3 @4-bit, 6e-5 @8-bit; dequant residual = expected bf16-storage rounding). The
338
338
  riskiest piece is de-risked. Compute scale/bias in f32, store bf16 (as mlx does).
@@ -411,7 +411,7 @@ Guard: bf16 KV (L1) only, no adapters, no vision. Add `--megakernel` CLI flag.
411
411
  of the old `tests/perf-kernel-oracle.test.ts` — deleted 2026-07-05 with its kernel,
412
412
  unified-engine-frontier-plan.md §6; the envelope-gate methodology stands on its
413
413
  own); paired decode tok/s A/B logged. Update
414
- `STATUS.md` + `benchmarks/RESULTS.md` (preflight-gated `benchmark.sh` for the
414
+ `STATUS.md` + `benchmarks/RESULTS.md` (preflight-gated `scripts/bench-serve.ts all` for the
415
415
  quotable number — `[[dirty-machine-numbers-are-garbage]]`).
416
416
 
417
417
  ---
@@ -462,12 +462,12 @@ so its 1-ULP/op drift is within contract — bit-exact is a focused REBUILD, not
462
462
 
463
463
  ```
464
464
  src/model/megakernel-pack.ts # Phase 1: weight repack + layout table
465
- scripts/gen-minicpm5-megakernel.ts # Phase 2: emit per-layer-baked kernel SOURCE
465
+ gen-minicpm5-megakernel.ts (deleted; git history) # Phase 2: emit per-layer-baked kernel SOURCE
466
466
  src/model/generated/minicpm5-megakernel.ts # (generated) the kernel SOURCE + bits
467
467
  src/model/megakernel-kernel.ts # Phase 2/3: MetalKernel + decodeMegakernel()
468
- scripts/experiments/megapack-check.ts # Phase 1 gate
469
- scripts/experiments/megakernel-teacherforced.ts # Phase 2/3 correctness gate
470
- scripts/experiments/megakernel-perf.ts # Phase 3/5 paired tok/s A/B
468
+ megapack-check.ts (deleted 2026-08-23; git history) # Phase 1 gate
469
+ megakernel-teacherforced.ts (deleted 2026-08-23; git history) # Phase 2/3 correctness gate
470
+ megakernel-perf.ts (deleted 2026-08-23; git history) # Phase 3/5 paired tok/s A/B
471
471
  tests/minicpm5-megakernel.test.ts # Phase 5 CI gate (env-gated)
472
472
  ```
473
473
  Modify: `src/model/minicpm5.ts` (add `decodeStep` megakernel branch),
@@ -39,7 +39,7 @@ chasing host overhead that compile already removed.
39
39
 
40
40
  **Steps:**
41
41
 
42
- 1. **Characterize before touching anything.** Run `scripts/decode-split.ts`
42
+ 1. **Characterize before touching anything.** Run `decode-split.ts (deleted; git history)`
43
43
  (the per-step wall-time splitter that already exists) on all three models at
44
44
  @600 and @8k. Record GPU-blocked time vs JS-graph-build time per step. This
45
45
  is the control measurement; everything in Phase A is judged against it. The
@@ -96,7 +96,7 @@ change that state.
96
96
  | LEAK-03 | P2 | fixed | `src/mlx/{autograd,checkpoint,custom-vjp}.ts` constructors | Failure out-parameter slots are initialized with live handles that may not be freed when native constructor calls fail. | Failure-injection tests for all three constructors prove slots, closures, and callbacks return to baseline with no double free. |
97
97
  | HYG-01 | P2 | fixed | `src/train/job.ts`, empty Gemma block | A config read and stale comment claim load-bearing environment setup, but the branch is empty. | Remove the read/block/comment; job parsing and training setup tests stay green. |
98
98
  | HYG-02 | P2 | fixed | `tsconfig.json` exclusions | Shipped web sources and tests that run in the gate are excluded from the zero-error typecheck contract. | Remove the exclusions or replace them with an explicit checked project reference; repository and web typechecks are green with no hidden files. |
99
- | HYG-03 | P2 | fixed | `scripts/test.sh` test glob | `scripts/bench-serving-load.test.ts` is model-free but outside the gate. | Gate enumerates and runs it exactly once; a sentinel/failing-case check proves it cannot silently fall out again. |
99
+ | HYG-03 | P2 | fixed | `scripts/test.sh` test glob | `tests/bench-serving-load.test.ts` is model-free but outside the gate. | Gate enumerates and runs it exactly once; a sentinel/failing-case check proves it cannot silently fall out again. |
100
100
  | SEC-01 | P0 | fixed | `src/web-tools.ts`, `web_fetch` | Model-selected URLs bypass the existing public-destination policy, follow redirects automatically, and buffer the full body. This permits SSRF into loopback/private services and unbounded response buffering. | Reuse one shared fetch-policy implementation: reject private literals and DNS resolutions, revalidate every redirect, combine caller abort with timeout, and stream to a byte cap. Tests cover loopback, private DNS, public-to-private redirect, redirect limit, chunked over-cap, and normal public text. |
101
101
  | SEC-02 | P1 | fixed | `src/download.ts`, `blobId` | An unvalidated blob ID reaches `join()` and symlink creation, unlike the adjacent validated digest. It requires a hostile HF-compatible endpoint. | Reject any non-lowercase-40-hex SHA-1 blob ID before path construction; traversal and malformed-ID tests fail closed. |
102
102
  | DEPLOY-01 | D | deferred | `src/server.ts`, WebSocket upgrade | No WebSocket Origin enforcement. | Deferred while bind is loopback-only. Reopen before any supported non-loopback bind, tunnel, reverse proxy, or browser origin; then add an allowlist and cross-origin rejection tests. |
@@ -127,7 +127,7 @@ change that state.
127
127
  transform constructors return slots, closures, and callbacks to zero under
128
128
  repeated failure injection. The root typecheck now includes DOM/web sources
129
129
  and the formerly excluded web tests. `scripts/test.sh` enumerates
130
- `scripts/bench-serving-load.test.ts` exactly once and rejects gate drift.
130
+ `tests/bench-serving-load.test.ts` exactly once and rejects gate drift.
131
131
  - `bunx tsc --noEmit`, `bun scripts/check-hygiene.ts`, `bash -n
132
132
  scripts/test.sh`, and `git diff --check` are green after Wave 3. The full
133
133
  post-Wave-3 repository gate and both performance measurements remain open.
@@ -140,7 +140,7 @@ change that state.
140
140
  Standard PEFT `use_rslora` now mounts and saves at exactly
141
141
  `alpha / sqrt(rank)`. Custom-VJP also frees the first callback if allocation
142
142
  of the second callback throws.
143
- - **PERF-01:** `scripts/bench-stream-decoder.ts` measured the original
143
+ - **PERF-01:** `bench-stream-decoder.ts (deleted 2026-08-23; git history)` measured the original
144
144
  full-history decoder against the bounded exact-suffix implementation with
145
145
  five paired repetitions. MiniCPM5 medians were 142.62 → 27.40 ms at 512
146
146
  tokens (5.20×), 576.01 → 56.45 ms at 1,024 (10.20×), and 2,284.57 →
@@ -148,7 +148,7 @@ change that state.
148
148
  113.62–116.06 ms). Every per-push chunk and final byte stream matched at
149
149
  64–2,048 tokens; the e4b 1,024-token check was 88.62 → 10.25 ms. Raw,
150
150
  gitignored artifacts are under `reports/perf-01-stream-decoder-*.json`.
151
- - **PERF-02:** `scripts/bench-logprobs-readback.ts` confirmed the reported
151
+ - **PERF-02:** `bench-logprobs-readback.ts (deleted 2026-08-23; git history)` confirmed the reported
152
152
  barrier on a clean M1 Max 32 GB with Bun 1.3.14 and
153
153
  Qwen2.5-0.5B-Instruct-4bit (256 tokens, two warmups, five measured rounds).
154
154
  At clean base `00e597e`, off/logprobs/top-5 medians were
@@ -302,7 +302,7 @@ after any overlapping merge.
302
302
  | Adapters/training | `tests/{lora,train-*,ifeval}.test.ts`; delayed writes, PEFT + mlx-lm layouts, unequal padding, optimizer LR scales, frozen scorer corpus |
303
303
  | Grammar/Responses store | `tests/{grammar,grammar-jump,responses,server}.test.ts`; degrade forms, top-logprob alignment, fake-clock reordered LRU |
304
304
  | MLX/resource ownership | focused diffusion/weights/autograd/checkpoint/custom-VJP failure loops with handle/allocation baselines |
305
- | Repository gate | `bun scripts/check-hygiene.ts`, `bunx tsc --noEmit`, `bash scripts/test.sh`; prove `scripts/bench-serving-load.test.ts` is included |
305
+ | Repository gate | `bun scripts/check-hygiene.ts`, `bunx tsc --noEmit`, `bash scripts/test.sh`; prove `tests/bench-serving-load.test.ts` is included |
306
306
  | Performance | deterministic raw artifact, paired A/B, exact output parity, quiet-machine preflight before any curated claim |
307
307
 
308
308
  ## 8. Exit gate
@@ -21,7 +21,7 @@ cross-linked, self-healing personal wiki. It **works end-to-end on real data.**
21
21
  ```
22
22
  # resumable driver; continues from cursor 720. Writes to ~/.mlx-bun/wiki-full (NOT the
23
23
  # real vault ~/.mlx-bun/wiki). ~25 min / 20-conv batch, ~50h total, SERIAL.
24
- bun scripts/experiments/dreaming-full-run.ts # resume (clean-slate guarded by an init flag)
24
+ bun scripts/memory/dreaming-full-run.ts # resume (clean-slate guarded by an init flag)
25
25
  # state files: ~/.mlx-bun/full-run-cursor.txt, ~/.mlx-bun/full-run-initialized, ~/.mlx-bun/full-run.log
26
26
  # after the import finishes: reindex, then connect the graph:
27
27
  mlx-bun memory link
@@ -78,7 +78,7 @@ RECONCILE (infobox-ground-truth consistency) → LINK (cross-link) → WIKIFY (e
78
78
  to the latest value; KEEPS the trajectory in a `## History` section **only for the
79
79
  USER's evolving positions** — an AI *factual error* is silently overwritten (no
80
80
  history). Date-aware; `reconcile.ts` is the consistency authority (infobox = ground
81
- truth). Proven via a timestamp-swap demo (`scripts/experiments/dreaming-selfheal-demo.ts`).
81
+ truth). Proven via a timestamp-swap demo (`scripts/memory/dreaming-selfheal-demo.ts`).
82
82
  6. **Parroting (recurred 5×).** The small model copies ANY concrete example value from
83
83
  prompts/Meta pages into unrelated articles (phantom S5IIX, "Anamorphic Video", etc.).
84
84
  **ALL prompts + Meta pages must be SCHEMATIC** (no real names/specs/dates). Purged;