Sandbox
@AlleyBo55/gocode

Go CLI agent runtime with MCP server and memory

gocode is a single-binary AI coding agent built in Go. It runs as a CLI, a TUI, an API server, or an MCP server, and it combines model routing, session memory, skills, hooks, and multi-agent orchestration.

45 stars17 forksGoUpdated 4mo ago
Who it's for

Builders who want a fast terminal agent they can use directly or connect to their editor.

What it delivers

You can work with a reusable agent runtime instead of re-explaining context and rebuilding the same tooling every session.

What it does

Multi-agent orchestration

Runs specialist sub-agents for planning, debugging, coordination, and background work, with concurrent agent execution.

MCP server and client

Serves MCP to editors and also connects to external MCP servers for extra tools.

Session memory and resume

Keeps persistent memory across sessions and supports continue and resume flows.

Skills system

Loads built-in skills and custom skills from `.gocode/skills/` so the agent can switch modes mid-session.

IDE bridge

Uses a WebSocket bridge for IDE integrations and bidirectional streaming with supported editors.

Terminal UI

Provides a Bubble Tea TUI with split panels, themes, and Vim keybindings.

Hooks and plugins

Includes lifecycle hooks and a plugin system for extending agent behavior around tool use and actions.

Planning and review tools

Adds planning, self-review, undo, diff, and commit flows for agent-led coding work.

How to get it

  1. 1Run
    curl -fsSL https://raw.githubusercontent.com/AlleyBo55/gocode/main/install.sh | bash
  2. 2Run
    irm https://raw.githubusercontent.com/AlleyBo55/gocode/main/install.ps1 | iex
  3. 3Run
    go install github.com/AlleyBo55/gocode/cmd/gocode@latest
  4. 4Run
    # Debian/Ubuntu
    curl -fsSL https://github.com/AlleyBo55/gocode/releases/latest/download/gocode_amd64.deb -o gocode.deb
    sudo dpkg -i gocode.deb
    
    # Fedora/RHEL
    curl -fsSL https://github.com/AlleyBo55/gocode/releases/latest/download/gocode_amd64.rpm -o gocode.rpm
    sudo rpm -i gocode.rpm
  5. 5Run
    git clone https://github.com/AlleyBo55/gocode.git
    cd gocode
    go build -o gocode ./cmd/gocode/
    sudo mv gocode /usr/local/bin/
  6. 6Run
    gocode --version

README

gocode — the fastest open-source AI coding agent. One binary. Any model.

Go 200+ Models Multi-Agent MCP Protocol Compliant Cursor MCP Ready Kiro Integrated VS Code MCP Ready Antigravity MCP Ready MIT License

gocode — The Open-Source Claude Code Alternative. Built in Go. Works With Any Model.

gocode terminal screenshot

One binary. Zero dependencies. 200+ models. A team of agents.
Inspired by the best terminal AI agents. Built from scratch in Go. Faster than everything else.

go install github.com/AlleyBo55/gocode/cmd/gocode@latest


Why gocode

We loved what Claude Code did for terminal-based AI coding. But we wanted something faster, model-agnostic, and dependency-free.

So we built gocode from scratch in Go — inspired by the best ideas in terminal AI agents, but with a completely original architecture. Every subsystem was designed and written from the ground up: the provider layer, the agent runtime, the tool executor, the orchestrator, the memory system, the planning engine. All of it.

The result: a single 12MB binary that starts in under 10 milliseconds, works with 200+ models across 11 providers, and ships with capabilities that most agents don't even attempt.


What Makes gocode Different

Any Model. Your Choice.

Most terminal agents lock you into one provider. gocode works with all of them. Claude, GPT, Gemini, Grok, DeepSeek, Mistral, Llama, local models — set one env var and go. Or use OpenRouter and access every model with a single API key.

A Team of Agents, Not Just One

gocode doesn't run a single agent loop. It runs an orchestrator with specialist sub-agents that plan, coordinate, and delegate to each other. Up to 5 concurrent background agents, each with their own model preference and tool permissions.

Memory That Persists — and Dreams

Cross-session memory that remembers your preferences, project conventions, and architectural decisions. Plus a dream system that autonomously consolidates and prunes memory during idle periods, keeping what matters and forgetting what doesn't.

IDE-Level Tooling in Your Terminal

