Skip to content

legibet/mycode-go

Repository files navigation

mycode-go

There are many coding agents, but this one is mine.

A minimal coding agent.

  • Minimal Go backend.
  • Multiple provider support and robust message replay.
  • 4 built-in tools (read, write, edit, bash), expanded via skills.
  • Mobile-friendly web UI.
  • Native image and pdf input support.

mycode-go is the Go CLI/server rewrite of mycode.

Go SDK

The reusable agent runtime is a single importable package: import "github.com/legibet/mycode-go/mycode". CLI/server configuration, AGENTS discovery, system prompt construction, and permission UI stay in app code.

go get github.com/legibet/mycode-go/mycode@latest
a, err := mycode.New(mycode.Config{
    Provider: "openai",
    Model:    "gpt-5",
    APIKey:   os.Getenv("OPENAI_API_KEY"),
    CWD:      cwd,
    Tools:    []mycode.Tool{mycode.ReadTool(), mycode.WriteTool(), mycode.EditTool(), mycode.BashTool()},
})

See docs/sdk.md for the public interface and examples.

Install the CLI

Download the archive for your platform from the latest release:

Platform Archive suffix
macOS, Apple silicon darwin_arm64
macOS, Intel darwin_amd64
Linux, x86-64 linux_amd64
Linux, ARM64 linux_arm64

Extract the archive and install the binary:

tar -xzf mycode-go_*.tar.gz
sudo mkdir -p /usr/local/bin
sudo install -m 0755 mycode-go /usr/local/bin/mycode-go
mycode-go --version

Each release includes SHA256SUMS for download verification. The CLI binary includes the web UI.

Quick Start

Set an API key for any supported provider:

export ANTHROPIC_API_KEY="..."

Run a prompt in the current directory:

mycode-go "explain how the session store works"

Resume the latest session for the current directory:

mycode-go run --continue "continue the last task"

Start the web UI at http://127.0.0.1:8000:

mycode-go web

API keys are read automatically from the environment. See Providers for supported variables.

Providers

Provider id Env var
Anthropic anthropic ANTHROPIC_API_KEY
OpenAI openai OPENAI_API_KEY
Google Gemini google GEMINI_API_KEY, GOOGLE_API_KEY
Moonshot moonshotai MOONSHOT_API_KEY
MiniMax minimax MINIMAX_API_KEY
DeepSeek deepseek DEEPSEEK_API_KEY
Z.AI zai ZAI_API_KEY
OpenRouter openrouter OPENROUTER_API_KEY
OpenAI-compatible openai_chat -

Configuration

A config file is optional. API keys from the environment are usually sufficient.

Create ~/.mycode/config.json (global) or .mycode/config.json under the current project to:

  • set a default provider, model, and reasoning effort
  • expose additional models on an existing provider
  • register a custom endpoint, such as a private or regional deployment
  • set tool permission defaults
{
  "default": {
    "provider": "anthropic",
    "model": "claude-sonnet-4-6",
    "reasoning_effort": "medium"
  },
  "permission": {
    "level": "safe",
    "mode": "ask"
  },
  "providers": {
    "openrouter": {
      "models": {
        "deepseek/deepseek-v3.2": {},
        "xiaomi/mimo-v2-pro": {}
      }
    },
    "zhipu-coding-plan": {
      "type": "zai",
      "base_url": "https://open.bigmodel.cn/api/coding/paas/v4",
      "api_key": "${ZHIPU_API_KEY}"
    },
    "custom-provider": {
      "type": "openai_chat",
      "base_url": "https://custom-endpoint.com/v1",
      "api_key": "${CUSTOM_API_KEY}",
      "models": {
        "custom-model": {
          "context_window": 128000,
          "max_output_tokens": 16384,
          "supports_reasoning": true,
          "supports_image_input": false,
          "supports_pdf_input": false
        }
      }
    }
  }
}
  • To override a built-in provider, reuse its id as the key; custom providers must declare type.
  • reasoning_effort controls extended thinking for supported models: auto (default) · none · low · medium · high · xhigh.
  • permission.level controls automatic tool execution: readonly · safe · standard · yolo; default safe.
  • permission.mode is ask or deny; non-interactive CLI runs treat ask as deny.
  • API keys in config accept ${ENV_VAR} references.
  • Model metadata is bundled from models.dev; {} is enough for most models.

Built-in Moonshot, MiniMax, and Z.AI providers default to international endpoints. Override base_url for China endpoints.

CLI Reference

mycode-go "..."                      send one message, non-interactive
mycode-go run "..."                  send one message, non-interactive
mycode-go run --continue "..."       resume the most recent session for the current cwd
mycode-go run --session <id> "..."   resume a specific session
mycode-go web                        start web server (default port 8000)
mycode-go web --dev                  API only, no static files
mycode-go session list               list saved sessions for the current cwd
mycode-go session list --all         list saved sessions for all cwd values

Development

The web/ UI is a git submodule from legibet/mycode-web; --recurse-submodules fetches it.

git clone --recurse-submodules https://github.com/legibet/mycode-go.git && cd mycode-go
make test
make build

Web development (backend + Vite dev server):

make web-install
make dev

Other useful shortcuts: make fmt · make lint · make check · make build

Refresh the bundled model catalog:

uv run --no-project python ./scripts/update_models_catalog.py

License

MIT

About

Go rewrite of mycode(https://github.com/legibet/mycode).

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages