Brimkerndocs

$ brimkern chat

brimkern · zsh

On-device WebGPU & WGSL inference engine

Brimkern WGSL
ModelQwen 3 4B (BRIK int4)EngineNative Dawn (in-process)WebGPUDawn (Metal)Status100% local

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.

brimkern chat
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.

curl -fsSL https://brimkern.com/install.sh | bash

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" > .gitignore

Models

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.

Problems solved, five suites (202 problems)
ModelHumanEvalHumanEval+MBPP+TypeScriptBug fixingTotal
coder-max41/4138/4035/4036/4034/41184/202
Claude Sonnet 541/4136/4033/4036/4040/41186/202
coder35/4134/4028/4028/4021/41146/202
super-coder33/4130/4029/4027/4026/41145/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

coder-max · Qwen 3.6 35B-A3BMoE, 20 GB+ of memory, no reasoning
coder · Qwen 3 4Bdefault preset, no reasoning
super-coder · Qwen 3.5 4Breasons before answering

Claude · cloud · measured, same benchmark

Claude Opus 5.5
Claude Sonnet 5
Claude Haiku 4.5

GPT · cloud · published by OpenAI, full HumanEval (164), their protocol, not measured here

GPT-4.1
GPT-4.1 mini
GPT-4o
Show as a table
GroupModelpass@1Detail
On your GPUcoder-max · Qwen 3.6 35B-A3B100.0 %41/41
On your GPUcoder · Qwen 3 4B85.4 %35/41
On your GPUsuper-coder · Qwen 3.5 4B80.5 %33/41
ClaudeClaude Opus 5.5100.0 %41/41
ClaudeClaude Sonnet 5100.0 %41/41
ClaudeClaude Haiku 4.597.6 %40/41
GPTGPT-4.194.5 %published by OpenAI
GPTGPT-4.1 mini93.8 %published by OpenAI
GPTGPT-4o90.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.

coder-max · moe
Qwen 3.6 35B-A3B Coder11.4 GB
formatGGUF Q4_K_Menginenative Dawnmemory20 GB+ machine5 suites184/202

Mixture of experts: ~3 B of its 19 B parameters work per token. Coding specialist, 50 % of experts pruned.

coder · default
Qwen 3 4B2.53 GB
formatBRIK int4enginenative Dawn5 suites146/202

Answers directly; reasoning on demand with /think deep.

super-coder · ssm
Qwen 3.5 4B Super Coder2.61 GB
formatGGUF Q4_0enginenative Dawn5 suites145/202

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
Model to run. Default: coder (Qwen 3 4B).
--mode=<code|plan|review|auto>string
How the assistant intervenes. Default: code.
--think=<off|auto|deep>string
Step-by-step reasoning. Default: auto (direct answers; deep turns reasoning on).
--lang=<en|fr>string
Interface language. Default: en (or BRIMKERN_LANG).
-s, --system=<prompt>string
Replaces the default system prompt (the project context is then not added).
-n, --max-tokens=<n>number
Cap on generated tokens. Default: 512.
-t, --temperature=<value>number
Sampling temperature. Default: 0.3.
-q, --quietflag
Quiet mode: emits raw output only, suppressing ASCII banners and stats.
--jsonflag
Structured JSON output with token counts, tok/s speed, duration and model name. Ideal for sub-agents and scripts.
mcpcommand
Starts the stdio Model Context Protocol (MCP) server for Claude Desktop, Cursor, Windsurf, or Antigravity.
--rawflag
Model text only on stdout: no header, timing or colours.
--native · --chromiumflag
Forces the in-process Dawn engine, or the headless Chromium one (used automatically for GGUF).
chatcommand
Starts the multi-turn REPL.

Under 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.