Language: English · 中文 (简体) · ไทย
Clew is an unofficial, research-oriented CLI for AI-assisted software development.
It is a source-built reconstruction and extension project designed for local development, debugging, self-hosted workflows, and provider choice.
This repository is not an official Anthropic product, distribution, partner project, or supported implementation.
Disclaimer: Anthropic, Claude, and Claude Code are trademarks of their respective owners. This project is not affiliated with, endorsed by, sponsored by, or approved by Anthropic PBC. Anthropic's official Claude Code product is proprietary software. Read LICENSE.md before using, modifying, redistributing, or deploying this repository.
| Area | Description |
|---|---|
| Source-built CLI | A Bun/TypeScript terminal application that can be built, tested, inspected, and modified locally. |
| Multi-provider routing | Support for multiple AI providers through provider adapters and model selection commands. |
| Developer tooling | Commands for context inspection, code review, simplification, research, plugins, MCP, LSP, sessions, and background workflows. |
| Local extensibility | Support for plugins, hooks, skills, custom tools, scheduled tasks, and project-level configuration. |
| Research use | A transparent codebase for studying AI coding agent architecture, terminal UX, provider routing, and tool execution. |
Clew runs directly in your terminal. It can inspect and edit local codebases, execute shell commands with permissions, switch model providers, and coordinate longer-running agent workflows.
Key features:
- Multi-provider AI routing — Supports Anthropic, OpenAI, Google Gemini, OpenRouter, Ollama, GitHub Copilot, and OpenAI-compatible endpoints.
- Runtime model switching — Switch models or providers during a session using
/model. - Tool-driven workflows — Read, search, edit, and write files; execute shell commands; query LSPs; run MCP tools; and integrate browser automation.
- Plugin hooks — Hook into prompts, shell execution, tool calls, message display, session start, and file editing actions.
- Dynamic skills — Load bundled and project-level skills from
.claude/skills/. - Code review tools — Use
/code-review --fixto review changed code and apply fixes. Use/simplifyfor cleanup-focused review. - Model picker — Choose global or session-only model defaults.
- Plugin marketplace support — Includes support for
skipLfswhen downloading plugin sources. - Local research workflow — Use
/research <query>for local-first web research and scraping workflows where configured. - Agents and supervisor — Manage background agents, multi-step workflows, summaries, task status, approvals, and session state.
- Background shell commands — Run long-lived commands with
!bg <command>. - Scheduled tasks — Create one-shot or recurring tasks through
/task. - Sessions and bridge mode — Save, resume, and coordinate development sessions.
npm install -g @jonusnattapong/claudecodeOr:
bun install -g @jonusnattapong/claudecodeRun the CLI inside a project directory:
clewThe global launcher requires Bun to be installed on your machine.
git clone https://github.com/JonusNattapong/claudecode.git
cd claudecode
bun install
bun run build
bun run startFor development:
bun run dev- Bun 1.3 or higher
- Node.js 18 or higher
- Git
- Windows, macOS, Linux, or WSL2
- At least one supported provider API key, unless using a local provider such as Ollama
Set provider keys in your shell or in a local .env file.
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
export GOOGLE_API_KEY=...
export OPENROUTER_API_KEY=sk-or-...
export OLLAMA_HOST=http://localhost:11434Switch models or providers inside a session:
/model
/model list
/model openai/gpt-4o
/model google/gemini-2.5-pro
Provider documentation:
docs/providers.html
/model Switch models or providers
/status Show provider, session, and context status
/doctor Run diagnostics
/context Inspect active context usage
/compact Compress conversation history
/mcp Manage Model Context Protocol servers
/code-review Review changed code for bugs
/simplify Run cleanup-focused review
/plugin Manage plugins and hooks
/bridge Configure bridge mode
/agent Manage background agent workflows
/daemon Open autonomous daemon dashboard
/task Create or manage scheduled tasks
Type / in the CLI prompt to view available commands.
The scheduled task system is available through /task.
/task
Examples:
/task
Name: Server Check
Schedule: Daily
Time: 20:00
Prompt: Verify the status of local servers
Storage: Durable
/task
Name: Commit Reminder
Schedule: In N minutes
Delay: 10
Prompt: Remind me to commit the code
Storage: Session-only
Task behavior:
- Durable tasks are saved to
.claude/scheduled_tasks.json. - Session-only tasks run only during the active session.
- Recurring tasks use standard 5-field cron syntax.
- One-shot tasks are removed after they run.
- Local machine timezone is used for scheduled execution.
bun run dev # Start development mode
bun run start # Run the CLI from source
bun run build # Build into dist/
bun test # Run tests
bun x tsc --noEmit # Type check
bun run lint:check # Check Biome lint rules
bun run format:check # Check Biome formatting
bun run check:ci # Run Biome CI validationDeveloper utilities:
bun run preload <module> # Preload module context
bun run session <command> # Save, list, or restore session context
bun run codegraph # Generate module dependency graphs
bun run ast-grep -- <args> # Run structural AST search or rewritesrc/
├── main.tsx # Terminal UI bootstrap and main loop
├── query.ts # Query processing and system prompt logic
├── QueryEngine.ts # Query orchestration, caching, deduplication, and rate limits
├── agentRuntime/ # Agent orchestration and persistent run stores
├── commands/ # Slash command implementations
├── tools/ # Built-in developer tools
├── services/
│ ├── ai/ # Provider manager, adapters, normalizers, and providers.json
│ ├── mcp/ # Model Context Protocol clients
│ ├── plugins/ # Plugin lifecycle hooks and interceptors
│ ├── tools/ # Tool execution service
│ ├── lsp/ # Language Server Protocol integration
│ ├── Supervisor/ # Background agent supervisor
│ └── SessionMemory/ # Persistent session memory
├── skills/ # Dynamic skill loader
├── cli/ # Terminal UI contexts
├── components/ # Terminal UI components
├── bridge/ # WebSocket bridge
├── coordinator/ # Multi-agent coordinator
├── keybindings/ # Keyboard shortcut mappings
├── state/ # Reactive stores
└── vim/ # Vim-like navigation mode
Terminal UI
-> Command registry and keybindings
-> Provider manager and AI adapters
-> Query engine and streaming loops
-> Tool executor service
-> Plugins, MCP, LSP, agents, session memory, and bridge
- Installation
- Quick Start
- Configuration
- AI Providers
- Models
- Commands
- Tools
- Plugins
- Skills
- Architecture
- Permission Model
- Bridge Mode
- SearXNG Search
- Troubleshooting
- Evals
DEBUG=1 bun run src/main.tsx
DEBUG=provider:anthropic bun run src/main.tsxRemove-Item -Recurse -Force node_modules
bun install
bun run devA precompiled ripgrep binary for Windows may be bundled under:
src/utils/vendor/ripgrep/x64-win32/rg.exe
Read these files before contributing:
Do not submit proprietary code, copied source, leaked material, credentials, private keys, or content you do not have the right to license.
Do not open public issues for security vulnerabilities.
Use the private reporting process described in SECURITY.md.
See CHANGELOG.md.
See LICENSE.md.
Only contributor-authored modifications and original additions are licensed as described in LICENSE.md. This repository does not grant rights to Anthropic proprietary software, services, models, trademarks, or other protected materials.
