claude-code-Go

module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT

README

claude-code-Go — AI Coding Agent in Go

Go Version Platform CI Go Report Card

A Go-native AI coding agent with full agent loop, tool execution, permission management, SSE streaming, and auto-recovery — in a single binary.

Status: v0.3 verified release — Core agent runtime, permission system, session persistence, multi-provider support, doctor checks, replay evidence, MCP/LSP extension diagnostics, and manifest-driven harness quality gates are implemented and tested. Real external MCP/LSP server smoke checks and competitor-agent comparisons remain manual. See PARITY.md for detailed feature status.

Disclaimer: This is an independent open-source project. It is not affiliated with, endorsed by, or connected to Anthropic PBC. "Claude" and "Claude Code" are trademarks of Anthropic PBC.

Installation

go install github.com/strings77wzq/claude-code-Go/cmd/go-code@latest

The binary installs to $GOPATH/bin (typically ~/go/bin). Make sure it's in your PATH:

export PATH="$HOME/go/bin:$PATH"
Build from Source
git clone https://github.com/strings77wzq/claude-code-Go.git
cd claude-code-Go
make install
go-code
Pre-built Binaries

Download from GitHub Releases:

# Example: Linux amd64
curl -fsSL https://github.com/strings77wzq/claude-code-Go/releases/latest/download/go-code-linux-amd64 -o go-code
chmod +x go-code
sudo mv go-code /usr/local/bin/

For script-based install, see scripts/ for install.sh and install.ps1.

Quick Start

1. Set your API key
# Anthropic
export ANTHROPIC_API_KEY=sk-ant-...

# Or Tencent Cloud Coding Plan
export ANTHROPIC_API_KEY=sk-sp-...
export ANTHROPIC_BASE_URL=https://api.lkeap.cloud.tencent.com/coding/anthropic
export ANTHROPIC_MODEL=tc-code-latest

Or create ~/.go-code/settings.json:

{
  "apiKey": "sk-ant-...",
  "model": "claude-sonnet-4-6-20251001"
}
2. Verify your setup

Run the health check before starting a real session:

go-code doctor

For offline environments:

go-code doctor --offline
3. Run
# Interactive TUI
go-code

# Legacy REPL
go-code --legacy-repl

# Single prompt (non-interactive)
go-code -p "Explain the agent loop architecture"

# JSON output (for scripting)
go-code -p "List files in current directory" -f json

# Replay a saved session
go-code replay latest

# Collect concise release/issue evidence
go-code replay --evidence latest

Verified Features (v0.3)

These features are tested and covered by the parity harness. See PARITY.md for evidence links.

Feature Status Tests
Agent Loop (think → act → observe) Verified Go unit + harness
11 Built-in Tools Verified Go tests
Permission System (3-tier) Verified Go + harness
Doctor Health Check Verified Go tests
Multi-Provider (Anthropic, OpenAI-compatible) Verified Go tests
Session Persistence + Resume Verified Go tests
Session Replay + Evidence Mode Partial v0.3 Go tests + harness
Slash Commands (/help, /model, /sessions, etc.) Verified Go tests
Skills System Verified Go tests
Hooks System Verified Go tests
MCP Integration Partial v0.3 Go tests + harness
LSP Integration Partial v0.3 Go tests + harness
Built-in Tools

Read, Write, Edit, Glob, Grep, Bash, Diff, Tree, WebFetch, TodoWrite, NotebookEdit

Supported Providers

Provider Setup
Anthropic ANTHROPIC_API_KEY=..., optional LLM_PROVIDER=anthropic
OpenAI LLM_PROVIDER=openai, ANTHROPIC_API_KEY=..., ANTHROPIC_BASE_URL=https://api.openai.com
DeepSeek LLM_PROVIDER=openai, ANTHROPIC_BASE_URL=https://api.deepseek.com, model deepseek-chat or deepseek-reasoner
Qwen LLM_PROVIDER=openai, ANTHROPIC_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode
GLM LLM_PROVIDER=openai, ANTHROPIC_BASE_URL=https://open.bigmodel.cn/api/paas
Tencent Cloud LLM_PROVIDER=anthropic, ANTHROPIC_BASE_URL=https://api.lkeap.cloud.tencent.com/coding/anthropic, model tc-code-latest

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    claude-code-Go                            │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────┐    ┌──────────────┐    ┌───────────────┐  │
│  │  Bubbletea   │───▶│ Agent Loop   │───▶│ Tool Registry │  │
│  │     TUI      │    │   + Context  │    │               │  │
│  └──────────────┘    └──────────────┘    └───────────────┘  │
│                            │                    │            │
│                            ▼                    ▼            │
│                     ┌──────────────┐    ┌───────────────┐  │
│                     │   API Client │    │   Built-in    │  │
│                     │ (SSE Stream) │    │    Tools      │  │
│                     └──────────────┘    └───────────────┘  │
└─────────────────────────────────────────────────────────────┘

For a detailed architecture overview, see docs/architecture/.

Project Structure

claude-code-Go/
├── cmd/go-code/          # Main entry point
├── internal/
│   ├── agent/            # Agent loop + context management
│   ├── config/           # Multi-source config loader
│   ├── cost/             # Cost tracking and estimation
│   ├── hooks/            # Pre/post execution hooks
│   ├── lsp/              # Language Server Protocol client
│   ├── permission/       # 3-tier permission system
│   ├── provider/         # Multi-provider abstraction
│   │   ├── anthropic/    # Anthropic API provider
│   │   ├── openai/       # OpenAI-compatible provider
│   │   └── registry/     # Provider auto-selection
│   ├── session/          # Session persistence + resume
│   ├── skills/           # Custom skills system
│   ├── tool/             # Tool interface + builtins
│   │   ├── builtin/      # 11 built-in tools
│   │   ├── mcp/          # MCP integration
│   │   └── init/         # Tool registration
│   └── update/           # Auto-update checker
├── pkg/
│   ├── tty/              # Legacy REPL (use --legacy-repl)
│   └── tui/              # Bubbletea TUI (default)
├── harness/              # Python test harness
├── docs/                 # VitePress documentation
├── scripts/              # Install and launch scripts
└── .github/workflows/    # CI/CD

Development

make build          # Build binary
make test           # Go + Python harness tests
make vet            # Static analysis
make build-all      # Cross-compile all platforms
make docs           # Serve docs locally
make docs-build     # Build docs for production

Documentation

Full documentation: https://strings77wzq.github.io/claude-code-Go/

Key pages:

License

MIT License — see LICENSE for details.

Directories

Path Synopsis
cmd
go-code command
internal
agent
Package agent provides the core agent loop for the Claude Code clone.
Package agent provides the core agent loop for the Claude Code clone.
api
config
Package config provides configuration loading for go-code.
Package config provides configuration loading for go-code.
hooks
Package hooks provides built-in hook implementations for logging and auditing.
Package hooks provides built-in hook implementations for logging and auditing.
lsp
Package lsp provides Language Server Protocol client and tool integration.
Package lsp provides Language Server Protocol client and tool integration.
provider
Package provider defines the interface for LLM providers.
Package provider defines the interface for LLM providers.
session
Package session provides session persistence in JSONL format.
Package session provides session persistence in JSONL format.
update
Package update provides functionality for checking and downloading updates.
Package update provides functionality for checking and downloading updates.
pkg
tty
tui

Jump to

Keyboard shortcuts

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