mlx-bun 0.2.0 → 0.4.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 (433) hide show
  1. package/README.md +71 -588
  2. package/docs/README.md +94 -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/archive/investigations/openjarvis-fit.md +198 -0
  8. package/docs/{design → archive/investigations}/optimization_plan.md +1 -1
  9. package/docs/{design → archive/investigations}/pre-colibri-stabilization.md +5 -5
  10. package/docs/archive/investigations/qwen38-27b-campaign-log.md +1092 -0
  11. package/docs/{design → archive/investigations}/the-dreaming-handoff.md +2 -2
  12. package/docs/archive/planning/release-notes-v0.3.0.md +35 -0
  13. package/docs/design/batching.md +1841 -0
  14. package/docs/design/decode-speed-program.md +2346 -169
  15. package/docs/design/dreaming-nightly-pipeline.md +675 -282
  16. package/docs/design/generic-model-support.md +655 -334
  17. package/docs/design/kv-cache.md +824 -0
  18. package/docs/design/orpo-training.md +673 -1239
  19. package/docs/design/speculative-decoding.md +1990 -0
  20. package/docs/design/turboquant.md +2212 -0
  21. package/docs/design/unified-engine-frontier-plan.md +1833 -727
  22. package/docs/design/web-chat-redesign.md +666 -1083
  23. package/docs/planning/PRODUCT_ROADMAP.md +50 -1
  24. package/docs/planning/release-notes-v0.4.0.md +45 -0
  25. package/docs/planning/video-series.md +2 -2
  26. package/docs/reference/benchmarks.md +3613 -0
  27. package/docs/reference/cli.md +434 -160
  28. package/docs/reference/distribution.md +328 -182
  29. package/docs/reference/environment.md +398 -0
  30. package/docs/reference/glossary.md +39 -0
  31. package/docs/reference/library-api.md +566 -168
  32. package/docs/reference/memory.md +227 -64
  33. package/docs/reference/models.md +113 -6
  34. package/docs/reference/server-api.md +944 -429
  35. package/docs/reference/server-config.md +740 -338
  36. package/docs/reference/training.md +393 -254
  37. package/docs/reference/troubleshooting.md +158 -0
  38. package/package.json +9 -4
  39. package/src/audio/decode.ts +2 -2
  40. package/src/audio/features.ts +2 -2
  41. package/src/backends/mlx/assistant-target.ts +46 -0
  42. package/src/backends/mlx/autoregressive-draft-rows.ts +120 -0
  43. package/src/backends/mlx/autoregressive.ts +108 -0
  44. package/src/backends/mlx/batch-group.ts +1790 -0
  45. package/src/backends/mlx/cache-attachment.ts +67 -0
  46. package/src/backends/mlx/cache-layout.ts +31 -0
  47. package/src/backends/mlx/checkpoint-state.ts +53 -0
  48. package/src/backends/mlx/continuation-persistence.ts +106 -0
  49. package/src/backends/mlx/continuation-request.ts +43 -0
  50. package/src/backends/mlx/continuation.ts +77 -0
  51. package/src/backends/mlx/diffusion.ts +39 -0
  52. package/src/backends/mlx/draft-target.ts +32 -0
  53. package/src/backends/mlx/evaluation.ts +105 -0
  54. package/src/backends/mlx/fill-append.ts +45 -0
  55. package/src/backends/mlx/full-kv-row-append.ts +32 -0
  56. package/src/backends/mlx/full-kv-row-donor.ts +54 -0
  57. package/src/backends/mlx/full-transitioning-kv-rows.ts +65 -0
  58. package/src/backends/mlx/gateway-binding.ts +130 -0
  59. package/src/backends/mlx/graph.ts +38 -0
  60. package/src/backends/mlx/kv-codec.ts +9 -0
  61. package/src/backends/mlx/kv-maintenance.ts +133 -0
  62. package/src/backends/mlx/kv-tensor-rows.ts +212 -0
  63. package/src/backends/mlx/memory-client.ts +189 -0
  64. package/src/backends/mlx/methods.ts +90 -0
  65. package/src/backends/mlx/model-prompt.ts +164 -0
  66. package/src/backends/mlx/model-serving.ts +79 -0
  67. package/src/backends/mlx/prefill-cohort.ts +89 -0
  68. package/src/backends/mlx/prefill-rows.ts +200 -0
  69. package/src/backends/mlx/prefill.ts +33 -0
  70. package/src/backends/mlx/projected-context-rows.ts +72 -0
  71. package/src/backends/mlx/request-policy.ts +20 -0
  72. package/src/backends/mlx/request-state-policy.ts +41 -0
  73. package/src/backends/mlx/rollback.ts +89 -0
  74. package/src/backends/mlx/row-sampling.ts +49 -0
  75. package/src/backends/mlx/serial-executor.ts +242 -0
  76. package/src/backends/mlx/speculative-group.ts +359 -0
  77. package/src/backends/mlx/speculative-round.ts +161 -0
  78. package/src/backends/mlx/speculative.ts +114 -0
  79. package/src/backends/mlx/state-rows.ts +104 -0
  80. package/src/backends/mlx/state-views.ts +46 -0
  81. package/src/backends/mlx/target-layout-capability.ts +35 -0
  82. package/src/backends/mlx/text-engine.ts +73 -0
  83. package/src/backends/mlx/transitioning-kv-rows.ts +165 -0
  84. package/src/cli.ts +66 -58
  85. package/src/client.ts +66 -0
  86. package/src/config.ts +21 -4
  87. package/src/contracts/completion.ts +16 -0
  88. package/src/contracts/execution.ts +60 -0
  89. package/src/contracts/generation.ts +103 -0
  90. package/src/contracts/host.ts +7 -0
  91. package/src/contracts/jobs.ts +66 -0
  92. package/src/contracts/pi-provider.ts +30 -0
  93. package/src/contracts/pi.ts +259 -0
  94. package/src/contracts/prefix-cache.ts +23 -0
  95. package/src/contracts/resources.ts +25 -0
  96. package/src/contracts/sampling.ts +23 -0
  97. package/src/contracts/scheduling.ts +45 -0
  98. package/src/contracts/tsconfig.json +14 -0
  99. package/src/diffusion/diffusion-generate.ts +218 -153
  100. package/src/embed.ts +1 -1
  101. package/src/engine/admission.ts +59 -0
  102. package/src/engine/cancellation.ts +38 -0
  103. package/src/engine/engine.ts +56 -0
  104. package/src/engine/execution-coordinator.ts +70 -0
  105. package/src/engine/execution-plan.ts +53 -0
  106. package/src/engine/resources.ts +53 -0
  107. package/src/engine/scheduler.ts +72 -0
  108. package/src/engine/session.ts +247 -0
  109. package/src/eval/README.md +44 -1
  110. package/src/eval/kl.ts +236 -3
  111. package/src/eval/reference-logits.ts +207 -0
  112. package/src/eval/runner.ts +8 -96
  113. package/src/fill/echo-index.ts +188 -0
  114. package/src/fill/fill-session.ts +452 -0
  115. package/src/fill/proposal.ts +68 -0
  116. package/src/fill/schema-rows.ts +506 -0
  117. package/src/fill/tool-boundary.ts +103 -0
  118. package/src/fit.ts +30 -16
  119. package/src/generate.ts +709 -417
  120. package/src/grammar.ts +12 -7
  121. package/src/harness-pi.ts +14 -33
  122. package/src/hub-rest.ts +4 -4
  123. package/src/index.ts +7 -0
  124. package/src/inference/denoising.ts +17 -0
  125. package/src/inference/draft-acceptance.ts +41 -0
  126. package/src/inference/draft-output.ts +49 -0
  127. package/src/inference/graph.ts +33 -0
  128. package/src/inference/prefill.ts +39 -0
  129. package/src/inference/rollback.ts +7 -0
  130. package/src/jobs/db.ts +4 -0
  131. package/src/jobs/index.ts +2 -0
  132. package/src/jobs/job-entry.ts +12 -12
  133. package/src/jobs/runner.ts +98 -13
  134. package/src/jobs/task-client.ts +19 -0
  135. package/src/jobs/types.ts +2 -58
  136. package/src/kv-scheme.ts +70 -12
  137. package/src/kv-store.ts +177 -63
  138. package/src/lab/README.md +18 -0
  139. package/src/{assets → lab/curve}/curve-designer.html +2 -2
  140. package/src/{curve-sampler.ts → lab/curve/curve-sampler.ts} +2 -2
  141. package/src/{expert-trace.ts → lab/expert-trace/expert-trace.ts} +5 -5
  142. package/src/lab/paged-kv/paged-kv-rows.ts +83 -0
  143. package/src/{model → lab/paged-kv}/paged-kv.ts +32 -15
  144. package/src/library.ts +40 -0
  145. package/src/lora.ts +18 -0
  146. package/src/media-fetch.ts +1 -1
  147. package/src/memory/article.ts +1 -1
  148. package/src/memory/chunk.ts +1 -1
  149. package/src/memory/model.ts +30 -169
  150. package/src/memory/prompts.ts +1 -1
  151. package/src/memory/rest.ts +1 -1
  152. package/src/memory/schedule.ts +1 -1
  153. package/src/memory/stages.ts +4 -1
  154. package/src/memory/vault.ts +1 -3
  155. package/src/mlx/array.ts +11 -11
  156. package/src/mlx/compile.ts +12 -2
  157. package/src/mlx/ffi.ts +58 -11
  158. package/src/mlx/materialize.ts +23 -0
  159. package/src/mlx/metal-kernel.ts +10 -11
  160. package/src/mlx/ops.ts +33 -13
  161. package/src/mlx/quantized-rows.ts +36 -0
  162. package/src/mlx/token-bitmask.ts +52 -0
  163. package/src/mlx/turboquant-kv-decode.ts +82 -0
  164. package/src/mlx/turboquant-kv-inverse.ts +122 -0
  165. package/src/mlx/turboquant-ops.ts +33 -3
  166. package/src/mlx/turboquant-tables.ts +2 -2
  167. package/src/model/artifact-identity.ts +73 -0
  168. package/src/model/batched-kv.ts +235 -0
  169. package/src/model/batched-mask.ts +20 -6
  170. package/src/model/batched-quant.ts +9 -3
  171. package/src/model/batched-quantized-kv.ts +144 -0
  172. package/src/model/batched-rotating-quant.ts +78 -17
  173. package/src/model/batched-rotating-state.ts +76 -0
  174. package/src/model/batched-rotating.ts +65 -23
  175. package/src/model/batched-row-storage.ts +52 -0
  176. package/src/model/batched-ssm.ts +52 -0
  177. package/src/model/batched-turboquant-kv.ts +93 -0
  178. package/src/model/compiled-decode.ts +8 -2
  179. package/src/model/decoded-kv-donor.ts +12 -0
  180. package/src/model/delayed-quantized-kv.ts +72 -0
  181. package/src/model/delayed-rotating-quantized-kv.ts +93 -0
  182. package/src/model/delayed-turboquant-kv.ts +55 -0
  183. package/src/model/diffusion-gemma.ts +8 -8
  184. package/src/model/factory.ts +76 -33
  185. package/src/model/fingerprint.ts +1 -1
  186. package/src/model/flash-attention.ts +3 -3
  187. package/src/model/full-prefill-padding.ts +56 -0
  188. package/src/model/full-prefill-row.ts +105 -0
  189. package/src/model/gemma4-base.ts +179 -80
  190. package/src/model/gemma4.ts +40 -32
  191. package/src/model/generated/gemma4-12b.ts +6 -3
  192. package/src/model/generated/gemma4-26b.ts +6 -3
  193. package/src/model/generated/gemma4-e4b.ts +6 -3
  194. package/src/model/glm52-cache.ts +80 -4
  195. package/src/model/glm52-dsa.ts +13 -9
  196. package/src/model/glm52-memory.ts +1 -1
  197. package/src/model/glm52-mla.ts +12 -6
  198. package/src/model/glm52.ts +19 -40
  199. package/src/model/implementation.ts +69 -0
  200. package/src/model/kv-attention-view.ts +67 -0
  201. package/src/model/minicpm5.ts +17 -15
  202. package/src/model/profile.ts +12 -2
  203. package/src/model/qwen-append.ts +12 -0
  204. package/src/model/qwen-conv.ts +52 -0
  205. package/src/model/qwen3-delta-state.ts +74 -0
  206. package/src/model/qwen3-delta.ts +59 -36
  207. package/src/model/qwen3_5-checkpoint.ts +164 -0
  208. package/src/model/qwen3_5.ts +202 -78
  209. package/src/model/rotating-kv-donor.ts +35 -0
  210. package/src/model/rotating-kv-layout.ts +262 -0
  211. package/src/model/rotating-row-transaction.ts +35 -0
  212. package/src/model/speculative-rotating-kv.ts +101 -0
  213. package/src/model/ssm-prefill-padding.ts +39 -0
  214. package/src/model/support.ts +1 -1
  215. package/src/model/trellis-balanced-scatter.ts +51 -0
  216. package/src/model/trellis-linear.ts +672 -0
  217. package/src/model/trellis-shared-m.ts +151 -0
  218. package/src/model/trellis-shared-scatter.ts +144 -0
  219. package/src/model/trellis-splitk-prefill.ts +158 -0
  220. package/src/model/trellis-tiled-prefill.ts +136 -0
  221. package/src/model/trellis-vector-expand.ts +62 -0
  222. package/src/model/trellis-wide-prefill.ts +94 -0
  223. package/src/model/turboquant-codec.ts +83 -0
  224. package/src/model/universal/dense.ts +15 -14
  225. package/src/model/universal/modules.ts +8 -1
  226. package/src/native-pack.ts +6 -5
  227. package/src/pi-provider.ts +6 -64
  228. package/src/pi-web.ts +8 -315
  229. package/src/preflight.ts +31 -15
  230. package/src/prompt-cache.ts +110 -69
  231. package/src/quantize/allocator.ts +1 -1
  232. package/src/quantize/config-writer.ts +10 -3
  233. package/src/quantize/rotate.ts +4 -4
  234. package/src/quantize/trellis.ts +586 -0
  235. package/src/responses.ts +28 -1
  236. package/src/runtime-config.ts +18 -4
  237. package/src/sampler.ts +40 -29
  238. package/src/serve/batch-scheduler.ts +8 -1671
  239. package/src/serve/chat-request.ts +391 -0
  240. package/src/serve/chat-stage.ts +195 -0
  241. package/src/serve/checkpoint-identity.ts +64 -0
  242. package/src/serve/completion-executor.ts +15 -7
  243. package/src/serve/discovery-routes.ts +12 -13
  244. package/src/serve/generation-gateway.ts +183 -213
  245. package/src/serve/http.ts +159 -0
  246. package/src/serve/inference-request.ts +79 -0
  247. package/src/serve/isolate.ts +297 -105
  248. package/src/serve/lab-routes.ts +3 -0
  249. package/src/serve/lane-registry.ts +2 -1
  250. package/src/serve/model-admin-routes.ts +7 -5
  251. package/src/serve/model-binding.ts +43 -0
  252. package/src/serve/model-host.ts +511 -0
  253. package/src/serve/openai-wire.ts +103 -0
  254. package/src/serve/parent-application.ts +56 -0
  255. package/src/serve/pipeline.ts +33 -0
  256. package/src/serve/preparation.ts +33 -0
  257. package/src/serve/request-plan.ts +23 -18
  258. package/src/serve/request-prep.ts +344 -0
  259. package/src/serve/response-lease.ts +24 -0
  260. package/src/serve/responses-client.ts +69 -0
  261. package/src/serve/session-completion-engine.ts +110 -0
  262. package/src/serve/session-search.ts +1 -1
  263. package/src/serve/static-routes.ts +5 -5
  264. package/src/serve/text-completion-stage.ts +104 -0
  265. package/src/serve/token-streams.ts +519 -0
  266. package/src/server.ts +335 -2711
  267. package/src/spec/assistant-rows.ts +92 -0
  268. package/src/spec/assistant-source.ts +31 -55
  269. package/src/spec/cache-identity.ts +22 -0
  270. package/src/spec/deepspec-rows.ts +29 -0
  271. package/src/spec/deepspec-source.ts +16 -14
  272. package/src/spec/dflash-source.ts +36 -12
  273. package/src/spec/drafter.ts +153 -142
  274. package/src/spec/dspark/ab-stats.ts +3 -3
  275. package/src/spec/dspark/calibration.ts +2 -2
  276. package/src/spec/dspark/deepspec-module.ts +97 -122
  277. package/src/spec/dspark/generate-dflash.ts +2 -2
  278. package/src/spec/dspark/generate.ts +2 -2
  279. package/src/spec/dspark/loader.ts +1 -1
  280. package/src/spec/dspark/module-dflash.ts +129 -172
  281. package/src/spec/dspark/module.ts +3 -3
  282. package/src/spec/dspark/quantize-drafter.ts +1 -1
  283. package/src/spec/generate.ts +1 -1
  284. package/src/spec/glm52-mtp-graph.ts +29 -0
  285. package/src/spec/glm52-mtp-rows.ts +132 -0
  286. package/src/spec/glm52-mtp-source.ts +54 -137
  287. package/src/spec/glm52-mtp-state.ts +33 -0
  288. package/src/spec/ngram-source.ts +93 -21
  289. package/src/spec/projected-draft-rows.ts +73 -0
  290. package/src/spec/qwen-mtp-module.ts +171 -0
  291. package/src/spec/qwen-mtp-rows.ts +219 -0
  292. package/src/spec/qwen-mtp-source.ts +147 -195
  293. package/src/spec/qwen-mtp-state.ts +30 -0
  294. package/src/spec/serve-loop.ts +201 -201
  295. package/src/spec/source.ts +110 -13
  296. package/src/spec/two-model-rows.ts +61 -0
  297. package/src/spec/two-model.ts +44 -102
  298. package/src/ssd-cache.ts +99 -19
  299. package/src/ssd-durability.ts +36 -20
  300. package/src/tool-call.ts +51 -14
  301. package/src/train/flash-cce.ts +2 -2
  302. package/src/train/forward.ts +6 -0
  303. package/src/train/loss.ts +1 -1
  304. package/src/train/prefix-shared.ts +5 -1
  305. package/src/train/segmented.ts +5 -3
  306. package/src/train/trainer.ts +6 -6
  307. package/src/vision/prompt.ts +1 -1
  308. package/src/vision/qwen3vl-tower.ts +52 -10
  309. package/src/web/app.html +1 -1
  310. package/src/web/app.js +62 -60
  311. package/src/web/src/adapters-panel.ts +3 -3
  312. package/src/web/src/assistant.ts +2 -36
  313. package/src/web/src/chat.ts +4 -4
  314. package/src/web/src/composer.ts +4 -4
  315. package/src/web/src/hub.ts +1 -1
  316. package/src/web/src/markdown.ts +0 -0
  317. package/src/web/src/memory-panel.ts +1 -1
  318. package/src/web/src/model-picker.ts +1 -1
  319. package/src/web/src/palette.ts +1 -1
  320. package/src/web/src/protocol.ts +3 -39
  321. package/src/web/src/sessions.ts +1 -1
  322. package/src/web/src/ui-catalog.ts +4 -18
  323. package/src/web-assets.ts +47 -0
  324. package/src/weights.ts +55 -9
  325. package/docs/archive/investigations/curve-runs/bisector-route.json +0 -98
  326. package/docs/archive/investigations/curve-runs/bisector-trace.json +0 -1393
  327. package/docs/archive/investigations/curve-runs/curve-terrain.json +0 -1179
  328. package/docs/archive/investigations/curve-runs/curve-terrain.svg +0 -42
  329. package/docs/archive/investigations/hlg-ab.html +0 -34
  330. package/docs/archive/investigations/hlg-explorer.html +0 -238
  331. package/docs/archive/investigations/hlg-figs/cliff.svg +0 -1
  332. package/docs/archive/investigations/hlg-figs/cross.svg +0 -1
  333. package/docs/archive/investigations/hlg-figs/edges.svg +0 -1
  334. package/docs/archive/investigations/hlg-figs/k20-grids.svg +0 -1
  335. package/docs/archive/investigations/hlg-figs/k20-peaks.svg +0 -1
  336. package/docs/archive/investigations/hlg-figs/lw-curve.svg +0 -1
  337. package/docs/archive/investigations/hlg-figs/terrain.svg +0 -1
  338. package/docs/archive/investigations/hlg-report.html +0 -262
  339. package/docs/archive/investigations/hlg-runs/hlg-ab.json +0 -149
  340. package/docs/archive/investigations/hlg-runs/hlg-blind-prompts.md +0 -87
  341. package/docs/archive/investigations/hlg-runs/hlg-blind.json +0 -107
  342. package/docs/archive/investigations/hlg-runs/hlg-cliff.json +0 -197
  343. package/docs/archive/investigations/hlg-runs/hlg-cross.json +0 -505
  344. package/docs/archive/investigations/hlg-runs/hlg-edge.json +0 -388
  345. package/docs/archive/investigations/hlg-runs/hlg-eval1.json +0 -25
  346. package/docs/archive/investigations/hlg-runs/hlg-frontier.json +0 -86
  347. package/docs/archive/investigations/hlg-runs/hlg-grid.json +0 -242
  348. package/docs/archive/investigations/hlg-runs/hlg-grid2.json +0 -343
  349. package/docs/archive/investigations/hlg-runs/hlg-lw-coarse.json +0 -110
  350. package/docs/archive/investigations/hlg-runs/hlg-map.json +0 -383
  351. package/docs/archive/investigations/hlg-runs/run0-original.log +0 -159
  352. package/docs/archive/investigations/hlg-runs/runA-recommended.log +0 -131
  353. package/docs/archive/investigations/hlg-runs/runAA-cliff-cpm5.log +0 -26
  354. package/docs/archive/investigations/hlg-runs/runAB-grid2-e4b.log +0 -18
  355. package/docs/archive/investigations/hlg-runs/runAC-peak-e4b-partial.log +0 -25
  356. package/docs/archive/investigations/hlg-runs/runAD-ab-samples.log +0 -8
  357. package/docs/archive/investigations/hlg-runs/runAE-edge-e4b.log +0 -51
  358. package/docs/archive/investigations/hlg-runs/runAF-logit-calibration.log +0 -10
  359. package/docs/archive/investigations/hlg-runs/runAG-eval-config2.log +0 -16
  360. package/docs/archive/investigations/hlg-runs/runB-gain-variants.log +0 -192
  361. package/docs/archive/investigations/hlg-runs/runC-pivots.log +0 -162
  362. package/docs/archive/investigations/hlg-runs/runD-oetf.log +0 -132
  363. package/docs/archive/investigations/hlg-runs/runE-eotf.log +0 -162
  364. package/docs/archive/investigations/hlg-runs/runF-shaper-working.log +0 -86
  365. package/docs/archive/investigations/hlg-runs/runG-shaper-sweep.log +0 -101
  366. package/docs/archive/investigations/hlg-runs/runH-wsweep.log +0 -176
  367. package/docs/archive/investigations/hlg-runs/runI-asweep.log +0 -176
  368. package/docs/archive/investigations/hlg-runs/runJ-knobmap.log +0 -49
  369. package/docs/archive/investigations/hlg-runs/runK-frontier.log +0 -19
  370. package/docs/archive/investigations/hlg-runs/runL-widemap.log +0 -65
  371. package/docs/archive/investigations/hlg-runs/runM-frontier-emb.log +0 -15
  372. package/docs/archive/investigations/hlg-runs/runN-verify.log +0 -116
  373. package/docs/archive/investigations/hlg-runs/runO-frontier-seed5000.log +0 -15
  374. package/docs/archive/investigations/hlg-runs/runP-grid-AxSm.log +0 -15
  375. package/docs/archive/investigations/hlg-runs/runQ-grid-tgW.log +0 -15
  376. package/docs/archive/investigations/hlg-runs/runR-blind-transcript.log +0 -79
  377. package/docs/archive/investigations/hlg-runs/runS-cross-coherence.log +0 -33
  378. package/docs/archive/investigations/hlg-runs/runT-cross-cpm5.log +0 -33
  379. package/docs/archive/investigations/hlg-runs/runU-cross-12b.log +0 -33
  380. package/docs/archive/investigations/hlg-runs/runV-lw-e4b.log +0 -22
  381. package/docs/archive/investigations/hlg-runs/runW-lw-12b.log +0 -22
  382. package/docs/archive/investigations/hlg-runs/runX-lw-cpm5.log +0 -22
  383. package/docs/archive/investigations/hlg-runs/runY-cliff-e4b.log +0 -26
  384. package/docs/archive/investigations/hlg-runs/runZ-cliff-12b.log +0 -26
  385. package/docs/archive/mlx-bun-lab-report.html +0 -275
  386. package/docs/archive/wwdc-mlx-bun.html +0 -848
  387. package/docs/design/adapters-end-to-end.md +0 -205
  388. package/docs/design/batching-perf-path.md +0 -255
  389. package/docs/design/batching-v2-plan.md +0 -529
  390. package/docs/design/bucketing-stage.md +0 -197
  391. package/docs/design/compat-cli-surface-design.md +0 -230
  392. package/docs/design/docs-reorg-plan.md +0 -165
  393. package/docs/design/dspark-serving-program.md +0 -371
  394. package/docs/design/dspark-speculative-decoding.md +0 -318
  395. package/docs/design/grammar-spec-batching-integration.md +0 -301
  396. package/docs/design/memory-inference-path.md +0 -422
  397. package/docs/design/memory-synthesis.md +0 -287
  398. package/docs/design/memory-system.md +0 -237
  399. package/docs/design/mlx-lm-serving-execution-seam.md +0 -81
  400. package/docs/design/mlx-lm-tool-parity-plan.md +0 -545
  401. package/docs/design/omlx-adoption-map.md +0 -98
  402. package/docs/design/orpo-dynamic-lambda.md +0 -220
  403. package/docs/design/orpo-future-enhancements.md +0 -340
  404. package/docs/design/paged-kv-cache.md +0 -214
  405. package/docs/design/parallel-slots.md +0 -567
  406. package/docs/design/parity-tier-dag.md +0 -161
  407. package/docs/design/repo-cleanup-plan.md +0 -231
  408. package/docs/design/runtime-isolation.md +0 -263
  409. package/docs/design/segmented-backward-training.md +0 -543
  410. package/docs/design/spec-decode-larger-targets.md +0 -229
  411. package/docs/design/ssd-kv-cold-tier.md +0 -415
  412. package/docs/design/structured-output.md +0 -484
  413. package/docs/design/tauri-desktop-app.md +0 -127
  414. package/docs/design/the-dreaming-master-plan.md +0 -445
  415. package/docs/design/turboquant-kv.md +0 -235
  416. package/docs/design/turboquant-weights.md +0 -467
  417. package/docs/design/w4a16-compute-precision-spike.md +0 -232
  418. package/docs/design/web-chat-beat-matrix.md +0 -315
  419. package/docs/design/write-pipeline-entity.md +0 -468
  420. package/docs/planning/IDEAS.md +0 -69
  421. package/docs/reference/embedding.md +0 -197
  422. package/docs/reference/features-matrix.md +0 -101
  423. package/docs/reference/orpo-quickstart.md +0 -135
  424. package/src/flags.ts +0 -11
  425. /package/docs/{design → archive/investigations}/colibri-glm52-port.md +0 -0
  426. /package/docs/{planning → archive/planning}/chunk-task-roadmap.md +0 -0
  427. /package/docs/{planning → archive/planning}/curve-sampler-research-plan.md +0 -0
  428. /package/docs/{planning → archive/planning}/memory-docs-and-dag-plan.md +0 -0
  429. /package/docs/{planning → archive/planning}/pi-integration-review.md +0 -0
  430. /package/docs/{planning → archive/planning}/release-notes-v0.2.0.md +0 -0
  431. /package/src/{memory-plan.ts → admission-plan.ts} +0 -0
  432. /package/{docs/archive/investigations → src/serve/assets}/curve-terrain.html +0 -0
  433. /package/{docs/dag → src/serve/assets}/training-inference-map.html +0 -0
