A coding agent
you control.

A coding agent for your terminal: the agent, the model, and the inference engine that runs it, in one Rust program. Local by default.

macOS on Apple silicon · Linux with Vulkan 1.1 · MIT

~/src/penberg/dwim
Recorded on a MacBook Pro with an Apple M5 and 32 GB of memory, played back at the speed it ran.

dwim is experimental software. Expect bugs, rough edges, and changes that break things from one commit to the next. The model runs shell commands on your machine without asking first, and dwim does not sandbox them, so run it in a container or a virtual machine, on code you have committed or backed up.

Interface

An interactive shell.
A scriptable tool.

With no arguments, dwim starts an interactive session in the current directory. Given a prompt, it answers and exits.

~/src/project
$ dwim
$ dwim "Explain the locking assumptions in this module." > locking.md
$ dwim --stats "Add a regression test for this failing case."
$ dwim --shell ./in-container "Find the allocation hot spots."

The reply is standard output

Nothing else is written there. Progress, the model's thinking, the commands it runs and their output go to standard error. Exit status is 0 or 1.

Six tools

bash, read, write, edit, glob and grep. Commands run as sh -c, or as program -c with --shell, to run them in a container.

AGENTS.md

If the working directory has one, its contents are given to the agent as project instructions.

Local by default

Nothing leaves the machine
unless you decide so.

By default, the model runs in a process on your machine, and a session reaches it over a Unix socket.

Your machine
$PWDdwimQwen3.8-27BGPU
only if you ask
Optional
--provider openrouter

No account, no API key by default

Install it and run it. Only a session at a provider needs a key, in OPENROUTER_API_KEY.

No token bill by default

A local session costs nothing per token. A session at OpenRouter sends the conversation there, and each request is charged for.

Offline once downloaded

The weights are fetched once, at a pinned revision. With HF_HUB_OFFLINE=1, a model that is not in the cache is an error, not a download.

Models

On your GPU,
or in the cloud.

Two models of one family, with one chat format and one way of calling tools. /model moves a session from one to the other, and the conversation goes with it.

--model medium (default) Qwen3.8-27B
Parameters
27 billion
Weights
16 GB, a Q4_0 GGUF
Runs
On your machine, or at OpenRouter
--model large Qwen3.8-2.4T-A95B
Parameters
2.4 trillion, 95 billion active for a token
Weights
The open weights of Qwen3.8 Max
Runs
At OpenRouter only

Speculative decoding

On your machine, a drafter in the model file proposes the next tokens, and the model verifies them in one pass. --speculate n sets how many: 4 by default, 0 for one at a time.

Context

Locally, a session gets as many tokens as fit in the device's free memory beside the model, and no fewer than 16384. At OpenRouter, 131072. --context overrides.

Compaction

At four fifths of the window, the agent writes itself a note of the task and starts over from the system prompt with the note and the most recent exchanges.

Engine

Its own inference engine,
in Rust.

The GGUF reader, the tokenizer, the transformer and the GPU kernels are part of dwim. There is no Python and no separate runtime to install.

--deviceBackendKernels
gpuMetal, on Apple siliconMSL
gpuVulkan 1.1 with VK_KHR_push_descriptorWGSL, compiled to SPIR-V at build time
cpuThe reference implementationRust

What it needs

A Mac with 32 GiB of memory, or a Linux GPU with 24 GB of VRAM, and 16 GB of disk. The CPU works too, slowly.

Measure it yourself

dwim --bench prints tokens per second for reading and for generating, at 1k, 8k, 32k, 64k and 128k tokens of context.

The system prompt is read once

The model's state after the system prompt is saved under ~/.cache/dwim/states/ and taken up by later runs in place of reading it again.

Server

One process has the weights.
Sessions are its clients.

A session connects to the socket, and starts dwim --serve, detached, when nothing answers. The server exits after ten minutes without a session.

$ dwim $ dwim --sessions n
AF_UNIX
dwim --serve
The weights, loaded onceA key/value cache for each session

State for each session

The weights are shared. Each session has its own key/value caches and recurrent states on the device, allocated when the server starts. --sessions sets how many: 2 by default.

Sessions take turns

The model answers one reply at a time. A session whose turn it is not waits, and says so. One beyond the limit is refused until another ends.

Yours to supervise

dwim --serve runs in the foreground, for a service manager. /server in the shell shows it, stops it, or restarts it.

Integrations

Run a session at a provider instead of on your machine. /model picks where the model runs, and /provider shows it.

Try it out now

Install it, cd into a repository, and run dwim.

Source on GitHub