Esc to close · ⌘K / Ctrl-K opens search anywhere
brcode is a Codex-/Claude-Code-style coding agent CLI, routed through
BharatRouter. One br- key drives six harnesses; your org's profile (default
model, MCP connectors, rules) follows every teammate with a single command; and everything
a coding agent does is metered, budgeted, and audited on the gateway.
This is the full guide. For the short pitch see the product page; for the HTTP endpoints behind the CLI see the API reference. Migrating? From Codex · from Claude Code — and read Context & memory for what carries over.
Homebrew (macOS / Linux):
brew install bharatrouter/tap/brcode Or one line (no Homebrew):
curl -fsSL https://bharatrouter.com/install/brcode.sh | bash Both give you brcode (and the br alias). The engine
(OpenCode, MIT) is installed on first
brcode init; Node is the only prerequisite (Homebrew installs it for you).
Update with brew upgrade brcode. Windows: use WSL.
brcode login # browser opens, key lands in the CLI — zero paste
brcode init # engine + your org's profile (model, MCP connectors, rules)
brcode # start coding That's the whole onboarding — init pulls the org profile from
GET /v1/me/profile, so a new teammate inherits the lead's exact setup.
A lead pushes their local setup up with brcode export.
| Command | What it does |
|---|---|
brcode | Launch the agent (runs init first if needed). brcode "fix the failing test" passes a prompt straight through. |
brcode login | Zero-paste login: opens the browser, catches the key on a localhost loopback (paste fallback). Key stored 0600 at ~/.config/bharatrouter/env. |
brcode init | Install the engine, pull the org profile, write configs, smoke-test the route. |
brcode export | (Leads) push your local model + MCP connectors to the org profile. Connector definitions carry env-var names only — never secret values. |
brcode doctor | Reachability, key, and routing checks — run this first when anything misbehaves. |
brcode model | List or switch the default model (persisted; applies to every harness). Includes Sangam consensus variants. |
brcode route | Routing collections: pick a preset (cost / speed / reliability / quality / auto), auto-build a provider failover chain from live route health, or build a custom weighted chain. Every collection is probed live before it's saved. |
brcode sangam | Consensus routing — list Sangam variants or set one as your model. |
brcode alerts | Route-health + spend warnings (also shown on the launch splash). |
brcode usage | Org spend/requests/tokens with per-model and per-agent breakdowns — the enterprise audit view. |
brcode logs | Local per-machine tool-use audit (written by the default PostToolUse hook). |
brcode identity | Per-machine agent identity: on / off / revoke / status / budget <₹|off>. See below. |
brcode sandbox | on / strict / off / status — contain what the agent can touch. See below. |
brcode memory | Edit this repo's AGENTS.md (mirrored to CLAUDE.md) — shared context for every harness. |
brcode ide | Wire the agent into Zed (ACP), VS Code, JetBrains, Continue, or any editor via ide watch. |
brcode claude | Switch harness: launch the real Claude Code CLI, routed through BharatRouter. |
brcode aider|goose|crush|qwen | More harnesses — same key, same gateway, same routing. |
brcode agents|commands|hooks | (Re)install the default subagents (@review, @explore), the in-agent slash commands, and the hooks plugin. |
brcode acp | Run as an ACP stdio server (what brcode ide zed wires up). |
Per-launch overrides: BHARATROUTER_MODEL=glm-4.7 brcode wins for
one session; BRCODE_FULL=1 restores the engine's full TUI.
Slash commands (typed inside the running TUI): /login, /doctor,
/brprofile. The engine's leader key is ctrl+x:
| Keys | Action |
|---|---|
ctrl+x n / ctrl+x l | New session / list sessions |
ctrl+x m | Model list — switch models mid-chat (brcode bakes the full catalog in) |
tab / shift+tab | Cycle agents (e.g. the @review, @explore subagents) |
ctrl+p | Command palette |
escape | Interrupt the agent |
ctrl+x h | Toggle help/tips |
ctrl+c | Exit |
Full list: OpenCode keybinds.
Other harnesses (brcode claude etc.) keep their own native keymaps.
| Harness | Launch | Best for |
|---|---|---|
| OpenCode (default engine) | brcode | Codex-style TUI; subagents, skills, hooks, themes — the most deeply integrated path. |
| Claude Code | brcode claude | If you already live in Claude Code — it's the real CLI, just BR-routed. Your skills and CLAUDE.md keep working. |
| Aider | brcode aider | Git-native pair programming; also powers brcode ide watch (edit-comment triggers from any editor). |
| Goose | brcode goose | Block's agent; session-based workflows. |
| Crush | brcode crush | Charm's TUI agent. |
| Qwen Code | brcode qwen | Gemini-CLI lineage. |
Harness choice is launch-time; the model is switchable everywhere
(persisted via brcode model, mid-chat via the TUI model list). All harnesses
share the same repo context (AGENTS.md) and the same
gateway-side governance.
brcode identity on # this machine codes as its own agent (agt_…)
brcode identity budget 500 # cap it at ₹500/month
brcode identity status # spend + cap per agent
brcode identity revoke # kill-switch: every live token dies With identity on, each coding session swaps the shared org key for a short-lived
per-agent token (minutes-long ES256 JWT — nothing durable to leak). You get per-agent ₹
attribution in brcode usage and on the dashboard, one-command revocation, and
per-agent monthly budgets: once a capped agent exhausts its ₹, its calls are denied with
429 agent_budget_exceeded until you raise or clear the cap. No identity
infrastructure to stand up — BharatRouter provisions everything behind the scenes.
brcode sandbox on # project-scoped policy
brcode sandbox strict # + macOS OS-level write-jail
brcode sandbox status sudo and rm -rf on / or
~ are denied; git push asks. Everything else flows.~/.ssh. Linux stays policy-only for now.Scope: the OpenCode engine (brcode, brcode acp).
Other harnesses keep their own native permission systems (Claude Code's permission modes,
etc.). Reads are not jailed in v1 — policy still asks on external paths.
The question everyone asks when switching tools. The honest breakdown:
| Layer | Where it lives | Carries over? |
|---|---|---|
| Repo context | AGENTS.md (+ mirrored CLAUDE.md) in the repo, edited via brcode memory | Yes, fully — travels with git; every harness reads it, exactly like Codex and Claude Code. |
| Org rules & connectors | Org profile on the gateway (/v1/me/profile) | Yes — one brcode init per machine pulls it. |
| Skills | ~/.config/opencode/skills/, project .opencode/skills/, and ~/.claude/skills/ | Yes — Claude Code skill packs are read unchanged. |
| Chat history | Per-harness session store (e.g. ~/.local/share/opencode) | No — chat sessions never cross harnesses, the same as switching between Codex and Claude Code today. Finish or summarise long-running threads (paste the summary into AGENTS.md) before switching. |
So: durable context (repo memory, rules, skills, connectors) carries; ephemeral conversation state doesn't — and never did, in any of these tools.
| File | What |
|---|---|
~/.config/bharatrouter/env | Your br- key (0600). Never committed, never in IDE settings. |
~/.config/bharatrouter/config | Persisted settings (model, route, identity, sandbox mode). Precedence: process env > this file > org profile > default. |
~/.config/opencode/opencode.json | Engine config brcode manages: provider → BharatRouter, model catalog, theme, MCP connectors, permission block (sandbox). |
~/.config/opencode/hooks.json | Claude-Code-style PreToolUse/PostToolUse rules — a PreToolUse non-zero exit blocks the tool. Project override: .opencode/hooks.json. |
./AGENTS.md · ./CLAUDE.md | Repo memory (mirrored pair) — see Context & memory. |
brcode doctor — it checks the engine, key, and live routing in one shot.api.bharatrouter.com; doctor flags this. Ask IT to exempt the domain.brcode login again. A running session keeps its startup credentials — restart brcode to pick up the new key.brcode identity budget 1000 to raise, or off to clear.bharatrouter/auto, sangam, open-sangam, glm-sangam) can't arbitrate tool calls, which coding agents need on every step. The gateway now serves a tool-bearing request on a single tool-capable GLM instead (the x-br-auto-delegate response header names it), so agents just work. If you still see this, the gateway predates the fix — brcode model default switches you to the org-default model.brcode init is idempotent; rerun it any time to repair configs.Not affiliated with OpenAI ("Codex") or Anthropic ("Claude Code" / "Claude"). Built on OpenCode (MIT); Aider, Goose, Crush and Qwen Code are independent open-source projects — brcode launches your installed copy, routed through BharatRouter.