KlaatAI/klaatcode

Open-source AI coding agent for the terminal. Claude Code-grade accuracy with smart model routing — uses the right AI model for each task, cutting costs 10x. Supports Claude, GPT, Gemini, DeepSeek & more.

Klaat Code – a terminal‑native AI coding assistant

What it is – Klaat Code is a command‑line tool that lets you talk to an AI‑powered coding agent directly from your terminal. You type a request (e.g., “fix all TypeScript errors”), the agent reads your project, edits files, runs commands, and checks the results, all while keeping you in control.

How it works – Every user message is sent to Klaatu‑o1, a hosted “router” model. Klaatu decides which of six cost‑tier models (nano, fast, code, reason, heavy, titan) is appropriate for the request and forwards the prompt there. The router can automatically escalate to a more powerful tier if the task turns out harder than expected, and it can de‑escalate when the extra power is no longer needed. Only the user messages count toward your quota; all tool calls (file reads, shell commands, web searches, etc.) are free.

Key differentiators

  1. Per‑request smart routing – you never have to pick a model up front; the service picks the cheapest tier that can solve the turn and upgrades only when necessary.
  2. Code‑graph index – the project is indexed into a semantic call‑graph. The agent can query symbols, callers, callees, and blast‑radius without loading whole files, cutting token usage 5‑15×.
  3. Unlimited tool rounds – unlike many CLI agents that stop after a fixed number of tool calls, Klaat Code lets the model iterate freely; the server detects true loops and aborts them with recovery guidance.
  4. Built‑in cost guards – real‑time burn‑rate monitoring, per‑task cost breakdown, hard session caps, and a --max-cost flag for CI pipelines.
  5. Context compaction with verification – when the conversation exceeds the model’s context window, the client automatically summarizes the lost parts, verifies the summary, and tells the model exactly what was forgotten.
  6. Reproducible benchmark – the repo ships a benchmark harness (bun run bench) that reproduces the published cost‑and‑speed numbers against Claude Code, Cursor, opencode, etc.

Main features

  • Rich terminal UI – syntax‑highlighted markdown, live token/cost counters, mouse‑draggable code blocks, 14 colour themes, Vim‑mode, and a sidebar showing routing analytics.
  • Slash‑commands – /tier, /model, /why, /cost, /context, /compact, /diff, /review, /commit, /undo, /checkpoint, /rollback, /skill, /plugin, /mcp, etc.
  • Toolset – read/write files, apply patches, glob/grep, run shell commands (permission‑gated), web fetch/search, project‑graph queries, semantic search, blast‑radius analysis, browser automation, and a delegation system that spawns sub‑agents for scoped work.
  • Git integration – AI‑generated diffs, reviews, commit messages, and easy undo/rollback.
  • Extensibility – custom tools (JavaScript plugins), reusable prompt templates (skills), lifecycle hooks, and project‑wide rules files.
  • Permissions & safety – three‑layer permission model, sandboxed writes, deny‑lists for dangerous commands, and automatic detection of runaway loops.

Installation – Available as a global npm package, a one‑line script, Homebrew formula, or Windows PowerShell installer. The installed binary runs without a Node/Bun runtime; the CLI itself is a compiled binary that ships alongside a tiny helper (klaatai).

Typical workflow

klaatcode login               # open browser, sign in to your KlaatAI account
klaatcode                     # start an interactive session in the current repo
# Example request
> fix all TypeScript errors
# The agent:
#   • reads the project graph
#   • runs the TypeScript compiler
#   • edits files
#   • runs the linter again
#   • returns the diff and a summary

For CI you can run headless:

klaatcode run "apply eslint fixes" --max-cost 0.10

If the run exceeds the budget it exits with a distinct code so your pipeline can fail safely.

Benchmarks (July 2026) – On a 33‑task suite the agent solved 33/33 tasks at an average cost of $0.027 per task (≈ 52 K tokens) and a median latency of 23 s. This is ~5.4× cheaper than Claude Code and ~1.7× cheaper than the nearest competitor while maintaining a perfect solve rate.

Where it fits – Developers who want an AI pair‑programmer that lives in the terminal, need fine‑grained cost control, and work on codebases where token budget matters (e.g., large monorepos, CI pipelines). It also serves teams that want to keep the routing intelligence proprietary while still open‑sourcing the client.

Docs & support – Full reference at https://klaatai.com/docs, live Discord community, and a public benchmark dashboard.

Related

  • Project
  • Project
  • Project
  • Project
  • Project