Awesome Go

clai

CategoryArtificial Intelligence
SubcategoryArtificial Intelligence
Stars153

Agentic harness focused on terminal workflows, following UNIX principles. No external dependencies, ideal for scripting/prototyping agentic apps, engine is also exposed as a package

About clai

Wakatime Go Reference

Test coverage: 92.4% πŸ˜πŸ‘Œ

Get started

Installing:

curl -fsSL https://raw.githubusercontent.com/baalimago/clai/main/setup.sh | sh

You can also install via go:

go install github.com/baalimago/clai@latest

Or run it from the Nix flake without installing (flakes must be enabled):

nix run github:baalimago/clai

Then run:

clai | clai query Please give a concise explanation of clai

Install Glow for formatted markdown output when querying text responses.

man clai documents every command. setup.sh installs the page, and the first run of a new release in a terminal installs or updates it; clai man install does it on demand and CLAI_MANPAGE=off turns the automatic install off.

See clai.chat for details on usecase of all the features. Here's a brief summary:

Features

  • Shell context injection - Inject shell context into the system prompt via configurable templates.
  • Seamless conversation import - Ran out of session? Continue in clai!
  • Agent Skills - Import skills from custom global directories, or project-level .agents/skills.
  • Profiles - Pre-prompted profiles enabling customized workflows and agents, run locally or from the Hub.
  • Model fallback - Name a verb (strong, fast, cheap) instead of a model: each machine resolves it to its own ordered list and the run tries them in turn, so a shared profile runs anywhere.
  • Loop until verified - Add -loop to a query and clai iterates toward the goal, accepting completion only when -check passes.
  • Structured output - -response-format returns JSON instead of prose, from any vendor; Jev answers a fixed set of questions about the data you pipe in.
  • MCP client support - Add any MCP server you'd like by pasting their configuration.
  • Images, both ways - Attach images with -image, a glob or stdin to any model, and get images back through the generate_image tool, or from an image-output model.
  • Sync, git-style - clai cloud pull and commit carry your config and conversations between machines, only when you ask.
  • Reply only - -reply-only keeps stdout for the answer and draws the progress on stderr.
  • Unix-like - Clai follows the unix philosophy and works with data piped in and out.

All of these features are easily combined and tweaked, empowering users to accomplish very diverse use cases. See examples for additional info and clai.chat for in-depth guides.

Featured supported vendors

VendorEnvironment VariableModels
JevTYPESAFE_API_KEYSystem One evaluation, model jev-latest, questions from -response-format
OpenRouterOPENROUTER_API_KEYText models, image models, use prefix or:
OllamaOLLAMA_API_KEYUse format ollama: (defaults to llama3), server defaults to localhost:11434
MistralMISTRAL_API_KEYText models
OpenAIOPENAI_API_KEYText models, photo models
DeepSeekDEEPSEEK_API_KEYText models, key is optional, no prefix (defaults to deepseek-flash)
GeminiGEMINI_API_KEYText models, photo models
AnthropicANTHROPIC_API_KEYText models

Moved but never forgotten:

Frequently Asked Questions

What is clai?

clai is a Artificial Intelligence library for the Go programming language. Agentic harness focused on terminal workflows, following UNIX principles. No external dependencies, ideal for scripting/prototyping agentic apps, engine is also exposed as a package

How do I install clai?

Install clai with the Go module system using `go get baalimago/clai`. Check the repository for the current installation instructions.

What category does clai belong to?

clai is listed under Artificial Intelligence, specifically Artificial Intelligence.

← Back to Artificial Intelligence