项目简介

赤龙虾(RustClaw)是一个高性能、低资源占用、可组合的自主智能体运行时。RustClaw 是面向智能代理工作流的运行时操作系统 — 它抽象了模型、工具、记忆和执行层,使代理可以一次构建、随处运行。

  • Rust 原生实现,单二进制部署,跨 ARM / x86 / RISC-V。
  • Trait 驱动架构,Provider / Channel / Tool / Memory 可替换。
  • 安全默认值优先:配对鉴权、显式 allowlist、沙箱与作用域约束。

默认轻量运行时

常见 CLI 与 status 工作流通常保持在几 MB 级内存范围。

低成本部署友好

面向低价板卡与小规格云主机设计,不依赖厚重运行时。

冷启动速度快

Rust 单二进制让常用命令与守护进程启动更接近“秒开”。

跨架构可移植

同一套二进制优先流程覆盖 ARM / x86 / RISC-V,组件可替换。

性能基准

以下是本地快速基准对比(macOS arm64,2026 年 4 月),按 0.8GHz Edge CPU 进行归一化展示

指标 RustClaw OpenClaw NanoBot PicoClaw
编程语言 Rust TypeScript Python Go
内存占用 < 5MB > 1GB > 100MB < 10MB
启动时间(0.8GHz 核) < 10ms > 500s > 30s < 1s
二进制体积 ~8.8 MB ~28MB(dist) N/A(脚本) ~8MB
成本 低至 $5 以上硬件 Mac Mini $599 Linux SBC ~$50 Linux 板卡 $10

说明:Rustclaw 的数据来自 release 构建,并通过 /usr/bin/time -l 测得。OpenClaw 需要 Node.js 运行时环境,仅该运行时通常就会带来约 390MB 的额外内存占用;NanoBot 需要 Python 运行时环境。PicoClaw 与 rustclaw 为静态二进制。

RustClaw 完整架构设计图

本地可复现测量

基准数据会随代码与工具链变化,建议始终在你的目标环境自行复测:

cargo build --release
ls -lh target/release/rustclaw

/usr/bin/time -l target/release/rustclaw --help
/usr/bin/time -l target/release/rustclaw status

当前 README 的样例数据(macOS arm64,2026-02-18):
• Release 二进制:8.8M
rustclaw --help:约 0.02s,峰值内存约 3.9MB
rustclaw status:约 0.01s,峰值内存约 4.1MB

一键部署

git clone https://github.com/RustClawBot/rustclaw.git
cd rustclaw
./install.sh

可选环境初始化:./install.sh --install-system-deps --install-rust(可能需要 sudo)。

详细说明见:docs/setup-guides/one-click-bootstrap.html

部署提示

建议在部署前确保目标机器已安装基础编译环境(gcc/g++、make、cmake 等), 对于 ARM 架构设备,需确认 Rust 工具链已正确配置交叉编译环境。

快速开始

Homebrew(macOS/Linuxbrew)

brew install rustclaw

源码编译安装

git clone https://github.com/RustClawBot/rustclaw.git
cd rustclaw
cargo build --release --locked
cargo install --path . --force --locked

基础使用命令

快速初始化(无交互)

rustclaw onboard --api-key sk-... --provider openrouter

引导式向导

rustclaw onboard

单次对话

rustclaw agent -m "Hello, rustclaw!"

启动网关

rustclaw gateway
# 默认: 127.0.0.1:42617

启动长期运行模式

rustclaw daemon

Subscription Auth

赤龙虾现已支持基于订阅的原生鉴权配置(多账号、静态加密存储)

配置文件

~/.rustclaw/auth-profiles.json

加密密钥

~/.rustclaw/.secret_key

Profile ID 格式

<provider>:<profile_name>
例:openai-codex:work

OpenAI Codex OAuth(ChatGPT 订阅)

# 推荐用于服务器/无显示器环境
rustclaw auth login --provider openai-codex --device-code

# 浏览器/回调流程,支持粘贴回退
rustclaw auth login --provider openai-codex --profile default
rustclaw auth paste-redirect --provider openai-codex --profile default

# 检查 / 刷新 / 切换 profile
rustclaw auth status
rustclaw auth refresh --provider openai-codex --profile default
rustclaw auth use --provider openai-codex --profile work

Claude Code / Anthropic setup-token

# 粘贴订阅/setup token(Authorization header 模式)
rustclaw auth paste-token --provider anthropic --profile default --auth-kind authorization

# 别名命令
rustclaw auth setup-token --provider anthropic --profile default

使用 subscription auth 运行 agent

rustclaw agent --provider openai-codex -m "hello"
rustclaw agent --provider openai-codex --auth-profile openai-codex:work -m "hello"

# Anthropic 同时支持 API key 和 auth token 环境变量:
# ANTHROPIC_AUTH_TOKEN, ANTHROPIC_OAUTH_TOKEN, ANTHROPIC_API_KEY
rustclaw agent --provider anthropic -m "hello"

贡献与许可证

贡献指南

许可证

MIT 或 Apache 2.0(见以下文件):

🌟 Recent Contributors (v0.3.1)

3 contributors shipped features, fixes, and improvements in this release cycle:

  • Argenis
  • argenis de la rosa
  • Claude Opus 4.6

Thank you to everyone who opened issues, reviewed PRs, translated docs, and helped test. Every contribution matters. 🦀

如果你需要完整实现细节(架构图、全部命令、完整 API、开发流程), 请直接阅读英文RustClaw.org官网,快速部署启动指南: 立即领养部署您的专属龙虾,进入全民Agent生产力时代!