Zero overhead. Zero compromise. 100% Rust. 100% Agnostic.
The fastest, smallest, fully autonomous AI assistant โ deploy anywhere, swap anything. ``` ~3MB binary ยท <10ms startup ยท 629 tests ยท 22 providers ยท Pluggable everything ``` ## Quick Start ```bash git clone https://github.com/theonlyhennygod/zeroclaw.git cd zeroclaw cargo build --release # Initialize config + workspace cargo run --release -- onboard # Set your API key export OPENROUTER_API_KEY="sk-..." # Chat cargo run --release -- agent -m "Hello, ZeroClaw!" # Interactive mode cargo run --release -- agent # Check status cargo run --release -- status --verbose # List tools (includes memory tools) cargo run --release -- tools list # Test a tool directly cargo run --release -- tools test memory_store '{"key": "lang", "content": "User prefers Rust"}' cargo run --release -- tools test memory_recall '{"query": "Rust"}' ``` > **Tip:** Run `cargo install --path .` to install `zeroclaw` globally, then use `zeroclaw` instead of `cargo run --release --`. ## Architecture Every subsystem is a **trait** โ swap implementations with a config change, zero code changes. ``` โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ ZeroClaw Architecture โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ Chat Apps โ โ Security Layer โ โ โ โ โ โ โ โ โ โ Telegram โโโโค โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ โ โ โ Discord โโโโค โ โ Auth Gate โ โ Rate Limiter โ โ โ โ โ Slack โโโโผโโโโบโ โ โ โ โ โ โ โ โ iMessage โโโโค โ โ โข allowed_ โ โ โข sliding window โ โ โ โ โ Matrix โโโโค โ โ users โ โ โข max actions/hr โ โ โ โ โ CLI โโโโค โ โ โข webhook โ โ โข max cost/day โ โ โ โ โ Webhook โโโโค โ โ secret โ โ โ โ โ โ โโโโโโโโโโโโโโโโ โ โโโโโโโโฌโโโโโโโ โโโโโโโโโโฌโโโโโโโโโโ โ โ โ โ โ โ โ โ โ โโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโ โ โ โผ โผ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ Agent Loop โ โ โ โ โ โ โ โ Message โโโบ LLM โโโบ Tools โโโบ Reply โ โ โ โ โฒ โ โ โ โ โ โ โโโโโโโโโโโโโโโ โ โ โ โ โ โผ โ โ โ โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ โ โ โ โ Context โ โ Sandbox โ โ โ โ โ โ โ โ โ โ โ โ โ โ โข Memory โ โ โข allowlist โ โ โ โ โ โ โข Skills โ โ โข path jail โ โ โ โ โ โ โข Workspace โ โ โข forbidden โ โ โ โ โ โ MD files โ โ paths โ โ โ โ โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ AI Providers (22) โ โ โ โ OpenRouter ยท Anthropic ยท OpenAI ยท Mistral ยท Groq ยท Venice โ โ โ โ Ollama ยท xAI ยท DeepSeek ยท Cerebras ยท Fireworks ยท Together โ โ โ โ Cloudflare ยท Moonshot ยท GLM ยท MiniMax ยท Qianfan ยท + more โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` | Subsystem | Trait | Ships with | Extend | |-----------|-------|------------|--------| | **AI Models** | `Provider` | 22 providers (OpenRouter, Anthropic, OpenAI, Venice, Groq, Mistral, etc.) | Any OpenAI-compatible API | | **Channels** | `Channel` | CLI, Telegram, Discord, Slack, iMessage, Matrix, Webhook | Any messaging API | | **Memory** | `Memory` | SQLite (default), Markdown | Any persistence | | **Tools** | `Tool` | shell, file_read, file_write, memory_store, memory_recall, memory_forget | Any capability | | **Observability** | `Observer` | Noop, Log, Multi | Prometheus, OTel | | **Runtime** | `RuntimeAdapter` | Native (Mac/Linux/Pi) | Docker, WASM | | **Security** | `SecurityPolicy` | Sandbox + allowlists + rate limits | โ | | **Heartbeat** | Engine | HEARTBEAT.md periodic tasks | โ | ### Memory System ZeroClaw has a built-in brain. The agent automatically: 1. **Recalls** relevant memories before each prompt (context injection) 2. **Saves** conversation turns to memory (auto-save) 3. **Manages** its own memory via tools (store/recall/forget) Two backends โ **SQLite** (default, searchable, upsert, delete) and **Markdown** (human-readable, append-only, git-friendly). Switch with one config line. ### Security Architecture ZeroClaw enforces security at **every layer** โ not just the sandbox. Every message passes through authentication and rate limiting before reaching the agent. #### Layer 1: Channel Authentication Every channel validates the sender **before** the message reaches the agent loop: | Channel | Auth Method | Config | |---------|------------|--------| | **Telegram** | `allowed_users` list (username match) | `[channels.telegram] allowed_users` | | **Discord** | `allowed_users` list (user ID match) | `[channels.discord] allowed_users` | | **Slack** | `allowed_users` list (user ID match) | `[channels.slack] allowed_users` | | **Matrix** | `allowed_users` list (MXID match) | `[channels.matrix] allowed_users` | | **iMessage** | `allowed_contacts` list | `[channels.imessage] allowed_contacts` | | **Webhook** | `X-Webhook-Secret` header (shared secret) | `[channels.webhook] secret` | | **CLI** | Local-only (inherently trusted) | โ | > **Note:** An empty `allowed_users` list or `["*"]` allows all users (open mode). Set specific IDs for production. #### Layer 2: Rate Limiting - **Sliding-window tracker** โ counts actions within a 1-hour rolling window - **`max_actions_per_hour`** โ hard cap on tool executions (default: 20) - **`max_cost_per_day_cents`** โ daily cost ceiling (default: $5.00) #### Layer 3: Tool Sandbox - **Workspace sandboxing** โ can't escape workspace directory - **Command allowlisting** โ only approved shell commands (`git`, `cargo`, `ls`, etc.) - **Path traversal blocking** โ `..` and absolute paths blocked - **Forbidden paths** โ `/etc`, `/root`, `~/.ssh`, `~/.gnupg` always blocked - **Autonomy levels** โ `ReadOnly` (observe only), `Supervised` (acts with policy), `Full` (autonomous within bounds) ## Configuration Config: `~/.zeroclaw/config.toml` (created by `onboard`) ## Documentation Index Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt Use this file to discover all available pages before exploring further. ## Token Use & Costs ZeroClaw tracks **tokens**, not characters. Tokens are model-specific, but most OpenAI-style models average ~4 characters per token for English text. ### How the system prompt is built ZeroClaw assembles its own system prompt on every run. It includes: * Tool list + short descriptions * Skills list (only metadata; instructions are loaded on demand with `read`) * Self-update instructions * Workspace + bootstrap files (`AGENTS.md`, `SOUL.md`, `TOOLS.md`, `IDENTITY.md`, `USER.md`, `HEARTBEAT.md`, `BOOTSTRAP.md` when new, plus `MEMORY.md` and/or `memory.md` when present). Large files are truncated by `agents.defaults.bootstrapMaxChars` (default: 20000). `memory/*.md` files are on-demand via memory tools and are not auto-injected. * Time (UTC + user timezone) * Reply tags + heartbeat behavior * Runtime metadata (host/OS/model/thinking) ### What counts in the context window Everything the model receives counts toward the context limit: * System prompt (all sections listed above) * Conversation history (user + assistant messages) * Tool calls and tool results * Attachments/transcripts (images, audio, files) * Compaction summaries and pruning artifacts * Provider wrappers or safety headers (not visible, but still counted) ### How to see current token usage Use these in chat: * `/status` โ **emoji-rich status card** with the session model, context usage, last response input/output tokens, and **estimated cost** (API key only). * `/usage off|tokens|full` โ appends a **per-response usage footer** to every reply. * Persists per session (stored as `responseUsage`). * OAuth auth **hides cost** (tokens only). * `/usage cost` โ shows a local cost summary from ZeroClaw session logs. Other surfaces: * **TUI/Web TUI:** `/status` + `/usage` are supported. * **CLI:** `zeroclaw status --usage` and `zeroclaw channels list` show provider quota windows (not per-response costs). ### Cost estimation (when shown) Costs are estimated from your model pricing config: ``` models.providers.