|
| 1 | +# Codebase CLI |
| 2 | + |
| 3 | +AI coding agent that runs in your terminal. Reads your project, writes code, runs commands — using any OpenAI-compatible LLM. |
| 4 | + |
| 5 | +## Install |
| 6 | + |
| 7 | +```sh |
| 8 | +curl -sSL https://raw.githubusercontent.com/codebase-foundation/codebase-cli/main/install.sh | sh |
| 9 | +``` |
| 10 | + |
| 11 | +Or with Go: |
| 12 | + |
| 13 | +```sh |
| 14 | +go install github.com/codebase-foundation/cli@latest |
| 15 | +``` |
| 16 | + |
| 17 | +Or build from source: |
| 18 | + |
| 19 | +```sh |
| 20 | +git clone https://github.com/codebase-foundation/codebase-cli.git |
| 21 | +cd codebase-cli |
| 22 | +go build -o codebase . |
| 23 | +``` |
| 24 | + |
| 25 | +## Quick Start |
| 26 | + |
| 27 | +```sh |
| 28 | +export OPENAI_API_KEY=sk-... |
| 29 | +cd your-project |
| 30 | +codebase |
| 31 | +``` |
| 32 | + |
| 33 | +Works with any OpenAI-compatible API: |
| 34 | + |
| 35 | +```sh |
| 36 | +# Groq |
| 37 | +export OPENAI_BASE_URL=https://api.groq.com/openai/v1 |
| 38 | +export OPENAI_API_KEY=gsk-... |
| 39 | +export OPENAI_MODEL=llama-3.3-70b-versatile |
| 40 | + |
| 41 | +# Ollama (local) |
| 42 | +export OPENAI_BASE_URL=http://localhost:11434/v1 |
| 43 | +export OPENAI_API_KEY=ollama |
| 44 | +export OPENAI_MODEL=qwen2.5-coder:32b |
| 45 | + |
| 46 | +# Any OpenAI-compatible endpoint |
| 47 | +export OPENAI_BASE_URL=https://your-provider.com/v1 |
| 48 | +export OPENAI_API_KEY=your-key |
| 49 | +export OPENAI_MODEL=your-model |
| 50 | + |
| 51 | +codebase |
| 52 | +``` |
| 53 | + |
| 54 | +## Tools |
| 55 | + |
| 56 | +The agent has 9 built-in tools: |
| 57 | + |
| 58 | +| Tool | Description | |
| 59 | +|------|-------------| |
| 60 | +| `read_file` | Read file contents with line numbers | |
| 61 | +| `write_file` | Create or overwrite files | |
| 62 | +| `edit_file` | Surgical find-and-replace | |
| 63 | +| `multi_edit` | Batch edits across multiple files | |
| 64 | +| `list_files` | Directory listing and glob search | |
| 65 | +| `search_files` | Regex search across codebase (ripgrep) | |
| 66 | +| `web_search` | Search the web (Tavily, Brave, SearXNG, or DuckDuckGo) | |
| 67 | +| `dispatch_agent` | Spawn a read-only research subagent | |
| 68 | +| `shell` | Run any shell command | |
| 69 | + |
| 70 | +Read-only tools run in parallel automatically. |
| 71 | + |
| 72 | +## Web Search |
| 73 | + |
| 74 | +Web search works out of the box with DuckDuckGo (no API key needed). For better results, configure a provider: |
| 75 | + |
| 76 | +```sh |
| 77 | +# Tavily (recommended for AI agents) |
| 78 | +export TAVILY_API_KEY=tvly-... |
| 79 | + |
| 80 | +# Brave Search |
| 81 | +export BRAVE_API_KEY=BSA... |
| 82 | + |
| 83 | +# Self-hosted SearXNG |
| 84 | +export SEARXNG_URL=https://your-searxng-instance.com |
| 85 | +``` |
| 86 | + |
| 87 | +## Glue Models (Optional) |
| 88 | + |
| 89 | +Route cheap tasks (intent classification, titles, narration) to a separate fast/small model while keeping your main agent on a smarter model: |
| 90 | + |
| 91 | +```sh |
| 92 | +export GLUE_API_KEY=gsk-... |
| 93 | +export GLUE_BASE_URL=https://api.groq.com/openai/v1 |
| 94 | +export GLUE_FAST_MODEL=llama-3.1-8b-instant |
| 95 | +export GLUE_SMART_MODEL=llama-3.3-70b-versatile |
| 96 | +``` |
| 97 | + |
| 98 | +If not set, glue falls back to your main `OPENAI_*` config. |
| 99 | + |
| 100 | +## Features |
| 101 | + |
| 102 | +- **Demoscene boot screen** — plasma, 3D cube, sine scroller, chiptune audio |
| 103 | +- **Streaming responses** — real-time token output as the model thinks |
| 104 | +- **Agentic loop** — multi-turn tool use with automatic continuation |
| 105 | +- **Parallel tool execution** — read-only tools run concurrently |
| 106 | +- **Conversation compaction** — automatic context management for long sessions |
| 107 | +- **Session persistence** — resume where you left off |
| 108 | +- **Project awareness** — reads AGENTS.md/CLAUDE.md/CODEX.md for project instructions |
| 109 | +- **Planning mode** — Glue-driven Q&A for complex tasks before building |
| 110 | +- **Intent routing** — chat, clarify, plan, or build based on your message |
| 111 | +- **Subagent dispatch** — spawn isolated research agents for deep dives |
| 112 | + |
| 113 | +## Flags |
| 114 | + |
| 115 | +``` |
| 116 | +-model LLM model name (default: gpt-4o) |
| 117 | +-base-url OpenAI-compatible API base URL |
| 118 | +-dir Working directory (default: current directory) |
| 119 | +-version Print version and exit |
| 120 | +``` |
| 121 | + |
| 122 | +## License |
| 123 | + |
| 124 | +MIT |
0 commit comments