MCPcopy Index your code
hub / github.com/diillson/chatcli

github.com/diillson/chatcli @v1.152.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.152.0 ↗ · + Follow
14,503 symbols 61,823 edges 1,349 files 8,386 documented · 58%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ChatCLI Logo

ChatCLI

Unified AI platform for terminal, gRPC server, and Kubernetes.

14 providers · 14 autonomous agents · 7-pattern quality pipeline · one binary.

CI Security Scan Release ArtifactHub Go Reference

Go version License Last commit Code size Platforms Trivy Cosign Signed SBOM Prometheus

PortuguêsFull documentationArchitectureObservability


ChatCLI Demo

ChatCLI connects the industry's leading LLMs to a single, extensible interface — from chatcli -p in your terminal to a Kubernetes operator with an autonomous AIOps pipeline, passing through a production-ready gRPC server with authentication, failover, and Prometheus metrics.

Highlights

Multi-provider with failover 14 LLM providers (OpenAI · OpenAI Responses · Anthropic · Bedrock · Google · xAI · ZAI · MiniMax · Moonshot (Kimi) · Copilot · GitHub Models · StackSpot · OpenRouter · Ollama) with intelligent error classification, exponential backoff, and per-provider cooldown.
Autonomous agents 14 built-in workers coordinated by a ReAct engine (Reason + Act): 12 orchestration specialists run in parallel + 2 quality agents (refiner, verifier), plus a 7-pattern quality pipeline.
Quality pipeline Self-Refine, Chain-of-Verification (CoVe), Reflexion, RAG + HyDE, Plan-and-Solve (ReWOO), cross-provider reasoning backbone — all composed via a thread-safe state machine with circuit breakers and hot reload.
Scheduler (Chronos) Durable scheduling with cron + wait-until + DAG + daemon mode. /schedule, /wait, /jobs + @scheduler tool for agents. CRC32 WAL, snapshots, rate limiter, circuit breakers, JSONL audit, 13 Prometheus metrics. Jobs survive crashes and CLI exit.
Durable Reflexion WAL-backed queue with worker pool, dead letter queue, boot replay, exponential retry with jitter — lessons survive process crashes.
Semantic convergence char → Jaccard → embedding cosine cascade for Self-Refine, with LRU/TTL cache and quality regression detection.
Production-ready gRPC + TLS 1.3, JWT + RBAC, AES-256-GCM, rate limiting, audit logging, 50+ Prometheus metrics.
Kubernetes-native Operator with 17 CRDs and an autonomous AIOps pipeline (54+ remediation actions), SLO monitoring, post-mortems.
Extensible Plugins with Ed25519 signature verification, multi-registry skills (skills.sh, ClawHub, ChatCLI.dev), lifecycle hooks, MCP client (stdio + SSE).

Installation

# Homebrew (macOS / Linux)
brew tap diillson/chatcli && brew install chatcli

# Go install
go install github.com/diillson/chatcli@latest

# Pre-built, cosign-signed binaries
# https://github.com/diillson/chatcli/releases

Build from source

git clone https://github.com/diillson/chatcli.git && cd chatcli
go mod tidy && go build -o chatcli

# With version metadata injected via ldflags
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
go build -ldflags "-X github.com/diillson/chatcli/version.Version=${VERSION}" -o chatcli

Quick Setup

LLM_PROVIDER=OPENAI    # OPENAI, CLAUDEAI, BEDROCK, GOOGLEAI, XAI, ZAI, MINIMAX, MOONSHOT,
                       # COPILOT, GITHUB_MODELS, OLLAMA, STACKSPOT, OPENROUTER
OPENAI_API_KEY=sk-xxx

Full provider configuration reference

Provider API Key Model Extras
OpenAI OPENAI_API_KEY OPENAI_MODEL OPENAI_MAX_TOKENS, OPENAI_USE_RESPONSES
Anthropic ANTHROPIC_API_KEY ANTHROPIC_MODEL ANTHROPIC_MAX_TOKENS
AWS Bedrock IAM / Profile / credentials chain BEDROCK_MODEL AWS_REGION, BEDROCK_CROSS_REGION
Google Gemini GOOGLEAI_API_KEY GOOGLEAI_MODEL GOOGLEAI_MAX_TOKENS
xAI XAI_API_KEY XAI_MODEL XAI_MAX_TOKENS
ZAI ZAI_API_KEY ZAI_MODEL ZAI_MAX_TOKENS
MiniMax MINIMAX_API_KEY MINIMAX_MODEL MINIMAX_MAX_TOKENS
Moonshot (Kimi) MOONSHOT_API_KEY MOONSHOT_MODEL MOONSHOT_MAX_TOKENS, MOONSHOT_THINKING
GitHub Copilot GITHUB_COPILOT_TOKEN COPILOT_MODEL or /auth login github-copilot
GitHub Models GITHUB_TOKEN GITHUB_MODELS_MODEL GH_TOKEN, GITHUB_MODELS_TOKEN
StackSpot CLIENT_ID, CLIENT_KEY STACKSPOT_REALM, STACKSPOT_AGENT_ID
OpenRouter OPENROUTER_API_KEY OPENROUTER_MAX_TOKENS, OPENROUTER_FALLBACK_MODELS
Ollama OLLAMA_MODEL OLLAMA_ENABLED=true, OLLAMA_BASE_URL
OpenAI (Responses API) OPENAI_API_KEY OPENAI_MODEL OPENAI_RESPONSES_API_URL

