安装方式

一键安装脚本(推荐)

curl -fsSL https://raw.githubusercontent.com/zeroclaw-labs/zeroclaw/master/install.sh | bash

脚本自动检测平台,下载对应预构建二进制,添加到 $PATH

安装参数

# 最小构建(~6.6MB,不含 TUI 和硬件支持)
curl -fsSL .../install.sh | bash -s -- --minimal

# 指定版本
curl -fsSL .../install.sh | bash -s -- --version v0.7.5

# 仅安装到指定目录
curl -fsSL .../install.sh | bash -s -- --prefix ~/.local

从源码构建

  1. 安装 Rust 工具链

    需要 Rust Edition 2024(stable ≥ 1.82)

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. 克隆仓库

    git clone https://github.com/zeroclaw-labs/zeroclaw
    cd zeroclaw
  3. 构建发布版本

    # 全功能构建
    cargo build --release
    
    # 最小功能构建
    cargo build --release --no-default-features
    
    # 使用 just(更方便)
    just build
  4. 安装到系统

    cargo install --path .
    # 或直接使用
    ./target/release/zeroclaw --version

Onboard 初始化流程

首次安装后运行交互式向导,分四个步骤配置核心参数:

zeroclaw onboard
  1. Provider 配置

    选择 LLM 提供商(Anthropic / OpenAI / Ollama / 自定义)并输入 API Key

  2. Agent 定义

    设置 Agent alias、人格描述(personality)、默认模型

  3. Risk Profile

    配置自主级别:supervised(默认)/ autonomous / strict

  4. Channel 配置

    选配通讯渠道(Discord token、Telegram bot、Email SMTP 等)

ℹ️配置文件生成在 ~/.zeroclaw/config.toml,可随时手动编辑。

配置文件结构

# ~/.zeroclaw/config.toml

[provider.main]
type = "anthropic"       # anthropic | openai | ollama | openai-compat
api_key = "$ANTHROPIC_API_KEY"
model = "claude-sonnet-4-6"

[agent.default]
alias = "aria"
provider = "main"
personality = "You are a helpful assistant."
workspace = "~/workspace"
autonomy = "supervised"   # supervised | autonomous | strict

[risk]
medium_risk_approval = true
high_risk_block = true
allowed_commands = ["git", "npm", "cargo"]

[channel.telegram]
bot_token = "$TELEGRAM_BOT_TOKEN"
agent = "aria"

配置字段速查

字段类型说明
[provider.*]tableLLM 提供商定义,支持 fallback chain
[agent.*]tableAgent 定义,每个 alias 一个
[risk]table全局风险策略
[channel.*]table通讯渠道配置
[gateway]tableHTTP/WebSocket 服务器配置
[memory]table内存引擎路径与向量参数
[sop.*]tableSOP(标准操作流程)规则

三种运行模式

💬 Chat Mode

单次对话,命令行交互。适合快速任务和调试。

zeroclaw agent -a aria
# 或单次消息
zeroclaw agent -a aria \
  --message "summarize today's news"

🌐 Gateway Mode

HTTP/WebSocket 服务器,供外部系统调用。Web 控制台 + API。

zeroclaw gateway start
# 默认监听 0.0.0.0:8080
# Dashboard: http://localhost:8080

⚡ Daemon Mode

全自主运行时,多通道 + 调度器 + SOP 同时工作。生产环境首选。

zeroclaw daemon start
zeroclaw daemon status
zeroclaw daemon stop

系统服务注册

将 ZeroClaw 注册为系统服务,开机自启:

# 安装为系统服务(自动适配 systemd / launchd / Windows SCM)
zeroclaw service install

# 启动服务
zeroclaw service start

# 查看状态
zeroclaw service status

# 查看日志
zeroclaw service logs --follow

# 卸载
zeroclaw service uninstall

Docker / Kubernetes 部署

Docker Compose

# docker-compose.yml(简化示例)
services:
  zeroclaw:
    image: ghcr.io/zeroclaw-labs/zeroclaw:latest
    volumes:
      - ~/.zeroclaw:/root/.zeroclaw
    ports:
      - "8080:8080"
    environment:
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
    restart: unless-stopped
docker compose up -d

Kubernetes

# 使用仓库内提供的 manifest
kubectl apply -f deploy-k8s/
kubectl get pods -n zeroclaw

Nix

# 使用 flake
nix run github:zeroclaw-labs/zeroclaw
# 或加入 NixOS 配置
inputs.zeroclaw.url = "github:zeroclaw-labs/zeroclaw";

CLI 命令总览

zeroclaw agent
交互式聊天会话
zeroclaw daemon
长运行自主 runtime(start/stop/status)
zeroclaw acp
JSON-RPC 2.0 IDE 集成服务器
zeroclaw onboard
交互式初始化向导
zeroclaw config
配置属性管理(get/set/list/schema)
zeroclaw auth
Provider 认证 Profile 管理
zeroclaw gateway
Webhook / WebSocket 服务器管理
zeroclaw channel
Telegram / Discord / Slack 渠道配置
zeroclaw memory
Agent 记忆检查与管理
zeroclaw cron
定时任务配置
zeroclaw sop
标准操作流程(SOP)管理
zeroclaw skills
用户自定义能力管理
zeroclaw plugin
WASM 插件安装与管理
zeroclaw integrations
50+ 第三方服务连接器浏览
zeroclaw hardware
USB 设备发现与检查
zeroclaw peripheral
硬件板管理(STM32/RPi GPIO)
zeroclaw service
系统服务安装与管理
zeroclaw migrate
从 OpenClaw 迁移数据