Real LSP integration (actual renames, actual go-to-definition — not regex). AST-grep for structural code search. A WebSocket bridge that connects to VS Code, Cursor, Kiro, and Antigravity. This isn't a chatbot with file access. It's an agent with IDE capabilities.

Instant. Always.

Under 10ms startup. 12MB binary. No runtime dependencies. No Python. No Node. No virtual environments. go install and you're done.


What's New

v0.9.0 — One More Thing.

Eighteen new capabilities. Eight new skills that change how the agent thinks. A dream system that consolidates memory while you sleep. A planning engine that delegates to the strongest model in the room. Vim keybindings. A cron scheduler. A swarm of agents that talk to each other. A WebSocket bridge for IDE integration. PDF reading. Output styles. And a buddy system — because even an AI agent deserves a companion.

v0.8.0 — The Universal Model Layer

200+ models. 11 providers. Local inference. Persistent memory. Task management. Web search. The agent can delegate to specialists and remember what you told it last week.

v0.7.0 — The Agent Operating System

Full terminal UI. Multi-agent orchestration. Model fallback. 21 slash commands. Skills system. Plugin architecture. LSP integration. AST-grep.

Full Changelog →


Modes

ModeWhat It DoesHow You Use It
Agent Mode (REPL)Line-based chat. Default mode.gocode chat
Agent Mode (TUI)Full terminal UI with split panels, diff viewer, themes.gocode chat --tui
API Server ModeHeadless HTTP REST API for remote clients.gocode serve
MCP Server ModePlug into Cursor, Kiro, VS Code, Antigravity, or Claude Desktop.gocode mcp-serve

Supported Models

Every model. Every provider. One binary. No lock-in.

4 native providers. 7 proxy services. Local inference. 200+ models. Set one env var and go.

ProviderHighlightsEnv Var
AnthropicClaude Opus 4.6, Sonnet 4.6, Haiku 4.5ANTHROPIC_API_KEY
OpenAIGPT-5.4, o3, o4-mini, CodexOPENAI_API_KEY
GoogleGemini 3.1 Pro, Gemini 3 FlashGEMINI_API_KEY
xAIGrok 4.20 Beta, Grok 3XAI_API_KEY
DeepSeekDeepSeek Chat, R1 Reasoner, CoderDEEPSEEK_API_KEY
MistralMistral Large, Codestral, PixtralMISTRAL_API_KEY
GroqLlama 3.3 70B at 800 tok/sGROQ_API_KEY
Together AILlama 405B, Qwen 72B TurboTOGETHER_API_KEY
Novita AILlama 3.3 70B, DeepSeek V3/R1, Qwen 2.5NOVITA_API_KEY
OpenRouter200+ models, one API keyOPENROUTER_API_KEY
Azure OpenAIEnterprise GPT deploymentsAZURE_OPENAI_API_KEY
Local (Ollama/LM Studio)Run any model on your machineOPENAI_BASE_URL
gocode chat --model sonnet          # Claude
gocode chat --model gpt5            # GPT-5.4
gocode chat --model deepseek        # DeepSeek
gocode chat --model groq-llama      # Llama on Groq (800 tok/s)
gocode chat --model llama           # Ollama local
gocode chat --goal coding           # auto-pick the best coding model

One Key. Every Model.

Don't want to manage 11 API keys? Set one OpenRouter key and access every model from every provider.

export OPENROUTER_API_KEY=sk-or-your-key

gocode chat --model openai/gpt-4o                         # GPT-4o
gocode chat --model anthropic/claude-sonnet-4-20250514    # Claude Sonnet
gocode chat --model google/gemini-2.5-pro-preview         # Gemini
gocode chat --model x-ai/grok-3                           # Grok
gocode chat --model deepseek/deepseek-chat                # DeepSeek
gocode chat --model meta-llama/llama-3.3-70b-instruct     # Llama
gocode chat --model mistralai/mistral-large-latest        # Mistral

One binary. One key. Every model on the planet. Get your key at openrouter.ai/keys.

Full Model List — 200+ Models →


The Full Feature Set

Multi-Agent Orchestration

  • 4 built-in sub-agent profiles: coordinator, deep-worker, planner, debugger
  • Up to 5 concurrent background agents with independent contexts
  • Agent-to-agent messaging via swarm coordination
  • Category-based model routing (deep/quick/visual/ultrabrain)
  • Automatic model fallback on rate limits and server errors