Three Modes of Operation

### Interactive CLI AI-powered terminal with a Bubble Tea TUI, project context, tool calling, and autonomous agents.
chatcli
chatcli -p "Explain this repo"
git diff | chatcli -p "Summarize"
### gRPC Server Shared backend with TLS 1.3, JWT/RBAC, failover, Prometheus metrics, MCP, and plugin discovery.
chatcli server --port 50051 \
  --token my-token
chatcli connect \
  --server host:50051 \
  --token my-token
### Kubernetes Operator Autonomous AIOps pipeline with 17 CRDs, 54+ remediation actions, SLO monitoring, and post-mortems.
helm install chatcli-operator \
  oci://ghcr.io/diillson/charts/chatcli-operator \
  --namespace chatcli-system \
  --create-namespace

Autonomous scheduler (Chronos)

The scheduler runs embedded in the CLI and optionally as a daemon. Jobs survive restarts via WAL + snapshot.

# Fire a command in 30s
/schedule ping --when +30s --do "/run curl https://api.example.com/health"

# Daily cron with retry
/schedule backup --cron "0 2 * * *" --do "shell: ./backup.sh" --max-retries 3

# Deploy + K8s wait + trigger smoke
/schedule deploy --when +0s --do "shell: terraform apply -auto-approve" \
  --wait "k8s:deployment/prod/api:Available" --timeout 15m \
  --triggers smoke-tests

# Daemon to keep running with the CLI closed
chatcli daemon start --detach
chatcli daemon status

# List / inspect / cancel
/jobs list
/jobs show <id>
/jobs tree
/jobs cancel <id>

Agents get the @scheduler tool and can pause themselves waiting on conditions — see Cookbook: scheduler automation and the feature doc.

Context commands (CLI mode)

Inject environment data directly into your prompt:

Command Description
@git Status, branches, and recent commits
@file <path> File or directory contents
@env Environment variables
@history Recent shell commands
@command <cmd> Execute a command and inject its output

Kubernetes manifest example (Instance CRD)

apiVersion: platform.chatcli.io/v1alpha1
kind: Instance
metadata:
  name: chatcli-prod
spec:
  provider: ZAI
  model: glm-5
  replicas: 2
  fallback:
    enabled: true
    providers:
      - name: OPENAI
        model: gpt-5.4
      - name: MINIMAX
        model: MiniMax-M2.7
helm install chatcli oci://ghcr.io/diillson/charts/chatcli \
  --namespace chatcli --create-namespace \
  --set llm.provider=OPENAI --set secrets.openaiApiKey=sk-xxx

Supported Providers

14 providers with a unified interface. Automatic failover with intelligent error classification, cross-provider extended thinking, and prompt caching where available.

Provider Default Model Tool Calling Vision Reasoning / Thinking
OpenAI gpt-5.4 Native Yes reasoning_effort (o-series / gpt-5)
Anthropic (Claude) claude-sonnet-4-6 Native Yes Extended thinking with cache
AWS Bedrock claude-sonnet-4-5 Native Yes Thinking budget (Anthropic models)
Google Gemini gemini-2.5-flash Native Yes
xAI (Grok) grok-4-1 XML fallback
ZAI (Zhipu AI) glm-5 Native Yes
MiniMax MiniMax-M2.7 Native Yes
Moonshot (Kimi) kimi-k2.6 Native Yes MOONSHOT_THINKING=enabled\|disabled\|auto
GitHub Copilot gpt-4o Native Yes
GitHub Models gpt-4o Native Yes
StackSpot AI StackSpotAI
OpenRouter openai/gpt-5.2 Native Yes Passthrough
Ollama (local) XML fallback <thinking> tag normalization
OpenAI (Responses API) gpt-5.4 Native Yes reasoning_effort
# Configurable fallback chain
CHATCLI_FALLBACK_PROVIDERS=OPENAI,CLAUDEAI,BEDROCK,ZAI,MINIMAX,MOONSHOT,OPENROUTER

/thinking on|off|auto enables extended thinking / reasoning_effort on any provider that supports it — the cross-provider mapping is automatic.


Autonomous Agents

ReAct engine (Reason + Act) with 14 built-in agents: 12 orchestration specialists running in parallel (file, coder, shell, git, search, planner, reviewer, tester, refactor, diagnostics, formatter, deps) + 2 quality-harness agents (refiner, verifier).

