rsclaw-ai/rsclaw: 15MB Rust Binary for Persistent AI Agents

M
Mohamed IDBRAHIM
Auteur
rsclaw-ai/rsclaw: 15MB Rust Binary for Persistent AI Agents

rsclaw-ai/rsclaw: 15MB Rust Binary for Persistent AI Agents

Most AI agents reset to zero between sessions. Your preferences, context, and workflow patterns vanish. For developers building automation, this isn't just inconvenient—it's a architectural limitation that forces constant re-prompting and brittle state management. rsclaw-ai/rsclaw addresses this directly: a Rust-built AI agent engine that persists memory across sessions, runs as a single 15MB binary on ~20MB RAM, and orchestrates multi-backend agents without touching Node.js.

What is rsclaw-ai/rsclaw?

rsclaw-ai/rsclaw (Crab AI) is an open-source AI agent engine maintained by rsclaw-ai, licensed under MIT OR Apache-2.0. Built entirely in Rust (1.91+), it currently holds 200 GitHub stars and 25 forks with active development as of July 2026.

The project sits at the intersection of three technical trends: the push for local-first AI infrastructure, the need for agent interoperability via protocols like Google's A2A, and the Rust ecosystem's maturation for systems-level AI tooling. Unlike Python↗ Bright Coding Blog-heavy alternatives that drag in gigabytes of dependencies, rsclaw ships as a single static binary—deployable on low-spec servers, edge devices, or developer laptops without containerization overhead.

Its core architectural bet is persistent memory: a three-layer store combining redb (embedded KV), tantivy (full-text search), and hnsw_rs (vector similarity) that keeps agent context alive across restarts. This isn't session caching—it's structured, queryable long-term memory that the agent learns from over time. The project also positions itself as a drop-in replacement for OpenClaw, with automated migration tooling for existing users.

Key Features

Three-Layer Persistent Memory The memory stack is fully local and built-in: redb handles hot key-value storage, tantivy provides full-text search, and hnsw_rs enables vector similarity for semantic recall. No external databases, no network calls, no data leaving ~/.rsclaw/.

Multi-Backend Agent Gateway Four execution backends coexist in one workflow: Native Rust (default, fastest), Claude Code, OpenCode, and any ACP-compatible agent via tool_cap. The LLM selects backends dynamically—no manual routing.

A2A v1.0 Cross-Machine Orchestration Full implementation of Google's A2A Protocol v1.0 including streaming, push notifications, task persistence, cancellation, and INPUT_REQUIRED interrupts. Auto-discovery via /.well-known/agent.json.

13 Messaging Channels WeChat Personal, Feishu/Lark, WeCom, QQ Bot, DingTalk, Telegram, Discord, Slack, WhatsApp, Signal, LINE, Zalo, Matrix—plus custom webhooks. All support DM/group policies, health monitoring, message retry, and pairing codes.

15 LLM Providers Qwen, DeepSeek, Kimi, Zhipu GLM, MiniMax, Doubao, SiliconFlow, GateRouter, OpenRouter, Anthropic, OpenAI, Gemini, xAI Grok, Groq, Ollama, plus any OpenAI-compatible API. Features include failover with exponential backoff, model fallback chains, and thinking budget controls.

Built-in Tooling 36 tools including file operations, shell exec with 50+ safety deny patterns, CDP browser automation (50+ actions, no ChromeDriver/Playwright/Node.js), document extraction, image/video generation, voice STT/TTS, cron jobs, and multi-agent spawn/task management.

Use Cases

Persistent DevOps↗ Bright Coding Blog Automation Deploy rsclaw on a low-spec VPS to manage infrastructure alerts. The agent remembers your runbook preferences, previous incident resolutions, and team escalation patterns across weeks of operation—no retraining on restart.

Cross-Platform Customer Support Bot Connect WeChat, Telegram, and Slack simultaneously. The agent recalls customer history across channels, handles structured data extraction via AnyCLI adapters, and escalates to human operators through A2A when confidence drops.

Local-First Coding Assistant Use tool_cap to delegate to Claude Code or Codex for complex refactoring while keeping project context in local memory. The 15MB binary runs comfortably alongside your editor without the memory pressure of electron-based alternatives.

