Skip to content

genai-io/gen-code

Repository files navigation

< GEN ✦ />

Open-source AI coding assistant for the terminal

Release Go Report Card Go Reference License

Gen Code is a terminal coding assistant with interchangeable LLM providers, assistant personas, and search engines. Existing Claude Code skills, plugins, and project instructions work unchanged. Implemented in Go as a single binary with concurrent multi-agent orchestration.

Features

Open architecture

  • LLM providers — Anthropic, OpenAI, Google, Moonshot, Alibaba, MiniMax. Runtime selection via /model.
  • Assistant personas — Markdown-defined identities at user or project scope; switch with /identity (details).
  • Search engines — Exa, Brave, or Serper; switch with /search.

Extensibility

  • Claude Code compatible — Existing skills, plugins, and MCP servers work unchanged.
  • Skills — User- and project-level activation.
  • Subagents — Configurable permission modes, tool whitelists, and optional sandboxing.
  • Lifecycle hooks — Shell, LLM, agent, and HTTP backends.
  • Project memory — User- and project-level instructions auto-loaded.

Engineering

  • Native performance — Single Go binary; see benchmark for measured numbers.
  • Event-driven coordination — Parallel subagent execution via a pub/sub hub (architecture).
  • Session persistence — Auto-save, resume, fork, and automatic context compaction.
  • Prompt prediction — Speculative completion of likely next prompts to reduce latency.

Installation

curl -fsSL https://raw.githubusercontent.com/genai-io/gen-code/main/install.sh | bash

Re-run to upgrade. To uninstall:

curl -fsSL https://raw.githubusercontent.com/genai-io/gen-code/main/install.sh | bash -s uninstall
Other methods

Go Install

go install github.com/genai-io/gen-code/cmd/gen@latest

Build from Source

git clone https://github.com/genai-io/gen-code.git
cd gen-code
go build -o gen ./cmd/gen
mkdir -p ~/.local/bin && mv gen ~/.local/bin/

Usage

# Interactive mode
gen

# Non-interactive mode
gen "explain this function"
cat main.go | gen "review this code"

# Resume previous session
gen --continue        # Resume most recent
gen --resume          # Select from list

Quick Start

  1. Run gen to start interactive mode
  2. Use /model to connect a provider and select a model
  3. Start chatting!

Commands

/model /tools /skills /agents /identity /mcp /plugin /compact /think /search /loop /resume /fork /clear /init /memory — type /help for details.

Keyboard: Shift+Tab toggle permission mode, Ctrl+O expand tool details, Ctrl+C cancel, Ctrl+D exit.

Configuration

User-level config lives in ~/.gen/; project-level files in <project>/.gen/ override per workspace. Place a GEN.md (or CLAUDE.md) in your project root for project-specific instructions — Gen Code auto-loads them into the system prompt.

LLM provider credentials

Provider Environment Variables
Anthropic (Claude) ANTHROPIC_API_KEY or Vertex AI
OpenAI (GPT, o-series, Codex) OPENAI_API_KEY
Google (Gemini) GOOGLE_API_KEY
Moonshot (Kimi) MOONSHOT_API_KEY
Alibaba (Qwen, DeepSeek) DASHSCOPE_API_KEY
MiniMax MINIMAX_API_KEY

Run /model in the TUI to see the currently available model list.

Web-search backend credentials

Backend Environment Variable
Exa EXA_API_KEY
Brave Search BRAVE_API_KEY
Serper SERPER_API_KEY
Directory layout

User-level (~/.gen/):

providers.json    # Provider connections and current model
settings.json     # Permissions, hooks, env, identity
skills.json       # Skill states
identities/       # Custom personas (see /identity)
skills/           # Custom skill definitions
agents/           # Custom agent definitions
commands/         # Custom slash commands
plugins/          # Installed plugins
projects/         # Session transcripts + indexes

Project-level (.gen/):

settings.json      # Permissions, hooks, disabled tools
mcp.json           # MCP server definitions
identities/*.md    # Project-scoped personas (override user-level)
agents/*.md        # Subagent definitions
skills/*/SKILL.md  # Skills
commands/*.md      # Slash commands

Benchmark: Gen Code vs Claude Code

Compared with Claude Code v2.1.112 on Apple Silicon, same model (claude-sonnet-4-6):

Metric Gen Code Claude Code Advantage
Download size 12 MB 63 MB (+ Node.js 112 MB) 5x smaller
Disk footprint 38 MB 175 MB 4.6x smaller
Startup time ~0.01s ~0.20s 20x faster
Startup memory ~32 MB ~189 MB 5.8x less
Simple task ~2.4s / 39 MB ~10.4s / 286 MB 4.3x faster, 7.3x less memory
Tool-use task ~3.3s / 39 MB ~26.0s / 285 MB 7.9x faster, 7.2x less memory

Both tools have comparable features (hooks, skills, plugins, session, MCP, etc.). The performance gap comes from Go's native compilation, minimal architecture design, and lean prompt engineering — vs Node.js V8/JIT/GC runtime overhead.

See full details: docs/benchmark-gencode-vs-claudecode.md

Documentation

Related Projects

  • Claude Code — Anthropic's AI coding assistant
  • Aider — AI pair programming in terminal
  • Continue — Open-source AI code assistant

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

Apache License 2.0 - see LICENSE for details.

Packages

 
 
 

Contributors

Languages