Self-contained multi-agent AI orchestrator in C. Single static binary. No dependencies. No runtime.
IRC · Multi-LLM · Runtime C plugins · Scheduling · Inter-agent messaging
A multi-agent AI orchestrator in C. One static binary under 1MB. It talks to LLMs (Claude, GPT, Ollama), lives on IRC, schedules its own tasks, and remembers things across sessions.
The binary is polyglot: built with Cosmopolitan Libc, it produces a single ELF that runs unmodified on Linux, FreeBSD, NetBSD, and OpenBSD. Same file, four kernels, no emulation -- the libc abstracts away syscall differences at compile time.
It also embeds TinyCC (Fabrice Bellard's C compiler) as a library. When an agent wants a new tool, it writes C source code. The daemon compiles it in-memory with tcc_compile_string(), relocates it into the process address space with tcc_relocate(), and resolves the entry point with tcc_get_symbol(). No .so ever touches disk -- the compiled code is live and callable immediately. Plugins are sandboxed: no libc access, only a curated set of functions (HTTP+TLS, JSON, file I/O) injected by the daemon before compilation. This means the binary is simultaneously an AI orchestrator, an IRC client, a TLS stack, and a C compiler -- all in under 1MB.
Fair warning. Shclaw gives AI agents access to shell commands, file I/O, and network calls. One of them can write and compile C at runtime. Run it somewhere you don't care about -- a VM, a container, a Pi on a VLAN.
The daemon runs an event loop that watches IRC and a Unix socket. Triggers (IRC messages, scheduled tasks, inter-agent messages, CLI commands) create sessions. Each agent has its own thread, a personality, persistent memory, and access to tools.
Agents coordinate via send_message -- file-based inboxes polled every 5 seconds.
Each agent is defined by an INI file in etc/agents/. Two flags matter:
hub = true-- Default recipient for IRC messages without an@mention. Handles general conversation, delegates to specialists. Works fine with small models (qwen3.5:9b,gpt-4.1-nano).builder = true-- Can create C plugins at runtime viacreate_plugin. Only sees 4 tools to keep its context focused. The plugin template is pre-injected into its prompt, and the daemon auto-extracts code if the model outputs it as text. Even small models likeqwen3.5:9bcan create working plugins on the first try.
A typical setup: a hub (cheap/local model), a research agent (standard model), a builder (capable model).
Each agent has two persistence layers:
- Memories -- Append-only log with categories, importance scores, and tags. Searched via
recall. Recent memories are included in the system prompt. - Facts -- Permanent key-value pairs (e.g.
timezone = Europe/Paris). Always in the system prompt. Few, precise, never pruned.
Agents can write C plugins that get compiled in-memory by TinyCC. No .so hits disk. Plugins run sandboxed (no libc) but get HTTP+TLS, JSON, and file I/O through injected tc_* functions.
See doc/plugin-api.md for the full plugin API.
sudo apt install build-essential musl-tools git # Debian/Ubuntu
git clone https://github.com/govlog/shclaw.git && cd shclaw
make musl # Linux only, ~528K
make cosmo # Cross-platform (Linux/NetBSD/FreeBSD/OpenBSD), ~968KVendor libraries are auto-fetched on first build.
mkdir -p etc/agentsetc/config.ini -- providers, IRC, paths:
[daemon]
data_dir = ./data
log_dir = ./logs
[provider.anthropic]
type = anthropic
api_key = sk-ant-api03-YOUR-KEY-HERE
[provider.ollama]
type = openai
base_url = http://localhost:11434
api_key =
[tiers]
simple = anthropic/claude-haiku-4-5-20251001
standard = anthropic/claude-sonnet-4-6
complex = anthropic/claude-opus-4-6
local = ollama/llama3
# Optional -- remove to run without IRC
[irc]
server = irc.libera.chat
port = 6697
nick = mybot
channel = #my-channel
channel_key = mysecretkey
owner = mynicketc/agents/jarvis.ini -- one file per agent:
[agent]
name = jarvis
model = simple
hub = true
max_turns = 30
personality = You are Jarvis, a helpful and efficient assistant.
[objectives]
1 = Answer questions quickly and efficiently
2 = Keep track of important tasks in memorySee etc/agents/*.ini.example for more examples.
./shclaw # foreground
./shclaw -d # daemonize
./shclaw tui # terminal chat UI
./shclaw tui oracle # talk to a specific agent
./shclaw msg jarvis "hi" # send a message
./shclaw status # agent status (JSON)
./shclaw stop # graceful shutdownThe daemon looks for etc/config.ini in the current directory. Override with --workdir=/path/to/instance.
make docker-image
docker run -v ./my-instance:/app/instance shclawThe Cosmopolitan binary runs on smolBSD -- a minimal NetBSD VM that boots in ~60ms.
make smolbsd AGENT_DIR=/path/to/instance
cd vendor/smolbsd && ./startnb.sh -k kernels/netbsd-SMOL \
-i images/shclaw-amd64.img -w /path/to/instance16 built-in tools:
| Tool | What it does |
|---|---|
exec |
Run a shell command |
read_file |
Read a file |
write_file |
Write/append a file |
schedule_task |
One-shot task at a given time |
schedule_recurring |
Recurring task |
list_tasks |
List scheduled tasks |
update_task |
Modify a task |
cancel_task |
Cancel a task |
remember |
Save a memory |
recall |
Search memories |
set_fact |
Store a key-value fact |
get_fact |
Retrieve a fact |
send_message |
Message an agent, the owner, or broadcast |
list_agents |
List running agents |
create_plugin |
Write + compile a C plugin (builder only) |
clear_memory |
Clear memories/facts |
Plugins created by agents become tools available to everyone immediately.
Single connection, single nick, one channel. Agents share the connection.
you> hey, check the server load => routed to hub
you> @oracle analyze this log file => routed to oracle
you> @oracle X @jarvis Y => both get their part
you> @all status => broadcast
bot> jarvis: CPU is at 12%, all good.
bot> oracle: I see 3 anomalies in the log...
- Plugin API -- writing plugins, available
tc_*functions - Internals -- event loop, TCC compilation, Cosmopolitan build
- Justine Tunney -- Cosmopolitan Libc. One binary, four operating systems.
- Fabrice Bellard -- TinyCC. A C compiler small enough to embed as a library.
- Thomas Pornin -- BearSSL. TLS for embedded systems.
- Dave Gamble -- cJSON. Single-file JSON parser.
- iMil -- smolBSD. NetBSD microVMs.
MIT. See LICENSE.
Vendored libraries: BearSSL (MIT), cJSON (MIT), TinyCC (LGPL-2.1), musl (MIT), Cosmopolitan (ISC). See NOTICE.