Install
Get Captain Code on your machine.
Local-first. Your credentials. Doctor tells you what is missing. Then open the TUI.
Before installing, please read the security disclaimers. Workers run with approvals disabled by default and can execute any command your user account can run.
Two shapes
| Shape | What you get | How |
|---|---|---|
| Brain-only | Router, captain doctor, shell tasks | go install |
| Full terminal | Brain + Captain TUI (OpenCode + plugins) | Clone the repo and run ./captaincode.sh |
go install alone cannot start the TUI: the panels and launcher live as files in the checkout, not inside the binary.
Requirements
| Tool | Install | Enables |
|---|---|---|
| Go 1.24.2+ | brew install go (macOS) or go.dev/dl | brain binary |
| Claude CLI | npm i -g @anthropic-ai/claude-code | claude leg (director) |
| Cursor agent | curl https://cursor.com/install -fsS | bash | cursor leg |
| Codex | npm i -g @openai/codex | codex-cli |
| OpenCode | curl -fsSL https://opencode.ai/install | bash | remote legs + TUI host |
| Bun | bun.sh (full terminal only) | captain-ui plugin deps |
One working leg is enough. captain doctor tells you exactly what to run.
Install the brain
go install github.com/lemma-ventures/captaincode/cmd/captaincode@latest
Ensure $(go env GOPATH)/bin is on your PATH. Go installs this package as captaincode. The docs use captain as shorthand; add alias captain=captaincode to your shell configuration, or substitute captaincode in the commands below.
Set up credentials
Captain Code holds no keys of its own. Each leg uses the login or API key already on your machine. Sign in before you expect that leg to be ready.
Local CLI agents (subscription logins)
These keep their own credential stores. Run the vendor login once:
# Claude Code (inside the CLI, or follow its login prompt)
claude
# then /login
# Codex CLI
codex login
# Cursor agent
cursor-agent loginRemote models (OpenCode providers)
Remote legs ride a local opencode serve session. Authenticate either way:
- Interactive:
opencode auth loginand pick the provider (xAI, OpenAI, OpenRouter, …). - Env file: put API keys in
~/.config/captain/env(created bycaptain init; never commit it).
Typical keys you may uncomment or add there:
# ~/.config/captain/env (sourced by the brain and by ./captaincode.sh)
#NVIDIA_API_KEY=… # kimi on NIM
#OPENROUTER_API_KEY=… # glm, gemini, deepseek, …
#HF_TOKEN=… # Hugging Face router legs
#TYPESAFE_API_KEY=… # optional: jev decision leg
#CAPTAIN_AA_API_KEY=… # optional: live perf rankingAfter editing the env file, restart the brain so doctor and workers see the new values. Doctor reads auth store keys only, never credential values. Each blocked leg line names the one command that unblocks it.
Initialize and verify
captain init
captain brain &
captain doctorcaptain init writes the OpenCode config Captain expects, scaffolds ~/.config/captain/env, and derives director/fallback from legs on PATH. Config is read at brain start. Always start the brain before trusting doctor.
Launch the TUI
Clone the repo (needed for plugins and the launcher), build, install UI deps, then start:
git clone https://github.com/lemma-ventures/captaincode
cd captaincode
go build -o ~/.local/bin/captain ./cmd/captaincode
(cd plugin/captain-ui && bun install)
captain init
# credentials from the section above already set
./captaincode.sh./captaincode.sh starts (or reuses) the brain on 127.0.0.1:14097 and opens the Captain TUI in the folder you launched from. Set CAPTAIN_SRC to the checkout if it is not the default path. captain init registers the plugins by absolute path from that tree.
First prompt in the TUI is enough: bare text goes to the director; force a leg with a prefix such as /claude … or /cursor ….
Brain-only: route from the shell
If you only installed the binary and do not need the TUI:
captain brain &
captain "find why checkout can charge a customer twice"Atomic upgrades
Never copy over a running binary. Build to a sibling path, then rename:
go build -o ~/.local/bin/captain.new ./cmd/captaincode \
&& mv ~/.local/bin/captain.new ~/.local/bin/captain