Planning & Strategy

  • /plan — interview-style planning sessions
  • /ultraplan — deep planning with strongest available model (background, 30min timeout)
  • Structured plan output with scope analysis and step-by-step blueprints

Memory & Persistence

  • Cross-session memory with 3 scopes and team sync
  • Dream system — autonomous memory consolidation (orient → gather → consolidate → prune)
  • Session persistence and resume (-c / -r flags)
  • Memory aging and relevance-based pruning

IDE-Level Tools

  • LSP integration — real renames, go-to-definition, find-references, diagnostics
  • AST-grep — structural code search and rewrite (Go, JS, TS, Python)
  • Hash-anchored file I/O — CRC32 line hashes prevent stale edits
  • Auto-format on save (gofmt, prettier, black, rustfmt)

IDE Bridge

  • WebSocket server for bidirectional IDE communication
  • Works with VS Code, Cursor, Kiro, Antigravity
  • Permission forwarding and real-time response streaming
  • Multiple concurrent IDE connections

Terminal UI

  • Full bubbletea TUI with split panels (chat + git diff viewer)
  • 4 built-in themes: golang, monokai, dracula, nord
  • Custom themes via .gocode/theme.json
  • Custom keybinds via .gocode/keybinds.json
  • Vim keybindings — full normal/insert/visual modes with motions, operators, text objects

MCP Server & Client

  • Full MCP protocol compliance (server mode for IDEs)
  • MCP client — connect to external MCP servers for extended capabilities
  • 14+ built-in tools
  • Dual transport: stdio and HTTP

Skills System

  • 16 built-in skills (see below)
  • Custom skills via .gocode/skills/ JSON files
  • Mid-session skill switching with /skill
  • Skills with MCP server configs auto-start child processes

Scheduling & Automation

  • Cron scheduler with 5-field expressions
  • Background agent execution on schedule
  • Persistent schedules in .gocode/cron.json
  • GitHub Actions integration (gocode-action for PR review and issue implementation)

Session & Git

  • Git checkpoints with /undo N and per-session refs
  • Git worktree tools for parallel branch work
  • /diff — see changes made this session
  • /review — agent self-reviews its own changes
  • /commit — auto-generated commit messages

More

  • PDF reading (text extraction, 50MB limit, pure Go)
  • Web search (DuckDuckGo, no API key needed)
  • Web fetch (URL content extraction)
  • Structured JSON output with --output-format json and --output-schema
  • Output styles (concise, verbose, markdown, minimal) + custom styles
  • Notebook editing (Jupyter .ipynb cell-level operations)
  • Tmux persistent terminal sessions
  • Plugin system with hook pipeline
  • Migrations system for automatic config upgrades
  • 25+ slash commands
  • 23 CLI subcommands

Skills — Expertise on Demand

One flag, and your agent becomes a specialist.

gocode chat --skill golang-best-practices    # writes Go like a senior engineer
gocode chat --skill nothing-design           # designs like Teenage Engineering
gocode chat --skill loop                     # autonomous keep-going mode

16 Built-in Skills

SkillWhat It Does
git-masterAtomic commits, interactive rebase, clean history
frontend-ui-uxDesign-first UI development, accessibility, semantic HTML
nothing-designNothing-inspired monochrome design. Swiss typography, OLED blacks.
golang-best-practicesIdiomatic Go — code style, error handling, testing, naming
clone-websitePixel-perfect website cloning. Extract CSS, rebuild in Next.js.
nextjs-best-practicesNext.js 15+ patterns — RSC, async APIs, data fetching
react-best-practicesReact performance — eliminate waterfalls, bundle size, re-renders
web-design-guidelinesAccessibility audit, responsive design, WCAG compliance
loopAutonomous keep-going mode — works until the task is done
stuckRecovery mode for confused or frozen agent sessions
debugStructured troubleshooting — reproduce, isolate, fix, verify
verifyDouble-check work by re-reading files, running tests, validating
simplifyCode review for complexity reduction and dead code removal
rememberActive memory management — save facts and preferences to memdir
skillifyMeta-skill — capture conversation patterns as reusable skill JSON
batchParallel batch processing across multiple files or worktree agents

