Kilo Code CLI is the tool you reach for when a full coding agent is overkill. Most daily coding tasks — explaining a regex, generating a TypeScript interface, writing a docstring, translating a snippet — don’t need autonomous planning or multi-step execution. They need a fast, context-aware LLM call that returns structured output you can pipe into your workflow.
This guide covers installation, provider configuration, practical usage patterns, and where Kilo fits in a modern AI toolchain.
Why Kilo Exists
Full agents (Claude Code, Cursor, OpenCode, Hermes) carry overhead: they plan, maintain state, spawn tools, and recover from failures. For a quick question like “what does this regex do?” or “write a boilerplate React component,” that overhead is pure latency.
Kilo strips away the agent loop and keeps what matters:
- Intelligent context gathering — automatically pulls relevant files, git diff, terminal output
- Provider agnostic — OpenAI, Anthropic, Google, Groq, local via Ollama with a single flag
- Structured output parsing — code blocks, shell commands, diffs ready for piping
- Sub-100ms startup — no agent runtime to initialize
The Unix philosophy: do one thing well. Kilo is the grep of AI coding — instant, composable, always there.
Installation
# npm (recommended)
npm install -g @kilocode/cli
# or with bun
bun add -g @kilocode/cli
# or download binary from GitHub releases
Verify installation:
kilo --version
# kilo v7.x.x
Provider Configuration
Kilo needs an API key for at least one provider. Set it as an environment variable:
# Anthropic (Claude)
export ANTHROPIC_API_KEY="sk-ant-..."
# OpenAI
export OPENAI_API_KEY="sk-..."
# Google (Gemini)
export GOOGLE_API_KEY="..."
# Groq (fast, cheap)
export GROQ_API_KEY="..."
# Local via Ollama (no key needed)
# ollama serve must be running
You can also create a .kiloconfig in your project or home directory:
{
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022",
"maxTokens": 8192,
"temperature": 0.1
}
Switch providers on the fly:
kilo --provider openai --model gpt-4o "explain this function"
kilo --provider ollama --model codellama "write a test"
Daily Usage Patterns
Explain Code
kilo "explain the regex in utils/validate.ts"
kilo --files src/parser.ts "what does this parser do?"
Generate Boilerplate
kilo "create a React component for a data table with sorting and pagination"
kilo --output tsx "typescript interface for this JSON: {\"user\":{\"id\":1,\"name\":\"test\"}}"
Write Documentation
kilo --files src/api/*.ts "write JSDoc comments for all exported functions"
kilo "generate README section for the auth module"
Translate Between Languages
kilo --files script.py "convert this to TypeScript"
kilo "translate this SQL query to Prisma ORM syntax"
Quick Code Review
kilo --files $(git diff --name-only) "review these changes for bugs and style issues"
kilo --stdin < patch.diff "review this diff"
Generate Commands & Scripts
kilo "bash command to find all TODO comments and output as JSON"
kilo "git alias for 'commit with conventional message and push'"
Context Management
Kilo automatically gathers context from:
- Open files in your editor (via LSP integration)
- Git status — staged/unstaged changes, recent commits
- Terminal history — last 50 lines of output
- Directory structure — project layout, config files
You can explicitly include files:
kilo --files src/auth.ts,src/middleware.ts "review auth flow"
kilo --dir src/components "document all components"
Exclude noise:
kilo --exclude "*.test.ts,*.spec.ts,dist/**" "review production code"
Output Handling
Kilo parses model responses into structured formats:
| Output Type | Use Case |
|---|---|
| Code blocks | Save directly to file: kilo "component" > Component.tsx |
| Shell commands | Pipe to bash: kilo "command to..." | bash |
| Diffs | Apply with git: kilo --diff "fix bug" | git apply |
| JSON | Parse with jq: kilo --json "analyze deps" | jq . |
Example workflow:
# Generate a component and save it
kilo "react form component with zod validation" > src/components/Form.tsx
# Get a command, review it, then run
kilo "find and kill process on port 3000"
# Output: lsof -ti:3000 | xargs kill -9
# Then run it manually or: kilo "..." | bash
When to Use Kilo vs Full Agents
| Task Type | Use Kilo | Use Full Agent |
|---|---|---|
| Explain code | ✅ | Overkill |
| Generate boilerplate | ✅ | Overkill |
| Write docs/docstrings | ✅ | Overkill |
| Quick refactor (1-3 files) | ✅ | ✅ |
| Multi-step refactor (10+ files) | ❌ | ✅ |
| Scheduled/background tasks | ❌ | ✅ (Hermes) |
| Autonomous debugging | ❌ | ✅ |
| Team workflow automation | ❌ | ✅ (OpenCode skills) |
Rule of thumb: If the task fits in a single prompt and returns in one shot → Kilo. If it needs planning, iteration, or state across steps → full agent.
Kilo in Your Toolchain
Kilo doesn’t have to be your only AI tool. A practical setup:
# ~/.bashrc or ~/.zshrc
alias k=kilo
alias kx='kilo --provider anthropic --model claude-3-5-sonnet-20241022'
alias kl='kilo --provider ollama --model codellama'
- Kilo — 50+ times/day for micro-tasks
- OpenCode/Hermes — weekly for heavy lifts
- AGENTS.md — both read the same project conventions
See our AGENTS.md complete guide for setting up shared conventions.
Advanced Tips
Use with Local Models for Privacy
# Start Ollama
ollama serve
# Pull a coding model
ollama pull codellama:13b
ollama pull deepseek-coder:6.7b
# Use with Kilo (no data leaves your machine)
kilo --provider ollama --model codellama:13b "review this auth code"
Cost Optimization
Route simple tasks to cheap models, complex reasoning to strong ones:
# Cheap & fast for boilerplate
kilo --provider groq --model llama-3.1-8b-instant "generate boilerplate"
# Strong model for architecture decisions
kilo --provider anthropic --model claude-3-5-sonnet "design this API"
Integrate with Editors
VS Code extension: search “Kilo Code” in marketplace. Adds inline chat and context menu actions.
Limitations
Kilo intentionally does not:
- Autonomously plan multi-step work
- Maintain long-running task state across sessions
- Self-recover from failed edits
- Run background/cron jobs
These are tradeoffs, not bugs — they keep Kilo fast, predictable, and safe. For autonomous work, see our Hermes Agent deep dive or OpenCode deep dive.
Security
Kilo reads your files and holds provider keys. Apply the same practices from our coding agent security checklist:
- Scope API keys tightly (per-project, read-only where possible)
- Use local models for sensitive code
- Review generated diffs before applying
- Keep Kilo and dependencies updated
Further Reading
- Kilo Code CLI Deep Dive — architecture & philosophy
- Kilo vs OpenCode — head-to-head comparison
- Kilo vs Pi.Dev — lightweight orchestrator comparison
- Best Coding Agents 2026 Decision Guide — full landscape
- Coding Agent Pricing Guide 2026 — cost comparison
Stop paying for AI subscriptions you barely use. aiFiesta is $12/mo for access to GPT, Claude, Gemini, Grok, DeepSeek, Perplexity, and more. One sub, every top model.
Related articles
- Kilo Code CLI Deep Dive: The Lightweight LLM Orchestrator
- OpenCode Deep Dive: The Skill-Driven Open-Source Coding Agent
- Best Coding Agents 2026 — Decision Guide (Not Another Hype List)
- AGENTS.md Complete Guide — The Configuration File Every Coding Agent Reads
- Coding Agent Security Checklist 2026 — The Operator’s Hardening Guide