BroCode is an agentic coding assistant that runs in your terminal. It connects to Anthropic's Claude API, streams responses in real time, and can read, write, edit files, run shell commands, and search your codebase — all from a single TUI interface.
-
Install dependencies:
bun install
-
Set your Anthropic API key:
export ANTHROPIC_API_KEY="your-api-key"
-
Start the CLI:
bun run dev:cli
- Streaming chat — Responses appear token-by-token in an OpenTUI terminal UI.
- 6 built-in tools —
read_file,write_file,edit_file,bash,glob,grep. - Agentic loop — The assistant can chain tool calls up to 10 iterations per turn.
- Permission gating — Mutating tools (
bash,write_file,edit_file) prompt for approval. Pressyto allow,nto deny, orato always allow for the session. - Session persistence — Conversations are saved to
~/.brocode/sessions/after each completed turn. - Model switching — Choose between Claude Sonnet 5, Claude Opus 4.8, and Claude Haiku 4.5 via
/models. - CLAUDE.md context — Automatically loads
CLAUDE.mdfrom the current project directory (walks up to 8 parents) and includes it in the system prompt. - Git context — Shows the current branch and
git status --shortoutput to the model on each turn.
packages/cli/src/
index.tsx — Root component, provider stack, renderer bootstrap
theme.ts — Theme definitions (colors, palettes)
providers/
index.tsx — ToastProvider
theme/index.tsx — ThemeProvider + persistence to ~/.brocode/preferences.json
keyboard-layer/index.tsx — KeyboardLayerProvider (layer stack for modal focus)
dialog/index.tsx — DialogProvider (open/close modal dialogs)
toast/types.ts — Toast type definitions
permission/index.tsx — PermissionProvider (Y/n/a gating for mutating tools)
model/index.tsx — ModelProvider + persistence to ~/.brocode/model-preference.json
conversation/index.tsx — ConversationProvider (chat state, agent loop, sessions)
lib/
types.ts — Shared types (ChatMessage, SessionRecord, SessionSummary)
models.ts — Model options + defaults
tools.ts — Tool definitions + executeTool implementation
anthropic-client.ts — Anthropic SDK client + runAgentTurn loop
sessions.ts — Session file I/O under ~/.brocode/sessions/
claude-md.ts — CLAUDE.md discovery + git context + system prompt builder
components/
input-bar.tsx — Textarea + slash-command menu
message-list.tsx — Scrollable message rendering in OpenTUI
status-bar.tsx — Model label + token usage display
header.tsx — ASCII art header
dialog-search-list.tsx — Reusable searchable list for dialogs
commands-menu/ — Slash-command parser, filter, and command list
dialogs/
theme-dialog.tsx — Theme picker dialog content
model-dialog.tsx — Model picker dialog content
sessions-dialog.tsx — Session picker dialog content
Provider stack (bottom to top):
ThemeProvider > KeyboardLayerProvider > DialogProvider > ToastProvider > PermissionProvider > ModelProvider > ConversationProvider > ThemeRoot
- Multi-turn thinking / extended thinking blocks
- Image / PDF input
- MCP tool integration
- Streaming tool results back to the UI in real time (tool calls appear after the assistant text block finishes)