mlx-bun 0.0.7 → 0.0.9

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 (138) hide show
  1. package/README.md +112 -20
  2. package/docs/design/batching-v2-plan.md +515 -0
  3. package/docs/design/bucketing-stage.md +196 -0
  4. package/docs/design/compat-cli-surface-design.md +11 -11
  5. package/docs/design/diffusion-gemma-port.md +602 -0
  6. package/docs/design/docs-reorg-plan.md +1 -1
  7. package/docs/design/dreaming-nightly-pipeline.md +291 -0
  8. package/docs/design/dspark-speculative-decoding.md +106 -0
  9. package/docs/design/generic-model-support.md +381 -0
  10. package/docs/design/memory-inference-path.md +422 -0
  11. package/docs/design/memory-synthesis.md +287 -0
  12. package/docs/design/minicpm5-decode-megakernel.md +484 -0
  13. package/docs/design/mlx-lm-tool-parity-plan.md +535 -0
  14. package/docs/design/orpo-dynamic-lambda.md +41 -0
  15. package/docs/design/orpo-training.md +35 -5
  16. package/docs/design/parallel-slots.md +12 -1
  17. package/docs/design/parity-tier-dag.md +13 -5
  18. package/docs/design/spec-decode-larger-targets.md +229 -0
  19. package/docs/design/tauri-desktop-app.md +2 -2
  20. package/docs/design/the-dreaming-handoff.md +141 -0
  21. package/docs/design/the-dreaming-master-plan.md +446 -0
  22. package/docs/design/write-pipeline-entity.md +468 -0
  23. package/docs/investigations/curve-bisector-routing.md +1 -1
  24. package/docs/investigations/decode-roofline-lookagain.md +262 -0
  25. package/docs/investigations/dspark-handoff.md +58 -0
  26. package/docs/investigations/kernel-perf-review-2026-07.md +92 -0
  27. package/docs/planning/PRODUCT_ROADMAP.md +2 -2
  28. package/docs/planning/curve-sampler-research-plan.md +331 -0
  29. package/docs/planning/memory-docs-and-dag-plan.md +185 -0
  30. package/docs/planning/pi-integration-review.md +178 -0
  31. package/docs/planning/release-notes-v0.0.9.md +122 -0
  32. package/docs/planning/web-ui-pass-plan.md +213 -0
  33. package/docs/planning/website-readme-pass-plan.md +224 -0
  34. package/docs/reference/cli.md +255 -0
  35. package/docs/reference/embedding.md +7 -2
  36. package/docs/reference/library-api.md +22 -3
  37. package/docs/reference/memory.md +5 -5
  38. package/docs/reference/models.md +137 -0
  39. package/docs/reference/orpo-quickstart.md +6 -0
  40. package/docs/reference/server-api.md +187 -9
  41. package/docs/reference/server-config.md +40 -9
  42. package/docs/reference/training.md +25 -11
  43. package/package.json +1 -1
  44. package/src/anthropic.ts +22 -0
  45. package/src/assets/curve-designer.html +1 -1
  46. package/src/chat-template.ts +25 -7
  47. package/src/cli.ts +1029 -86
  48. package/src/config.ts +54 -3
  49. package/src/diffusion/diffusion-generate.ts +436 -0
  50. package/src/download.ts +99 -8
  51. package/src/embed.ts +77 -0
  52. package/src/eval/perplexity.ts +164 -0
  53. package/src/eval/runner.ts +19 -7
  54. package/src/eval/tasks/bfcl.ts +1 -1
  55. package/src/generate.ts +196 -19
  56. package/src/harness-pi.ts +43 -17
  57. package/src/index.ts +2 -0
  58. package/src/lora.ts +2 -2
  59. package/src/memory/article.ts +558 -0
  60. package/src/memory/chunk-validation.ts +150 -0
  61. package/src/memory/chunk.ts +305 -12
  62. package/src/memory/cluster.ts +344 -17
  63. package/src/memory/coverage.ts +134 -0
  64. package/src/memory/crosslink.ts +0 -0
  65. package/src/memory/db.ts +184 -45
  66. package/src/memory/entity.ts +203 -0
  67. package/src/memory/gate.ts +187 -0
  68. package/src/memory/history.ts +152 -0
  69. package/src/memory/ingest.ts +324 -11
  70. package/src/memory/model.ts +321 -0
  71. package/src/memory/normalize.ts +671 -0
  72. package/src/memory/parse.ts +22 -0
  73. package/src/memory/pipeline.ts +242 -30
  74. package/src/memory/prompts.ts +42 -0
  75. package/src/memory/query.ts +334 -0
  76. package/src/memory/reconcile.ts +734 -0
  77. package/src/memory/redirect.ts +108 -0
  78. package/src/memory/reindex.ts +325 -0
  79. package/src/memory/resolve.ts +307 -0
  80. package/src/memory/route.ts +272 -0
  81. package/src/memory/schedule.ts +6 -4
  82. package/src/memory/stages.ts +774 -0
  83. package/src/memory/synthesize.ts +1629 -20
  84. package/src/memory/tools.ts +446 -96
  85. package/src/memory/vault.ts +462 -35
  86. package/src/memory/wikify.ts +1057 -16
  87. package/src/mlx/ffi.ts +11 -0
  88. package/src/mlx/ops.ts +113 -0
  89. package/src/model/compiled-decode.ts +43 -8
  90. package/src/model/diffusion-gemma.ts +1026 -0
  91. package/src/model/factory.ts +35 -8
  92. package/src/model/flash-attention.ts +4 -2
  93. package/src/model/fused-decode-kernel.ts +14 -7
  94. package/src/model/fused-mlp-kernel.ts +169 -0
  95. package/src/model/fused-swiglu-kernel.ts +240 -0
  96. package/src/model/gemma4-base.ts +62 -6
  97. package/src/model/gemma4.ts +33 -2
  98. package/src/model/minicpm5.ts +106 -8
  99. package/src/model/qwen3.ts +276 -0
  100. package/src/model/steel-linear-kernel.ts +96 -0
  101. package/src/model/support.ts +45 -7
  102. package/src/model/universal/archs.ts +332 -0
  103. package/src/model/universal/dense.ts +576 -0
  104. package/src/model/universal/modules.ts +163 -0
  105. package/src/model/universal/rope.ts +366 -0
  106. package/src/pi-provider.ts +1 -1
  107. package/src/pi-terminal.ts +29 -8
  108. package/src/pi-web.ts +19 -2
  109. package/src/quantize/config-writer.ts +1 -1
  110. package/src/registry.ts +215 -7
  111. package/src/responses.ts +23 -0
  112. package/src/sampler.ts +220 -9
  113. package/src/serve/batch-scheduler.ts +272 -80
  114. package/src/serve/generation-gateway.ts +90 -18
  115. package/src/server.ts +643 -50
  116. package/src/spec/drafter.ts +81 -49
  117. package/src/spec/dspark/data-dflash.ts +156 -0
  118. package/src/spec/dspark/data.ts +201 -0
  119. package/src/spec/dspark/generate-dflash.ts +193 -0
  120. package/src/spec/dspark/generate.ts +290 -0
  121. package/src/spec/dspark/loss.ts +213 -0
  122. package/src/spec/dspark/module-dflash.ts +361 -0
  123. package/src/spec/dspark/module.ts +540 -0
  124. package/src/spec/dspark/sample.ts +112 -0
  125. package/src/spec/generate.ts +40 -19
  126. package/src/status-page.html +1 -1
  127. package/src/tokenizer.ts +7 -0
  128. package/src/train/diffusion-lora.ts +216 -0
  129. package/src/train/flash-cce.ts +70 -15
  130. package/src/train/fuse.ts +243 -0
  131. package/src/train/index.ts +3 -0
  132. package/src/train/job.ts +8 -0
  133. package/src/train/loss.ts +289 -30
  134. package/src/train/prefix-shared.ts +33 -5
  135. package/src/train/segmented.ts +67 -11
  136. package/src/train/trainer.ts +92 -28
  137. package/src/vision/diffusion-vision.ts +620 -0
  138. package/src/web/skills/memory/SKILL.md +40 -17
@@ -20,26 +20,49 @@ the user's machine. Nothing about their memory leaves the device.
20
20
 
21
21
  When the answer depends on personal continuity — an explicit memory/recall
22
22
  request, or a named project, person, decision, preference, or history that is
23
- not explained in the current chat — consult memory before answering or asking
24
- the user to re-explain.
23
+ not explained in the current chat — look it up **before** answering or asking
24
+ the user to re-explain. Doing the lookup first, instead of answering from first
25
+ principles, is itself the helpful move.
25
26
 
26
27
  Do **not** use memory for weather, current public facts, generic web research,
27
28
  or ordinary coding/file tasks when the current files or the web tools answer the
28
29
  question. Memory is for user-specific context, not for performing familiarity.
29
30
 
30
- 1. **Search.** Call `memory_search` with the topic (plain phrasing is fine —
31
- a name or key noun). It returns ranked articles and sample lines.
32
- 2. **Read enough.** For short or central articles, call `memory_read`. For long
33
- articles, use `memory_toc` then `memory_section` to read the relevant part.
34
- The article is the answer — read it rather than reconstructing the user's
35
- position from scattered fragments. Treat it as their current view.
36
- 3. **Follow nearby context when useful.** Use `memory_links` if backlinks or
37
- related concepts matter. `memory_list` gives an overview when search comes up
38
- short. mlx-bun reference docs are separate from personal memory; use
39
- `reference_search`, `reference_read`, and `reference_list` for those.
40
- `memory_status` answers setup/schedule/location questions.
41
- 4. **Use it silently, as a prior.** Let what you find shape your response like
42
- a long-time colleague would — don't announce "I searched your memory."
31
+ The read path is **FIND the article → READ it small → answer**. It is
32
+ deterministic navigation — never a vector search, and there is no way to
33
+ query/sort articles by an infobox field (the infobox is facts you *read*, via
34
+ `memory_infobox`, not a filter).
35
+
36
+ 1. **FIND the article.**
37
+ - When the user names a specific thing, person, or project, call
38
+ `memory_resolve` with the name as said ("S5 IIX", "the Lumix"). It returns
39
+ the matched stem, title, kind, and lead — no search, no guessing.
40
+ - For "what do I have about X", call `memory_category` with a `category`
41
+ (e.g. `Lenses`), `type`, or `series`. This is membership, not search: it
42
+ lists the articles that are actually about X.
43
+ 2. **READ it small (the default).** Call `memory_read` to get the article's TOC
44
+ + lead, then `memory_section` to read just the **one** section you need. The
45
+ whole article is the exception — pass `force=true` only when you truly need
46
+ all of it. The article is the user's consolidated current position; read it
47
+ rather than reconstructing their view from scattered fragments.
48
+ 3. **Follow the graph / read the infobox when useful.** `memory_links` shows
49
+ outgoing links grouped by origin (infobox / series / see also / prose) plus
50
+ backlinks — use it to hop to a neighbour (e.g. from a camera's infobox
51
+ `mount: [[L-Mount]]` to the mount article). `memory_infobox` surfaces the
52
+ structured facts to read. `memory_list` is a bare overview;
53
+ `memory_status` answers setup/schedule/location questions. mlx-bun reference
54
+ docs are separate from personal memory; use `reference_search`,
55
+ `reference_read`, and `reference_list` for those.
56
+ 4. **`memory_search` is the LAST resort.** Only fall back to it when
57
+ `memory_resolve` / `memory_category` have failed across a couple of
58
+ phrasings. It is a plain substring scan that doesn't understand meaning.
59
+ 5. **Use it silently, as a continuation.** Let what you find shape your response
60
+ like a long-time colleague who already knows the state of things. Speak as a
61
+ continuation, never as a retrieval report: do not preface answers with "per
62
+ the wiki…", "according to the article…", "I checked your memory…", or
63
+ "welcome back, I see you're working on X". Cite an article by name only if
64
+ the user asks where something came from, or to distinguish "the wiki says X"
65
+ from "I think Y".
43
66
 
44
67
  Use memory as an invisible prior: it should narrow relevance and improve the
45
68
  answer, not become the topic of the answer. Avoid performative recall — do not
@@ -85,8 +108,8 @@ wiki, scheduling nightly synthesis). Confirm before each persistent action.
85
108
 
86
109
  ## What not to do
87
110
 
88
- - Don't claim a fact "from memory" that you didn't read in an article — search
89
- and read first, or say you don't have it.
111
+ - Don't claim a fact "from memory" that you didn't read in an article — find
112
+ and read the article first, or say you don't have it.
90
113
  - Don't write to or edit the wiki during a normal conversation; the read tools
91
114
  are read-only by design. Synthesis is a separate, deliberate step.
92
115
  - Do open the wiki or a specific article in Obsidian/Finder if the user asks to