Create your own — drop a JSON file in .gocode/skills/.

Community Skills — Standing on the Shoulders of Giants

SkillInspired ByAuthor
nothing-designnothing-design-skill@dominikmartn
golang-best-practicescc-skills-golang@samber
clone-websiteai-website-cloner-template@JCodesMore
nextjs-best-practicesclaude-code-nextjs-skills@laguagu
react-best-practicesclaude-code-nextjs-skills@laguagu
web-design-guidelinesclaude-code-nextjs-skills@laguagu

Installation

One-Line Install (macOS / Linux)

curl -fsSL https://raw.githubusercontent.com/AlleyBo55/gocode/main/install.sh | bash

One-Line Install (Windows PowerShell)

irm https://raw.githubusercontent.com/AlleyBo55/gocode/main/install.ps1 | iex

Go Install (all platforms, requires Go 1.21+)

go install github.com/AlleyBo55/gocode/cmd/gocode@latest

Download Binary Manually

Grab the binary for your platform from GitHub Releases:

PlatformFile
macOS (Apple Silicon)gocode_*_darwin_arm64.tar.gz
macOS (Intel)gocode_*_darwin_amd64.tar.gz
Linux (x86_64)gocode_*_linux_amd64.tar.gz
Linux (ARM64)gocode_*_linux_arm64.tar.gz
Windows (x86_64)gocode_*_windows_amd64.zip
Windows (ARM64)gocode_*_windows_arm64.zip

Linux Packages (deb/rpm)

# Debian/Ubuntu
curl -fsSL https://github.com/AlleyBo55/gocode/releases/latest/download/gocode_amd64.deb -o gocode.deb
sudo dpkg -i gocode.deb

# Fedora/RHEL
curl -fsSL https://github.com/AlleyBo55/gocode/releases/latest/download/gocode_amd64.rpm -o gocode.rpm
sudo rpm -i gocode.rpm

Build from Source

git clone https://github.com/AlleyBo55/gocode.git
cd gocode
go build -o gocode ./cmd/gocode/
sudo mv gocode /usr/local/bin/

Verify

gocode --version

Quickstart

# 1. Install
go install github.com/AlleyBo55/gocode/cmd/gocode@latest

# 2. Set your API key (pick any provider)
export ANTHROPIC_API_KEY=sk-ant-...

# 3. Chat
gocode chat

# Or one-shot
gocode prompt "find all TODO comments in this project"

No Python. No Node. No virtual environments. One binary, one env var, go.


Architecture

26 internal packages. Clean interfaces. Zero external runtime dependencies. Goroutines and channels for native concurrency. go:embed for compiled-in registries. Atomic file writes for zero-corruption session persistence.

gocode/
├── cmd/gocode/          # CLI entrypoint — 23 subcommands
├── data/                # Embedded command/tool registries
├── internal/
│   ├── agent/           # ConversationRuntime, ToolExecutor, permissions, hooks
│   ├── apiclient/       # Provider interface, Anthropic/OpenAI/Gemini/xAI/proxy providers
│   ├── orchestrator/    # Multi-agent orchestration, background agents
│   ├── swarm/           # Agent-to-agent messaging, discovery registry
│   ├── ultraplan/       # Deep planning with strongest model
│   ├── dream/           # Autonomous memory consolidation
│   ├── lsp/             # Language Server Protocol integration
│   ├── astgrep/         # Structural code search
│   ├── bridge/          # WebSocket IDE bridge
│   ├── mcp/             # MCP server (full protocol)
│   ├── mcpclient/       # MCP client (external servers)
│   ├── tui/             # Bubbletea terminal UI
│   ├── repl/            # Interactive REPL
│   ├── vim/             # Vim keybinding engine
│   ├── skills/          # Skills system
│   ├── cron/            # Cron scheduler
│   ├── session/         # Session persistence
│   ├── memory/          # Persistent memory
│   ├── buddy/           # Terminal companion system
│   └── ...              # 6 more packages

Full Architecture Guide →


Documentation

