bro-code

module
v0.1.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT

README ยถ

โ”Œโ” โ”ฌโ”€โ”โ”Œโ”€โ”โ•”โ•โ•—โ”Œโ”€โ”โ”Œโ”ฌโ”โ”Œโ”€โ”
โ”œโ”ดโ”โ”œโ”ฌโ”˜โ”‚ โ”‚โ•‘  โ”‚ โ”‚ โ”‚โ”‚โ”œโ”ค 
โ””โ”€โ”˜โ”ดโ””โ”€โ””โ”€โ”˜โ•šโ•โ•โ””โ”€โ”˜โ”€โ”ดโ”˜โ””โ”€โ”˜
ship less, ship right

BroCode v0.1.43

Autonomous AI Coding Agent for High-Performance Software Engineering
Deterministic, token-efficient, zero-data-race coding assistant for real-world production codebases.

Version Go Version License Platforms


โšก Overview

BroCode is an autonomous AI coding agent designed for precision, reliability, and token efficiency. Rather than performing unconstrained file overwrites or speculative edits, BroCode follows a deterministic engineering cycle:

$$\text{Analyze Context} \longrightarrow \text{Plan Architecture} \longrightarrow \text{Locate Symbols} \longrightarrow \text{Apply Resilient Edit} \longrightarrow \text{Verify Build/Tests} \longrightarrow \text{Retain Project Rules}$$

๐Ÿ›ก๏ธ Core Engineering Pillars:

  1. Targeted Precision: Performs localized, surgical edits without unnecessary full-file rewrites.
  2. 5-Tier Resilient Code Editor: Automatically resolves indentation shifts, line trimming, CRLF/LF line endings, and sliding-window fuzzy matching to prevent patch failures.
  3. Atomic Git Shadow Tree Rollback: Generates zero-loss Git plumbing snapshots under refs/brocode/snapshots before writing to disk, enabling instant /undo without corrupting working branches.
  4. Cryptographic AI Provenance Engine: Tracks every modification with SHA-256 Merkle chains and signed SBOM artifacts to mathematically verify AI authorship via /verify and /trace.
  5. Stack-Agnostic Dependency Resolver & Blast Radius: Analyzes project dependencies across Node.js, Go, Python, Rust, PHP, Ruby, and .NET to auto-resolve missing packages and map blast radiuses.
  6. Multi-Provider Circuit Breaker & Fallback Router: Automatically fails over to backup models upon rate limits or server errors with cooldown management and vendor isolation.
  7. Exact Offline BPE Token Accounting & Auto-Compaction: Native tiktoken-go offline tokenizer ensures deterministic context compaction at 80% capacity with 5-part structured memory preservation.
  8. Native LSP & One-Click Auto-Fix: Auto-detects installed language servers (TypeScript, Go, Python, Rust, C/C++, Vue, Svelte) to deliver project-wide diagnostics, code actions, and auto-imports.

๐Ÿ“ฆ Installation

Choose the installation method that fits your workflow:

Method 1: One-Line Installer

macOS & Linux (Bash/Zsh):

curl -fsSL https://raw.githubusercontent.com/plumpslabs/bro-code/main/scripts/install.sh | bash

Windows (PowerShell):

irm https://raw.githubusercontent.com/plumpslabs/bro-code/main/scripts/install.ps1 | iex

Method 2: Go Install

go install github.com/plumpslabs/bro-code/cmd/brocode@latest

Method 3: Homebrew (macOS & Linux)

brew tap plumpslabs/tap
brew install brocode

Method 4: Pre-built Binaries

Download pre-compiled binaries from GitHub Releases for:

  • macOS: Apple Silicon (arm64) / Intel (amd64)
  • Linux: amd64 / arm64 / Alpine
  • Windows: amd64 / arm64 (.zip)
  • FreeBSD: amd64

Method 5: Build from Source

git clone https://github.com/plumpslabs/bro-code.git
cd bro-code
go build -ldflags="-s -w" -o brocode ./cmd/brocode
sudo mv brocode /usr/local/bin/

๐ŸŽฎ Quick Start

# Start an interactive session in the current directory
brocode

# Resume the most recent conversation session
brocode -c

# Launch with a specific provider and model
brocode -provider anthropic -model claude-3-7-sonnet

# Set a per-task spending cap (USD)
brocode -budget 1.00

# Inspect CLI version
brocode --version

๐ŸŽญ Agent Operating Modes

Switch modes at any time using Shift + Tab or dedicated slash commands (/builder, /planner, /miner):