Distributed ML Pipeline Orchestration Link multiple rsclaw instances via A2A across GPU servers and edge nodes. A main agent on your laptop delegates training tasks to a remote gpu-worker, receives streaming updates, and persists results—all without central cloud coordination.

Privacy-Sensitive Document Processing Process PDFs, DOCX, and spreadsheets entirely offline. The embedding model (BGE-small-zh, ~91MB) downloads once and runs locally. No API keys for cloud LLMs needed if using Ollama with local models.

Installation & Setup

New Installation

# macOS / Linux
curl -fsSL https://app.rsclaw.ai/scripts/install.sh | bash

# Windows (PowerShell)
irm https://app.rsclaw.ai/scripts/install.ps1 | iex

After installation, initialize the environment:

rsclaw setup      # Creates ~/.rsclaw/ directory structure
rsclaw onboard    # Interactive wizard for provider, channels, preferences
rsclaw start

First-run model download: The BGE-small-zh embedding model (~91MB) downloads automatically to ~/.rsclaw/models/bge-small-zh/. The download is resumable—interrupted transfers continue on next start. To skip this, pre-place model.safetensors, tokenizer.json, and config.json from BAAI/bge-small-zh-v1.5 before starting. The desktop app bundles this model, eliminating the download entirely.

Migrating from OpenClaw

openclaw gateway stop
rsclaw setup      # Detects OpenClaw data, offers one-click import
rsclaw start      # Channels, agents, sessions preserved

Your ~/.openclaw/ directory is never modified. All configuration fields are supported in import.

Alternative Install Methods

  • Desktop app: .dmg / .exe / .deb from Releases
  • Cargo: cargo install rsclaw
  • From source: git clone https://github.com/rsclaw-ai/rsclaw.git && cd rsclaw && cargo build --release

Real Code Examples

A2A Task Dispatch

The A2A protocol enables cross-machine agent communication. Here's a basic task submission:

curl -sS -X POST http://127.0.0.1:18888/api/v1/a2a \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0","id":"1","method":"SendMessage",
    "params":{"message":{"messageId":"m1","role":"user",
      "parts":[{"type":"text","text":"reply with ack"}]}}
  }'
# Response: { "result": { "status": { "state": "TASK_STATE_COMPLETED" },
#                 "artifacts": [{ "parts": [{"type":"text","text":"ack"}] }], ... } }

This demonstrates the JSON-RPC 2.0 interface for synchronous task execution. The SendMessage method blocks until terminal state, returning the final Task object with artifacts.

Resuming INPUT_REQUIRED Tasks

When an agent suspends awaiting user input:

curl -X POST http://127.0.0.1:18888/api/v1/a2a -H "Content-Type: application/json" -d '{
  "jsonrpc":"2.0","id":"r1","method":"SendMessage",
  "params":{"message":{
    "messageId":"m-resume-1",
    "taskId":"<the same taskId>",     # critical: same id routes to resume short-path
    "role":"user",
    "parts":[{"type":"text","text":"<your answer>"}]
  }}
}'

The taskId match is essential—this triggers the resume short-path rather than creating a new task. Streaming subscribers see the agent loop continue and produce the final artifact.

AnyCLI Structured Data Extraction

rsclaw anycli run hackernews top --format table limit=10
rsclaw anycli run bilibili hot --format markdown↗ Smart Converter
rsclaw anycli run github-trending repos language=rust
rsclaw anycli search zhihu        # search community hub
rsclaw anycli install zhihu       # install adapter

AnyCLI transforms websites into structured CLI output via declarative YAML adapters. The agent automatically uses anycli when structured data is available, preferring it over raw web_fetch for cleaner results.

Agent Configuration with Multi-Backend

{
  agents: {
    list: [
      { id: "main", default: true, model: { primary: "qwen-plus" } },
      { id: "coder", model: { primary: "deepseek-chat", toolset: "code" } },
    ],
    a2a: [
      { id: "gpu-worker", url: "http://gpu-server:18888", token: "${TOKEN}" },
    ],
  },
}