GuideDescription
📖 Agent Mode GuideModels, API keys, flags, slash commands, examples
🌍 Supported Models200+ models across 11 providers
🚀 Advanced FeaturesMulti-agent, fallback, planning, skills, LSP, AST-grep
🎨 UX FeaturesStreaming, thinking blocks, slash commands, cost estimation
🔌 MCP & IDE GuideCursor, Kiro, VS Code, Antigravity, Claude Desktop
🏗 ArchitectureInternal packages, system diagrams, design decisions
📚 CLI ReferenceAll CLI commands with flags and examples
📋 ChangelogFull version history

gocode vs Claude Code

gocode is inspired by Claude Code but built from scratch with a different architecture, different language, and a broader vision. Here's how they compare:

MetricClaude Code (Node.js)gocode (Go)
Startup time~200ms<10ms
Binary size~180MB (node_modules)~12MB (single file)
Runtime dependenciesNode.js 18+, npmNone
LLM providersClaude only200+ models, 11 providers
Deploymentnpm install -gCopy one file
ConcurrencyNode.js async/awaitGoroutines + channels
MCP supportYes (client + server)Yes (client + server)
IDE integrationsVS Code, JetBrains, Web, Desktop5 IDEs via MCP
Multi-agent / subagentsYesYes (4 profiles, 5 concurrent)
Model fallbackNoYes (automatic failover)
Skills systemYesYes (16 built-in + custom)
Custom slash commandsYesYes
Hooks (lifecycle)YesYes
Web searchYesYes (built-in, no API key)
Persistent memoryYesYes (3 scopes, aging, team sync)
Git checkpoints / rewindYesYes (/undo N, per-session refs)
Git worktree toolsYesYes
Task management toolsYesYes (+ background agents)
Notebook editingYesYes
GitHub ActionsYesYes (gocode-action)
Structured outputYesYes (--output-format json, --output-schema)
Session continueYesYes (-c / -r flags)
Vim keybindingsYesYes (full normal/insert/visual modes)
Deep planningYesYes (/ultraplan, background, 30min timeout)
Dream systemYesYes (orient→gather→consolidate→prune)
Cron/scheduled tasksYesYes (5-field cron, background agents)
IDE bridgeYesYes (WebSocket, bidirectional)
Swarm coordinationYesYes (agent-to-agent messaging)
PDF handlingYesYes (50MB limit, pure Go)
Output stylesYesYes (4 built-in + custom)
Buddy systemNoYes (18 species, deterministic gacha)
Multi-model supportNo (Claude only)Yes (200+ models, 11 providers)
Category-based routingNoYes (deep/quick/visual/ultrabrain)
Hash-anchored file I/ONoYes (CRC32 line hashes)
AST-grep integrationNoYes (structural code search)
Tmux sessionsNoYes (persistent terminal sessions)
TUI modeNoYes (bubbletea split panels, themes)

Contributing

git clone https://github.com/AlleyBo55/gocode.git
cd gocode
make test && make build

The Buddy System

One more thing. gocode comes with a terminal companion. 18 species across 5 rarity tiers. Deterministic gacha seeded from your user ID. Tracks DEBUGGING, CHAOS, and SNARK stats. Displays ASCII sprites in your REPL banner.

Because even an AI agent deserves a friend.

you> /buddy

License

MIT — use it, fork it, ship it.


Search Keywords

claude code alternative · claude code replacement · claude code open source · open source claude code · ai coding agent go · go ai agent · mcp server go · cursor mcp server go · kiro mcp server · vscode mcp server golang · fast ai agent go · single binary ai agent · multi model ai agent · multi agent orchestration go · deepseek coding agent · groq fast inference agent · ollama coding agent · local llm coding agent · 200 models ai agent · openai compatible agent · ai pair programmer terminal · terminal coding agent golang · claude code but faster · claude code go alternative


Built from scratch. Built in Go. Built to be fast, open, and yours.

gocode — the open-source Claude Code alternative. 200+ models. Multi-agent. Instant startup.
One binary. Zero dependencies. Any LLM. A team of agents.

⭐ Star this repo if you believe developer tools should be fast, simple, and open.

Files in the repo

Repository payload23 top-level entries
  • .cursor
  • .gemini
  • .github
  • .gocode
  • .kiro
  • .vscode
  • assets
  • cmd
  • data
  • docs
  • gocode-action
  • internal
  • .gitignore
  • .goreleaser.yml
  • CHANGELOG.md
  • go.mod
  • go.sum
  • gocode
  • install.ps1
  • install.sh
  • LICENSE
  • Makefile
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k