|
1 | 1 | <h1 align="center">codebase</h1> |
2 | 2 |
|
3 | 3 | <p align="center"> |
4 | | - <strong>An AI coding agent for builders.</strong><br/> |
5 | | - Lives in your terminal. Reads your project, writes code, runs commands, ships work. |
| 4 | + <strong>An AI coding agent that lives in your terminal.</strong><br/> |
| 5 | + Any LLM. Reads your project, writes code, runs commands, ships work. |
6 | 6 | </p> |
7 | 7 |
|
8 | 8 | <p align="center"> |
9 | 9 | <a href="https://www.npmjs.com/package/codebase-cli"><img alt="npm" src="https://img.shields.io/npm/v/codebase-cli?style=flat-square" /></a> |
10 | 10 | <a href="https://github.com/codebase-foundation/codebase-cli/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" /></a> |
11 | 11 | </p> |
12 | 12 |
|
13 | | -<p align="center"> |
14 | | - Built on <strong><a href="https://github.com/earendil-works/pi">pi</a></strong> — |
15 | | - the agent loop, provider adapters, and session protocol that make this whole |
16 | | - thing tick. <a href="https://github.com/earendil-works/pi">Go give them a star.</a> |
17 | | -</p> |
| 13 | +## Install |
18 | 14 |
|
19 | | ---- |
| 15 | +Requires **Node.js ≥ 20**. |
20 | 16 |
|
21 | | -## Two ways to run it |
| 17 | +```sh |
| 18 | +# macOS / Linux |
| 19 | +curl -fsSL https://codebase.design/install.sh | sh |
22 | 20 |
|
23 | | -**Bring your own LLM.** Drop an API key in your shell and go — Anthropic, OpenAI, Groq, OpenRouter, Mistral, Ollama, any OpenAI-compatible endpoint. |
| 21 | +# Windows (PowerShell) |
| 22 | +irm https://codebase.design/install.ps1 | iex |
24 | 23 |
|
25 | | -```sh |
26 | | -ANTHROPIC_API_KEY=sk-ant-... codebase |
27 | | -# or |
28 | | -OPENAI_API_KEY=sk-... codebase |
| 24 | +# any platform, with npm |
| 25 | +npm i -g codebase-cli |
29 | 26 | ``` |
30 | 27 |
|
31 | | -**Sign in to [codebase.design](https://codebase.design) and skip key wrangling.** One auth, every model. |
32 | | - |
33 | | -- **Free tier** — try open-weight models (MiniMax, Qwen, Llama, etc.) with a **10-turn taste** so you can kick the tires before paying anyone for anything. No API keys to set up. |
34 | | -- **Paid account** — uncaps the open-weights, adds the frontier models (Claude Opus / Sonnet, GPT-5, …), higher rate limits, and longer context windows. One subscription replaces N provider bills. |
| 28 | +Then, in any project: |
35 | 29 |
|
36 | 30 | ```sh |
37 | | -codebase auth login |
| 31 | +cd your-project |
38 | 32 | codebase |
39 | 33 | ``` |
40 | 34 |
|
41 | | -Switch between models any time with `/model` (interactive picker) or `/model <id>`. |
| 35 | +Type, hit enter. It reads files, edits code, runs tests, and shows its work. `/help` lists everything. |
42 | 36 |
|
43 | | -## Install |
| 37 | +## Pick your LLM |
44 | 38 |
|
45 | | -Requires **Node.js ≥ 20**. |
| 39 | +**Bring your own key** — Anthropic, OpenAI, Groq, OpenRouter, Mistral, Ollama, or any OpenAI-compatible endpoint: |
46 | 40 |
|
47 | 41 | ```sh |
48 | | -# one-liner (macOS / Linux) |
49 | | -curl -fsSL https://codebase.design/install.sh | sh |
50 | | - |
51 | | -# Windows (PowerShell) |
52 | | -irm https://codebase.design/install.ps1 | iex |
53 | | - |
54 | | -# any platform |
55 | | -npm i -g codebase-cli |
| 42 | +ANTHROPIC_API_KEY=sk-ant-... codebase # or OPENAI_API_KEY, GROQ_API_KEY, … |
56 | 43 | ``` |
57 | 44 |
|
58 | | -## Quick start |
| 45 | +**Or sign in once** and skip the key wrangling — [codebase.design](https://codebase.design) gives you a free taste of open-weight models, and a paid account uncaps those plus the frontier models (Claude Opus/Sonnet, GPT-5, …) behind one bill. First run walks you through it; it even auto-detects a local LLM (LM Studio / Ollama / vLLM). |
59 | 46 |
|
60 | 47 | ```sh |
61 | | -cd your-project |
62 | | -codebase |
| 48 | +codebase auth login |
63 | 49 | ``` |
64 | 50 |
|
65 | | -Type. Hit enter. The agent reads files, runs tests, edits code, and shows you what it did. Slash `/help` for the rest. |
| 51 | +Swap models live with `/model`. Set reasoning depth with `/effort`. |
| 52 | + |
| 53 | +## What makes it good |
66 | 54 |
|
67 | | -A few things worth knowing: |
| 55 | +- **🏁 Tournaments.** `/tournament <task>` races several agents on the same change in isolated worktrees, a judge ranks them, you merge the winner. `--models opus,sonnet,haiku` pits models head-to-head on *your* code. |
| 56 | +- **↺ Rewind anything.** `/rewind` rolls the conversation *and* the files back to before any earlier prompt — a bad turn fully un-happens. Every edit is checkpointed. |
| 57 | +- **🧠 Remembers across sessions.** Pulls durable facts (your prefs, project decisions, the rules you set) out of a session in the background so the next one starts informed. `#note` to add one by hand. |
| 58 | +- **🔌 MCP.** Connect external tool servers (filesystem, Postgres, git, fetch, …) over stdio or remote HTTP, OAuth and all. Their tools splice straight into the agent. |
| 59 | +- **🤖 Subagents.** Fan out read-only researchers or write-capable workers that keep their tool-noise out of your main context — each can run in its own git worktree, on its own model and reasoning level. |
| 60 | +- **🪝 Hooks.** Shell commands on lifecycle events (pre/post tool, edit, prompt, session start/end) — run a formatter on save, block secrets, commit on exit. |
| 61 | +- **🌐 SSH.** Run commands on enrolled remote hosts by name, behind the same safety validator as the local shell. |
68 | 62 |
|
69 | | -- `/model` — pick a model interactively, live list of what your account can hit |
70 | | -- `/plan` — Q&A before the agent touches anything |
71 | | -- `!cmd` — run a shell command without spending a turn |
72 | | -- `@path` — pin a file into the next prompt |
73 | | -- `\<Enter>` — multi-line input |
74 | | -- **Type while the agent is working** — your prompt queues, fires when the current turn ends (`Ctrl-C` while busy clears the queue along with the turn) |
75 | | -- **Ctrl-C** stops the current turn, twice fast exits |
| 63 | +…plus a fast differential TUI (clean copy-mode with `Ctrl-O`, image paste with `Ctrl-V`, history search with `Ctrl-R`, `$EDITOR` compose with `Ctrl-G`), **plan mode** for a cheap Q&A pass before editing, **auto-compaction** of long sessions, **multi-session resume** (`/resume`, `/rename`, `/tag`), **skills** & **output styles** as drop-in markdown, **45+ tools** behind one interface, and **effect-based permissions** you can teach with `/permissions`. |
76 | 64 |
|
77 | | -## What it does |
| 65 | +## Cheat sheet |
| 66 | + |
| 67 | +``` |
| 68 | +/model /effort /plan /tournament /rewind /resume /permissions /mcp /agents /help |
| 69 | +!cmd run a shell command without spending a turn |
| 70 | +@path pin a file into the next prompt |
| 71 | +#note save a memory · \<Enter> multi-line · Ctrl-C stop turn / exit |
| 72 | +``` |
78 | 73 |
|
79 | | -- **Streaming responses.** Real-time token output, coalesced to 60 fps so the TUI doesn't thrash. |
80 | | -- **Multi-turn agentic loop.** Tool call → result → next turn, automatically. |
81 | | -- **Parallel tool execution.** Read-only tools (grep, glob, read, git status…) run concurrently within a turn. |
82 | | -- **Project awareness.** Auto-loads `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, or `.cursorrules` from the project root into the system prompt. |
83 | | -- **Conversation compaction.** Long sessions automatically summarize older turns to stay under the context window. |
84 | | -- **Session persistence.** Auto-resume from where you left off; `--new` for a clean slate. |
85 | | -- **Plan mode.** A cheap-model Q&A pass surfaces the right plan before the expensive agent starts editing. |
86 | | -- **Intent routing.** Chit-chat doesn't burn a full agent turn; complex asks roll into plan mode automatically. |
87 | | -- **Subagent dispatch.** Spawn isolated research agents that keep their tool noise out of your main context. |
| 74 | +Type while it's working — your prompt queues and fires when the turn ends. |
88 | 75 |
|
89 | | -## Builder-focused defaults |
| 76 | +## Built on pi |
90 | 77 |
|
91 | | -- **Any LLM**, not just Anthropic. Provider choice is config. |
92 | | -- **45+ tools** behind one small interface — adding one is mechanical. |
93 | | -- **Effect-based permissions** instead of tool-name allowlists. |
94 | | -- **Single immutable state** driven by a typed reducer — the UI is one render of one value. |
95 | | -- **Multi-process safe OAuth** with lockfile-coordinated token refresh — run 10 instances of codebase at once and they share a single refresh per hour. |
96 | | -- **Plain `npm i -g`**, no bundler lock-in. |
| 78 | +The agent loop, provider adapters, and session protocol come from |
| 79 | +**[pi](https://github.com/earendil-works/pi)** (MIT). Go give them a star. |
97 | 80 |
|
98 | 81 | ## More |
99 | 82 |
|
100 | | -- [`.settings/`](.settings/) — orientation: tenets, architecture, extending, testing |
101 | | -- [`CLAUDE.md`](CLAUDE.md) — quick reference for AI agents working in this repo |
| 83 | +- [`CLAUDE.md`](CLAUDE.md) — full feature reference |
| 84 | +- [`.settings/`](.settings/) — tenets, architecture, extending, testing |
102 | 85 | - [`docs/MIGRATION_v1_to_v2.md`](docs/MIGRATION_v1_to_v2.md) — upgrading from the Go v1 binary |
103 | | -- `/help` inside the CLI — every slash command and shortcut |
| 86 | +- `/help` inside the CLI — every command and shortcut |
104 | 87 |
|
105 | 88 | ## License |
106 | 89 |
|
107 | | -MIT. Built on [pi-mono](https://github.com/earendil-works/pi) (MIT). |
| 90 | +MIT. |
0 commit comments