Your AI coding agent.
In the terminal.
LeanCTL is a terminal-native AI coding agent built in Rust. It reads, writes, tests, and commits your code — with built-in LeanCTX compression that reduces your token usage on every API call.
The problem
AI coding tools are expensive.
And getting worse.
Every AI coding agent — Cursor, Claude Code, Windsurf — sends your files in full to the AI. A 300-line file costs 4,200 tokens. Read it again? Another 4,200. Run your tests? 847 lines of raw output dumped into the context window.
What if your agent compressed everything automatically?
Meet LeanCTL
A full AI coding agent — inside your terminal.
You type what you want in plain English. LeanCTL reads your codebase, writes the code, runs tests, and commits. Like Cursor or Claude Code — but terminal-native, keyboard-first, and compressed by default.
Who is it for?
Solo developers
You pay for your own API calls. Every token counts. LeanCTL turns your $50/month bill into $10.
Terminal enthusiasts
You live in the terminal. LeanCTL gives you a full AI experience without ever touching a GUI. SSH-friendly.
Open source maintainers
Compression means longer sessions and more context without blowing your budget across repos.
Built-in capabilities
Full-screen TUI
Inline diffs, syntax highlighting, live token streaming — all rendered natively with Ratatui.
7+ providers supported
Bring your own key for Claude, GPT, DeepSeek, Ollama, Groq, OpenRouter. Switch mid-session with /model.
Session memory
Every conversation persists locally (SQLite). Resume any session, search across all chats.
Git-native
Status, diff, and commit are built-in tools. The agent commits its own work automatically.
MCP support
Connect external tools, databases, and APIs via the Model Context Protocol.
Permission control
Every file write asks for permission with a diff preview. Or go full --yolo.
How it works
Three steps. Five minutes.
Single binary — no Node, no Python, no Docker. Install, connect, code.
Install
One command. macOS, Linux, Windows. Single Rust binary, zero dependencies.
Connect your AI
Anthropic, OpenAI, DeepSeek, Ollama — your key, your control.
Start coding
Type what you want. LeanCTL handles the rest — compressed automatically.
Powered by LeanCTX
Built on LeanCTX. Engineered for efficiency.
In LeanCTL, compression is compiled into the binary. Every file read, every shell command, every re-read — always compressed. No plugin, no configuration.
8 compression modes, each for a different scenario. The right mode is selected automatically based on file type, cache state, and task context.
LeanCTL is proactive — it predicts what files the AI will need and preloads them before the first tool call.
Auto-Preload
Predicts relevant files and caches them before the AI starts working. Zero-latency context.
Batch Read + Dedup
Read 20 files in one call with automatic cross-file deduplication. Shared imports sent once.
Project Knowledge
Remembers architecture decisions across sessions. Contradiction detection flags conflicts automatically.
Auto-Compaction
Auto-compacts history — latest exchange verbatim, older turns summarized. Or trigger with /compact.
Smart Caching
First read cached. Every re-read returns a cache hit (~13 tokens) or a delta of only changed lines.
Auto-Checkpoint
Every 15 tool calls, session state is saved. Terminal crash? Resume exactly where you left off.
Before the AI sees a single token, LeanCTL classifies your message into one of 9 task types and tailors the thinking budget.
Three guardrails between your wallet and wasted tokens.
Loop Detection
Tool call fingerprinting. Same call 3× → throttled. 12× → blocked. Prevents runaway token burn.
Quality Guard
Four-metric check after every compression: AST, identifiers, lines, density. Score too low → automatic rollback.
LITM Optimizer
LLMs lose attention in the middle. LeanCTL places goals at the start and findings at the end — where attention peaks.
Lab-tuned defaults across 100+ benchmark iterations. Use /lab to tune and /benchmark to measure.
Why LeanCTL
The only agent with compression built in.
Other agents send everything raw. LeanCTL compresses every operation — automatically, always, without configuration.
| Cursor / Claude Code | LeanCTX (MCP) | LeanCTL | |
|---|---|---|---|
| File reads | Raw (full file) | Compressed if used | Always compressed |
| Shell output | Raw dump | Compressed if used | 90+ patterns |
| Re-reads | Full cost again | Cached (~13 tok) | Delta only |
| Thinking | Fixed budget | N/A | Auto-steered |
| Loop protection | None | None | Auto-throttle |
| Quality guard | None | None | AST + ID check |
| Memory | None | Session state | Knowledge base |
| Efficiency | 1× | ~2× | 3–5× |
Works with
Your savings
Do the math. It pays for itself.
Drag the slider to your monthly API spend and see how much you'd save.
Pricing
Bring your own API key. We handle the rest.
LeanCTL doesn't provide AI — you connect your own API key from Anthropic, OpenAI, or any provider. We charge $9/month for the compression engine that makes your existing API calls cheaper.
Free
Pro
FAQ
Common questions.
LeanCTX is the open-source compression engine — it works as an MCP server that any AI tool can use. LeanCTL is a complete AI coding agent with LeanCTX compiled directly into its core. Every operation is automatically compressed, no configuration needed.
No. LeanCTL works with your existing API key — Anthropic, OpenAI, DeepSeek, Groq, OpenRouter, or local models via Ollama. You keep your provider and your billing relationship.
The free tier works with local models only (Ollama, LM Studio, llama.cpp). You get all 23 tools, full compression, and unlimited sessions — no time limit, no credit card. To use your own cloud API keys (Anthropic, OpenAI, etc.), you need Pro at $9/month.
LeanCTL classifies every prompt into 9 task types and adjusts the AI's reasoning depth automatically. Simple code generation uses 1,024 thinking tokens, complex debugging gets 8,192. This saves 80% of thinking tokens compared to always-deep reasoning.
No. LeanCTL runs entirely on your machine. Your files, sessions, and history are stored locally. The only data that leaves your computer goes directly to your chosen AI provider — compressed, via your own API key.
Yes. LeanCTL runs in your terminal — it doesn't replace your editor. Many developers use it alongside their IDE for tasks that benefit from terminal-native speed.
Install
One command. Ready in seconds.
macOS / Linux
curl -fsSL https://leanctl.com/install.sh | sh Then register for the free Pro beta:
$ leanctl register Ready to try it?
Install in seconds. Start free with local models or register for the Pro beta — all features, no credit card.