ComAI is a Bash-powered AI assistant for your Linux terminal.
Use it to ask Linux questions, explain commands before you run them, inspect files, scan logs, and talk to local AI, Ollama, OpenAI, or Gemini without leaving your shell. ComAI is the client; LocalAI is only one optional backend.
- Works from any terminal with the simple
comaicommand. - Supports LocalAI, Ollama, LM Studio, llama.cpp server, OpenAI, Gemini, and other OpenAI-compatible APIs.
- Understands files and logs with
-f. - Keeps setup and provider checks visible with
comai status. - Installs as a user-space tool under
~/localcomai.
One-line install:
curl -fsSL https://hossbit.github.io/comai/install.sh | bashCustom install directory:
curl -fsSL https://hossbit.github.io/comai/install.sh | COMAI_INSTALL_DIR="$HOME/apps/comai" bashManual install:
git clone https://github.com/hossbit/comai-linux-assistant.git
cd comai-linux-assistant
chmod +x scripts/install.sh
./scripts/install.shThen run:
comai statuscomai explain chmod 755
comai how do I find files larger than 1GB?
comai do you see any error? -f application.log
comai ollama hi
comai lmstudio hi
comai gpt hi
comai gemini hiLocal mode is the default. Use comai ollama ... for Ollama,
comai lmstudio ... for LM Studio, comai gpt ... for OpenAI, and
comai gemini ... for Gemini.
Use -- when the first word of your question is also a provider name:
comai -- ollama is the first word of this questioncomai setup # Configure provider, API, and model
comai ask # Ask one question
comai chat # Start an interactive conversation
comai explain # Explain a command, error, or output
comai analyze # Analyze logs, files, or piped output
comai status # Show provider status and connections
comai provider # Show active and available providers
comai models # List models from all providers
comai config # View, get, or edit settings
comai history # Show previous conversations
comai start # Start the optional LocalAI helper service
comai stop # Stop the optional LocalAI helper service
comai restart # Restart the optional LocalAI helper serviceCommon options:
comai --provider gemini --model gemini-2.5-flash hi
comai --max-tokens 900 "summarize this"--max-tokens must be a positive integer.
ComAI supports:
local: any OpenAI-compatible local server, defaulthttp://127.0.0.1:11435ollama: local Ollama API, defaulthttp://127.0.0.1:11434lmstudio: LM Studio local server, defaulthttp://127.0.0.1:1234openai: OpenAI API withOPENAI_API_KEYorproviders.openai.api_keygemini: Gemini API withGEMINI_API_KEYorproviders.gemini.api_key
Check providers:
comai status
comai models
comai providerComAI can list models from every configured provider, so you can use local models, Ollama models, LM Studio models, OpenAI models, and Gemini models from the same command line.
comai modelsExample output:
local (active):
Qwen2.5-Coder-7B-Instruct-Q4_K_M
Qwen3.5-9B-UD-IQ2_XXS
bge-m3-q8_0
ollama:
qwen2.5-coder:7b
lmstudio:
qwen/qwen3.5-9b
openai:
gpt-4o-mini
gpt-4.1
gpt-4o
gemini:
gemini-2.5-flash
gemini-2.5-pro
gemini-flash-latest
Use any listed model for one request:
comai --provider gemini --model gemini-2.5-flash "explain journalctl -u nginx"
comai --gpt --model gpt-4o-mini "write a safe backup command"
comai --ollama --model qwen2.5-coder:7b "explain this shell error"Or save a provider's default model:
comai config set providers.gemini.model gemini-2.5-flash
comai config set providers.openai.model gpt-4o-miniProvider code lives under lib/comai/providers/. To add another API provider,
add a provider module with the standard model, api_base, status, models,
and ask functions, then register it in lib/comai/providers/registry.sh.
comai explain this script -f install.sh
comai summarize this config -f nginx.conf
comai is this service healthy? -f service.logComAI service/status logs are written under:
~/localcomai/logs/comai.logFull documentation lives in the wiki:
- Quick Start
- Installation
- Providers
- Configuration
- ComAI + LocalAI
- Local AI Service
- File and Log Analysis
- Troubleshooting
- Uninstall
Bash 4.2+ curl jq awk grep sed sort head wc tr readlink date
GNU coreutils, including stat -c
GNU findutils, including find -printf
Optional:
file numfmt git systemctl shellcheck
Standard Debian, Ubuntu, RHEL, Fedora, Rocky, AlmaLinux, and CentOS-style
systems provide GNU coreutils/findutils, so find -printf and stat -c are
expected to work there. Minimal BusyBox/toybox-based containers, Alpine images,
and some UBI-minimal images may not provide those GNU extensions; install GNU
findutils/coreutils or run ComAI from a fuller Debian/RHEL userland.
For local portability checks, run:
scripts/test-local.shThe test script uses the current awk, plus mawk and gawk when installed.
To fully exercise the RHEL/Fedora awk path, run it on a host with gawk
installed.


