$ brimkern chat
On-device WebGPU & WGSL inference engine
A coding assistant in your terminal, running on your own GPU
The same hand-written WGSL kernels as the browser engine, driven from your shell. Qwen 3 4B by default, no Python, no CUDA, no server, no API key: your code never leaves the machine.
A real session
Captured as is from the terminal, colours included: Markdown is rendered while it streams (bold, code, lists), and every answer ends with its timing and an estimate of what a paid API would have charged.
kern › give me 3 advantages of TypeScript as a list with bold titles, and one short code example Type Safety: Ensures that variables are used correctly by the compiler, reducing runtime errors. Better Tooling: Provides features like intellisense, refactoring support, and error detection during development. Maintainable Code: Enforces a structured approach to code organization and promotes cleaner, more readable code through interfaces and type annotations. Code Example: function greet(name: string): void { console.log(`Hello, ${name}!`); } greet("World"); ⏱ 10.67s · ~9.6 tok/s · 102 tokens · ≈ $0.0024 saved (session: $0.0024) (Dawn (Metal))
Recorded on 2026-09-23 on an M-series Mac, Qwen 3 4B (native Dawn), warm cache. Output untouched.
Install
On macOS or Linux, with Node.js 20+ and git. The script clones the repository into ~/.brimkern, installs the dependencies, builds the engine and adds a brimkern command to ~/.local/bin. Run it again to update.
Then run brimkern chat in any project folder. The GPU is used directly: Metal on macOS, Vulkan on Linux. The first launch downloads the default model once (2.53 GB); the next launches read it from ~/.cache/brimkern (measured on the 491 MB model: 35.4 s the first time, 3.4 s the second).
Uninstall: rm -rf ~/.brimkern ~/.local/bin/brimkern
The REPL
Type / and the matching commands appear under the prompt as you type, the rest of the first one greyed out: → or Tab accepts it. The assistant knows which project you are in (it reads the README, the package description and the git branch), so “what is this project for?” gets a real answer.
@path/file:10-40Injects a file (or a line range) into the prompt. Tab completes paths./modelInteractive picker (↑/↓, Enter) to hot-swap the model./mode code|plan|review|autoChanges how the assistant intervenes./think off|auto|deepStep-by-step reasoning, shown in its own block./diff · /commitReview of your git changes · commit message proposals./review <file>Deep review of one file./copy · /acceptCopies the last answer · extracts its code blocks./status · /statsSession state · tokens, speed, estimated savings./reset · /clearForgets the conversation · clears the screen.!git statusRuns a shell command without leaving the REPL.Esc · Ctrl+CStops the generation in progress (the session survives).The savings figure is an estimate, and presented as one: tokens ≈ characters / 4, the conversation history counted on every turn as an API would bill it, at a reference price of $3 / $15 per million input / output tokens; set BRIMKERN_PRICE_IN and BRIMKERN_PRICE_OUT to use your own.
Files, git & shell
@file
Mention a file, optionally with a line range: it is read from disk and inserted in the prompt.
kern › explain the state handling in @src/app/Composer.tsx:10-60
/diff · /commit · /review
Reads your uncommitted changes to review them or propose three conventional commit messages; /review takes one file.
kern › /diff kern › /commit kern › /review src/lib/storage.ts
Pipes & scripts
Standard input is read automatically, so Brimkern chains with the usual tools. --raw keeps only the model’s text on stdout (no header, no timing, no colours), ready to redirect.
git diff | brimkern "Write a conventional commit title"
cat crash.log | brimkern "Find the root cause"
brimkern --raw "Write a .gitignore for a Next.js app" > .gitignoreModels
Three presets, ranked on our code benchmark: five suites, 202 problems, greedy decoding, every answer executed against tests. coder-max is within 2 problems of Claude Sonnet 5, but needs a machine with 20 GB of memory or more.
| Model | HumanEval | HumanEval+ | MBPP+ | TypeScript | Bug fixing | Total |
|---|---|---|---|---|---|---|
| coder-max | 41/41 | 38/40 | 35/40 | 36/40 | 34/41 | 184/202 |
| Claude Sonnet 5 | 41/41 | 36/40 | 33/40 | 36/40 | 40/41 | 186/202 |
| coder | 35/41 | 34/40 | 28/40 | 28/40 | 21/41 | 146/202 |
| super-coder | 33/41 | 30/40 | 29/40 | 27/40 | 26/41 | 145/202 |
HumanEval (41), HumanEval+ (EvalPlus, 40), MBPP+ (40), TypeScript (MultiPL-E, 40), bug fixing (HumanEvalFix, 41), 2026-09-25. Problems solved only: timings depended on the machine’s state and are not compared. Reproduce: node scripts/bench-code.mjs --suite=humaneval,heplus,mbppplus,ts,fix.
On your GPU · measured, same benchmark
Claude · cloud · measured, same benchmark
GPT · cloud · published by OpenAI, full HumanEval (164), their protocol, not measured here
Show as a table
| Group | Model | pass@1 | Detail |
|---|---|---|---|
| On your GPU | coder-max · Qwen 3.6 35B-A3B | 100.0 % | 41/41 |
| On your GPU | coder · Qwen 3 4B | 85.4 % | 35/41 |
| On your GPU | super-coder · Qwen 3.5 4B | 80.5 % | 33/41 |
| Claude | Claude Opus 5.5 | 100.0 % | 41/41 |
| Claude | Claude Sonnet 5 | 100.0 % | 41/41 |
| Claude | Claude Haiku 4.5 | 97.6 % | 40/41 |
| GPT | GPT-4.1 | 94.5 % | published by OpenAI |
| GPT | GPT-4.1 mini | 93.8 % | published by OpenAI |
| GPT | GPT-4o | 90.2 % | published by OpenAI |
pass@1 on 41 HumanEval problems (one in four), 2026-09-24. Local models: native Dawn on an M-series Mac, greedy decoding. Claude: same prompt and tests through claude -p. GPT scores are OpenAI’s own, on the full benchmark: shown for scale, not comparable point for point. Reproduce: node scripts/bench-code.mjs.
Mixture of experts: ~3 B of its 19 B parameters work per token. Coding specialist, 50 % of experts pruned.
Answers directly; reasoning on demand with /think deep.
Hybrid Gated DeltaNet + attention; always reasons before answering, hence slower.
Any single-file .gguf or .brik also works, by URL or local path (served to the engine with HTTP range requests, never loaded whole in RAM):
brimkern --model=./models/custom.brik "Explain this code"
Options
-m, --model=<coder|coder-max|super-coder|url|path>string--mode=<code|plan|review|auto>string--think=<off|auto|deep>string--lang=<en|fr>string-s, --system=<prompt>string-n, --max-tokens=<n>number-t, --temperature=<value>number-q, --quietflag--jsonflagmcpcommand--rawflag--native · --chromiumflagchatcommandUnder the hood
Hand-written WGSL
The compute shaders of the browser engine, compiled by the platform WebGPU driver: Metal on macOS, Vulkan on Linux.
Native Dawn
.brik models run in-process through Node bindings to Google Dawn, without starting a browser.
Self-validating kernels
Every kernel is checked against a CPU reference at startup; if a GPU gets it wrong, the engine falls back to a portable path.
Streamed once, cached
Weights arrive by HTTP byte ranges and stay on disk: the next launch reads them locally.
More on the engine: measured comparison with WebLLM · the .brik container.
Brimkern: open WebGPU engine, built by Romain Khanoyan. Local AI, WebGPU, on-device engines.