This configuration defines a local main agent, a coding-specialized agent with restricted toolset, and a remote A2A peer for GPU-intensive tasks. The LLM routes to tool_cap or agent_<id> tools based on task requirements.

Advanced Usage & Best Practices

Memory Management: Session compaction triggers automatically at 80% context window. Use /compact proactively before long operations to preserve conversation summaries. /clear preserves a summary—use it rather than full reset when context drifts.

Security Hardening: The 50+ exec deny patterns apply globally and cannot be bypassed per-agent. For additional control, configure per-agent command ACLs and enable confirmation gates for write operations. Review tool loop detection thresholds if building highly recursive workflows.

A2A Exposure: Default binding is 127.0.0.1:18888—inaccessible to remote peers. For internet exposure, Cloudflare Tunnel works well internationally; mainland China users should prefer frp with domestic VPS due to GFW interference with Cloudflare's WebSocket/SSE paths. Always set RSCLAW_A2A_BEARER_TOKENS before exposing publicly.

Model Fallback Chains: Configure provider failover with exponential backoff for production reliability. The thinking budget control helps manage costs on reasoning-heavy models like DeepSeek-R1 or Claude 3.7 Sonnet.

Comparison with Alternatives

rsclaw-ai/rsclaw OpenClaw General Python Agent Frameworks
Binary size ~15MB ~300MB+ (node_modules) Variable; often 500MB+ with dependencies
Startup time ~26ms 2–5s Seconds to minutes
Idle RAM ~20MB ~1000MB+ 200MB–2GB+
Long-term memory Three-layer (redb + tantivy + hnsw_rs) None Requires external vector DB
Self-learning Usage pattern learning None Implementation-dependent
Multi-backend agents Native Rust / Claude Code / OpenCode / ACP Single backend Usually single runtime
A2A protocol Full v1.0 None Emerging; rarely complete
Browser automation Built-in CDP (no Node.js) None Playwright/Selenium dependencies

Trade-offs exist: rsclaw's Rust ecosystem means smaller pool of ML-native libraries compared to Python. For researchers iterating on novel architectures, Python frameworks offer more flexibility. For production deployment where resource efficiency and predictable behavior matter, rsclaw's static binary approach reduces operational surface area significantly.

FAQ

Can I run rsclaw and OpenClaw simultaneously? Yes—rsclaw uses port 18888, OpenClaw uses 18789. Separate data directories prevent conflicts.

Does rsclaw modify my OpenClaw data during migration? Never. Import is read-only on ~/.openclaw/; all rsclaw data writes to ~/.rsclaw/.

What Rust version is required? Rust 1.91 or later. Check with rustc --version before building from source.

Can I use rsclaw commercially? Yes—MIT OR Apache-2.0 dual license permits proprietary use, SaaS deployment, and redistribution without open-source obligations.

Does it work fully offline? Yes with Ollama for local LLM inference. Voice STT also runs local via Candle Whisper. The BGE embedding model downloads once and stays local.

How do I add a custom messaging channel? Use the webhook POST endpoint at /hooks/{name} with custom channel configuration in rsclaw.json5.

What's the cancellation behavior for long-running tasks? CancelTask fires a token checked between tool calls, not during execution. A 30-second blocking tool completes before cancellation takes effect.

Conclusion

rsclaw-ai/rsclaw targets a specific but growing need: AI agents that persist, learn, and interoperate without infrastructure bloat. Its 15MB binary and ~20MB idle footprint make it viable for edge deployment, while the A2A protocol support enables genuine distributed agent networks. The OpenClaw migration path lowers switching costs for existing users.

This tool fits developers who prioritize resource efficiency, data locality, and protocol interoperability over the flexibility of Python-heavy stacks. If you're building automation that needs to remember context across sessions, orchestrate multiple agent backends, or run on constrained hardware, rsclaw warrants evaluation.

Explore the repository, join the community channels, and star the project if it proves useful: https://github.com/rsclaw-ai/rsclaw

Commentaires 0

Aucun commentaire pour l'instant. Soyez le premier à réagir !

Laisser un commentaire