bro-code

module
v0.1.12 Latest Latest
Warning

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

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

README ยถ

โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  
โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•  
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ•  โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•

Autonomous AI Coding Agent for Software Engineering
High-performance, token-efficient, and deterministic coding assistant for real-world 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:

Analyze Context โ†’ Plan Architecture โ†’ Locate Symbols โ†’ Apply Resilient Edit โ†’ Verify Build/Tests โ†’ Retain Project Rules

Core Engineering Principles:

  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 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. Exact Offline BPE Token Accounting: Precise context calibration using native tiktoken-go without external network latency.
  5. Continuous Project Knowledge: Automatically extracts and persists verified rules, architecture patterns, and traps to .brocode/memory.md with dynamic BM25 retrieval.
  6. Collaborative Specialist Swarm: Multi-agent pipeline coordinating Architect, Builder, and Auditor roles for structured code transformations.

๐Ÿ“ฆ Installation

Choose the installation method that fits your workflow:

Method 1: One-Line Installer (macOS & Linux)

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

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:

Mode Badge Description
BUILDER ๐Ÿ”ต BUILDER Autonomous implementation mode: inspects code, applies resilient edits, executes shell commands, and verifies tests.
PLANNER ๐ŸŸฃ PLANNER Read-only analysis mode: surveys repositories, inspects call graphs, and drafts structured roadmaps without modifying files.
MINER ๐ŸŸก MINER Knowledge extraction mode: analyzes repository structure and persists verified rules and patterns to .brocode/memory.md.

โŒจ๏ธ Interactive Autocomplete & Navigation

BroCode includes a floating suggestion popup in the terminal interface:

  • โšก Slash Commands (/): Type / to display built-in commands with live descriptions.
  • ๐Ÿ“‚ File Mentions (@): Type @ anywhere in the input prompt (e.g. @app.go) for fuzzy path completions.
  • Controls:
    • โ†‘ / โ†“ โ€” Navigate suggestions (with automatic sliding-window scrolling).
    • Tab or Enter โ€” Select and apply the active suggestion.
    • Esc โ€” Dismiss the popup.

๐Ÿ“– Slash Commands

Command Description
/help Show available commands and shortcuts
/undo Time-Travel Rollback: Instantly revert all file modifications from the previous turn
/sessions Switch, resume, or manage saved chat sessions
/models Open the interactive AI model selector
/connect Configure LLM providers and API keys interactively
/memory Inspect cross-session project memory and verified rules
/cost View token usage and estimated spend breakdown
/lsp Inspect Language Server Protocol status and diagnostics
/diagnose Run self-contained syntax and type diagnostics on modified files
/miner Switch active mode to MINER
/new Start a fresh conversation session
/clear Clear the current terminal viewport

๐ŸŒ Supported Providers

BroCode connects natively to all major LLM providers:

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

To configure providers, run /connect within the interactive interface.


๐Ÿ› ๏ธ Versioning & Release Automation

BroCode follows Semantic Versioning (SemVer).

Use the included helper script to release updates:

# Bump patch version (v0.1.0 -> v0.1.1)
./scripts/bump_version.sh patch

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

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

๐ŸŒ Platform Compatibility

BroCode is built with 100% Pure Go (Zero-CGO) and runs seamlessly 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)
  • 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