mlx-bun 0.0.10 → 0.0.12
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.
- package/README.md +107 -32
- package/THIRD_PARTY_LICENSES.md +10 -0
- package/docs/archive/mlx-bun-lab-report.html +275 -0
- package/docs/archive/wwdc-mlx-bun.html +848 -0
- package/docs/design/audio-input-plan.md +356 -0
- package/docs/design/batching-perf-path.md +58 -35
- package/docs/design/batching-v2-plan.md +23 -9
- package/docs/design/bucketing-stage.md +2 -1
- package/docs/design/colibri-glm52-port.md +1479 -0
- package/docs/design/compat-cli-surface-design.md +4 -3
- package/docs/design/decode-speed-program.md +172 -0
- package/docs/design/docs-reorg-plan.md +1 -1
- package/docs/design/dspark-serving-program.md +371 -0
- package/docs/design/dspark-speculative-decoding.md +167 -5
- package/docs/design/faithful-l1-consolidation.md +310 -0
- package/docs/design/generic-model-support.md +8 -5
- package/docs/design/grammar-spec-batching-integration.md +301 -0
- package/docs/design/minicpm5-decode-megakernel.md +16 -11
- package/docs/design/mlx-lm-tool-parity-plan.md +11 -1
- package/docs/design/omlx-adoption-map.md +14 -6
- package/docs/design/orpo-training.md +34 -30
- package/docs/design/paged-kv-cache.md +214 -0
- package/docs/design/parallel-slots.md +82 -49
- package/docs/design/parity-tier-dag.md +43 -33
- package/docs/design/pre-colibri-stabilization.md +329 -0
- package/docs/design/repo-cleanup-plan.md +189 -0
- package/docs/design/runtime-isolation.md +19 -3
- package/docs/design/segmented-backward-training.md +3 -2
- package/docs/design/ssd-kv-cold-tier.md +130 -0
- package/docs/design/structured-output.md +484 -0
- package/docs/design/the-dreaming-master-plan.md +2 -3
- package/docs/design/turboquant-kv.md +235 -0
- package/docs/design/unified-engine-frontier-plan.md +774 -0
- package/docs/design/web-chat-beat-matrix.md +315 -0
- package/docs/design/web-chat-redesign.md +1112 -0
- package/docs/investigations/colibri-oracle-pin.md +1284 -0
- package/docs/investigations/dspark-handoff.md +182 -16
- package/docs/investigations/indexshare-performance-spike.md +357 -0
- package/docs/investigations/lab-build-journal.md +2 -2
- package/docs/investigations/openwiki-evaluation.md +249 -0
- package/docs/planning/IDEAS.md +14 -0
- package/docs/planning/PRODUCT_ROADMAP.md +2 -3
- package/docs/planning/chat-ui-vision-memory-first.md +199 -0
- package/docs/planning/chat-ui-vision.md +50 -0
- package/docs/planning/memory-docs-and-dag-plan.md +15 -6
- package/docs/planning/release-notes-v0.0.11.md +239 -0
- package/docs/planning/release-notes-v0.0.12.md +80 -0
- package/docs/reference/cli.md +63 -18
- package/docs/reference/distribution.md +37 -6
- package/docs/reference/embedding.md +40 -16
- package/docs/reference/features-matrix.md +99 -0
- package/docs/reference/library-api.md +69 -20
- package/docs/reference/memory.md +26 -6
- package/docs/reference/models.md +60 -3
- package/docs/reference/orpo-quickstart.md +3 -4
- package/docs/reference/server-api.md +717 -24
- package/docs/reference/server-config.md +265 -129
- package/docs/reference/training.md +24 -16
- package/package.json +5 -3
- package/src/anthropic.ts +67 -44
- package/src/audio/conformer.ts +647 -0
- package/src/audio/decode.ts +133 -0
- package/src/audio/features.ts +202 -0
- package/src/audio/transcode.ts +67 -0
- package/src/chat-template.ts +155 -10
- package/src/cli.ts +483 -113
- package/src/config.ts +116 -24
- package/src/diffusion/diffusion-generate.ts +14 -8
- package/src/download.ts +143 -12
- package/src/eval/README.md +7 -6
- package/src/eval/ifeval.ts +63 -120
- package/src/eval/kl.ts +59 -3
- package/src/eval/quality-db.ts +2 -2
- package/src/eval/runner.ts +17 -8
- package/src/eval/tasks/ifeval.ts +167 -31
- package/src/expert-io.ts +391 -0
- package/src/expert-offload.ts +15 -2
- package/src/expert-residency.ts +1134 -0
- package/src/expert-usage.ts +415 -0
- package/src/flags.ts +13 -0
- package/src/generate.ts +438 -35
- package/src/grammar.ts +585 -0
- package/src/hf-push.ts +1 -1
- package/src/hub-rest.ts +242 -0
- package/src/index.ts +14 -2
- package/src/jobs/runner.ts +37 -18
- package/src/kv-store.ts +586 -93
- package/src/lora.ts +85 -14
- package/src/md-modules.d.ts +42 -0
- package/src/media-fetch.ts +426 -0
- package/src/memory/rest.ts +245 -0
- package/src/memory/vault.ts +74 -0
- package/src/mlx/array.ts +149 -19
- package/src/mlx/autograd.ts +53 -16
- package/src/mlx/checkpoint.ts +46 -13
- package/src/mlx/custom-vjp.ts +83 -35
- package/src/mlx/ffi.ts +27 -3
- package/src/mlx/metal-kernel.ts +7 -4
- package/src/mlx/ops.ts +153 -23
- package/src/mlx/turboquant-ops.ts +831 -0
- package/src/mlx/turboquant-tables.ts +237 -0
- package/src/model/batched-mask.ts +62 -1
- package/src/model/batched-quant.ts +206 -0
- package/src/model/batched-rotating-quant.ts +346 -0
- package/src/model/batched-rotating.ts +46 -1
- package/src/model/compiled-decode.ts +4 -15
- package/src/model/factory.ts +103 -6
- package/src/model/gemma4-base.ts +395 -39
- package/src/model/gemma4.ts +122 -33
- package/src/model/generated/gemma4-12b.ts +9 -13
- package/src/model/generated/gemma4-26b.ts +10 -5
- package/src/model/generated/gemma4-e4b.ts +14 -9
- package/src/model/glm52-atlas.ts +511 -0
- package/src/model/glm52-cache.ts +706 -0
- package/src/model/glm52-config.ts +262 -0
- package/src/model/glm52-container.ts +305 -0
- package/src/model/glm52-coupling.ts +388 -0
- package/src/model/glm52-dsa.ts +602 -0
- package/src/model/glm52-expert-layout.ts +253 -0
- package/src/model/glm52-layout.ts +152 -0
- package/src/model/glm52-memory.ts +473 -0
- package/src/model/glm52-mla.ts +786 -0
- package/src/model/glm52-moe.ts +223 -0
- package/src/model/glm52-pilot.ts +537 -0
- package/src/model/glm52-reference.ts +445 -0
- package/src/model/glm52-residency.ts +557 -0
- package/src/model/glm52-resident-weights.ts +135 -0
- package/src/model/glm52-streamed-experts.ts +453 -0
- package/src/model/glm52-streamed-metal.ts +610 -0
- package/src/model/glm52-weights.ts +503 -0
- package/src/model/glm52.ts +1153 -0
- package/src/model/minicpm5.ts +58 -102
- package/src/model/paged-kv.ts +253 -0
- package/src/model/qwen3-delta.ts +76 -15
- package/src/model/qwen3-moe.ts +404 -0
- package/src/model/qwen3.ts +9 -8
- package/src/model/qwen3_5.ts +88 -23
- package/src/model/support.ts +19 -1
- package/src/model/universal/dense.ts +40 -5
- package/src/model/universal/rope.ts +36 -21
- package/src/native/expert_io.c +523 -0
- package/src/native-pack.ts +6 -4
- package/src/pi-web.ts +1299 -82
- package/src/preflight.ts +27 -8
- package/src/prompt-cache.ts +293 -33
- package/src/quantize/quantizer.ts +16 -1
- package/src/registry.ts +57 -2
- package/src/responses.ts +62 -49
- package/src/serve/batch-scheduler.ts +1050 -78
- package/src/serve/generation-gateway.ts +252 -24
- package/src/serve/isolate.ts +417 -0
- package/src/serve/lane-registry.ts +44 -0
- package/src/serve/session-search.ts +326 -0
- package/src/server.ts +1701 -175
- package/src/spec/assistant-source.ts +150 -0
- package/src/spec/deepspec-source.ts +143 -0
- package/src/spec/dflash-source.ts +124 -0
- package/src/spec/dspark/ab-stats.ts +136 -0
- package/src/spec/dspark/calibration.ts +112 -0
- package/src/spec/dspark/deepspec-module.ts +801 -0
- package/src/spec/dspark/generate-dflash.ts +72 -20
- package/src/spec/dspark/loader.ts +23 -0
- package/src/spec/dspark/module-dflash.ts +278 -36
- package/src/spec/dspark/quantize-drafter.ts +91 -0
- package/src/spec/generate.ts +59 -25
- package/src/spec/glm52-mtp-source.ts +392 -0
- package/src/spec/ngram-source.ts +132 -0
- package/src/spec/serve-loop.ts +617 -0
- package/src/spec/source.ts +118 -0
- package/src/spec/two-model.ts +171 -0
- package/src/ssd-cache.ts +111 -35
- package/src/tokenizer.ts +288 -2
- package/src/tool-approvals.ts +131 -0
- package/src/tool-call.ts +438 -22
- package/src/train/flash-cce.ts +2 -2
- package/src/train/job.ts +0 -12
- package/src/train/lora-params.ts +17 -6
- package/src/train/trainer.ts +60 -30
- package/src/vision/prompt.ts +217 -48
- package/src/web/app.html +1197 -1791
- package/src/web/app.js +5694 -0
- package/src/web/icon.svg +13 -0
- package/src/web/manifest.webmanifest +24 -0
- package/src/web/src/adapters-panel.ts +288 -0
- package/src/web/src/api.ts +57 -0
- package/src/web/src/assistant.ts +485 -0
- package/src/web/src/chat.ts +1050 -0
- package/src/web/src/composer.ts +959 -0
- package/src/web/src/dataset.ts +132 -0
- package/src/web/src/finetune.ts +267 -0
- package/src/web/src/hub.ts +428 -0
- package/src/web/src/main.ts +98 -0
- package/src/web/src/markdown.ts +0 -0
- package/src/web/src/memory-panel.ts +572 -0
- package/src/web/src/model-picker.ts +159 -0
- package/src/web/src/palette.ts +346 -0
- package/src/web/src/protocol.ts +62 -0
- package/src/web/src/quantize.ts +167 -0
- package/src/web/src/rag.ts +274 -0
- package/src/web/src/sessions.ts +469 -0
- package/src/web/src/shell.ts +804 -0
- package/src/web/src/status.ts +300 -0
- package/src/web/src/ui-catalog.ts +92 -0
- package/src/web/sw.js +71 -0
- package/src/web/vendor/README.md +61 -0
- package/src/web/vendor/hljs-LICENSE +29 -0
- package/src/web/vendor/hljs-theme.css +59 -0
- package/src/web/vendor/hljs.js +26 -0
- package/src/web-tools.ts +54 -2
- package/src/weights.ts +82 -19
- package/src/model/fused-decode-kernel.ts +0 -312
- package/src/model/fused-geglu-kernel.ts +0 -198
- package/src/model/fused-mlp-kernel.ts +0 -169
- package/src/model/fused-swiglu-kernel.ts +0 -240
- package/src/model/steel-linear-kernel.ts +0 -96
- package/src/status-page.html +0 -497
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# OpenWiki — evaluation & fit analysis
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-07-06
|
|
4
|
+
**Author:** investigation (agent), worktree `investigate/openwiki-memory`
|
|
5
|
+
**Subject:** [langchain-ai/openwiki](https://github.com/langchain-ai/openwiki) — "a CLI that writes and
|
|
6
|
+
maintains agent documentation for your codebase, built specifically for agents to consume."
|
|
7
|
+
**Question asked:** how (if at all) does OpenWiki fit inside our memory system ("The Dreaming"), and
|
|
8
|
+
is it a good fit anywhere else in mlx-bun?
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## TL;DR — four verdicts
|
|
13
|
+
|
|
14
|
+
| # | Question | Verdict | One-liner |
|
|
15
|
+
|---|----------|---------|-----------|
|
|
16
|
+
| 1 | Adopt OpenWiki **as the memory engine**? | ❌ **No** | Architecturally the mirror-image of The Dreaming; would throw away the hard-won decomposition + gate design and drag LangChain into a Bun/MLX-only repo. |
|
|
17
|
+
| 2 | Borrow OpenWiki **patterns** into memory? | 🟡 **Marginal** | We already independently arrived at its good ideas, usually in stronger form. One minor borrow (the `_plan.md` durable-plan artifact). |
|
|
18
|
+
| 3 | Run OpenWiki **on mlx-bun the repo** (its own agent docs)? | ✅ **Yes, good fit** | It targets exactly our named failure mode — reference-doc drift — and runs as an external dev tool, not a vendored dep. |
|
|
19
|
+
| 4 | Point OpenWiki **at our own OpenAI-compatible server**? | ✅ **Yes — the strategic find** | DeepAgents-over-local-mlx-bun is an on-brand, zero-cloud dogfood showcase *and* a hard agentic-tool-use conformance test for the server. |
|
|
20
|
+
|
|
21
|
+
The headline: **OpenWiki is not a fit *inside* the memory pipeline, but it is a fit *around* mlx-bun** —
|
|
22
|
+
as a doc tool for our own repo and, more interestingly, as a real LangChain agent to run *against* our
|
|
23
|
+
server to prove the "drop-in, local, agentic" thesis.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 1. What OpenWiki is (full rundown)
|
|
28
|
+
|
|
29
|
+
A CLI (`npm install -g openwiki`) from LangChain, released **v0.0.1 on 2026-07-05** (i.e. one day old at
|
|
30
|
+
time of writing; ~7.7k stars, but 42 open PRs / 48 issues — treat as brand-new and unstable). MIT
|
|
31
|
+
licensed. TypeScript/JavaScript.
|
|
32
|
+
|
|
33
|
+
**Purpose.** Generate and maintain a repo's documentation *for coding agents*, not for humans. The
|
|
34
|
+
generated wiki is "structured markdown optimized for LLM context — headings, cross-references, and
|
|
35
|
+
summaries designed for an agent to quickly find relevant context." Motivation from the launch post:
|
|
36
|
+
*"Agents write better code when they understand the repo they're working in,"* and stuffing the whole
|
|
37
|
+
repo into one `CLAUDE.md` wastes context in large repos.
|
|
38
|
+
|
|
39
|
+
**Surface.**
|
|
40
|
+
```
|
|
41
|
+
openwiki --init # pick provider + API key, then generate the wiki
|
|
42
|
+
openwiki # interactive
|
|
43
|
+
openwiki "<request>" # interactive, seeded
|
|
44
|
+
openwiki -p "<request>" # one-shot, non-interactive
|
|
45
|
+
openwiki --update # refresh from repo changes since last run
|
|
46
|
+
```
|
|
47
|
+
- Writes an `openwiki/` directory of markdown pages.
|
|
48
|
+
- Patches `AGENTS.md` / `CLAUDE.md` with a pointer to the wiki **and a "when to use it" note**.
|
|
49
|
+
- Ships a **GitHub Action** and **GitLab CI** template that open a PR/MR when docs need updating.
|
|
50
|
+
- Config in `~/.openwiki/.env`: provider, API key, model id, optional LangSmith tracing.
|
|
51
|
+
- Providers: OpenRouter (default, an open model), Fireworks, Baseten, OpenAI, Anthropic, and
|
|
52
|
+
**OpenAI-compatible** via `OPENAI_COMPATIBLE_BASE_URL` (also `ANTHROPIC_BASE_URL`). ← load-bearing
|
|
53
|
+
for verdict 4.
|
|
54
|
+
|
|
55
|
+
## 2. How OpenWiki works (architecture)
|
|
56
|
+
|
|
57
|
+
Built on LangChain's **DeepAgents** + **LangGraph**. The construction is deliberately thin:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const agent = createDeepAgent({
|
|
61
|
+
model,
|
|
62
|
+
tools: [], // NO custom tools
|
|
63
|
+
checkpointer, // thread memory
|
|
64
|
+
backend: new LocalShellBackend({ /* vfs → repo root */ }),
|
|
65
|
+
systemPrompt: createSystemPrompt(command),
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **No bespoke tools.** It hands a general coding agent a `LocalShellBackend`: a virtual filesystem
|
|
70
|
+
mapped to the repo root exposing `ls / read_file / write_file / edit_file / glob / grep` plus a
|
|
71
|
+
sandboxed `execute` (120 s timeout, 100 KB output cap). All capability comes from the shell backend.
|
|
72
|
+
- **All the IP is in the system prompt + the loop.** The prompt encodes:
|
|
73
|
+
- **Discovery → plan.** Before writing, the agent writes a temporary `openwiki/_plan.md` listing
|
|
74
|
+
*intended pages, source evidence per page, and remaining questions.*
|
|
75
|
+
- **Granularity rules.** ≤~10 primary source files → a `quickstart.md` + at most 1–2 supporting
|
|
76
|
+
pages. *"Do not create a directory unless it represents a real documentation area."*
|
|
77
|
+
- **One canonical page per concept.** *"Keep each concept in one canonical page… keep the detailed
|
|
78
|
+
explanation in the canonical page and make other mentions brief or link-only."* Inline source-file
|
|
79
|
+
references so a reader can verify.
|
|
80
|
+
- **Surgical, diff-budgeted updates.** On `--update` it *"checks which commits landed since the last
|
|
81
|
+
run, uses git diffs to understand what changed, then updates the wiki."* Soft budget: *"if fewer
|
|
82
|
+
than about 5 source files changed, update at most 1–2 wiki pages… Updates may be a no-op."*
|
|
83
|
+
- **Change detection** by content snapshot (`createOpenWikiContentSnapshot`); persists run metadata
|
|
84
|
+
only when the wiki actually changed.
|
|
85
|
+
- Streaming LangGraph invocation with a checkpointer keyed by `thread_id` (interactive Q&A over the
|
|
86
|
+
wiki + codebase reuses the thread).
|
|
87
|
+
|
|
88
|
+
**Design bet:** a *strong single model* + a *good prompt* + a *free-roaming agent* with raw shell
|
|
89
|
+
tools. Trust the model to hold the repo in its head and write files directly.
|
|
90
|
+
|
|
91
|
+
## 3. The Dreaming, in one screen (for contrast)
|
|
92
|
+
|
|
93
|
+
Our memory system ("The Dreaming", `src/memory/*`, ~12 k LoC, running end-to-end on real data):
|
|
94
|
+
|
|
95
|
+
- **Corpus:** the user's conversation history (pointer-DB of `messages` → `chunks` as
|
|
96
|
+
`(conv,start,end)` ranges), not a code tree.
|
|
97
|
+
- **Engine:** ONE local model (`gemma-4-e4b-it-OptiQ-4bit`) + per-stage LoRAs, loaded once. No cloud.
|
|
98
|
+
- **Pipeline:** `SEGMENT → EXTRACT → ROUTE → SECTION-ROUTE → PATCH → NORMALIZE → LINK → WIKIFY →
|
|
99
|
+
RECONCILE → COMMIT`, every stage the *smallest atomic task* (binary yes/no preferred).
|
|
100
|
+
- **Output:** entity-centric wiki — articles are *things*, with infoboxes, wikilinks, categories.
|
|
101
|
+
- **Invariants enforced by code, not the model:** *"LoRAs propose, gates dispose"* — ≥70% prose floor,
|
|
102
|
+
every citation survives, weak output → NO-OP, deterministic footnote bijection + wikilink
|
|
103
|
+
canonicalization, one git commit per run.
|
|
104
|
+
- **Single writer:** *"Chat agents read memory; `mlx-bun memory synthesize` is the only writer."* Reads
|
|
105
|
+
go through 7 read-only `memory_*` tools + a bundled skill.
|
|
106
|
+
- **Self-healing:** chronological walk; latest statement wins; AI errors silently overwritten.
|
|
107
|
+
|
|
108
|
+
**Design bet:** the exact opposite of OpenWiki — a *weak local model* + *heavy decomposition* +
|
|
109
|
+
*deterministic scaffolding*. Assume the model **cannot** hold an article in its head or be trusted to
|
|
110
|
+
write files freely, and engineer around that.
|
|
111
|
+
|
|
112
|
+
## 4. Head-to-head: same shape, opposite philosophy
|
|
113
|
+
|
|
114
|
+
Both are *"corpus → agentic synthesis → LLM-navigable markdown wiki → agent consumes it, kept fresh
|
|
115
|
+
incrementally."* That surface similarity is why the question is worth asking. But under the hood they
|
|
116
|
+
are mirror images:
|
|
117
|
+
|
|
118
|
+
| Axis | OpenWiki | The Dreaming |
|
|
119
|
+
|------|----------|--------------|
|
|
120
|
+
| Corpus | Code repository | Personal conversation history |
|
|
121
|
+
| Model | Strong cloud model (default OpenRouter) | Weak local e4b + LoRAs, no cloud |
|
|
122
|
+
| Capacity model | Big context — model holds the repo | *Capacity by decomposition* — can't hold an article |
|
|
123
|
+
| Harness | Thin (shell tools + one prompt) | Thick (10-stage DAG, ledgers, gates) |
|
|
124
|
+
| Writes | Agent writes files freely | Single writer, gated, git-committed |
|
|
125
|
+
| Dedup | Prompt rule ("one canonical page") | Deterministic entity name-match routing |
|
|
126
|
+
| Update trigger | `git diff` since last commit | Chronological chunk cursor / new sessions |
|
|
127
|
+
| Self-healing | Re-edit page on diff | Chronological latest-value reconcile |
|
|
128
|
+
| Determinism | Trusts the model | Code enforces invariants |
|
|
129
|
+
| Deps | LangChain + DeepAgents + LangGraph | Bun-native, MLX-only, minimal |
|
|
130
|
+
|
|
131
|
+
Pithily: **OpenWiki = smart model, dumb harness. The Dreaming = dumb model, smart harness.** They solve
|
|
132
|
+
the same *shape* of problem from opposite ends of the model-capability axis.
|
|
133
|
+
|
|
134
|
+
## 5. The four fit verdicts, argued
|
|
135
|
+
|
|
136
|
+
### Verdict 1 — OpenWiki as the memory engine: ❌ No
|
|
137
|
+
|
|
138
|
+
- **Architectural inversion.** The Dreaming's entire thesis is that a local 4-bit e4b *cannot* do
|
|
139
|
+
OpenWiki's free-roaming, hold-it-in-context, write-files-directly loop — which is *why* the
|
|
140
|
+
decomposition + gate architecture exists. Adopting OpenWiki means discarding the exact design that
|
|
141
|
+
makes local synthesis work.
|
|
142
|
+
- **Contract violation.** OpenWiki's agent writes files freely; The Dreaming has a single gated writer
|
|
143
|
+
with a git-commit-per-run audit trail and NO-OP-on-weak-output. These are incompatible write models.
|
|
144
|
+
- **Corpus mismatch.** OpenWiki reads a code tree via shell/grep; The Dreaming reads a pointer-DB of
|
|
145
|
+
conversation chunks with chronological self-healing. Different input, different invariants.
|
|
146
|
+
- **Identity/deps.** Pulling LangChain + LangGraph into a repo whose stated identity is Bun-native,
|
|
147
|
+
MLX-only, minimal-dep, private (see the `mlx-bun scope & framing` and `drop-in replacement` notes)
|
|
148
|
+
is a non-starter as a runtime dependency.
|
|
149
|
+
- **Maturity.** v0.0.1, one day old. Nothing load-bearing should sit on it yet.
|
|
150
|
+
|
|
151
|
+
### Verdict 2 — Borrow OpenWiki's patterns: 🟡 Marginal
|
|
152
|
+
|
|
153
|
+
We have *convergently* arrived at most of OpenWiki's good ideas, usually stronger:
|
|
154
|
+
|
|
155
|
+
| OpenWiki idea | Our equivalent | Who's ahead |
|
|
156
|
+
|---------------|----------------|-------------|
|
|
157
|
+
| `_plan.md` before writing | CREATE flow: sub-cluster → outline → draft | ~tie; their durable, reviewable *plan artifact* is a nice touch |
|
|
158
|
+
| Soft diff budget, updates may be no-op | Idempotency ledger + conservative gate + NO-OP | **us** (ledger is stronger than a prompt heuristic) |
|
|
159
|
+
| One canonical page (prompt rule) | Deterministic entity name-match routing | **us** (mechanism > instruction) |
|
|
160
|
+
| Patch `AGENTS.md`/`CLAUDE.md` with pointer | 7 read-only `memory_*` tools + bundled skill | **us** (tools > prose pointer) |
|
|
161
|
+
| git-diff-driven refresh | chronological chunk cursor | different corpus; both valid |
|
|
162
|
+
|
|
163
|
+
**Only genuinely fresh borrow:** emit a durable, auditable **plan artifact** (their `_plan.md`) in the
|
|
164
|
+
CREATE flow, so a synthesis run's *intended* article/section changes are reviewable in the git diff
|
|
165
|
+
alongside the result. Low effort, small upside. Not worth a dedicated work item; fold in opportunistically.
|
|
166
|
+
|
|
167
|
+
### Verdict 3 — Run OpenWiki on mlx-bun the repo: ✅ Good fit
|
|
168
|
+
|
|
169
|
+
This is where OpenWiki was literally built to help, and mlx-bun is close to a canonical target:
|
|
170
|
+
|
|
171
|
+
- **It attacks our named failure mode.** `CLAUDE.md` calls reference-doc drift *"the observed failure
|
|
172
|
+
mode"* (the 2026-07-03 sweep found undocumented flags, dead version pins). The doc-map even carries a
|
|
173
|
+
manual chore: *"keep these lists in sync with `ls docs/…`."* OpenWiki's diff-driven refresh + CI-PR is
|
|
174
|
+
exactly this job.
|
|
175
|
+
- **Additive, not a replacement.** It would generate a *derived, agent-facing structural index of the
|
|
176
|
+
code* — it does **not** replace the curated, opinionated human docs (`PLAN.md` is "the engineering
|
|
177
|
+
contract"; `STATUS.md`, design docs). Think: an auto-maintained `openwiki/` map of `src/` that points
|
|
178
|
+
back into the hand-written design docs.
|
|
179
|
+
- **Nice synergy with the vault.** The memory vault already symlinks mlx-bun docs into
|
|
180
|
+
`~/.mlx-bun/wiki/Reference/` (read-only). An auto-maintained repo wiki would flow straight into that
|
|
181
|
+
Reference surface — the personal vault gets a fresher code map for free.
|
|
182
|
+
- **Runs as an external dev tool**, a global npm CLI in CI — *not* a vendored dependency. No LangChain
|
|
183
|
+
contamination of the shipped codebase. This sidesteps the Verdict-1 dependency objection entirely.
|
|
184
|
+
|
|
185
|
+
**Caveat:** the one tension is "cloud API on a local/private repo." Verdict 4 dissolves it.
|
|
186
|
+
|
|
187
|
+
### Verdict 4 — Point OpenWiki at our own OpenAI-compatible server: ✅ The strategic find
|
|
188
|
+
|
|
189
|
+
OpenWiki speaks **OpenAI-compatible base URL**; mlx-bun *is* an OpenAI-compatible server (the whole
|
|
190
|
+
"drop-in replacement for mlx-lm / serving speed is the user metric" thesis). Compose them:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
OPENAI_COMPATIBLE_BASE_URL=http://localhost:<mlx-bun-port> \
|
|
194
|
+
OPENAI_COMPATIBLE_API_KEY=… openwiki --init # generate mlx-bun's own wiki, 100% local
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Why this is the most interesting outcome of the investigation:
|
|
198
|
+
|
|
199
|
+
1. **On-brand, zero-cloud.** Resolves the Verdict-3 tension: a real LangChain agent documents our repo
|
|
200
|
+
with *no* cloud call, on a Gemma running in mlx-bun. Directly demonstrates the `local-to-you` and
|
|
201
|
+
`install-to-chat` theses on an external, third-party agent.
|
|
202
|
+
2. **A hard conformance test.** DeepAgents drives many tool calls + long contexts + streaming. Chat
|
|
203
|
+
parity is easy; *agentic tool-use conformance* is the bar that actually matters for "agents need the
|
|
204
|
+
server" (`serving speed is the user metric`). If OpenWiki runs unmodified end-to-end against our
|
|
205
|
+
server, that's a strong, concrete proof point for the README/website. If it *doesn't*, we've found a
|
|
206
|
+
real function-calling / prefill / KV gap under agentic load — also valuable.
|
|
207
|
+
3. **Coverage/stress.** It exercises the server the way a coding agent does (glob/grep/read/write loops,
|
|
208
|
+
big prefills), complementing the batch/spec-decode perf work with a realistic agentic workload.
|
|
209
|
+
|
|
210
|
+
**Caveat to measure, not assume:** DeepAgents presumes a *capable* model — the very assumption The
|
|
211
|
+
Dreaming rejects for local e4b. A 4-bit e4b may drive the free-roaming loop poorly and produce a
|
|
212
|
+
mediocre wiki. Mitigations: point it at a larger local model (the 12B parity target) via the same
|
|
213
|
+
server, and/or judge output quality explicitly. Either way the *conformance* result (does the loop run?)
|
|
214
|
+
is decoupled from the *quality* result (is the wiki good?), and both are worth knowing.
|
|
215
|
+
|
|
216
|
+
## 6. Recommendation — what to actually do
|
|
217
|
+
|
|
218
|
+
1. **Do not** put OpenWiki inside the memory pipeline. The Dreaming is more mature for its constraints
|
|
219
|
+
and philosophically opposite. (Verdicts 1 & 2.)
|
|
220
|
+
2. **Spike Verdict 4 first — it's the highest-information, lowest-cost move.** Point OpenWiki at a
|
|
221
|
+
running mlx-bun server (Josh runs the server; no session starts it) and try `openwiki --init` on a
|
|
222
|
+
small repo, then on mlx-bun itself. Outcome is binary-useful: either a showcase demo of
|
|
223
|
+
"third-party LangChain agent runs locally on mlx-bun," or a concrete agentic-tool-use bug list for
|
|
224
|
+
the server. Bench it under the standard preflight if any perf number gets quoted
|
|
225
|
+
(`dirty-machine-numbers-are-garbage`).
|
|
226
|
+
3. **If the spike is clean,** consider OpenWiki as an *external CI doc tool* for the repo (Verdict 3):
|
|
227
|
+
an auto-maintained `openwiki/` structural map that feeds the vault's `Reference/` surface. Keep it
|
|
228
|
+
clearly subordinate to the hand-written `PLAN.md`/design docs.
|
|
229
|
+
4. **Opportunistically** add a durable `_plan.md`-style plan artifact to the memory CREATE flow for
|
|
230
|
+
reviewability (Verdict 2). Not a standalone work item.
|
|
231
|
+
|
|
232
|
+
## 7. Risks & unknowns
|
|
233
|
+
|
|
234
|
+
- OpenWiki is **v0.0.1, ~1 day old**, 42 open PRs / 48 issues — API and behavior will churn. Pin a
|
|
235
|
+
commit if used in CI.
|
|
236
|
+
- **Local-model quality** driving DeepAgents is unproven (contradicts our own capacity-by-decomposition
|
|
237
|
+
finding). Measure; don't assume the wiki is good just because the loop runs.
|
|
238
|
+
- **DeepAgents ⇄ our server function-calling compatibility** is the actual thing under test in Verdict
|
|
239
|
+
4 — tool-call formatting, streaming, and long-prefill behavior are where it could break.
|
|
240
|
+
- Do **not** treat any OpenWiki-generated wiki as a source of truth over the curated docs; it's a
|
|
241
|
+
derived index.
|
|
242
|
+
|
|
243
|
+
## Sources
|
|
244
|
+
|
|
245
|
+
- [langchain-ai/openwiki](https://github.com/langchain-ai/openwiki) — repo, README, `src/agent/*`
|
|
246
|
+
- [LangChain blog — Introducing OpenWiki](https://www.langchain.com/blog/introducing-openwiki-an-open-source-agent-for-repo-documentation)
|
|
247
|
+
- Internal: `docs/design/memory-system.md`, `memory-synthesis.md`, `memory-inference-path.md`,
|
|
248
|
+
`write-pipeline-entity.md`, `the-dreaming-master-plan.md`, `the-dreaming-handoff.md`,
|
|
249
|
+
`docs/reference/memory.md`; `src/memory/*` (~12 k LoC).
|
package/docs/planning/IDEAS.md
CHANGED
|
@@ -53,3 +53,17 @@ persistent memory of *you*; mlx-bun is the local, private model runtime.
|
|
|
53
53
|
Combined: a model that runs entirely on your machine **and** is continuously
|
|
54
54
|
grounded in your own accumulated context — local in both senses, and yours in a
|
|
55
55
|
way no hosted frontier model can be.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Library/app split (idea only — NOT planned, Josh 2026-07-05)
|
|
59
|
+
|
|
60
|
+
Two pulls: "one executable, everything you want to do with local AI" (the
|
|
61
|
+
product's charm) vs "some people just want a JS ML library — do they need
|
|
62
|
+
the rest?" The runtime-isolation work (2026-07-05) drew the exact boundary
|
|
63
|
+
either future needs: the engine child = the GPU stuff (src/model, src/mlx,
|
|
64
|
+
caches, scheduler, generate); the parent = the app (serve/UI/registry/
|
|
65
|
+
jobs/proxy). If a split ever happens it is a PACKAGING decision, not a
|
|
66
|
+
refactor — e.g. npm subpath exports (mlx-bun/model vs the full CLI bundle)
|
|
67
|
+
so library users import only the core. Library usage is unaffected by
|
|
68
|
+
isolation today (in-process generate(), no server involved). Revisit only
|
|
69
|
+
if Josh decides; both directions stay open from the current structure.
|
|
@@ -171,7 +171,6 @@ Each profile should eventually carry:
|
|
|
171
171
|
kv: "mixed",
|
|
172
172
|
memoryBudgetBytes: "...",
|
|
173
173
|
compiledDecode: true,
|
|
174
|
-
perfKernel: false,
|
|
175
174
|
expectedDecodeTps: 30,
|
|
176
175
|
expectedTtftMs: 100,
|
|
177
176
|
label: "Recommended for this Mac",
|
|
@@ -309,8 +308,8 @@ to text-only mode when no image is present, so the chat UI gains image support
|
|
|
309
308
|
with no startup cost. Features are within ~1% rel-RMSE of the optiq oracle;
|
|
310
309
|
every MLX primitive (rms_norm, gelu, matmul, SDPA, RoPE, pooling) is bit-exact.
|
|
311
310
|
The residual is sub-bf16 floating-point accumulation across the deep encoder,
|
|
312
|
-
not a porting gap. L1
|
|
313
|
-
path on L1 and L2.
|
|
311
|
+
not a porting gap. The L1 and L2 paths both work; vision falls back to the
|
|
312
|
+
monolith path on L1 and L2.
|
|
314
313
|
|
|
315
314
|
### Adapter web selector and CLI /v1/adapters (shipped)
|
|
316
315
|
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Chat UI Vision: The Model That Knows You
|
|
2
|
+
|
|
3
|
+
**Stance: memory/personalization-first.** Every other axis in this
|
|
4
|
+
doc — speed, tools, LoRA routing, privacy — is real, but it is in
|
|
5
|
+
service of one idea: mlx-bun is the only local chat surface where the
|
|
6
|
+
model visibly, auditably gets better at being *yours* over time. If we
|
|
7
|
+
build a fast, private, tool-capable chat app that doesn't make that
|
|
8
|
+
tangible on screen, we've built LM Studio with worse artifacts. That is
|
|
9
|
+
not the plan.
|
|
10
|
+
|
|
11
|
+
## The feeling
|
|
12
|
+
|
|
13
|
+
Open the app. It's not a hero screen with generic suggestion chips —
|
|
14
|
+
it's a hero screen that already knows something. Not in a creepy way:
|
|
15
|
+
in the way a good assistant who's worked with you for months starts a
|
|
16
|
+
Monday with "want me to pick up the Lisbon itinerary thing from
|
|
17
|
+
Thursday?" instead of "How can I help you today?" It should feel like
|
|
18
|
+
walking into a room where someone has been quietly paying attention,
|
|
19
|
+
not opening a fresh terminal.
|
|
20
|
+
|
|
21
|
+
The tell, mechanically: a chat with mlx-bun after a month of use is a
|
|
22
|
+
*different product* from day one — not because we shipped a new model,
|
|
23
|
+
but because the sidebar, the hero, and the answers themselves carry
|
|
24
|
+
accumulated context the user can see, correct, and trust. Cloud
|
|
25
|
+
chatbots fake a version of this behind a black box on someone else's
|
|
26
|
+
server. Local competitors (LM Studio, Ollama, macMLX) don't attempt
|
|
27
|
+
it — stateless between chats by design. Open WebUI and AnythingLLM
|
|
28
|
+
attempt it as prompt-stuffing into a flat fact list. Odysseus gets
|
|
29
|
+
closest (memory + skills) but on vLLM/llama.cpp infra with no adapter
|
|
30
|
+
concept at all. **Nobody combines memory-as-training-artifact with
|
|
31
|
+
weight-level LoRA routing and native MLX speed. That combination is the
|
|
32
|
+
whole pitch, and today it's invisible in our own UI** — the vault, the
|
|
33
|
+
memory tools, and the adapter runtime already exist server-side; none
|
|
34
|
+
of it shows on screen.
|
|
35
|
+
|
|
36
|
+
## The five things that make this unmistakable
|
|
37
|
+
|
|
38
|
+
**1. Memory is a visible citizen of the chat, not a silent tool call.**
|
|
39
|
+
Today `memory_search`/`memory_read` fire invisibly inside a generic
|
|
40
|
+
tool-call card indistinguishable from a bash command. The redesign
|
|
41
|
+
gives memory its own visual language: when the model consults the
|
|
42
|
+
vault mid-answer, a small soft-colored chip appears inline — not a
|
|
43
|
+
context dump, not an approval gate (it's read-only, never needs
|
|
44
|
+
permission), just a quiet citation: **"grounded in: Photography,
|
|
45
|
+
Lisbon-2026"**. Click it, it expands to the exact section read. This
|
|
46
|
+
is the single highest-leverage UI change in the whole plan: it turns
|
|
47
|
+
an architectural property ("the model is grounded in your vault") into
|
|
48
|
+
a *felt* one, every single turn, for free, using tool-call
|
|
49
|
+
infrastructure that already exists.
|
|
50
|
+
|
|
51
|
+
**2. A real Memory surface — not a settings toggle, a workspace.** New
|
|
52
|
+
8th tab (or better: reachable via one click from the sidebar, since
|
|
53
|
+
memory is chat-adjacent, not admin-adjacent): a vault browser. Articles
|
|
54
|
+
+ categories on the left, a reading pane on the right, a wikilink graph
|
|
55
|
+
view (the backend already resolves `memory_links` — nobody has drawn
|
|
56
|
+
it). Critically: a **git-history scrubber** on every article, because
|
|
57
|
+
self-healing-through-correction (the wiki updates itself when you
|
|
58
|
+
contradict a prior claim) is our best differentiator-in-the-flesh and
|
|
59
|
+
today it happens with zero visible seam. Correct the model about your
|
|
60
|
+
camera body in a chat on Tuesday; open the Photography article on
|
|
61
|
+
Wednesday and see the diff, dated, with the source conversation linked.
|
|
62
|
+
This is the "watch it happen" answer to ChatGPT/Claude's opaque
|
|
63
|
+
"Manage Memories" list — we don't just show *what* is remembered, we
|
|
64
|
+
show *how it changed and why*, because the whole pipeline runs on the
|
|
65
|
+
user's own disk.
|
|
66
|
+
|
|
67
|
+
**3. LoRA adapters are a routing story, not a filename dropdown.** The
|
|
68
|
+
current `<select>` lists raw ids (`minicpm5-chunk-final · r16`). The
|
|
69
|
+
redesign gives every adapter a name, a one-line specialty, and a
|
|
70
|
+
*kind*: **memory adapters** (trained nightly from the vault — these are
|
|
71
|
+
the "gets to know you" adapters) versus **task adapters** (coding,
|
|
72
|
+
writing-voice, whatever a user trains deliberately). The composer shows
|
|
73
|
+
a small persistent chip: **"grounded in your Writing adapter"** with a
|
|
74
|
+
one-click swap, and — since the backend already supports it — a
|
|
75
|
+
**stacking** affordance (memory adapter + task adapter together,
|
|
76
|
+
visibly, not just via a hidden `a+b` string). This is where LoRA
|
|
77
|
+
routing and memory literally become the same feature in the UI: a
|
|
78
|
+
memory-LoRA *is* accumulated personalization made concrete in weights,
|
|
79
|
+
and that's a claim no competitor's "persona" or "preset" system
|
|
80
|
+
(LM Studio Presets, Msty Personas, Ollama Modelfiles) can make, because
|
|
81
|
+
none of them adapt weights per user.
|
|
82
|
+
|
|
83
|
+
**4. Speed is shown, not hidden, because it's the substrate memory runs
|
|
84
|
+
on.** A live perf strip near the composer — tok/s, TTFT, prompt-cache
|
|
85
|
+
hit (already computed server-side, never surfaced), a plain-English
|
|
86
|
+
serving-lane badge ("batched ×3" / "spec-decode active"). This isn't a
|
|
87
|
+
generic benchmarking flex: it's what makes "the model reads your whole
|
|
88
|
+
vault before answering, every time, and it's still instant" credible
|
|
89
|
+
instead of hopeful. Fast local retrieval is worthless if it feels slow.
|
|
90
|
+
|
|
91
|
+
**5. Tool-call and approval UI as a trust surface for an agent with
|
|
92
|
+
real disk access.** The approval gate is fully built (per-call
|
|
93
|
+
allow/deny, diff preview) but dead in web chat today — the browser
|
|
94
|
+
tool allowlist excludes bash/edit/write entirely. Ship a "Power" mode
|
|
95
|
+
that widens the toolset with the approval cards already built, styled
|
|
96
|
+
as inline code-review hunks (LM Studio's argument-editable pattern,
|
|
97
|
+
Jan's non-blocking inline cards). This matters to the memory thesis
|
|
98
|
+
specifically: a vault the model can *write* to, not just read, is the
|
|
99
|
+
next step after this redesign, and users need to already trust
|
|
100
|
+
approval before we get there.
|
|
101
|
+
|
|
102
|
+
## Making it tangible in the surface
|
|
103
|
+
|
|
104
|
+
**Layout.** Keep the two-pane shape (sidebar + thread) — it's not
|
|
105
|
+
broken, and Msty/Claude/ChatGPT converge on it. Change what the sidebar
|
|
106
|
+
*contains*: above the flat session list, a compact **Memory status
|
|
107
|
+
strip** — vault article count, "last synthesis: 6h ago, 3 articles
|
|
108
|
+
updated," a dot that goes amber if synthesis is overdue. This is
|
|
109
|
+
`vaultStatus()` (already returns exactly this data) surfaced for the
|
|
110
|
+
first time. One click opens the Memory workspace as a slide-over, not a
|
|
111
|
+
full tab switch — memory should feel adjacent to chat, not a separate
|
|
112
|
+
destination.
|
|
113
|
+
|
|
114
|
+
**Composer.** Left of Send: the adapter chip (kind-colored — memory
|
|
115
|
+
adapters warm, task adapters cool), click to open a compact router
|
|
116
|
+
panel (available/loaded/selected, RAM cost per loaded adapter, stack
|
|
117
|
+
toggle). Right of the textarea: the perf strip. Above the composer:
|
|
118
|
+
typing `#` surfaces both attached-file context AND vault articles in
|
|
119
|
+
one unified picker, because "attach a file" and "recall something I
|
|
120
|
+
told you" are the same retrieval gesture from the user's point of view.
|
|
121
|
+
Don't teach two mental models for "give the model context."
|
|
122
|
+
|
|
123
|
+
**Messages.** Each assistant bubble gets, for the first time, a real
|
|
124
|
+
action row (copy — currently missing outside code blocks, regenerate,
|
|
125
|
+
edit-and-branch with the ChatGPT/Claude convention of a lightweight
|
|
126
|
+
`< 1/2 >` sibling toggle rather than a full tree). The memory-citation
|
|
127
|
+
chip attaches only when memory tools actually fired that turn — never
|
|
128
|
+
fabricated, because false positives here destroy the trust the feature
|
|
129
|
+
depends on.
|
|
130
|
+
|
|
131
|
+
**Model & adapter switching.** The nav model label goes from a static
|
|
132
|
+
span to a real switcher (currently zero affordance, a stark gap for a
|
|
133
|
+
product built on per-model specialization). The adapter panel sits next
|
|
134
|
+
to it, not buried in a settings modal.
|
|
135
|
+
|
|
136
|
+
**Tool-call display.** Three visual tiers, not one generic card: (a)
|
|
137
|
+
read-only tools (file read, web fetch) render minimally, collapsed,
|
|
138
|
+
auto-allowed; (b) memory tools render as the soft citation chip from
|
|
139
|
+
differentiator #1 — deliberately *not* styled like a tool call; (c)
|
|
140
|
+
mutating tools (bash/edit/write, once Power mode exists) render as the
|
|
141
|
+
inline approve/deny code-review-hunk card with visible diff. Same
|
|
142
|
+
underlying `tool_call` event stream, three renderers — conflating "read
|
|
143
|
+
your camera preferences" with "wants to delete a file" in one visual
|
|
144
|
+
language is exactly what makes today's UI feel generic.
|
|
145
|
+
|
|
146
|
+
**Onboarding.** The <1-minute install-to-chat promise gets a second
|
|
147
|
+
clause: install-to-chat-*that-remembers*-under-two-minutes. First-run
|
|
148
|
+
hero adds one honest, skippable memory-consent step ("Let mlx-bun keep
|
|
149
|
+
a personal notes vault on your Mac? Read, edit, or delete it anytime —
|
|
150
|
+
it's just Markdown files") in the same breath as the first message, not
|
|
151
|
+
buried in a CLI-only `mlx-bun memory init`. Consent has to happen
|
|
152
|
+
*before* the flywheel can start proving itself.
|
|
153
|
+
|
|
154
|
+
## What we deliberately don't build
|
|
155
|
+
|
|
156
|
+
- **No enterprise/multi-user layer** — no RBAC, no Open-WebUI-style
|
|
157
|
+
Channels, no admin console. mlx-bun is single-user by identity.
|
|
158
|
+
- **No general-purpose agent-flow builder** (AnythingLLM's Agent Flows,
|
|
159
|
+
Msty's Turnstiles). Automation, if any, is scoped narrowly to what
|
|
160
|
+
the synthesis pipeline needs, not a drag-and-drop canvas.
|
|
161
|
+
- **No cloud tier, no hosted anything** — no Ollama-style `:cloud`
|
|
162
|
+
hybrid. "Escalate to a bigger model" means local spec-decode against
|
|
163
|
+
a larger local target, never a paid API.
|
|
164
|
+
- **No email/calendar/documents workspace clone** (Odysseus's scope
|
|
165
|
+
creep). Personal-context connectors, if they ever happen, are
|
|
166
|
+
read-only memory *feeders*, not a productivity suite to maintain.
|
|
167
|
+
- **No full conversation-tree graph view.** The lightweight
|
|
168
|
+
sibling-toggle branch UI (ChatGPT/Claude's convention) is the right
|
|
169
|
+
amount of investment; neither incumbent ships a real tree either.
|
|
170
|
+
- **No page-level PDF citation rendering as v1.** Filename + snippet
|
|
171
|
+
citation gets most of the trust benefit for a fraction of the
|
|
172
|
+
engineering; save PDF-aware rendering for later.
|
|
173
|
+
- **No speech-to-speech voice mode as a v1 commitment** — a bolt-on
|
|
174
|
+
STT→LLM→TTS pipeline reads as worse than what users now expect;
|
|
175
|
+
scope as future work, not parity-by-next-release.
|
|
176
|
+
- **No unsandboxed shell tool shipped quietly.** If Power mode widens
|
|
177
|
+
the toolset to bash/edit/write, the approval-gate trust surface
|
|
178
|
+
ships *with* it, not after — Odysseus's unsandboxed bash tool and
|
|
179
|
+
its 48-hour-patched CVEs are the cautionary tale.
|
|
180
|
+
- **No competing on raw model-catalog breadth** (Ollama's library,
|
|
181
|
+
LM Studio's HF browser). MLX-only by identity; a focused, well-labeled
|
|
182
|
+
local model/adapter list beats a sprawling catalog we'd have to
|
|
183
|
+
maintain against a moving target.
|
|
184
|
+
|
|
185
|
+
## Why this ordering, not another
|
|
186
|
+
|
|
187
|
+
Speed, tool UX, and multi-adapter composition are all worth building —
|
|
188
|
+
the research surfaces excellent, copyable patterns for each (Jan's
|
|
189
|
+
inline approval cards, LM Studio's hardware-fit indicator, Msty's
|
|
190
|
+
split-pane compare). But every one of those patterns is *matchable* by
|
|
191
|
+
a well-resourced competitor within a release cycle. The memory flywheel
|
|
192
|
+
is not: it requires a vault architecture, a synthesis pipeline, an
|
|
193
|
+
adapter-namespaced KV runtime, and a product culture willing to treat
|
|
194
|
+
"gets better at being yours" as the headline rather than a checkbox —
|
|
195
|
+
all of which mlx-bun already has built and simply hasn't surfaced. The
|
|
196
|
+
redesign's job is not to invent new backend capability. It's to stop
|
|
197
|
+
hiding the one capability nothing else in this market has, and frame
|
|
198
|
+
every other improvement (speed HUD, tool cards, adapter switching) as
|
|
199
|
+
infrastructure *for* that capability, not a parallel feature track.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# The mlx-bun chat surface: a vision
|
|
2
|
+
|
|
3
|
+
*Draft vision, product/design lead pass — 2026-07-06. Bold stance: reimagine the chat surface from scratch. Companion to the market research and current-state audit that produced it; see `docs/planning/web-ui-pass-plan.md` for the tactical bug list and `docs/design/adapters-end-to-end.md` / `docs/design/memory-system.md` for the backend contracts this vision assumes.*
|
|
4
|
+
|
|
5
|
+
## The feeling
|
|
6
|
+
|
|
7
|
+
Open mlx-bun and it should feel like sitting down with someone who already knows you — not a search box you interrogate, not a terminal you configure, not a dashboard you administer. Every other local-AI chat UI (Open WebUI, LM Studio, Jan, Ollama's app) is, underneath the polish, the **same product**: a stateless request/response window in front of a model file. They compete on how many knobs they expose. We are not building a better knob panel. We are building the only chat surface where "it remembers what I told it three weeks ago, and it's faster than the thing it's replacing" is literally, verifiably true — and where the UI's job is to make that trust legible turn by turn, not assert it in marketing copy.
|
|
8
|
+
|
|
9
|
+
`src/web/app.html` has already solved the hard infrastructure problem (streaming, tool-calls, sessions, steering) and completely missed the product problem: memory is invisible, LoRA routing is a bare `<select>`, and the first thing a new user sees is marketing copy about privacy with zero proof of personalization on screen. The redesign's job is not "add more tabs." It's: collapse the surface to what a person actually touches every day (chat), and make the three things nobody else can build — memory that becomes weights, routed adapters, an engine fast enough to show its work — into things you can *see happen*.
|
|
10
|
+
|
|
11
|
+
## Five things that make this unmistakably not-Open-WebUI
|
|
12
|
+
|
|
13
|
+
**1. Memory has a face, and it's a citation, not a settings toggle.**
|
|
14
|
+
Every competitor's "memory" (ChatGPT, AnythingLLM, Odysseus) is a flat fact-list re-injected into a system prompt — legible after the fact, invisible during the conversation. We already run `memory_search`/`memory_read` silently on every turn (`src/memory/tools.ts`, wired into `webChatToolAllowlist`) and render them with the same generic wrench icon as `bash`. Instead: when a memory tool fires, render a distinct, quieter card — a small "📖 Photography" chip inline with the response — that expands on click to show the exact vault section that grounded that sentence. No context dump, no "as an AI with access to your notes" narration, just a footnote that proves the flywheel is real. This costs almost nothing: the event stream already distinguishes memory calls; we just have to stop rendering them like `bash`.
|
|
15
|
+
|
|
16
|
+
**2. Adapters are personas you route to, not files you pick.**
|
|
17
|
+
Nobody else has hot-swappable LoRA adapters with adapter-namespaced KV — not LM Studio, not Ollama, not Msty (whose "Persona Studio" is prompt-only). We already have `/v1/adapters`, three-tier state, and per-request injection; the UI throws it away on a `<select>` full of raw filenames. Instead: a **persona rail** above the composer, one pill per named persona (adapter + system prompt + tool allowlist + memory scope bundled, a richer Ollama Modelfile), each with a one-line specialty, a resident/cold dot, and RAM cost on hover. Switching shows a "new context segment" micro-transition (genuine, not cosmetic — that's what adapter-namespaced KV means), and a Msty-style split-compare fires one prompt at two personas side by side to *prove* the adapter earns its keep.
|
|
18
|
+
|
|
19
|
+
**3. Speed is a HUD, not a footnote.**
|
|
20
|
+
Today tok/s is a dim gray number after the message finishes. Every other local tool either hides serving mechanics (Open WebUI) or shows only tok/s (Ollama `ps`, LM Studio). We control the whole stack down to spec-decode and batch slots. A persistent strip near the composer: live tok/s *during* the stream, TTFT, a context-fullness ring, and a lane badge — "draft+verify (dspark)" vs "batched ×3" vs "serial" — since mlx-lm's own architecture treats these as mutually exclusive lanes and users should see which one they're in. An internal engineering decision becomes a felt, screenshot-able proof point.
|
|
21
|
+
|
|
22
|
+
**4. Tool-calls are a code-review hunk, not a permission dialog.**
|
|
23
|
+
We already have per-call approve/deny in `pi-web.ts` with a diff-style card; Jan and LM Studio validate the pattern (inline, non-blocking, argument-editable), nobody's pushed it further. Ours should feel like reviewing a PR: syntax-highlighted args, a blast-radius line ("will write 40 lines to `src/foo.ts`"), three-state approval (once / always-this-session / deny) persisted to disk so it survives restarts (Claude Desktop and Cowork visibly get this wrong), and read-only tools pre-approved by default so fatigue only hits tools that deserve scrutiny.
|
|
24
|
+
|
|
25
|
+
**5. The whole thing installs to a felt "it knows me" moment in under a minute.**
|
|
26
|
+
Every competitor's onboarding ends at "chat works." Ours ends at "chat works, and it already asked, gently, whether it can start learning from you." First run: pick a hardware-fit-scored starter model, land in chat, and the hero screen's first chip isn't "what is mlx-bun?" — it's a dismissible memory-consent card ("Let mlx-bun remember what matters across chats? Nightly, local, git-tracked, editable any time.") where a philosophy statement used to be. Say yes and the vault seeds; say no and it never mentions it again — the one screen where "local-to-you" becomes an action instead of a claim.
|
|
27
|
+
|
|
28
|
+
## Making the differentiators tangible, in one line each
|
|
29
|
+
|
|
30
|
+
**Privacy** = a one-click "Temporary chat" pill, honestly stronger than ChatGPT/Claude's (theirs retains 30 days server-side; ours touches no third party, ever) — stated once in a tooltip, otherwise proven by the UI's total silence about accounts or "sync." **Memory** = the citation chips plus a **Memory panel** (slide-over, not a 6th tab): vault search, per-article git-diff so a user can *watch* an article self-correct, and a nightly synthesis changelog — the mechanism shown, not asserted. **LoRA routing** = the persona rail plus a routing table in settings (which surface defaults to which persona) with the three-tier lifecycle (available/loaded/selected) shown honestly, RAM cost visible before it's spent. **Speed** = the always-on HUD plus a Benchmark strip in Status (live prefill/decode tok/s, TTFT, peak RSS, spec-decode acceptance rate, cold-start — macMLX's pattern, extended with what only dspark can show). **Local tools** = the code-review-hunk approval cards plus a curated first-run toolset (file read, web fetch, our own `memory_search`) so day one isn't a JSON config exercise.
|
|
31
|
+
|
|
32
|
+
## Concrete screens
|
|
33
|
+
|
|
34
|
+
**Layout.** Kill the 7-tab flat nav. One primary surface (Chat), with Quantize / Fine-tune / Build Dataset / Curves / Routes / Status collapsed behind a single **Developer** toggle (LM Studio's User/Power-User/Developer pattern, flattened to two states). A new user's day-one mental model: sidebar, thread, composer, persona rail, speed HUD — not seven tabs including a fine-tuning dashboard before they've sent one message.
|
|
35
|
+
|
|
36
|
+
**Sidebar.** Full-text session search (not just title — unlike Claude's well-known gap), and a real mobile treatment: a slide-over drawer behind a hamburger, not today's "delete the sidebar at 760px with no replacement."
|
|
37
|
+
|
|
38
|
+
**Thread.** Actions that don't exist today: copy on any assistant message, edit-and-resend that forks non-destructively with an inline `< 1/2 >` branch switcher (a linear toggle, not a tree — both cloud incumbents prove that's the right ceiling), regenerate, and "regenerate with a different persona." Streaming gets fixed architecturally: block-level memoization (only the live tail re-parses) instead of today's `innerHTML = mdToHtml(fullText)` on every token — O(n²) over a response, and the thing most likely to make a spec-decode-accelerated model *feel* slow because the frontend can't keep up with its own backend. Code fences get real syntax highlighting; math gets KaTeX — both zero today.
|
|
39
|
+
|
|
40
|
+
**Composer.** Autosize textarea, file/image attach (existing), a persona pill, live steering (existing — keep it), and the sampling popover expanded from three sliders to the full server-supported set (min_p, XTC, penalties, logit_bias) behind an "Advanced" disclosure — closing a plain parity gap against the mlx-lm oracle.
|
|
41
|
+
|
|
42
|
+
**Memory & model switching.** A slide-over Memory panel (vault search, git-diff per article, synthesis changelog) plus a vault-status chip in the composer, and a real model switcher — today's `#nav-model` is a read-only label with no click handler, an odd miss given the pitch is fast tier-switching between e4b/12B/26B.
|
|
43
|
+
|
|
44
|
+
**Tool-call display.** Inline, non-blocking approval cards (Jan's pattern) with argument diffs, blast-radius text, three-tier persistence, and pre-approved read-only defaults.
|
|
45
|
+
|
|
46
|
+
## What we deliberately do not build
|
|
47
|
+
|
|
48
|
+
No Channels or multi-user/Slack-style shared spaces (Open WebUI's most enterprise-flavored feature) — mlx-bun is single-user by identity. No RBAC, org admin, or plugin marketplace — there is no "org" to administer. No general-purpose no-code agent-flow canvas (AnythingLLM's Agent Flows, Msty's Turnstiles) — if one ever justifies itself, scope it to the memory/synthesis pipeline, not general automation. No speech-to-speech voice mode as a v1 commitment — it would visibly disappoint next to Advanced Voice Mode if half-built; an honest stretch goal, not table stakes. No paid cloud escalation tier (Ollama Cloud) — any "bigger model" story stays local (dspark spec-decode against a larger local target). No email/calendar/document-suite bloat (Odysseus), even reframed as "memory feeders," until the core loop is airtight. And no sandbox-theater for a shell tool we can't actually sandbox — if we ship tool execution, we say plainly it runs on your machine with your permissions.
|
|
49
|
+
|
|
50
|
+
The through-line: every screen either makes local-to-you *provable* or it doesn't ship. Speed you can see. Memory you can read and correct. Adapters you can name, compare, and trust. Everything else is Open WebUI's problem to solve, not ours.
|
|
@@ -83,6 +83,14 @@ one scope-fix + one hub table + reading order**, all cheap and link-stable:
|
|
|
83
83
|
|
|
84
84
|
## B. The DAG view (docs/dag/training-inference-map.html + parity-tier-dag.md)
|
|
85
85
|
|
|
86
|
+
> **2026-07-05 annotation:** the Phase-1 deletion pass
|
|
87
|
+
> ([unified-engine-frontier-plan.md §6](../design/unified-engine-frontier-plan.md))
|
|
88
|
+
> deleted the perf-kernel, fused-decode, and fused-swiglu/geglu kernels and
|
|
89
|
+
> removed `--l3` as a product mode (output-changing experiments are Lab items
|
|
90
|
+
> now). The `perfKernelEnabled()` / `fusedDecodeSdpa` / `fusedSwiglu` route
|
|
91
|
+
> predicates referenced in this section (and the map's n92/n95 branches) no
|
|
92
|
+
> longer exist in the code; treat those mentions as the pre-deletion snapshot.
|
|
93
|
+
|
|
86
94
|
### B.1 What exists today
|
|
87
95
|
|
|
88
96
|
- **parity-tier-dag.md** — the framework doc. **Already refreshed 2026-07-01**:
|
|
@@ -133,14 +141,14 @@ Keep it hand-authored, make it honest:
|
|
|
133
141
|
**B3.2 Runtime route explainer (recommended first "derive from code" step,
|
|
134
142
|
~1 day).** Josh's ask is literally "for each model and config, how it is
|
|
135
143
|
actually running" — the cheapest ground-truth answer is not static analysis
|
|
136
|
-
but a CLI verb, e.g. `mlx-bun route <model> [--l1|--l2
|
|
144
|
+
but a CLI verb, e.g. `mlx-bun route <model> [--l1|--l2] [--kv-quant …]`,
|
|
137
145
|
that:
|
|
138
146
|
- runs `applyDecodeRoute()` (cli.ts:723 — the TIERS preset table is already a
|
|
139
147
|
machine-readable matrix), loads **config only** (no weights),
|
|
140
|
-
- evaluates the actual exported predicates (`
|
|
141
|
-
`
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
- evaluates the actual exported predicates (`NO_FUSED_SDPA`,
|
|
149
|
+
`CompiledDecode.for` eligibility, kv-quant resolution, factory ladder
|
|
150
|
+
selection — the old perf-kernel/fused-decode/fused-swiglu predicates were
|
|
151
|
+
deleted 2026-07-05),
|
|
144
152
|
- prints the resolved route as a tree/JSON: which model class, which sdpa
|
|
145
153
|
path, which kernels, which tier each hop sits in, and **which flag would
|
|
146
154
|
change each hop**.
|
|
@@ -164,7 +172,8 @@ What "derive the DAG from code" concretely means here:
|
|
|
164
172
|
generator fails if a tagged node vanished (renames get caught).
|
|
165
173
|
- **CI gate**: a workflow step asserts every **L1-tagged** node names an
|
|
166
174
|
`oracleTest` file that exists and passes (`bun test <file>`); an L1 node
|
|
167
|
-
without a passing bit-exact test fails CI or must be re-tagged
|
|
175
|
+
without a passing bit-exact test fails CI or must be re-tagged no-oracle
|
|
176
|
+
(Lab-gated). This is
|
|
168
177
|
PLAN's "the oracle is the gate becomes a check" box — and it composes with
|
|
169
178
|
STATUS finding #4 (no CI at all): land the `tsc + bun test` gate first,
|
|
170
179
|
hang the L1-tag check off it.
|