by krillclaw
The world's smallest AI agent runtime. 49KB. Written in Zig. Zero dependencies.
# Add to your Claude Code skills
git clone https://github.com/krillclaw/KrillClaw~450KB binary. 0 dependencies. 19 source files. 50+ validated device targets. Runs on a $3 microcontroller or a cloud server.
KrillClaw is an autonomous AI agent runtime written in Zig. It connects to 20+ LLM providers (Claude, OpenAI, Ollama + 17 via --base-url), executes tools, and loops until the task is done. Includes cron scheduling, persistent KV store, MCP support, 7 messaging channels, GPIO/hardware control, and BLE/Serial transports for edge devices.
┌──────────────────────────────────────────────────────┐
│ │
│ ~450 KB. Zero deps. Boots in <10ms. │
│ The entire agent runtime — LLM client, tool │
│ executor, JSON parser, SSE streaming, cron, │
│ KV store, context mgmt — in 4,576 lines of Zig. │
│ │
└──────────────────────────────────────────────────────┘
# 1. Install Zig 0.15+ → https://ziglang.org/download/
# 2. Clone and build (takes ~1 second)
git clone https://github.com/krillclaw/KrillClaw.git
cd KrillClaw
zig build -Doptimize=ReleaseSmall
# 3. Set your API key and go
export ANTHROPIC_API_KEY=sk-ant-...
./zig-out/bin/krillclaw "create a REST API in Go with user auth"
That's it. No npm install. No pip. No Docker. Just Zig and a binary.
Every AI agent runtime is massive. Desktop coding agents ship as 50–500MB bundles with hundreds of dependencies. The actual logic — "call LLM, parse response, execute tools, repeat" — shouldn't need any of that.
KrillClaw proves it doesn't. The same agentic loop that powers desktop tools, compiled to a binary smaller than a JPEG, running on hardware that costs less than a coffee.
KrillClaw exists because AI agents should run everywhere — not just on machines with Node.js and 8GB of RAM.
No comments yet. Be the first to share your thoughts!
| | KrillClaw | Typical Edge Runtime | Desktop Agent | |---|:---:|:---:|:---:| | Binary | ~450 KB | 2–8 MB | 50–500 MB | | RAM | ~2 MB | 10–512 MB | 150 MB – 1 GB | | Source | 4,576 LOC | 5–30K LOC | 30–100K+ LOC | | Dependencies | 0 | 10–100+ | 100–1000+ | | Boot time | <10 ms | <1s | 2–5s | | Embedded/BLE | Yes | Sometimes | No | | Cron/Daemon | Yes | Sometimes | No |
| Feature | KrillClaw | MimiClaw | PicoClaw |
|---------|:---------:|:--------:|:--------:|
| Language | Zig | Python | Go |
| Binary size | ~450 KB | ~2 MB | ~8 MB |
| RAM usage | ~2 MB | ~512 KB* | ~10 MB |
| Dependencies | 0 | pip | Go modules |
| BLE transport | ✅ | ❌ | ❌ |
| Serial transport | ✅ | ❌ | ❌ |
| Multi-provider | 20+ (Claude, OpenAI, Ollama + 17 via --base-url) | 2 | 1 |
| SSE streaming | ✅ | ❌ | ❌ |
| Inline tests | 60 | 0 | Limited |
| Sandbox mode | ✅ | ❌ | ❌ |
| MCP support | ✅ | ❌ | ❌ |
| Channels | 7 (Telegram, Discord, Slack, WhatsApp, MQTT, WebSocket, Webhook) | 2 | N/A |
| GPIO / hardware | ✅ (GPIO, I2C, SPI) | ✅ (GPIO) | ❌ |
| License | BSL 1.1 | MIT | MIT |
Competitor data as of Feb 2026. Check their repos for current numbers.
┌─────────────────────────────────────────────────────────────┐
│ KrillClaw │
│ │
│ ┌─────────┐ ┌──────────┐ ┌────────────┐ │
│ │ main │───▶│ agent │───▶│ tools │ │
│ │ (CLI) │ │ (loop) │ │ (dispatch)│ │
│ └─────────┘ └────┬─────┘ └─────┬──────┘ │
│ │ │ │
│ ┌────▼─────┐ ┌─────▼──────────────┐ │
│ │ api │ │ tools_coding.zig │ │
│ │ (client) │ │ tools_iot.zig │ │
│ └────┬─────┘ │ tools_robotics.zig │ │
│ │ └────────────────────┘ │
│ ┌──────▼──────┐ │
│ │ transport │ ◀── vtable dispatch │
│ └──┬────┬──┬──┘ │
│ │ │ │ │
│ ┌───▼┐ ┌▼──▼┐ │
│ │HTTP│ │BLE │ │Serial│ │
│ └────┘ └────┘ └──────┘ │
│ │
│ Support: json.zig │ stream.zig │ context.zig │ config.zig │
│ types.zig │ arena.zig │
└─────────────────────────────────────────────────────────────┘
19 files. 4,576 lines. Zero dependencies.
| File | Lines | Role |
|------|------:|------|
| main.zig | 198 | CLI, REPL, cron daemon entry point |
| agent.zig | 215 | Agent loop + FNV-1a stuck-loop detection |
| api.zig | 341 | Multi-provider HTTP client (Claude/OpenAI/Ollama) |
| stream.zig | 362 | SSE streaming parser |
| json.zig | 519 | Hand-rolled JSON parser/builder — zero deps |
| tools.zig | 191 | Tool dispatcher — comptime profile + shared tools |
| tools_shared.zig | 362 | Shared tools: time, KV, web search, sessions, OTA (all profiles) |
| tools_coding.zig | 484 | Coding profile: bash, read/write/edit, search, list, patch |
| tools_iot.zig | 176 | IoT profile: MQTT, HTTP, device info |
| tools_robotics.zig | 153 | Robotics profile: commands, e-stop, telemetry |
| context.zig | 226 | Token estimation + priority-based truncation |
| config.zig | 202 | Config: file → env → CLI precedence |
| cron.zig | 206 | Cron/heartbeat scheduler for daemon mode |
| transport.zig | 179 | Abstract vtable transport + RPC protocol |
| types.zig | 157 | Core types: Provider, Message, Config, ToolDef |
| ble.zig | 159 | BLE GATT transport (protocol + simulation) |
| serial.zig | 142 | UART/serial transport (Linux/macOS) |
| arena.zig | 200 | Fixed arena allocator for embedded targets |
| react.zig | 104 | ReAct reasoning loop |
Compile-time profiles select different tool sets. Only the selected profile's code ships in the binary — zero runtime overhead.
# Coding agent (default)
zig build -Dprofile=coding -Doptimize=ReleaseSmall
# IoT agent — MQTT, HTTP, KV store, device info
zig build -Dprofile=iot -Doptimize=ReleaseSmall
# Robotics agent — motion commands, e-stop, telemetry
zig build -Dprofile=robotics -Doptimize=ReleaseSmall
| Profile | Tools | Binary Size | Security Policy | |---------|-------|:-----------:|-----------------| | coding | bash, read/write/edit, search, list, patch + shared | ~459 KB | bash behind approval gate, writes restricted to cwd | | iot | MQTT pub/sub, HTTP, GPIO, I2C, SPI, device info + shared | ~463 KB | no bash, no file writes, 30 req/min rate limit | | robotics | robot_cmd, estop, telemetry + shared | ~473 KB | no bash, bounds checking, 10 cmd/s, e-stop |
All profiles include shared tools available across every profile:
get_current_time — ISO-8601 timestampkv_get / kv_set / kv_list / kv_delete — persistent key-value storeAll profiles support sandbox mode: zig build -Dsandbox=true
Run KrillClaw as a scheduled agent on edge devices:
# Run agent every 5 minutes with a custom prompt
krillclaw --cron-interval 300 --cron-prompt "check sensors and report anomalies"
# Heartbeat every 60 seconds + agent every 10 minutes
krillclaw --heartbeat 60 --cron-interval 600
# Run 10 times then exit
krillclaw --cron-interval 120 --cron-max-runs 10 --cron-prompt "collect data"
Designed for edge devices running data collection cycles between connectivity windows (BLE, Serial). The scheduler has minimal binary cost (~2KB) and uses no threads.
KrillClaw supports 20+ LLM providers through three protocol backends. Any provider with an OpenAI-compatible API works via --base-url.
| Provider | Models | Auth |
|----------|--------|------|
| Claude | claude-sonnet-4-5, claude-opus-4, etc. | ANTHROPIC_API_KEY |
| OpenAI | gpt-4o, gpt-4-turbo, etc. | OPENAI_API_KEY |
| Ollama | llama3, codellama, mistral, etc. | None (local) |
| + 17 more | via --base-url | Provider-specific |
# Claude (default)
./zig-out/bin/krillclaw "fix the tests"
# OpenAI
export OPENAI_API_KEY=sk-...
./zig-out/bin/krillclaw --provider openai -m gpt-4o "fix the tests"
# Local Ollama
./zig-out/bin/krillclaw --provider ollama