/coder "Refactor the auth module to use JWT"
chatcli -p "Create tests for the utils package" --agent-auto-exec
Agent Responsibility
File File reading, writing, and manipulation
Coder Code generation and editing
Shell System command execution
Git Version control operations
Search Code and file search
Planner Complex task decomposition (Plan-and-Solve / ReWOO)
Reviewer Automated code review
Tester Test generation and execution
Refactor Safe code refactoring
Diagnostics Problem analysis and debugging
Formatter Formatting and linting
Deps Dependency management
Refiner Self-Refine post-hook (critique → revise)
Verifier Chain-of-Verification (questions + final answer)

Workers are coordinated by the dispatcher with a configurable semaphore (CHATCLI_AGENT_MAX_WORKERS), retry policy, and FileLockManager synchronization.


Harness/Quality Pipeline

Seven prompting/execution patterns composed via a pluggable pipeline with state machine, hot reload, and per-hook isolation.

# Pattern Status Opt-in
1 ReAct (Reason + Act) ✅ agent core
2 Plan-and-Solve / ReWOO /plan, CHATCLI_QUALITY_PLAN_FIRST_MODE
3 Reflexion (with durable queue) on by default
4 RAG + HyDE CHATCLI_QUALITY_HYDE_ENABLED=1
5 Self-Refine (with semantic convergence) CHATCLI_QUALITY_REFINE_ENABLED=1
6 Chain-of-Verification (CoVe) CHATCLI_QUALITY_VERIFY_ENABLED=1
7 Cross-provider reasoning backbone CHATCLI_QUALITY_REASONING_MODE=auto

Pipeline Architecture

  • State machine (Active → Draining → Closed) with atomic CAS transitions.
  • Copy-on-Write via atomic.Pointer[snapshot]AddPre/AddPost/SwapConfig are atomic, zero locks on the hot path.
  • Per-hook isolation: panic recovery, timeout enforcement (default 30s), circuit breaker (5 failures → open for 30s).
  • Priority-based ordering via optional Prioritized interface (backward-compatible — unmarked hooks default to 100).
  • Short-circuit sentinels: ErrSkipExecution (cache-hit before agent.Execute) and ErrSkipRemainingHooks (ensemble patterns).
  • **Gr

Extension points exported contracts — how you extend this code

ModelLister (Interface)
ModelLister is an optional interface that LLM clients can implement to support listing available models from the provide [13 …
llm/client/llm_client.go
HubClient (Interface)
HubClient is the subset of the remote client the CLI needs to share a conversation through the hub. *client/remote.Clien [7 …
cli/hub_sync.go
ConditionEvaluator (Interface)
ConditionEvaluator is a plug-in that knows how to check one condition type. Methods are pure from the scheduler's standp [11 …
cli/scheduler/registry.go
LLMClient (Interface)
LLMClient is the interface the memory system needs from the LLM. Matches the subset of client.LLMClient used by memory o [38 …
cli/workspace/memory/types.go
SessionAdapter (Interface)
SessionAdapter exposes saved-session search to the @session tool. [7 implementers]
cli/plugins/builtin_session.go
Compressor (Interface)
Compressor reduces one class of content. Implementations must be safe for concurrent use — the router may invoke them fr [7 …
cli/compress/compress.go
Adapter (Interface)
Adapter is a platform integration. Implementations must be safe to Start once; Start blocks until ctx is canceled, pushi [9 …
cli/gateway/gateway.go
PartitionPolicy (Interface)
PartitionPolicy lets the caller inject capability lookups without pulling cli/plugins or cli/mcp into the agent package [25 …
cli/agent/tool_orchestration.go

Core symbols most depended-on inside this repo

Errorf
called by 5101
plugins-examples/chatcli-docs-flatten/main.go
T
called by 3509
i18n/i18n.go
Error
called by 2269
cli/cli.go
colorize
called by 1133
cli/colors.go
Equal
called by 913
cli/scheduler/types.go
String
called by 785
cli/agent/moa/moa.go
Unlock
called by 581
cli/agent/workers/file_lock.go
Get
called by 570
cli/compress/ccr.go

Shape

Function 7,113
Method 5,639
Struct 1,500
TypeAlias 123
Interface 93
FuncType 35

Languages

Go100%

Modules by API surface

proto/chatcli/v1/chatcli.pb.go601 symbols
operator/api/v1alpha1/zz_generated.deepcopy.go286 symbols
proto/chatcli/v1/chatcli_grpc.pb.go146 symbols
operator/api/rest/server.go92 symbols
k8s/multi_test.go81 symbols
cli/mcp/mcp_test.go78 symbols
cli/cli_completer.go72 symbols
cli/agent/ui_renderer.go65 symbols
cli/agent_tool_flatten_test.go63 symbols
cli/ctxmgr/ctxmgr_test.go61 symbols
operator/controllers/remediation_controller_test.go58 symbols
operator/controllers/remediation_actions_extended.go55 symbols

Datastores touched

(mongodb)Database · 1 repos
dbDatabase · 1 repos

For agents

$ claude mcp add chatcli \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact