clai CLI

A terminal AI agent in Go: Hub profiles, MCP servers, skills and a loop that retries until your check passes

  • 153 ★ on the repository
  • Last commit
  • MIT
CLI

Extended access

Why this level

  • The agent calls tools and MCP servers from its profile; a Hub profile brings its own, so review it before agreeing.
  • Vendor keys sit in environment variables, and queries plus pipeline output go to the chosen vendor.
All reasons and checks

baalimago/clai

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/clai

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The agent calls tools and MCP servers from its profile; a Hub profile brings its own, so review it before agreeing.
  • Vendor keys sit in environment variables, and queries plus pipeline output go to the chosen vendor.

This is third-party code. Review the repository files before installing.

What it does

clai is a terminal wrapper around an AI agent, written in Go, that behaves like a regular unix tool: it reads from `stdin`, writes the answer to `stdout` and fits into pipelines. A query runs with `clai query`, and the model comes from one of 12 vendors: OpenAI, Anthropic, Gemini, Mistral, DeepSeek, xAI, OpenRouter, HuggingFace, Berget AI, Inception, Jev or a local Ollama. Shell context is injected into the system prompt through templates. A profile stores the model, tools, MCP servers and skills; clai reads skills from the project `.agents/skills` and from global directories. Ready-made profiles load from clai.chat: `clai -profile-path cchub:clai/pr-summarizer@1 query`. Instead of a model name you can name a role (`strong`, `fast`, `cheap`), and each machine resolves it to its own ordered list of models. The `-loop` flag repeats a query until the check from `-check` confirms the goal. `-response-format` returns JSON instead of prose, `-image` attaches pictures and the `generate_image` tool sends them back. The same agent loop plugs into a Go program through the `github.com/baalimago/clai/pkg/agent` package.

Who it is for. Terminal users who want a scriptable agent instead of an interactive one: shell pipeline authors, administrators and Go developers embedding an agent in their programs.

Good fit when

  • Pipe a command output or a log to a model and get the answer on `stdout`.
  • A task has to repeat until a check passes, with the check set through `-check`.
  • One agent profile must run on a laptop and on a server with different keys and models.
  • An agent is embedded in a Go program and the answer is needed as a typed structure.
  • A session in another agent ran out of limits and you want to continue the conversation.

Not a fit when

  • Interactive work on project files in an editor: clai is built for the console and pipelines.
  • Company rules forbid sending data to cloud vendors and no local model is set up in Ollama.
  • You want to run someone else's Hub profile blind: on first run clai shows its model, tools, MCP servers and skills and asks for your trust.

Example request

Turn the output of `git log --oneline -30` into release notes: `git log --oneline -30 | clai query Write release notes from this log`.

Limitations

At least one vendor key in an environment variable (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY` and so on) or a running Ollama is required. Markdown rendering in answers needs Glow installed. `clai cloud` sync is optional: config storage is free up to 1 GB, conversations cost $1 per started GB a month and need a card. A config holding a literal key is never uploaded. Documentation and examples are in English, and clai.chat is only needed for the Hub and sync.

How to disable. Delete the `clai` binary (for a Go install it is the file in `$GOPATH/bin`) and the config directory; cloud sync never sends anything on its own, so just stop running `clai cloud commit`.

FAQ

How do I install clai?

Use the setup script from the README: `curl -fsSL https://raw.githubusercontent.com/baalimago/clai/main/setup.sh | sh`. Alternatives are `go install github.com/baalimago/clai@latest` and `nix run github:baalimago/clai` without installing.

Which models does clai support?

Twelve vendors: OpenAI, Anthropic, Gemini, Mistral, DeepSeek, xAI, OpenRouter, HuggingFace, Berget AI, Inception, Jev and Ollama. The key goes into an environment variable such as `OPENAI_API_KEY`; Ollama defaults to localhost:11434.

What does the -loop flag do?

It repeats the query until the command from `-check` succeeds. Without `-check` the loop cannot tell when to stop, so the flags are used together.

Can clai be used as a Go library?

Yes. The `github.com/baalimago/clai/pkg/agent` package runs the same agent loop silently and returns typed errors; the answer structure is set through `agent.NewTyped`.

What does clai cloud sync?

Profiles, MCP servers, shell contexts, skills and the theme, and optionally conversations, between your machines. It works like git: `clai cloud pull` fetches changes and `clai cloud commit -m "laptop"` uploads yours.

Discussion

No questions or reviews yet.

CLI tools

OpenClacky is an open-source AI agent in Ruby with 16 tools, any OpenAI-compatible key and extension through skills.

CLIBroad access1.2KRepository stars
Needs a VPN

A Go command-line client for working with OpenAI, Azure, Perplexity and LLaMA language models right from the terminal

CLIBroad access966Repository stars

The clawctl CLI manages a fleet of AI agents on local machines over SSH and Ansible: install, start, upgrade and token tracking.

CLIBroad access67Repository stars

An AI-agent workspace with parallel worktrees, cross-provider orchestration, and bots across chat channels.

CLIBroad access134Repository stars

A CLI that connects local agents to a shared cloud store of sessions, memory, skills and MCP connectors.

CLIExtended access107Repository stars

A Go CLI that configures the AI coding agents you already use: it gives them shared memory, a workflow and deterministic steps without replacing the agents them

CLIExtended access9KRepository stars

Comparison with similar tools

Cards that share the main search query, and how they differ.

ToolOfficialRepository starsMain difference
clai (this card)no153
Aiderno50,089edits code in a git repository; clai works on arbitrary pipeline data and retries a task until a check passes
AIChatno10,567a general terminal chat with models; clai adds Hub profiles, model roles instead of names and a Go embedding package

README in short

The README opens with install commands and a feature list, then covers running agents from the Hub, using the package as a library and cloud sync. A table at the end maps vendors to environment variables. Details live in the `architecture/` directory and the examples file.

README badge

Report a problem