klaatai
v0.1.4
Published
KlaatAI — AI coding assistant CLI with smart model routing
Maintainers
Readme
Klaat Code
AI coding assistant CLI with smart model routing — built for developers who live in the terminal.
npm install -g klaatai
klaataiWhat is Klaat Code?
Klaat Code is a terminal-native AI coding assistant — similar to Claude Code or OpenCode — but with smart model routing that automatically picks the right AI model for each request, saving cost without sacrificing quality.
It runs entirely in your terminal with a full TUI (no Electron, no browser required), supports MCP servers, vim keybindings, skills, hooks, and everything else you'd expect from a professional AI coding tool.
Install
npm (requires Node ≥ 18 or Bun ≥ 1)
npm install -g klaataimacOS permission error? If you see
EACCES: permission denied, either prefix withsudo:sudo npm install -g klaataiOr fix npm's global prefix once so you never need
sudoagain:mkdir -p ~/.npm-global npm config set prefix ~/.npm-global echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc source ~/.zshrc npm install -g klaatai
macOS (Apple Silicon) — standalone binary, no runtime needed
curl -fsSL https://github.com/klaatai/klaatai-cli/releases/latest/download/klaatai-macos-arm64 \
-o /usr/local/bin/klaatai && chmod +x /usr/local/bin/klaataimacOS (Intel)
curl -fsSL https://github.com/klaatai/klaatai-cli/releases/latest/download/klaatai-macos-x64 \
-o /usr/local/bin/klaatai && chmod +x /usr/local/bin/klaataiLinux (x64)
curl -fsSL https://github.com/klaatai/klaatai-cli/releases/latest/download/klaatai-linux-x64 \
-o /usr/local/bin/klaatai && chmod +x /usr/local/bin/klaataiQuick Start
# Open current directory
klaatai
# Open a specific project
klaatai ~/projects/my-app
klaatai /path/to/project
# Headless / CI mode
klaatai run "Fix all TypeScript errors"
klaatai run "Write tests for auth.ts" < auth.ts
# Authenticate
klaatai login
klaatai whoamiFeatures
Smart Model Routing
Klaat Code automatically routes each request to the most cost-effective model that can handle it. You get heavy model quality at nano model prices for simple tasks. The sidebar shows real-time tier distribution and estimated savings.
/model heavy # force a specific tier
/model # restore smart routing
/why # explain the last routing decisionFull TUI — No Browser Required
- Streaming responses with live token display
- Collapsible tool output (click to expand)
- Mouse support — click, scroll, drag to select + auto-copy
- Vim keybindings (
/vimmode on) - 7 themes: dark, light, dracula, nord, ayu, catppuccin, gruvbox
- Split sidebar: usage, context window, MCP servers, routing analytics
Built-in Tools
| Tool | Description |
|---|---|
| read_file | Read files with line numbers, offset/limit |
| write_file | Write files, creates parent dirs automatically |
| edit_file | Surgical string replacement |
| glob | File pattern matching |
| grep | Regex search across files |
| run_command | Execute shell commands |
| web_fetch | Fetch and read web pages |
| web_search | Search the web |
| todo_write/read | Persistent task management |
| delegate_task | Sub-agent delegation for complex tasks |
MCP (Model Context Protocol)
Full stdio MCP client — connect any MCP server in seconds.
# Configure in .klaatai/mcp.json
/mcp # manage servers in TUI7 built-in presets: filesystem, GitHub, Postgres, Puppeteer, Brave Search, Fetch, and more.
Git Integration
/diff # show git diff
/review # AI code review of current changes
/commit # AI-generated commit message + confirm
/undo # undo last AI file changes
/checkpoint # snapshot project state
/rollback # restore a checkpointSkills — Reusable Prompt Templates
Save prompts as .md files and invoke them by name.
/skill list # list all skills
/skill fix-types # invoke a skill
/skill new fix-types # create a new skill in $EDITORSkills live in .klaatai/skills/ (project) or ~/.klaatai/skills/ (global).
Hooks — Lifecycle Automation
Run shell commands before/after tool calls and messages.
// .klaatai/hooks.json
{
"after_message": ["afplay /System/Library/Sounds/Glass.aiff"],
"before_tool": ["echo \"$KLAATAI_TOOL_NAME\" >> ~/.klaatai/tool.log"],
"after_tool": ["notify-send \"$KLAATAI_TOOL_NAME done\""]
}Available events: before_message · after_message · before_tool · after_tool
Slash Commands
| Command | Description |
|---|---|
| /help | Show all commands |
| /model <tier> | Force routing tier: nano / fast / code / reason / heavy |
| /why | Explain last routing decision |
| /diff [file] | Show git diff |
| /review [ref] | AI code review |
| /commit | AI-generated git commit message |
| /test [args] | Run test suite (auto-detects Bun/Vitest/Jest/pytest/Go/Cargo) |
| /skill <name> | Invoke a saved prompt skill |
| /hooks | List configured lifecycle hooks |
| /init | Detect tech stack and generate project rules |
| /compact | Summarise context to free up the context window |
| /checkpoint [label] | Snapshot project state |
| /rollback [id] | Restore a checkpoint |
| /undo | Revert last AI file changes |
| /share | Export session to markdown |
| /theme <name> | Switch theme |
| /vimmode on\|off | Toggle vim keybindings |
| /mcp | Manage MCP servers |
| /sessions | List saved sessions |
| /resume <id> | Resume a previous session |
| /doctor | Diagnose auth, API, MCP, and project health |
| /clear | Clear chat |
| /cost | Show session cost |
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
| ctrl+p | Command palette |
| ctrl+y | Copy last AI response to clipboard |
| ctrl+d | Quit |
| ctrl+c | Cancel streaming / quit |
| ctrl+x ctrl+e | Open $EDITOR to compose message |
| esc | Cancel streaming |
| @ | Insert file reference (fuzzy picker) |
| !cmd | Run shell command and inject output |
| Mouse drag | Select and auto-copy to clipboard |
Vim Mode (/vimmode on)
| Key | Action |
|---|---|
| esc | NORMAL mode |
| i / a / A / I | INSERT mode |
| h / l | Move cursor |
| j / k | Scroll chat |
| w / b / e | Word motion |
| 0 / $ | Line start / end |
| dd | Clear input |
| D | Kill to end of line |
| gg / G | Scroll to top / bottom |
| ctrl+u / ctrl+d | Half-page scroll |
Configuration
Config is stored in ~/.klaatai/config.json.
{
"baseUrl": "https://api.klaatai.com",
"routingDisplay": "minimal",
"theme": "dark",
"vimMode": false
}| Key | Values | Description |
|---|---|---|
| routingDisplay | off / minimal / full | Chat header detail level |
| theme | dark / light / dracula / nord / ayu / catppuccin / gruvbox | UI theme |
| vimMode | true / false | Vim keybindings |
Project Rules
Create .klaatai/rules.md in your project root — it's injected as a system message every session. Use /init to auto-generate one based on your tech stack.
Permissions
Fine-grained tool permissions in ~/.klaatai/permissions.json:
{
"allow": ["read_file:*", "glob:*"],
"deny": ["run_command:rm -rf*"],
"trusted_tools": ["read_file", "glob", "grep"]
}Headless / CI Mode
# Single prompt, streams to stdout
klaatai run "Summarise CHANGELOG.md"
# Pipe input
echo "Explain this function" | klaatai run -
# With options
klaatai run "Fix type errors" --model fast --system "You are a TypeScript expert"
# In CI — no TUI, just output
klaatai run "Check for security issues in auth.ts" < auth.tsAPI Server Mode
klaatai serve --port 8080Exposes a REST API at http://localhost:8080 for IDE extensions and integrations:
GET /v1/health— health checkGET /v1/info— session infoPOST /v1/chat— chat with SSE streaming
Directory Structure
~/.klaatai/
credentials.json # API key + auth
config.json # user preferences
permissions.json # tool permission rules
mcp.json # global MCP servers
hooks.json # global lifecycle hooks
sessions/ # saved session transcripts
skills/ # global prompt skills (.md files)
plugins/ # custom tool plugins (.js files)
todos.json # persistent todo list
.klaatai/ # project-level (in your repo)
rules.md # project rules (injected as system message)
mcp.json # project MCP servers
hooks.json # project lifecycle hooks
skills/ # project prompt skillsLicense
MIT © KlaatAI
