Skip to content

Repository files navigation

gluwi

A desktop AI coding agent built with Wails v3 (Go backend) + React 19 (Vite frontend). Chat with an agent that can read/write files, run shell commands, search code, fetch URLs, manage todos/goals, spawn subagents, and run scheduled/background services — all scoped to a selected workspace folder.

gluwi

Features

  • Plan / Build modes — Toggle between read-only research (Plan) and full edit access (Build) with Tab
  • 12+ LLM providers — W&B, ZAI, OpenAI, Anthropic, DeepSeek, xAI, Google Gemini, Groq, Together AI, Mistral, Perplexity, Fireworks, Cohere, Novita
  • 80+ models — Searchable model selector with context window info
  • 5 themes — Rust & Brown, Midnight Blue, Purple Noir, Pure Black, Carbon Green
  • Session management — SQLite-backed history, session forking, auto-compaction
  • Background services — Start/stop long-running processes with live output (dev servers, watchers, etc.)
  • Tool safety — 4-level command classifier (Safe / Mutation / Destructive / Blocked)
  • SSRF protection — Blocks private/loopback/link-local/metadata IP ranges
  • Multi-key failover — Automatic key cooldown + exponential backoff on 429
  • Auto-update — Atom feed, SHA-256 verified, zip-slip-safe extraction
  • MCP support — Model Context Protocol server integration (stdio/SSE/HTTP)
  • Proxy-aware — System proxy detection (Windows registry, macOS scutil, env vars)
  • i18n — English + Chinese
  • Custom skills — Load skills from ~/.agents/skills, ~/.claude/skills, or workspace .agents/skills

Quick Start

Prerequisites

  • Go 1.25+
  • Node.js 18+
  • CGO (required by Wails for WebView2)

Development

# Terminal 1 — frontend (hot reload)
cd frontend
npm install
npm run dev

# Terminal 2 — Go backend (loads from Vite server)
$env:CGO_ENABLED=1
go run -tags dev .

Or use the dev script:

.\dev.ps1

Production Build

cd frontend
npm run build

cd ..
$env:CGO_ENABLED=1
go build -o gluwi.exe .
Copy-Item gluwi.exe build\gluwi.exe -Force

Run:

.\build\gluwi.exe

Architecture

main.go                         Entry point, Wails app, embed frontend/dist
internal/app/                   All backend logic (single Go package "app")
  app.go                        App struct, initialization, service registration
  biz_config.go                 Config state, providers, proxy
  biz_context.go                buildMessages(): [system, history, user, todos]
  biz_database.go               SQLite layer: sessions, messages, parts
  biz_mcp.go                    MCP (Model Context Protocol) manager
  biz_prompt.go                 System prompt assembly + skills
  biz_sessions.go               Session manager (in-memory cache + SQLite)
  biz_workspace.go              Workspace map cache, path index, gitignore
  orch_chat_loop.go             Main chat loop (stream → tool → loop)
  orch_dispatch.go              Tool dispatch + plan-mode safety net
  orch_tools.go                 Tool schemas (80+ tools, plan-mode filter)
  orch_command_safety.go        4-level command classifier
  orch_services.go              Background service manager
  orch_subagent.go              Subagent runner
  orch_scheduler.go             Scheduled task manager
  prov_failover.go              Provider selection, 429 retry, key cooldown
  prov_openai_chat.go           OpenAI Chat adapter
  prov_anthropic.go             Anthropic Messages adapter
  host_wails.go                 Wails service methods (RPC boundary)
internal/tools/                 Pure packages (no App dependency)
  calculate/                    Arithmetic expression evaluator
  command/                      Shell command tokenizer + safety classifier
  edit/                         File edit planner (version tokens, overlap detection)
  pathutil/                     Workspace boundary enforcement
  read/                         File decoder (UTF-8/UTF-16), line renderer
  shared/                       CodedError type
frontend/                       React 19 + Vite + TypeScript + Tailwind
  src/App.tsx                   Root component, event routing
  src/components/               ChatMessages, ChatInput, Sidebar, ToolCallCard, etc.
  src/hooks/                    useChat, useConfig, useServices, useTheme, useLocale
  src/lib/                      wails.ts, events.ts, cn.ts, i18n.ts

Configuration

Config lives at ~/.gluwi/config.json:

{
  "providerName": "Weights & Biases",
  "apiFormat": "openai_chat",
  "baseUrl": "https://api.inference.wandb.ai/v1",
  "model": "zai-org/GLM-5.2",
  "apiKeys": ["sk-..."],
  "workspace": "C:\\Users\\you\\project",
  "temperature": 0.2,
  "maxTokens": 16384,
  "contextWindow": 262144,
  "reasoningEffort": "max",
  "proxy": { "enabled": false, "url": "", "bypass": "" }
}

Plan Mode

Plan mode restricts the agent to read-only tools — it can research, read files, search code, and ask questions, but cannot edit, create, delete, run commands, or start services. Use it to iterate on an approach before switching to Build mode to execute.

  • Press Tab in the input box to toggle
  • The active mode is highlighted in orange
  • A banner appears at the top of the chat when Plan mode is active

Themes

Switch themes in Settings → Theme:

Theme Background Accent
Rust & Brown #1a1612 #ff8860
Midnight Blue #0d1117 #58a6ff
Purple Noir #14111f #b87cff
Pure Black #000000 #e0e0e0
Carbon Green #0c1210 #5dd6a0

Build & Release

task build       # frontend + go build
task package     # package current platform
task release     # build + package + feed + checksums
git tag v1.0.0; git push origin v1.0.0  # CI triggers on tag

Testing

# Go tests
$env:CGO_ENABLED=0
go test ./internal/app/
go test ./internal/tools/...

Tech Stack

Layer Technology
Backend Go 1.25, Wails v3, SQLite (modernc.org/sqlite)
Frontend React 19, Vite 5, TypeScript 5.5 (strict), Tailwind CSS 3.4
Markdown react-markdown + remark-gfm + rehype-highlight
Diagrams Mermaid (lazy-loaded)
Icons lucide-react
Font Lilex (all weights)

License

MIT

About

A desktop AI coding agent built with Wails v3 (Go backend) + React 19 (Vite frontend). Chat with an agent that can read/write files, run shell commands, search code, fetch URLs, manage todos/goals, spawn subagents, and run scheduled/background services — all scoped to a selected workspace folder.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages