Building ask: An LLM in Your Terminal
ask is a Python CLI for natural language interaction with LLMs. This post covers
why it exists and the choices that keep it fast and out of the way.
Installation
Homebrew (macOS)
brew tap nimahejazi/tap
brew install nh-ask-cli
You may need brew trust nimahejazi/tap.
pip
pip install nh-ask-cli
From Source
git clone https://github.com/nimahejazi/ask.git
cd ask
pip install -e .
Why a terminal assistant?
Most days I have a question that is faster to ask than to grep the docs for: how
do I revert one file in git, what port is this process holding, why is this log
complaining. The friction was leaving the shell, opening a browser, and pasting
back a command. ask collapses that loop to a single line.
The first version did one thing: stream an answer. Two flags made it genuinely
useful. -c returns a single bare command for easy copying, and together with
the interactive --it mode they turn “I wonder how” into “it is done” without
copy paste gymnastics.
Keeping the model local or cloud
A terminal tool should not lock you into one provider. Run ask once to configure
your preferred LLM: Mock, Ollama, LM Studio, Anthropic, or ChatGPT. Settings are
stored and can be overridden with environment variables.
ask ──► local (Ollama / LM Studio) | cloud (Anthropic / OpenAI) | custom
That split means the same CLI works on a laptop with no API key and on a machine wired to a cloud model.
Tool support
The -t ./tools.sh flag lets you pass shell functions as tools. The model calls
them when appropriate, extending its capabilities without hardcoding logic.
Architecture in brief
The code is plain Python. ask/ holds the CLI entrypoint and provider clients;
the chat loop handles streaming responses and tool orchestration. Configuration
is resolved from environment variables, and installation supports Homebrew,
pip, or editable installs from source.
stdin / args ──► ask ──► provider ──► streamed answer or command
└──► tool execution (when requested via -t)
Tests run with pytest or python -m pytest, and the package builds with
pip install ..
##Wrapping up
ask is deliberately small. It answers, it returns a command you can run, and it
extends itself via tools when needed. The result is a tool that stays in the
background until you actually need it.
- Source code: github.com/nimahejazi/ask
- Project page: [/projects/ask/]