An AI-Powered CLI Coding Assistant with Multi-Provider Support and Hierarchical Agent System
GorCode is an intelligent CLI coding assistant that revolutionizes developer workflows through its powerful multi-provider LLM support and sophisticated hierarchical agent architecture. Built for developers who demand flexibility, extensibility, and intelligent code assistance.
GorCode seamlessly integrates with multiple LLM providers through a unified interface:
| Provider | Router | Features |
|---|---|---|
| OpenAI | openai-chat |
GPT-4, GPT-3.5, streaming support |
| Anthropic | anthropic |
Claude 3.5/3.7 Sonnet, extended thinking |
| OpenAI Interleaved | openai-chat-interleaved |
OpenAI with interleaved content |
| Anthropic Interleaved | anthropic-interleaved |
Anthropic with interleaved content |
| OpenAI Responses | openai-response |
OpenAI Responses API |
Multiple routers can work simultaneously, allowing you to leverage different models for different tasks within the same session.
GorCode features a powerful multi-level agent architecture:
┌─────────────────────────────────────────┐
│ Primary Agent │
│ (build, plan - Main Orchestrators) │
└─────────────────┬───────────────────────┘
│
┌─────────┼─────────┐
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│ Sub-Agent │ │ Sub-Agent │ │ Sub-Agent │
│ (explore) │ │ (general) │ │ (custom) │
└─────┬─────┘ └───────────┘ └───────────┘
│
▼
┌───────────┐
│ Sub-Sub │ ← Agents can spawn more agents!
│ Agent │
└───────────┘
Agent Hierarchy Features:
- Primary Agents: Main orchestrators (
build,plan) that handle complex tasks - Sub-Agents: Specialized workers (
explore,general) for focused subtasks - Recursive Delegation: Any agent can spawn sub-agents for parallel task execution
- Custom Agents: Define your own agents with custom prompts and capabilities
Agents are fully customizable through Markdown-based configuration:
---
name: my-custom-agent
mode: subagent
description: Specialized agent for database operations
allowsubagents: ["explore", "general"]
tools:
search_codebase: true
file_tools: true
permissions:
edit: allow
bash:
"*": ask
---
# Custom System Prompt
You are a specialized database optimization agent...GorCode supports the Model Context Protocol for extended capabilities:
- Tool Discovery: Automatically discover and use tools from MCP servers
- Resource Access: Access external resources through standardized protocols
- Multiple Servers: Connect to multiple MCP servers simultaneously
- Claude Code Compatible: Compatible with Claude Code MCP configurations
Inject specialized knowledge into conversations:
- Skill Directories: Organize knowledge in
.gorcode/skills/ - YAML Frontmatter: Define skill metadata with YAML
- Resource Embedding: Include code examples, documentation, and templates
- Dynamic Injection: Skills are injected into context when needed
- Streaming Responses: Real-time response streaming with thinking visibility
- Tool Calling: Built-in tools for file operations, code search, web fetching
- Context Management: Intelligent context compaction and summarization
- Permission System: Configurable permission levels for sensitive operations
- Session Persistence: Save and resume conversations
git clone https://github.com/Kingge97/GorCode.git
cd GorCode/GorCodeOption A: Using requirements.txt (Recommended for users)
# Install dependencies from requirements.txt
pip install -r requirements.txtOption B: Using pip install -e (Recommended for developers)
# Install in editable mode
pip install -e .
# Or install with development dependencies
pip install -e ".[dev]"Run the setup script to add gorcode command to your PATH:
Windows (PowerShell):
.\scripts\setup-gorcode.ps1macOS/Linux:
bash scripts/setup-gorcode.shAfter running the script, open a new terminal and you can use the gorcode command directly.
Create ~/.gorcode/config.json:
{
"models": {
"claude": {
"name": "claude",
"model_name": "claude-3-5-sonnet-20241022",
"base_url": "https://api.anthropic.com/v1/",
"api_key": "your-anthropic-api-key",
"router": "anthropic",
"stream": true
},
"gpt4": {
"name": "gpt4",
"model_name": "gpt-4-turbo",
"base_url": "https://api.openai.com/v1/",
"api_key": "your-openai-api-key",
"router": "openai-chat",
"stream": true
}
}
}# Start GorCode with default agent
gorcode
# Use a specific agent
gorcode --agent plan
# Use a specific model
gorcode --model claudeGorCode/
├── GorAI_LLMClient/ # Unified LLM client library
│ ├── models/ # Provider-specific implementations
│ │ ├── _openai_model.py
│ │ ├── _anthropic_model.py
│ │ ├── _deepseek_openai_model.py
│ │ └── ...
│ └── executor.py # Tool execution engine
├── backend/
│ ├── agents/ # Agent system
│ │ ├── base.py # Base agent classes
│ │ └── loader.py # Agent loading
│ ├── core/
│ │ ├── model_connector.py # Multi-provider connector
│ │ └── executor.py # Core execution logic
│ ├── mcp/ # MCP protocol support
│ ├── skills/ # Skill system
│ └── tools/ # Built-in tools
├── frontend/
│ └── cli/ # Command-line interface
└── agents/ # Built-in agent definitions
├── build.md
├── plan.md
├── explore.md
└── general.md
Create a new agent by adding a .md file to .gorcode/agents/:
---
name: security-audit
mode: subagent
description: Security-focused code review agent
is_native: false
allowsubagents: ["explore"]
tools:
search_codebase: true
file_tools: true
webfetch: true
permissions:
edit: ask
bash:
"*": deny
---
# Security Audit Agent
You are a security-focused code reviewer. Your task is to:
1. Identify potential security vulnerabilities
2. Check for common security anti-patterns
3. Review authentication and authorization logic
4. Analyze input validation
Always provide specific line references and suggest fixes.Add MCP servers to your config:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token"
}
}
}
}| Router | Description | Best For |
|---|---|---|
openai-chat |
OpenAI Chat Completion API | GPT-4, GPT-3.5, DeepSeek, MiniMax |
anthropic |
Anthropic Messages API | Claude 3.5/3.7 Sonnet |
openai-chat-interleaved |
OpenAI with interleaved content | Complex multimodal tasks |
anthropic-interleaved |
Anthropic with interleaved content | Complex multimodal tasks |
openai-response |
OpenAI Responses API | Latest OpenAI features |
| Variable | Description |
|---|---|
GORCODE_CONFIG |
Path to custom config file |
GORCODE_WORKDIR |
Default working directory |
GORCODE_DEBUG |
Enable debug logging |
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
GorCode is released under the MIT License.
- Built with GorAI_LLMClient for unified LLM access
- Inspired by Claude Code and other AI coding assistants
- MCP protocol support based on Model Context Protocol
中文文档 | Documentation | Issues