clew-code
v0.2.14
Published
ClewCode — multi-provider AI coding agent CLI
Maintainers
Readme
Clew Code
The open-source AI coding agent — in your terminal and on your LAN.
A multi-provider AI coding CLI that codes, learns your preferences, coordinates across machines, and runs autonomously on your own hardware. One Bun bundle. Local-first by design.
GitHub · Latest Release · Docs · Issues
Hacking in public
Clew Code is a fork of Claude Code (Anthropic), rebuilt from the ground up to be multi-provider — you're not locked into one API. As of this writing the project ships peer-to-peer LAN coordination, a preference-learning engine, autonomous background loops, MCP integration, and 27 provider adapters.
Forked from Claude Code. Rebuilt for every provider.
Features
27 providers — Anthropic, OpenAI, Google Gemini, DeepSeek, Groq, xAI (Grok), Mistral, Cohere, Perplexity, Cerebras, Moonshot (Kimi), Zhipu (GLM), NVIDIA NIM, OpenRouter, GitHub Copilot, OpenCode, KiloCode, Ollama (local), Together AI, Fireworks AI, Deep Infra, SiliconFlow, Hugging Face, Poe, DigitalOcean, Cline, OpenCode Go. Switch mid-session.
Peer-to-peer LAN mesh — find other Clew instances on the same machine (file registry) or across machines (UDP multicast). Assign tasks, set roles, execute remote commands — 14 AI tools let your agent coordinate autonomously.
Autonomous agent loop — file-backed persistent task queue, lease-based concurrency, exponential backoff retry, dead-letter management. Cron scheduler for recurring jobs. Max 3 concurrent workers.
50+ built-in tools — Read, Write, Edit, Glob, Grep, Bash, WebSearch, WebFetch, Browser (Playwright), PR (create/list/view/review/merge/status), NotebookEdit, JsonPath, peer tools, MCP tools, ProcessPeer (exec/pty).
MCP — Model Context Protocol — connect external tools via stdio (local subprocesses), SSE (remote servers with OAuth), or DirectConnect (in-process plugin servers).
Skills, plugins, hooks — extend without touching source. Skills via
SKILL.md, plugins with manifest, hooks at every lifecycle stage (PreToolUse, PostToolUse, PreBash, PostPrompt, PreAcceptEdit).7 permission modes — default, ask, plan, auto, acceptEdits, bypassPermissions, dontAsk. Granular allow/deny rules with pattern matching.
Install
npm install -g clew-code# Then run inside any project
cd my-project
clewRequires Bun 1.3+, Node.js 18+, Git, and one provider API key.
Build from source:
git clone https://github.com/ClewCode/ClewCode.git
cd ClewCode
bun install && bun run build && bun run start- macOS — works out of the box (Apple Silicon & Intel)
- Linux — no special dependencies
- Windows — requires Git Bash, WSL, or PowerShell. Some tools (ComputerUse) are Windows-only.
Quick start
# First run — pick a provider when prompted
clew
# Configure a provider (inside the REPL)
❯ /provider openai
❯ /model gpt-5.5
# Or try DeepSeek
❯ /model deepseek-v4-pro
# Or go local with Ollama
❯ /model ollama/llama3.3
# In-session commands
❯ /help # list everything
❯ /status # current provider, model, context info
❯ /peer discover # find other Clew instances on LAN
❯ /mcp list # connected MCP servers
❯ /loop start # background autonomous loop
# One-shot mode (pipe-friendly)
clew -p "summarize CHANGELOG.md"
# Resume last session
clew --resume lastProvider setup
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
export GOOGLE_API_KEY=...
export DEEPSEEK_API_KEY=...
export GROQ_API_KEY=...
export OPENROUTER_API_KEY=...
export OLLAMA_HOST=http://localhost:11434
export COPILOT_GITHUB_TOKEN=gho_...Commands
/model Switch provider or model
/status Provider, session, context info
/doctor Diagnostics
/context Active context usage
/compact Compress conversation history
/mcp MCP server management
/code-review Review changed files for bugs
/simplify Cleanup-focused review
/plugin Plugin and hook management
/bridge Bridge mode config
/agent Background agent workflows
/peer LAN peer coordination
/remote WebSocket remote control
/loop 24/7 autonomous agent loop
/daemon Autonomous daemon dashboard
/task Scheduled tasksProject layout
src/
├── main.tsx # Entry point
├── query.ts / QueryEngine.ts
├── agentRuntime/ # Background agent orchestration
├── commands/ # Slash command implementations
├── tools/ # 50+ built-in tools
├── services/
│ ├── ai/ # Provider manager + 27 providers
│ ├── mcp/ # MCP client + auth + transports
│ ├── plugins/ # Plugin hooks + marketplace
│ ├── autonomous/ # Agent loop + task queue + cron
│ ├── lsp/ # LSP integration
│ └── Supervisor/ # Agent supervisor IPC
├── peer/ # PeerServer + PeerDiscovery
├── bridge/ # WebSocket bridge + relay
├── components/ # Ink terminal UI components
├── state/ # AppState management
└── hooks/ # React hooksDevelopment
bun run dev # Live reload
bun run build # Build to dist/
bun test # Vitest
bun x tsc --noEmit # Type-check
bun run check:ci # Full CI check (lint + test + typecheck)Windows:
Remove-Item -Recurse -Force node_modules
bun install && bun run devContribute
We welcome contributions. Read CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md, and LICENSE.md before submitting.
Good first issues
- Add a new provider adapter in
src/services/ai/ - Write tests for untested tools
- Fix docs, add examples
- Build a plugin or MCP server
- Improve Windows support
Contributors
Documentation
Installation · Configuration · Providers · Models · Commands · Tools · MCP · Plugins · Skills · Peer-to-Peer · Agent Loop · Permission Model · Daemon · Bridge Mode · Troubleshooting
Changelog
- process_peer PTY terminal box — terminal-style progress box with ANSI-preserving output tail
/peer run codex <task>— run one-shot Codex process peer from chat- Auto-update dialog — npm update notification before app starts
- Rich model fetching — API models now carry context window, vision, tools, reasoning, free tags
/model listcapability tags —[200K ctx, vision, tools, reason, free]per model- GlimmerMessage gradient — per-character color interpolation with fade effect
- Cost in status line — shows session cost when >$0
- Peer HTTP heartbeat — 60s liveness checks, offline peers detected immediately
- Removed GitHub Copilot — provider and all references cleaned out
/agentsvisual polish — redesigned dashboard, cleaner layout- Auto-updater — switched from Anthropic GCS to npm registry
- Rebranded to Clew Code — docs, UI copy, and package updated
- Memory search —
/memory searchfor stored entries - Peer tools — 14 AI coordination tools, peer help, connection count in footer
- Fixed
/providers— duplicateconst inforuntime error fixed
- Peer-to-peer — UDP multicast discovery, file registry, 14 AI coordination tools, interactive PeerMenu
- Autonomous agents — agent loop, supervisor integration, task queue, Loop Lock
- Workflow Rainbow — per-character gradient highlight for "workflow" keyword
/effortworks with any provider exposingreasoningEffort(NVIDIA, DeepSeek, OpenRouter, etc.)/modelfetches live model list from provider APIs- Relay server for cross-network remote control
- Bridge v2: provider-agnostic remote control
/pr create/list/view/review/merge/status- Security: PowerShell rules, malformed tool call guard, 100 MB bash output cap
License
LICENSE.md — covers only contributor-authored modifications and original additions. Does not grant rights to third-party software, models, or trademarks.
Clew Code is a fork of Claude Code (Anthropic). All original Claude Code code remains under its license.