Mode Visual Theme Badge Description
BUILDER ๐ŸŸข Green (ANSI 42) ๐ŸŸข BUILDER Autonomous implementation mode: inspects code, applies resilient edits, executes shell commands, and verifies test suites.
PLANNER ๐ŸŸฃ Purple (ANSI 141) ๐ŸŸฃ PLANNER Read-only architecture & strategy mode: analyzes call trees, drafts execution roadmaps, and archives plans without modifying files.
MINER ๐ŸŸก Gold (ANSI 214) ๐ŸŸก MINER Continuous knowledge extraction mode: analyzes repo structure and persists verified rules, conventions, and traps to .brocode/memory.md.

โŒจ๏ธ Keyboard Shortcuts & TUI Navigation

Shortcut Scope Action
Shift + Tab Global Cycle operating modes (BUILDER โž” PLANNER โž” MINER)
Ctrl + K / Alt + K Input / Queue Open Prompt Queue Management (e edit, d delete, m switch mode, K/J reorder)
Ctrl + P Viewport Toggle In-TUI Full-Answer Pager (scroll last assistant answer with PgUp/PgDn/โ†‘/โ†“/Home/End, exit with q/Esc)
Ctrl + Y Global Copy Last Response directly to system OS clipboard
Ctrl + M Global Toggle Mouse Mode (SCROLL for wheel scrolling vs SELECT for native terminal drag-select)
Ctrl + F Chat Log Toggle Live Diff Expansion between compact summary rows and full colorized diffs
Ctrl + U / Alt + โŒซ Input Clear the entire prompt input line instantly
Ctrl + V Input / Modals Paste system clipboard content directly (supports multi-line prompt pastes)
1 โ€“ 9 Empty Input Trigger interactive Senior Recommendations numbered 1 to 9
โ†‘ / โ†“ Input / Autocomplete Navigate prompt history or scroll through suggestion popup window
Tab / Enter Autocomplete Select and insert active suggestion
Esc Global Cancel suggestion popup, close open modal, or interrupt active turn execution
Ctrl + C Global Cleanly terminate session and gracefully release in-flight goroutines

๐Ÿ“– Comprehensive Slash Commands Reference

Type / in the prompt to open fuzzy autocomplete for all 34 built-in commands:

1. Sessions & History

  • /new โ€” Start a fresh, clean conversation session.
  • /sessions (/s) โ€” Interactive session manager modal (resume, search, d delete, D delete all).
  • /history โ€” Display full conversation transcript for the active session.
  • /compact (/summarize) โ€” Force instant context compaction into structured session memory.
  • /clear (/cls, /reset) โ€” Clear current chat viewport buffer.
  • /undo โ€” Time-Travel Rollback: Revert all file changes from the last turn via Git shadow tree snapshots.
  • /diff โ€” Render a visual side-by-side / unified diff of all modifications made in the session.
  • /cost (/tokens, /usage) โ€” Inspect real-time token consumption, context usage, and estimated spend.

2. Modes & Agent Architecture

  • /mode [builder|planner|miner] โ€” Inspect or switch the active agent operating mode.
  • /builder โ€” Activate BUILDER mode (autonomous coding & command execution).
  • /plan (/planner) โ€” Activate PLANNER mode (read-only architectural planning).
  • /plan clear (/plan reset) โ€” Archive the active plan from .brocode/current_plan.md to .brocode/plans/archive/.
  • /mine (/miner) โ€” Activate MINER mode (knowledge extraction & memory persistence).
  • /agent [name] โ€” Inspect or switch between custom agent definitions in .brocode/agents/*.md.

3. Code Intelligence & Quality

  • /diagnose (/scan, /lint) โ€” Run project-wide LSP diagnostics and display categorized error/warning lists.
  • /diagnose fix (/scan fix) โ€” Automatically invoke safe quick-fixes, import organizes, and renames.
  • /lsp โ€” Inspect connected Language Server Protocol managers, active servers, and install hints.
  • /deps (/dep-resolve) โ€” Run the stack-agnostic dependency resolver to detect and install missing packages.
  • /spec [prompt] โ€” Execute the architectural specification engine to draft a full blueprint before building.
  • /tournament [prompt] โ€” Run competitive multi-solution tournament benchmarking to evaluate algorithmic trade-offs.
  • /repair [prompt] โ€” Run autonomous root-cause analysis and automated test-driven repair.

4. Security, Provenance & Audit

  • /provenance (/verify) โ€” Verify the cryptographic Merkle chain and tamper-evident AI SBOM signature.
  • /trace โ€” Trace the complete provenance origin, generation timestamps, and author hashes of touched files.
  • /mcp โ€” Open the Model Context Protocol manager (inspect connected servers, a add wizard, d delete, r reload).
  • /debug โ€” Display runtime engine metrics, memory allocation stats, and goroutine health.

5. Providers & Configuration

  • /connect (/c) โ€” Launch the interactive provider configuration wizard (API keys, endpoints, custom gateways).
  • /models (/m) โ€” Open the interactive model picker with real-time fuzzy search.
  • /search-key [key] โ€” Configure or check web search provider credentials (Exa / Tavily).
  • /context7-key [key] โ€” Configure Context7 documentation resolver credentials.
  • /update (/upgrade) โ€” Check for and install the latest BroCode release binary.
  • /quit (/exit, /q) โ€” Exit BroCode cleanly.

๐ŸŒ Supported LLM Providers & Gateways

BroCode connects natively to all major LLM providers with automatic fallback routing:

  • Anthropic: claude-3-7-sonnet, claude-3-5-sonnet, claude-3-5-haiku
  • OpenAI: gpt-4o, o1, o3-mini, gpt-4o-mini
  • DeepSeek: deepseek-chat, deepseek-reasoner
  • Poolside / Laguna: laguna-s-2.1
  • Ollama / Local LLMs: qwen2.5-coder, llama3.3, deepseek-r1, mistral
  • OpenRouter & Groq
  • OpenCode Gateway & Any OpenAI-Compatible Endpoints

๐Ÿ› ๏ธ Versioning & Release Automation

BroCode follows Semantic Versioning (SemVer).

Use the included helper script to release updates:

# Bump patch version (v0.1.40 -> v0.1.41)
./scripts/bump_version.sh patch

# Bump minor version (v0.1.40 -> v0.2.0)
./scripts/bump_version.sh minor

# Bump major version (v0.1.40 -> v1.0.0)
./scripts/bump_version.sh major

๐ŸŒ Platform Compatibility

BroCode is built with 100% Pure Go (Zero-CGO) and runs natively on:

  • macOS: Apple Silicon (arm64) & Intel (amd64)
  • Linux: amd64, arm64, Alpine, Ubuntu, Debian, Arch, Fedora
  • Windows: Windows 10/11 amd64 & arm64 (PowerShell, CMD, Git Bash, Windows Terminal)
  • FreeBSD: amd64

๐Ÿ“œ License

MIT License โ€” see LICENSE for details.

Directories ยถ

Path Synopsis
cmd
brocode command
internal
bench
Package bench provides a Terminal Bench-style harness for measuring how well the BroCode agent loop solves real tasks: it runs a task in a throwaway sandbox project, then verifies the outcome with a script.
Package bench provides a Terminal Bench-style harness for measuring how well the BroCode agent loop solves real tasks: it runs a task in a throwaway sandbox project, then verifies the outcome with a script.
hooks
Package hooks provides lifecycle hooks for the agent loop, mirroring the pattern of Claude Code / opencode: the user defines shell commands that run at specific points in the turn (start, end, on error, before/after tool calls).
Package hooks provides lifecycle hooks for the agent loop, mirroring the pattern of Claude Code / opencode: the user defines shell commands that run at specific points in the turn (start, end, on error, before/after tool calls).
learn
Package learn implements BroCode's self-improving control layer: it observes each turn's context utilization and nudges the global efficiency knobs (today: the compaction trigger ratio) so the agent gets smarter about its own token budget the longer it is used โ€” without any user tuning.
Package learn implements BroCode's self-improving control layer: it observes each turn's context utilization and nudges the global efficiency knobs (today: the compaction trigger ratio) so the agent gets smarter about its own token budget the longer it is used โ€” without any user tuning.
lsp
Package lsp integrates Language Server Protocol (LSP) support into BroCode.
Package lsp integrates Language Server Protocol (LSP) support into BroCode.
mcp
Package mcp integrates Model Context Protocol (MCP) servers into BroCode.
Package mcp integrates Model Context Protocol (MCP) servers into BroCode.
memory
Package memory implements BroCode's cross-session project memory.
Package memory implements BroCode's cross-session project memory.
prompt
Package prompt assembles the system prompt from composable, layered blocks instead of one monolithic string.
Package prompt assembles the system prompt from composable, layered blocks instead of one monolithic string.
repo
Package repo implements BroCode's deterministic project intelligence layer: a repo map (entry points, structure, hot files) built without the LLM, and cross-session usage tracking ("the more BroCode is used, the smarter it gets").
Package repo implements BroCode's deterministic project intelligence layer: a repo map (entry points, structure, hot files) built without the LLM, and cross-session usage tracking ("the more BroCode is used, the smarter it gets").
search
Package search provides zero-dependency code intelligence: symbol extraction (function/struct/class maps per file) and BM25 relevance search over file contents.
Package search provides zero-dependency code intelligence: symbol extraction (function/struct/class maps per file) and BM25 relevance search over file contents.
subagent
Package subagent implements sub-agents: isolated agent loops that run with their own fresh context while sharing the main provider adapter and tool set.
Package subagent implements sub-agents: isolated agent loops that run with their own fresh context while sharing the main provider adapter and tool set.
tokens
Package tokens provides LLM token counting.
Package tokens provides LLM token counting.
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL