# limit-cli
[](https://crates.io/crates/limit-cli)
[](https://docs.rs/limit-cli)
[](https://opensource.org/licenses/MIT)
**AI-powered terminal coding assistant with REPL and TUI.**
An intelligent coding assistant that lives in your terminal. Features multi-provider LLM support, session persistence, and 18 built-in tools for file operations, git, and code analysis.
Part of the [Limit](https://github.com/marioidival/limit) ecosystem.
## Why This Exists
Developers shouldn't have to leave their terminal to get AI assistance. `limit-cli` brings the power of LLMs directly to your command line with a beautiful TUI, full tool integration, and seamless session management.
## Features
- **Multi-provider LLM**: Anthropic Claude, OpenAI GPT, z.ai GLM, and local models
- **Two interfaces**: Full TUI (default) or simple REPL mode with `--no-tui`
- **18 built-in tools**: File I/O, bash execution, git operations, code analysis
- **AST-aware search**: Structural code matching with `ast-grep` (Rust, TypeScript, Python)
- **LSP integration**: Go-to-definition, find-references
- **Session persistence**: Auto-save and restore conversations
- **Token tracking**: SQLite-based usage tracking with cost estimation
- **Web search**: Fetch current information via Exa AI
- **Markdown rendering**: Rich formatting with syntax highlighting
- **File autocomplete**: Type `@` to quickly reference files with fuzzy matching
## Installation
### One-line Install (Recommended)
```bash
### via Cargo
```bash
cargo install limit-cli
```
**Requirements**: Unix-like OS (Linux, macOS), Rust 1.70+
## Quick Start
```bash
# Set your API key
export ANTHROPIC_API_KEY="your-key-here"
# Start the TUI
lim
```
That's it! Start chatting with your AI coding assistant.
### REPL Mode
```bash
lim --no-tui
```
## Configuration
Create `~/.limit/config.toml`:
```toml
provider = "anthropic"
[providers.anthropic]
model = "claude-sonnet-4-6-20260217"
max_tokens = 4096
```
### Environment Variables
| `ANTHROPIC_API_KEY` | Anthropic Claude |
| `OPENAI_API_KEY` | OpenAI |
| `ZAI_API_KEY` | z.ai |
## Built-in Tools
### File Operations
| `file_read` | Read file contents (max 50MB) |
| `file_write` | Create or overwrite files |
| `file_edit` | Diff-based file editing |
### Shell & Git
| `bash` | Execute shell commands |
| `git_status` | Show repository status |
| `git_diff` | Show changes |
| `git_log` | Show commit history |
| `git_add` | Stage files |
| `git_commit` | Create commit |
| `git_push` / `git_pull` | Remote operations |
| `git_clone` | Clone repository |
### Code Analysis
| `grep` | Regex search in files |
| `ast_grep` | AST-aware code search (Rust, TypeScript, Python) |
| `lsp` | Language server operations |
### Web
| `web_search` | Search the web via Exa AI |
| `web_fetch` | Fetch URL content as markdown |
| `browser` | Browser automation for testing and scraping |
## Session Management
Sessions are automatically saved to `~/.limit/sessions/`:
```bash
# In the TUI/REPL
/session list # List all saved sessions
/session new # Create a new session
/session load <id> # Load a specific session
/share # Copy session to clipboard
/share md # Export as markdown file
/share json # Export as JSON file
```
## File Autocomplete
Type `@` in the TUI to quickly reference files:
```
Read @Cargo.toml and analyze the dependencies
```
Features:
- Fuzzy matching powered by Frizbee
- Respects `.gitignore` and `.ignore`
- Keyboard navigation (↑/↓/Enter/Tab/Esc)
## Commands
| `/exit` | Save session and exit |
| `/clear` | Clear the screen |
| `/help` | Show available commands |
| `/model` | Show current model configuration |
| `/session list` | List all saved sessions |
| `/session new` | Create a new session |
| `/session load <id>` | Load a specific session |
| `/share` | Copy session to clipboard |
| `/share md` | Export session as markdown |
| `/share json` | Export session as JSON |
## Token Tracking
Usage statistics are tracked in `~/.limit/tracking.db`:
- Request count
- Input/output tokens
- Cost estimation
- Duration metrics
## License
MIT © [Mário Idival](https://github.com/marioidival)