Zing Forum

Reading

Crab Code: An Open-Source Claude Code Alternative Built from Scratch with Rust

A fully open-source, Rust-native Agentic programming CLI tool that supports any LLM and provides a workflow experience compatible with Claude Code

RustAI编程开源Claude CodeAgenticLLM终端工具MCP
Published 2026-04-06 17:15Recent activity 2026-04-06 17:19Estimated read 9 min
Crab Code: An Open-Source Claude Code Alternative Built from Scratch with Rust
1

Section 01

[Introduction] Crab Code: An Open-Source Rust-Native Alternative to Claude Code

Crab Code: An Open-Source Claude Code Alternative Built from Scratch with Rust

Crab Code is a fully open-source, Rust-native Agentic programming CLI tool that supports any LLM, designed to provide a workflow experience compatible with Claude Code. It addresses the limitations on customization freedom imposed by Claude Code's closed-source nature, offering developers an open and customizable alternative.

2

Section 02

Project Background and Motivation

Project Background and Motivation

The emergence of Claude Code marks the shift of programming assistants from 'suggestion-based' to 'execution-based', but its closed-source nature limits developers' customization freedom and privacy needs. Developed by the CrabForge community, Crab Code is fully open-source under the Apache 2.0 license, with no functional restrictions or black-box operations. Currently, the first phase of the project is nearly complete; the core Agent loop, tool system, TUI interface, MCP support, and multi-Agent infrastructure have all been implemented, with over 945 test cases passing across 17 crates.

3

Section 03

Core Technical Architecture

Core Technical Architecture

Crab Code adopts a four-layer architecture design, consisting of 17 crates:

  • Foundation Layer: common, core, config, auth modules provide basic types, configuration management, and authentication functions.
  • Service Layer: api, tools, mcp, tui, plugin, telemetry modules handle LLM API communication, tool execution, MCP protocol, terminal interface, plugin system, and telemetry data.
  • Orchestration Layer: agent and session modules implement core logic for Agent loops and session management.
  • Entry Layer: cli, daemon, xtask provide command-line interface, daemon mode, and build tasks.

The project uses Tokio as the asynchronous runtime, implements zero dynamic dispatch using enum-type LlmBackend, and ensures type safety through exhaustive match.

4

Section 04

Key Feature Analysis

Key Feature Analysis

Model-Agnostic Design

Supports any model provider compatible with the OpenAI API (e.g., Claude, GPT, DeepSeek, Qwen, Ollama, etc.), allowing users to switch models flexibly.

Secure Permission System

Built-in three-level permission modes: Default (ask by default), TrustProject (trust the project), Dangerously (dangerous mode), combined with glob pattern matching to finely control tool execution permissions.

MCP Protocol Compatibility

Fully supports stdio and SSE transmission methods of the Model Context Protocol (MCP), seamlessly integrating external MCP tools via McpToolAdapter.

Intelligent Context Management

Implements session save/load/restore functions, supports CRAB.md project instruction files, and automatically triggers compression when the context window usage reaches 80%.

Interactive Terminal Interface

The TUI built on ratatui supports Markdown rendering, syntax highlighting, and Vim mode, while also supporting single-command mode for scripted scenarios.

5

Section 05

Development Roadmap and Community Participation

Development Roadmap and Community Participation

The project has completed phases M0 to M7a (including project scaffolding, domain models, streaming API, core tools, Agent loop, TUI interface, configuration management, and MCP integration), and phase M7b (multi-Agent and skill system) is under development.

Future plans include:

  • OS-level sandbox (Linux Landlock/macOS Seatbelt)
  • OAuth2 + AWS Bedrock/GCP Vertex authentication
  • Team/group multi-Agent coordination
  • WASM plugin runtime
  • WebSocket MCP transmission
  • Daemon mode and automatic update mechanism

The community welcomes contributions. Current areas needing help include: testing and benchmarking, OS-level sandbox implementation, integration with additional LLM providers, MCP WebSocket transmission, document internationalization, and plugin system development.

6

Section 06

Use Cases and Value

Use Cases and Value

Crab Code provides unique value for the following user groups:

  • Open Source Advocates: Fully open-source under Apache 2.0, allowing free auditing and source code modification.
  • Performance-Sensitive Users: Rust-native implementation brings instant startup, minimal memory footprint, and no Node.js runtime overhead.
  • Privacy-Conscious Developers: Supports local models (e.g., Ollama), so sensitive code does not need to be uploaded to the cloud.
  • Customization Seekers: Four-layer architecture and plugin system support deep customization.
  • Multi-Model Users: One tool connects to multiple models, avoiding the need to install multiple clients.
7

Section 07

Conclusion

Conclusion

Crab Code represents the development trend of AI-assisted programming tools towards open-source, localization, and customization. It replicates Claude Code's Agentic programming experience, and through Rust's performance advantages and open architecture, provides developers with a truly autonomous programming assistant. With the improvement of multi-Agent coordination and skill systems, Crab Code is expected to become an important force in the open-source AI programming ecosystem.

For developers who want to experience Agentic programming while valuing open-source freedom, Crab Code is worth paying attention to and trying.