package/docs/README.md ADDED
@@ -0,0 +1,94 @@
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/openjarvis-fit.md](../docs/archive/investigations/openjarvis-fit.md) — OpenJarvis research and fit with mlx-bun
24
+ - [investigations/openwiki-evaluation.md](../docs/archive/investigations/openwiki-evaluation.md) — OpenWiki — evaluation & fit analysis
25
+ - [investigations/optimization_plan.md](../docs/archive/investigations/optimization_plan.md) — mlx-bun: gemma4.ts decompose & optimize — action plan
26
+ - [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
27
+ - [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
28
+ - [investigations/orpo-uf-testing-handoff.md](../docs/archive/investigations/orpo-uf-testing-handoff.md) — ORPO-on-UF — results + testing-phase handoff
29
+ - [investigations/pareto-specialized-runtime-findings.md](../docs/archive/investigations/pareto-specialized-runtime-findings.md) — Pareto-specialized runtime findings
30
+ - [investigations/pi-builtin-investigation.md](../docs/archive/investigations/pi-builtin-investigation.md) — Investigation: pi as a "built-in" terminal for mlx-bun
31
+ - [investigations/pre-colibri-stabilization.md](../docs/archive/investigations/pre-colibri-stabilization.md) — Pre-Colibri stabilization program
32
+ - [investigations/qwen38-27b-campaign-log.md](../docs/archive/investigations/qwen38-27b-campaign-log.md) — Qwen3.8-27B optimization campaign — execution log (2026-09-04 → 2026-09-08)
33
+ - [investigations/segmented-backward-handoff.md](../docs/archive/investigations/segmented-backward-handoff.md) — Handoff — segmented backward training (2026-06-16)
34
+ - [investigations/starter-model-port-handoff.md](../docs/archive/investigations/starter-model-port-handoff.md) — Handoff: the sub-GB starter model port (publishing gate 1)
35
+ - [investigations/steel-flash-cce-handoff.md](../docs/archive/investigations/steel-flash-cce-handoff.md) — Steel flash-CCE — handoff
36
+ - [investigations/the-dreaming-handoff.md](../docs/archive/investigations/the-dreaming-handoff.md) — THE DREAMING — HANDOFF (2026-06-28)
37
+ - [investigations/trainer-validation-experiment.md](../docs/archive/investigations/trainer-validation-experiment.md) — Trainer validation experiment
38
+ - [planning/chat-ui-vision-memory-first.md](../docs/archive/planning/chat-ui-vision-memory-first.md) — Chat UI Vision: The Model That Knows You
39
+ - [planning/chat-ui-vision.md](../docs/archive/planning/chat-ui-vision.md) — The mlx-bun chat surface: a vision
40
+ - [planning/chunk-task-roadmap.md](../docs/archive/planning/chunk-task-roadmap.md) — Chunk-task quality roadmap (2026-06-17)
41
+ - [planning/curve-sampler-research-plan.md](../docs/archive/planning/curve-sampler-research-plan.md) — Curve sampler — preregistered research plan (distinctness track)
42
+ - [planning/journal.md](../docs/archive/planning/journal.md) — Engineering Journal
43
+ - [planning/memory-docs-and-dag-plan.md](../docs/archive/planning/memory-docs-and-dag-plan.md) — Memory docs organization + DAG-view refresh — review & plan
44
+ - [planning/pi-integration-review.md](../docs/archive/planning/pi-integration-review.md) — pi integration review — internal embeds + `harness pi` (2026-07-01)
45
+ - [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
46
+ - [planning/release-notes-v0.0.11.md](../docs/archive/planning/release-notes-v0.0.11.md) — v0.0.11 release notes
47
+ - [planning/release-notes-v0.0.12.md](../docs/archive/planning/release-notes-v0.0.12.md) — v0.0.12 release notes
48
+ - [planning/release-notes-v0.0.13.md](../docs/archive/planning/release-notes-v0.0.13.md) — v0.0.13 release notes
49
+ - [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)
50
+ - [planning/release-notes-v0.2.0.md](../docs/archive/planning/release-notes-v0.2.0.md) — mlx-bun v0.2.0
51
+ - [planning/release-notes-v0.3.0.md](../docs/archive/planning/release-notes-v0.3.0.md) — mlx-bun v0.3.0
52
+ - [planning/web-ui-pass-plan.md](../docs/archive/planning/web-ui-pass-plan.md) — Web UI pass — ranked fix list (2026-07-01 audit)
53
+ - [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)
54
+
55
+ ## docs/design/
56
+
57
+ Active engineering design docs — one per topic; status lives in front matter + PLAN.md.
58
+
59
+ - [batching.md](../docs/design/batching.md) — Batching — continuous scheduling for `--batch N`
60
+ - [decode-speed-program.md](../docs/design/decode-speed-program.md) — Inference performance program
61
+ - [dreaming-nightly-pipeline.md](../docs/design/dreaming-nightly-pipeline.md) — The Dreaming — memory write path + synthesis (canonical design)
62
+ - [generic-model-support.md](../docs/design/generic-model-support.md) — Model support — run anything mlx-lm runs, and the ports we target
63
+ - [kv-cache.md](../docs/design/kv-cache.md) — KV cache — residency and layout
64
+ - [orpo-training.md](../docs/design/orpo-training.md) — Training — design (ORPO, flash-CCE head, prefix sharing, segmented backward)
65
+ - [speculative-decoding.md](../docs/design/speculative-decoding.md) — Speculative decoding — one verifier, every draft source
66
+ - [turboquant.md](../docs/design/turboquant.md) — TurboQuant — rotation-based quantization (KV leg landed, weights leg open)
67
+ - [unified-engine-frontier-plan.md](../docs/design/unified-engine-frontier-plan.md) — Engine architecture — four layers, per-scheme oracles, one request path
68
+ - [web-chat-redesign.md](../docs/design/web-chat-redesign.md) — Web chat — the built-in chat surface (canonical design)
69
+
70
+ ## docs/planning/
71
+
72
+ Living product/vision docs (USING side).
73
+
74
+ - [PRODUCT_ROADMAP.md](../docs/planning/PRODUCT_ROADMAP.md) — PRODUCT ROADMAP
75
+ - [ResearchTopics.md](../docs/planning/ResearchTopics.md) — Research Topics
76
+ - [release-notes-v0.4.0.md](../docs/planning/release-notes-v0.4.0.md) — mlx-bun v0.4.0
77
+ - [video-series.md](../docs/planning/video-series.md) — mlx-bun video series
78
+
79
+ ## docs/reference/
80
+
81
+ User-facing reference — the ONLY home for flags, routes, models, numbers, and environment facts.
82
+
83
+ - [benchmarks.md](../docs/reference/benchmarks.md) — mlx-bun benchmark results (curated)
84
+ - [cli.md](../docs/reference/cli.md) — CLI reference
85
+ - [distribution.md](../docs/reference/distribution.md) — Distributing mlx-bun — build, sign, notarize, publish
86
+ - [environment.md](../docs/reference/environment.md) — Reference environment and platform facts
87
+ - [glossary.md](../docs/reference/glossary.md) — mlx-bun serving
88
+ - [library-api.md](../docs/reference/library-api.md) — Library API
89
+ - [memory.md](../docs/reference/memory.md) — Memory — the personal wiki
90
+ - [models.md](../docs/reference/models.md) — Models: supported roster + management (get / scan / ls / gc)
91
+ - [server-api.md](../docs/reference/server-api.md) — Server API
92
+ - [server-config.md](../docs/reference/server-config.md) — Server configuration
93
+ - [training.md](../docs/reference/training.md) — Training / fine-tuning reference
94
+ - [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),
@@ -0,0 +1,198 @@
1
+ # OpenJarvis research and fit with mlx-bun
2
+
3
+ Inspected September 8, 2026. OpenJarvis source revision
4
+ [`e25e77d36ee487aa456978e7a7f19a7f6d712260`](https://github.com/open-jarvis/OpenJarvis/tree/e25e77d36ee487aa456978e7a7f19a7f6d712260).
5
+ mlx-bun revision `673b43f39b88d8f6438e625aaaceca00851d0fbf`.
6
+ This is a source/documentation review, not a reproduced benchmark or a verified
7
+ live integration. No servers, model downloads, inference, or training ran.
8
+
9
+ OpenJarvis is useful both as a possible consumer of mlx-bun and as prior work
10
+ for the local adaptation research. Its most useful architectural idea is a
11
+ versioned configuration that can be evaluated and changed across model,
12
+ agent, tools, memory, and runtime settings. mlx-bun already supplies several
13
+ of those components. The remaining opportunity is to connect them through
14
+ replayable task evidence and controlled updates.
15
+
16
+ ## What the diagram means for this project
17
+
18
+ The [architecture documentation][architecture] separates five configurable
19
+ components. Interfaces and hardware surround them. The table maps those
20
+ roles to documented mlx-bun capabilities; it does not claim identical scope.
21
+
22
+ | OpenJarvis component | Existing mlx-bun contribution | Work above or around the engine |
23
+ |---|---|---|
24
+ | Intelligence | Supported model graphs, model discovery, quantization and adapters | Task-aware model/adapter selection, with measured loading and switching costs |
25
+ | Engine | Native MLX inference, HTTP serving, TypeScript library, caching and batching | An OpenJarvis compatibility check and an adapter for richer runtime measurements |
26
+ | Agents | Built-in Pi and integration with an external Pi | Compare task loops, including bounded RLM, outside numerical inference code |
27
+ | Tools and memory | Pi tools, embeddings, personal Markdown wiki and synthesis | Common tool contracts, evidence provenance and replayable memory snapshots |
28
+ | Learning | LoRA SFT/DPO/ORPO training and adapter serving | Verified data collection, candidate evaluation, retention tests and promotion |
29
+ | User interfaces | CLI and browser application | Messaging/desktop integrations only when a concrete workload needs them |
30
+
31
+ Local sources: [CLI](../../reference/cli.md),
32
+ [library API](../../reference/library-api.md),
33
+ [server API](../../reference/server-api.md),
34
+ [memory](../../reference/memory.md), [training](../../reference/training.md).
35
+ The Dreaming is memory synthesis, not weight training. Its current
36
+ [`runPipeline`](../../../src/memory/pipeline.ts) assumes conversations are
37
+ already ingested; closing that ingestion gap remains existing work.
38
+ Serving a model does not imply its architecture supports every training path.
39
+
40
+ ## RLM implementation and its limits
41
+
42
+ OpenJarvis includes a concrete [`RLMAgent`][rlm] with a persistent Python
43
+ [`RLMRepl`][repl]. It installs external context in a variable, executes
44
+ model-written code, exposes `llm_query` and `llm_batch`, and can return an
45
+ answer through `FINAL`, `FINAL_VAR`, or the `answer` dictionary.
46
+
47
+ This is a useful reference for the bounded external-context experiment in
48
+ the existing `harness_research/RESEARCH_PROGRAM.md`. It belongs in the task
49
+ execution loop. A separate optimizer could improve its prompt, decomposition
50
+ rules or tool configuration over time.
51
+
52
+ The inspected implementation has several details an experiment must account for:
53
+
54
+ - `llm_batch` runs subqueries sequentially. Its name does not imply engine
55
+ batching or parallel execution.
56
+ - Subqueries call `engine.generate` directly and can resolve one round of
57
+ returned tool calls. They do not create child REPL agents. This path should
58
+ not be described as arbitrary-depth recursive RLM execution.
59
+ - `AgentResult.metadata` accumulates root-call usage. `_make_sub_query`
60
+ returns text and does not add leaf or follow-up usage to that accumulator.
61
+ Measure every backend request independently for whole-task accounting.
62
+ - Root turns and per-call output tokens have limits, but these methods do not
63
+ impose one shared subcall/token/deadline budget. A single REPL program can
64
+ request many leaves. Enforce shared admission limits in a request broker.
65
+ - The REPL checks prohibited substrings and then invokes in-process Python
66
+ `exec`. Output truncation happens after execution. These mechanisms are not
67
+ process isolation or a hard execution/memory deadline. The project has
68
+ separate sandbox facilities; a benchmark must explicitly select isolation
69
+ and keep authoritative evaluation data outside the candidate environment.
70
+ - `_resolve_context` reads `AgentContext.metadata["context"]` or memory
71
+ results, while the normal user input still enters the root prompt.
72
+ Put the large corpus in the external-context field, not the user question.
73
+ Existing conversation messages are also retained by
74
+ [`BaseAgent._build_messages`][base-agent].
75
+
76
+ The appropriate comparison remains retrieval versus an external-context
77
+ REPL without subcalls versus bounded depth-1 RLM, on dense document
78
+ aggregation. Small lookup tasks establish connectivity but give weak
79
+ evidence about RLM's value. On a serial Mac GPU, extra model calls can erase
80
+ the benefit of smaller contexts; measure complete tasks.
81
+
82
+ ## Self-improvement is several separate implementations
83
+
84
+ | Mechanism | What the inspected source establishes |
85
+ |---|---|
86
+ | Learned routing | [`LearnedRouterPolicy`][routing] maps coarse query classes to models using trace outcomes and feedback. This is distinct from training language-model weights. |
87
+ | Configuration search | [`SpecSearchOrchestrator`][search] connects diagnosis, typed edit planning, execution, evaluation and recording. Runtime dependencies must be supplied. |
88
+ | Candidate gate | [`BenchmarkGate`][gate] compares overall score and per-cluster regressions using a versioned benchmark and repeatable subsample seed. |
89
+ | Weight training | [`SFTTrainer`][sft] delegates LoRA training to a separate trainer. [`GRPOTrainer`][grpo] contains a Torch/Transformers training loop with policy and reference models. Neither was executed in this review. |
90
+ | Weight updates inside spec search | [`LoraStubApplier`][lora-stub] rejects `LORA_FINETUNE` and raises `NotImplementedError` if applied. Separate trainers do not establish an integrated spec-search training cycle. |
91
+
92
+ The [spec-search guide][search-guide] describes a teacher diagnosing local
93
+ student failures and proposing changes. Its quickstart uses fake
94
+ teacher/student/judge components. It illustrates the orchestration, not
95
+ measured improvement by a deployed learning system.
96
+
97
+ There is documentation drift worth preserving in a reproduction. The guide's
98
+ gate predicate requires improvement on the targeted failure cluster. The
99
+ inspected `BenchmarkGate.evaluate` instead requires improvement in overall
100
+ score and rejects excessive per-cluster regressions; it receives no target
101
+ cluster argument. Its constructor defaults to a 0.05 regression allowance,
102
+ while the guide's configuration uses 0.01. `from_config` forwards the supplied
103
+ value. Pin the actual configuration and predicate instead of assuming that
104
+ the prose, constructor defaults, and configured execution are interchangeable.
105
+
106
+ The [learning architecture page][learning] also describes older router names
107
+ and a GRPO router stub. Current learned routing is consolidated in
108
+ `learning/routing/learned_router.py`, while the separate intelligence GRPO
109
+ trainer has implementation code. A blanket claim that "GRPO is a stub"
110
+ would therefore be misleading.
111
+
112
+ The [paper][paper] is close prior work for the research program: it studies
113
+ typed specifications and teacher-guided edits across several components,
114
+ with local inference after search. Its reported experiments span multiple
115
+ models and hardware classes, including Macs and larger workstations.
116
+ They do not establish the same gains on our M1 Max or M4 Pro, or prove that
117
+ the checked-out code reproduces every reported experiment. Its acknowledged
118
+ limitations include judge bias, statistical precision and search convergence.
119
+ We should reproduce a bounded comparison before adopting performance claims.
120
+
121
+ ## Integration path
122
+
123
+ The current [engine registry][engines] already registers `MLXEngine` through
124
+ the shared [`_OpenAICompatibleEngine`][http-engine]. That class accepts a
125
+ host URL, probes `/v1/models`, and calls `/v1/chat/completions`. The generic
126
+ `OpenAICompatEngine` offers the same interface for explicit endpoints.
127
+ This makes using mlx-bun as the inference backend a plausible small
128
+ integration, without importing OpenJarvis into the inference engine.
129
+
130
+ For a future smoke test, construct the generic engine with mlx-bun's origin
131
+ URL, without `/v1`, and choose the exact model ID from `list_models()`.
132
+ Check plain completion, tool-call round trips, streaming completion/error
133
+ handling, cancellation, reasoning output, model identity and usage against
134
+ raw HTTP responses. This review did not perform that test.
135
+
136
+ Two adapter behaviors need special attention:
137
+
138
+ - Synchronous generation retries a tool-bearing HTTP 400 without `tools`
139
+ and `tool_choice`. A successful retry does not establish tool compatibility.
140
+ - It takes the maximum of reported prompt tokens and an estimate, and labels
141
+ reported prompt tokens as `prompt_tokens_evaluated`. Those fields cannot
142
+ establish actual prefill work or cache reuse. Retain raw server measurements.
143
+
144
+ Use HTTP for the first comparison. A direct TypeScript implementation can
145
+ later use mlx-bun's library if measured requirements justify it.
146
+
147
+ ## Recommended direction
148
+
149
+ Keep mlx-bun responsible for inference correctness, resource management,
150
+ training execution and adapter lifecycle. Keep experimental task loops and
151
+ the process that changes them in `harness_research` initially. Use the same
152
+ backend for Pi, a controlled loop and OpenJarvis comparisons.
153
+
154
+ The next useful steps extend the existing research program:
155
+
156
+ 1. Complete the already proposed repeated-failure-feedback experiment in
157
+ `harness_research/NEXT_EXPERIMENT.md`. OpenJarvis strengthens the case for
158
+ including both a prompt-only comparison and executable loop changes.
159
+ 2. Define an immutable run identity covering model artifact, quantization,
160
+ adapter, agent code, prompts, tools, memory snapshot, runtime settings,
161
+ task revision and evaluation revision. Record all root/leaf/teacher calls.
162
+ 3. Add an OpenJarvis baseline through HTTP after the compatibility checks.
163
+ Preserve its full configuration and raw request trace.
164
+ 4. Run the separate RLM ablation with one shared request budget, isolated
165
+ execution and serial GPU admission. Include forced finalization in costs.
166
+ 5. Introduce typed candidate edits, frozen evaluation and rollback. Start with
167
+ bounded prompt/tool/loop changes before searching many dimensions together.
168
+ 6. Connect verified examples to existing LoRA training only after the fixed
169
+ task loop is measurable. Compare frozen, controller-only, adapter-only and
170
+ combined adaptation, including retention and collection/training/eval cost.
171
+
172
+ Personal memory, task scratch state, training data and learned adapters need
173
+ separate identities. A useful memory article is not automatically a training
174
+ example, and a plausible answer is not automatically a verified success.
175
+ Background synthesis, judging and training all consume the same Mac budget.
176
+ The existing serialized scheduling proposal remains appropriate for the first
177
+ study; this research supplies no evidence for concurrent training and serving.
178
+
179
+ The opportunity is a local system that improves verified task outcomes while
180
+ remaining usable on a personal Mac. OpenJarvis provides a close comparison
181
+ and concrete implementation ideas. Our differentiator must be demonstrated
182
+ through that complete operating loop, including its costs and failures.
183
+
184
+ [architecture]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/docs/architecture/overview.md
185
+ [learning]: https://open-jarvis.github.io/OpenJarvis/architecture/learning/
186
+ [paper]: https://arxiv.org/html/2605.17172v1
187
+ [rlm]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/agents/rlm.py
188
+ [repl]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/agents/rlm_repl.py
189
+ [base-agent]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/agents/_stubs.py
190
+ [routing]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/learning/routing/learned_router.py
191
+ [search]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/learning/spec_search/orchestrator.py
192
+ [gate]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/learning/spec_search/gate/benchmark_gate.py
193
+ [sft]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/learning/intelligence/sft_trainer.py
194
+ [grpo]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/learning/intelligence/grpo_trainer.py
195
+ [lora-stub]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/learning/spec_search/execute/appliers/lora_stub.py
196
+ [search-guide]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/docs/user-guide/llm-guided-spec-search.md
197
+ [engines]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/engine/openai_compat_engines.py
198
+ [http-engine]: https://github.com/open-jarvis/OpenJarvis/blob/e25e77d36ee487aa456978e7a7f19a7f6d712260/src/openjarvis/engine/_openai_compat.py
@@ -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