scripts/README.md
This directory contains everything needed to cross-compile ZeroClaw and deploy it to a Raspberry Pi over SSH.
| File | Purpose |
|---|---|
deploy-rpi.sh | One-shot cross-compile and deploy script |
rpi-config.toml | Production config template deployed to ~/.zeroclaw/config.toml |
zeroclaw.service | systemd unit file installed on the Pi |
99-act-led.rules | udev rule for ACT LED sysfs access without sudo |
brew install zig
cargo install cargo-zigbuild
rustup target add aarch64-unknown-linux-gnu
cargo install cross
rustup target add aarch64-unknown-linux-gnu
# Docker must be running
The deploy script auto-detects which tool is available, preferring cargo-zigbuild.
Force a specific tool with CROSS_TOOL=zigbuild or CROSS_TOOL=cross.
If you can't use SSH key authentication, install sshpass and set the RPI_PASS environment variable:
brew install sshpass # macOS
sudo apt install sshpass # Linux
RPI_HOST=raspberrypi.local RPI_USER=pi ./scripts/deploy-rpi.sh
After the first deploy, you must set your API key on the Pi (see First-Time Setup).
| Variable | Default | Description |
|---|---|---|
RPI_HOST | raspberrypi.local | Pi hostname or IP address |
RPI_USER | pi | SSH username |
RPI_PORT | 22 | SSH port |
RPI_DIR | ~/zeroclaw | Remote directory for the binary and .env |
RPI_PASS | (unset) | SSH password — uses sshpass if set; key auth used otherwise |
CROSS_TOOL | (auto-detect) | Force zigbuild or cross |
aarch64-unknown-linux-gnu with --features hardware,peripheral-rpi.sudo systemctl stop zeroclaw on the Pi (continues if not yet installed).$RPI_DIR exists on the Pi.$RPI_DIR/zeroclaw..env — writes an .env skeleton with an ANTHROPIC_API_KEY= placeholder to $RPI_DIR/.env with mode 600. Skipped if the file already exists so an existing key is not overwritten.rpi-config.toml to ~/.zeroclaw/config.toml, preserving any api_key already present in the file.zeroclaw.service to /etc/systemd/system/, then enables and restarts it.gpio group, copies 99-act-led.rules to /etc/udev/rules.d/, and resets the ACT LED trigger.After the first successful deploy, SSH into the Pi and fill in your API key:
ssh [email protected]
nano ~/zeroclaw/.env
# Set: ANTHROPIC_API_KEY=sk-ant-...
sudo systemctl restart zeroclaw
The .env is loaded by the systemd service as an EnvironmentFile.
Once the service is running the gateway listens on port 8080.
curl http://raspberrypi.local:8080/health
curl -s -X POST http://raspberrypi.local:8080/api/chat \
-H 'Content-Type: application/json' \
-d '{"message": "What is the CPU temperature?"}' | jq .
curl -N -s -X POST http://raspberrypi.local:8080/api/chat \
-H 'Content-Type: application/json' \
-H 'Accept: text/event-stream' \
-d '{"message": "List connected hardware devices", "stream": true}'
ssh [email protected] 'journalctl -u zeroclaw -f'
ZeroClaw is deployed with the peripheral-rpi feature, which enables two LLM-callable tools:
gpio_read — reads a GPIO pin value via sysfs (/sys/class/gpio/...).gpio_write — writes a GPIO pin value.These tools let the agent directly control hardware in response to natural-language instructions.
The udev rule 99-act-led.rules grants the gpio group write access to:
/sys/class/leds/ACT/trigger
/sys/class/leds/ACT/brightness
This allows toggling the Pi's green ACT LED without sudo.
If a Total Phase Aardvark adapter is connected, the hardware feature enables I2C/SPI communication with external devices. No extra setup is needed — the device is auto-detected via USB.
| Remote path | Source | Description |
|---|---|---|
~/zeroclaw/zeroclaw | compiled binary | Main agent binary |
~/zeroclaw/.env | created on first deploy | API key and environment variables |
~/.zeroclaw/config.toml | rpi-config.toml | Agent configuration |
/etc/systemd/system/zeroclaw.service | zeroclaw.service | systemd service unit |
/etc/udev/rules.d/99-act-led.rules | 99-act-led.rules | ACT LED permissions |
rpi-config.toml is the production config template. Key defaults:
anthropic-custom:https://api.z.ai/api/anthropicclaude-3-5-sonnet-20241022fullgit, cargo, npm, mkdir, touch, cp, mv, ls, cat, grep, find, echo, pwd, wc, head, tail, dateTo customise, edit ~/.zeroclaw/config.toml directly on the Pi and restart the service.
ssh [email protected] 'sudo systemctl status zeroclaw'
ssh [email protected] 'journalctl -u zeroclaw -n 50 --no-pager'
Make sure the deploy user is in the gpio group and that a fresh login session has been started:
ssh [email protected] 'groups'
# Should include: gpio
If the group was just added, log out and back in, or run newgrp gpio.
Re-run the deploy script. Confirm the target:
ssh [email protected] 'file ~/zeroclaw/zeroclaw'
# Expected: ELF 64-bit LSB pie executable, ARM aarch64
CROSS_TOOL=zigbuild RPI_HOST=raspberrypi.local ./scripts/deploy-rpi.sh
# or
CROSS_TOOL=cross RPI_HOST=raspberrypi.local ./scripts/deploy-rpi.sh
cargo zigbuild --release \
--target aarch64-unknown-linux-gnu \
--features hardware,peripheral-rpi