Skip to content

hossbit/comai-linux-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ComAI - Linux Terminal AI Assistant

ComAI local AI assistant for Linux

Linux Bash Local AI Ollama LM Studio OpenAI Gemini License Wiki

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.

Why Use It

  • Works from any terminal with the simple comai command.
  • 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.

Demo

ComAI terminal demo

Install

One-line install:

curl -fsSL https://hossbit.github.io/comai/install.sh | bash

Custom install directory:

curl -fsSL https://hossbit.github.io/comai/install.sh | COMAI_INSTALL_DIR="$HOME/apps/comai" bash

Manual install:

git clone https://github.com/hossbit/comai-linux-assistant.git
cd comai-linux-assistant
chmod +x scripts/install.sh
./scripts/install.sh

Then run:

comai status

First Commands

comai 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 hi

Local 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 question

Main Commands

comai 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 service

Common options:

comai --provider gemini --model gemini-2.5-flash hi
comai --max-tokens 900 "summarize this"

--max-tokens must be a positive integer.

Providers

ComAI supports:

  • local: any OpenAI-compatible local server, default http://127.0.0.1:11435
  • ollama: local Ollama API, default http://127.0.0.1:11434
  • lmstudio: LM Studio local server, default http://127.0.0.1:1234
  • openai: OpenAI API with OPENAI_API_KEY or providers.openai.api_key
  • gemini: Gemini API with GEMINI_API_KEY or providers.gemini.api_key
Local AI Server
hossbit/local-ai-server

OpenAI-compatible Linux local AI backend for the local provider.

Check providers:

comai status
comai models
comai provider

Models

ComAI 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 models

Example 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-mini

Provider 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.

Files And Logs

comai explain this script -f install.sh
comai summarize this config -f nginx.conf
comai is this service healthy? -f service.log

ComAI service/status logs are written under:

~/localcomai/logs/comai.log

Documentation

Full documentation lives in the wiki:

Requirements

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.sh

The 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.

Support

If this repo helped you, give it a star

About

Local AI Linux terminal assistant written in Bash. Explain commands, analyze files and logs, and use local LLMs or OpenAI-compatible APIs.

Topics

Resources

License

Stars

4 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages