
dwim
Do what I mean. Type what you want in bash. When bash finds no command for the line, dwim hands it to a model, which answers with one command. You run it, edit it, or skip it.
$ go to the etc directory and print where I am
→ cd /etc && pwd
[enter] run [e] edit [any] skip
/etcThe model is yours to pick: Claude, GPT, Gemini, a model on your own Ollama server, or a small model from Hugging Face that runs on your machine, with no service and no key.
Install
dwim has no release yet, so its packages are not on npm. Once they are, three lines set it up:
npm install --global @wtf/dwim @wtf/dwim-qwen-coder
dwim provider use @wtf/dwim-qwen-coder
echo 'eval "$(dwim shell init bash)"' >> ~/.bashrcOpen a new shell and type what you mean. The first line downloads the local model, 1.8 GB, and loads it. The lines after it answer in a couple of seconds.
Pick a model
A provider package brings the model. There are two:
@wtf/dwim-ai-sdkruns any model of the AI SDK. Anthropic, OpenAI, Google and any OpenAI-compatible server, such as Ollama, come with it. It needs the provider's key.@wtf/dwim-qwen-coderruns Qwen2.5-Coder on your CPU, 1.5B by default, or any ONNX model on Hugging Face. It needs 1.8 GB of disk.
dwim provider use picks one, and -o sets its options:
dwim provider use @wtf/dwim-ai-sdk # Claude Haiku
dwim provider use @wtf/dwim-ai-sdk -o package=openai -o model=gpt-5-mini
dwim provider use @wtf/dwim-qwen-coder -o size=3B
dwim provider showHow it works
- bash calls dwim's hook for a line it finds no command for. A line of one word, like the typo
gti, still gets bash's usual "command not found". - A daemon keeps the model loaded for 30 idle minutes, so a local model loads once, not on every line.
dwim daemon startstarts it ahead of the first line. - The command runs in your own shell, so
cdandexportstick, and it lands in your history. - bash reads the line before dwim sees it: an apostrophe opens a quote, and
>,|and*mean what they always do. A line that starts with a command that exists, such asmake a tarball, runs that command.
Settings
| Setting | What it does |
|---|---|
DWIM_OFF=1 | Leave unknown commands alone. |
DWIM_MIN_WORDS=2 | Lines of fewer words get "command not found". |
DWIM_TIMEOUT=120 | Seconds the hook waits for an answer. |
Source
dwim is a pnpm workspace of TypeScript packages: the CLI, its library, the two providers, and its guides, which also show how to write a provider of your own. They are all inits repo on GitLab, under the MIT license.