Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Fetched from the repository for this visit.
Whai is a simple way to call an LLM from terminal. It is not an agent that wipes your hard drive while you are in the kitchen.
I built this to lend me a hand when I get stuck or confused when ssh'd into my NAS. The goal is to keep you in your flow and save you from an alt tab to a browser and copy pasting context to get help.
https://github.com/user-attachments/assets/cbe834f0-2437-405b-9c95-88f02f6f69d9
whai is a lightweight AI terminal assistant that integrates directly into your native shell and workflow.
The philosophy of whai is to supplement your normal terminal usage without taking control.
You don't have to start a chat loop, alt-tab or copy paste.
When you get stuck, need a command, or encounter an error, just call whai for help on demand.
Analyze Previous Errors: If a command fails, you can call whai (no arguments needed!) or ask whai why did that fail?.
It reads the failed command and its error output from your terminal history to provide a diagnosis and solution. Note: Command output is available when running inside tmux or a whai shell session. Otherwise, the model will only see your commands but not their outputs.
Persistent Roles (Memory): whai uses simple, file-based "Roles" to provide persistent memory. You define your context once, what machine you are on, what tools are available, your personal preferences, and how you like to work, and whai retains this context for all future interactions.
Session Context: When running inside tmux or a whai shell session, whai reads your command history and outputs to understand both what you ran and what happened.
Help On Demand: Get help as you're using your shell:
> whai check my docker containers logs for errors
> whai "Is this resource usage normal?"
Requires Approval: Every whai command requires your explicit [a]pprove / [r]eject confirmation.
MCP Tool Integration: Connect local MCP servers to extend whai with additional tools like file operations, database queries, or API integrations, all with the same approval workflow.
Model-Agnostic: Use models from OpenAI, Gemini, Mistral, Anthropic, local Ollama models, and more.
Insert-Command Mode (Optional): Turn natural language at your prompt into a single shell command with a keybinding that replaces your current line without auto-executing anything.
$ whai give me the biggest folder here
Info: Model: gpt-5-mini | Role: default
I'll list all top-level directories (including hidden ones),
compute their disk usage, sort them, and show the largest
few with human-readable sizes.
I'll run this command:
find . -maxdepth 1 -mindepth 1 -type d -print0 | \
xargs -0 du -sk 2>/dev/null | \
sort -n | tail -n 5 | \
awk '{print $1 "\t" $2}' | \
numfmt --to=iec-i --suffix=B --field=1,1
Breakdown of what each part does:
- find . -maxdepth 1 -mindepth 1 -type d: Find directories at
current level only (excludes . and ..)
- -print0: Use null separator to safely handle spaces in
directory names
- xargs -0 du -sk: Pass each directory to du to get disk usage
in kilobytes, 2>/dev/null suppresses errors
- sort -n: Sort numerically by size
- tail -n 5: Show the 5 largest entries
- awk '{print $1 "\t" $2}': Format output as size (tab) path
- numfmt --to=iec-i --suffix=B --field=1,1: Convert sizes to
human-readable format (KiB, MiB, etc.)
╭─────────────────────── Proposed command ────────────────────────╮
│ find . -maxdepth 1 -mindepth 1 -type d -print0 | │
│ xargs -0 du -sk 2>/dev/null | │
│ sort -n | tail -n 5 | │
│ awk '{print $1 "\t" $2}' | │
│ numfmt --to=iec-i --suffix=B --field=1,1 │
╰─────────────────────────────────────────────────────────────────╯
[a]pprove / [r]eject / [m]odify: a
╭─────────────────── Output ────────────────────╮
│ 440B ./tests │
│ 1.4KiB ./.git │
│ 87KiB ./.venv_tmp │
│ 108KiB ./.venv │
│ 123KiB ./.venv-linux │
╰───────────────────────────────────────────────╯
Result (interpretation)
- The largest top-level directory here is ./.venv-linux
with ~123KiB.
Next steps (options)
- Show the top N largest items anywhere under the current
tree (files+dirs):
- du -ah . 2>/dev/null | sort -rh | head -n 30
- Show only directories, recursively, largest first:
- du -h --max-depth=3 2>/dev/null | sort -hr | head -n 30
$ uv pip install requirements.txt
Using Python 3.11.9 environment at: .venv-linux
× No solution found when resolving dependencies:
╰─▶ Because requirements-txt was not found in the package registry...
$ whai what is the problem
Info: Model: gpt-5-mini | Role: default
What's happening
- You ran: uv pip install requirements.txt
- pip treated "requirements.txt" as the name of a package to
download from the package index, not as a file of requirements.
- The resolver tried to find a package called (normalized)
"requirements-txt" on PyPI and failed, so it reports the
dependencies are unsatisfiable.
How to fix it
- Use the -r (or --requirement) flag so pip reads the file
instead of treating it as a package name.
Commands you can run
1) Check the requirements file exists:
ls -l requirements.txt
2) Install from the file (match how you invoked pip):
uv pip install -r requirements.txt
Do you want me to:
- run the ls to confirm the file exists, or
- run the install command for you now?
$ git push origin main
To https://github.com/user/repo.git
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/user/repo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
$ whai
Info: Model: gpt-5-mini | Role: default
What's happening
- You tried to push your local branch "main" to the remote,
but git rejected it.
- Your local branch is behind the remote branch—someone else
pushed changes to the remote that you don't have locally.
- Git won't let you push because it would overwrite those
remote changes.
How to fix it
- Pull the remote changes first, then push. This integrates
the remote commits with your local ones.
Commands you can run
1) See what commits are on the remote but not locally:
git fetch
git log HEAD..origin/main
2) Pull and merge the remote changes:
git pull origin main
3) After resolving any merge conflicts (if they occur), push again:
git push origin main
Do you want me to run git pull for you now?
$ whai "Quick how do I exit Vim??"
Info: Model: gpt-5-mini | Role: default
I'll show the quick ways to exit Vim and what each one does.
1) Get to Normal mode
- Press Esc (or Ctrl-[) until you stop inserting text. If Esc doesn't respond, try Ctrl-C.
2) Common exit commands (type them in Normal mode, then press Enter)
- :q
- Quit (works only if no changes since last save).
- :q!
- Quit and discard any unsaved changes.
- :wq
- Write (save) and quit.
- :x
- Write (only if changed) and quit (similar to :wq).
3) Shortcuts
- ZZ (Shift+Z twice) — save and quit (same as :wq if there are changes).
- ZQ — quit without saving (same as :q!).
You can install uv here
Then:
uv tool install whai
Or even without installing it!
uvx whai "your command"
pipx install whai
pip install whai
git clone https://github.com/gael-vanderlee/whai.git
cd whai
pip install -e .
On first run, whai launches an interactive configuration wizard:
whai --interactive-config
Or edit ~/.config/whai/config.toml directly:
[llm]
default_provider = "openai"
[llm.openai]
api_key = "sk-proj-your-key-here"
default_model = "gpt-5-mini"
Make sure to use a model that is capable of calling tools. Most frontier models have this functionality. For local models, you can look at the LMStudio models tagged for tool use here. Get API keys from:
To use a local model with LM Studio:
Enable the server in LM Studio:
Configure whai:
whai --interactive-config
lm_studio as the providerhttp://localhost:1234/v1llama-3-8b-instruct)Note: Model names are stored without provider prefixes in the config file. Prefixes are automatically added at runtime when needed.
Use openai_api for llama.cpp, llama-swap, vLLM, Tabby, and any other server that exposes an OpenAI-compatible /v1 API.
Start your local server and confirm its OpenAI API base URL.
Configure whai:
whai --interactive-config
openai_api as the providerllama3, qwen2.5, or your server’s exposed model id)Note: whai stores model names without provider prefixes and automatically adds the LiteLLM routing prefix at runtime.
Getting Help: For a complete list of command-line options and flags, run
whai --help.
whai "your question"
That's it! whai will:
whai shell, commands only otherwise)[a]pprove / [r]eject / [m]odify promptsTip: Quotes are not necessary, but do use them if you use special characters like
'or?whai show me the biggest file here whai "what's the biggest file?"
whai supports the following LLM providers:
gpt-5-mini, gpt-4, gpt-4-turbo)claude-3-5-sonnet-20241022, claude-3-opus)gemini-2.5-flash, gemini-2.5-pro)mistral-small-latest, mistral-medium-latest, mistral-large-latest)Each provider must be configured in your ~/.config/whai/config.toml file. You can configure multiple providers and switch between them using roles or the --provider flag.
Note:
whaiuses LiteLLM for multi-provider support. Additional providers from LiteLLM's supported providers list can be added upon request.
Roles allow you to customize whai's behavior and responses, and let you save information you don't have to repeat yourself in every conversation.
Let's create a toy role that tells whai to respond only in emoji:
$ whai role create emoji # "Answer using only emojis"
$ whai can you tell me the plot of the first Shrek movie --role emoji
Info: Model: gpt-5-mini | Role: emoji
👑👸💤🐉🏰
👹🏞️🕳️➡️🏰🐴😂
⚔️🐉🔥💨👸
👹❤️👸💚
🌅💋✨💚💚
🎉🎶🧅
# Create a new role
whai role create my-workflow
# Use it
whai "help me with this task" -r my-workflow
# List all roles
whai role list
For a complete list of role management commands, run whai role --help.
Roles are stored in ~/.config/whai/roles/ as Markdown files with YAML frontmatter, like so:
---
provider: openai
model: gpt-5-mini
# Optional parameters you can add:
# temperature: 0.3 # Only used when supported by the selected model
---
You are a helpful terminal assistant.
Describe context, behaviors, tone, and constraints here.
You can specify any provider in the provider field. See the Supported Providers section for the list of available providers.
The provider must be configured in your ~/.config/whai/config.toml file before it can be used. If no provider is specified in the role, whai uses the default provider from your configuration.
The default role is defined in the config.
whai automatically captures context from:
whai shellwhai supports connecting to local MCP servers to extend functionality with additional tools. MCP servers can provide tools for file operations, database queries, API integrations, and more.
~/.config/whai/mcp.json with your MCP server configuration:{
"mcpServers": {
"server-name": {
"command": "command-to-run",
"args": ["arg1", "arg2"],
"env": {"KEY": "value"},
"name": "Display Name (optional)",
"requires_approval": true
}
}
}
{
"mcpServers": {
"time-server": {
"command": "uvx",
"args": ["mcp-server-time"],
"env": {},
"name": "Time Server",
"requires_approval": false
}
}
}
Configuration fields:
command (required): Command to run the MCP serverargs (optional): Arguments to pass to the commandenv (optional): Environment variables for the servername (optional): Display name shown in tool approval promptsrequires_approval (optional, default: true): Whether to prompt for approval before executing tools from this serverMCP support is opt-in: if mcp.json doesn't exist, MCP is disabled. Tools from MCP servers are automatically discovered and made available to the LLM alongside the built-in execute_shell tool.
To disable MCP for a single run, use the --no-mcp flag:
whai "my question" --no-mcp
To disable MCP persistently, change in config.toml:
[mcp]
enabled = false
In a tmux session with multiple panes, you can run whai in one pane and have it use context from, and run approved commands in, another pane (e.g. one pane SSH'd to a server). Use --target or -T with the pane number (see pane numbers with Ctrl+b q):
whai -T 1 "check disk space"
Set WHAI_TARGET=1 in your environment to use a default target pane so you can omit the flag.
For output context without tmux, use whai shell to launch an interactive shell with session recording:
whai shell
This command:
The recorded session behaves exactly like your normal shell. The only difference is that whai can now access full command outputs for better assistance.
To exit: Type exit in the shell to return to your previous terminal.
Options:
# Launch with a specific shell
whai shell --shell zsh
# Specify a custom log path
whai shell --log ~/my-session.log
Session logs are stored temporarily during the session and are deleted when you exit the shell.
When you run whai from within a recorded shell session, it automatically uses the in-session log.
whai can also be used as a “turn this line into a command” helper.
whai --interactive-config) offers to add a Ctrl+G (can be changed in the snipped) keybinding snippet to your shell config file (e.g. ~/.bashrc or ~/.zshrc).After enabling it:
list largest folders here.Ctrl+G.whai --command-only.Ctrl+C to interrupt anytimewhai is integrated into your terminal with context awareness. It sees your command history and can execute commands.
Most terminal assistants either require you to explicitely start a chat loop which takes you out of your usual workflow, don't allow for roles, or don't allow to mix natural language conversation and shell execution.
You don't need AI to cd into a directory, you keep full agency over simple actions.
The goal was really to replace alt-tabbing to google with a CLI command.
Only when you run whai.
It captures recent history (50 last commands), tmux scrollback (commands + output), or recorded shell session content (commands + output while the session is active) and includes it in the request.
If you use a remote API model, it will see your recent terminal history.
You can disable this with the --no-context flag.
Yes! Configure Ollama or LMStudio for local models. See the configuration section above.
Contributions are welcome! If you'd like to contribute to whai, please:
git checkout -b feature/amazing-feature)uv run pytest)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Every Pull Request triggers the Pull Request CI workflow, which runs the full nox test matrix across Python 3.10–3.14 plus ruff linting. Keep your local uv run pytest runs green to avoid CI surprises.
For detailed development setup and guidelines, see DEV.md.
Built with LiteLLM for multi-provider support, Typer for the CLI, and Rich for pretty terminal output.
GitHub checked 160h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.