The workspace is split into layers. Edge crates talk to the outside world; core crates orchestrate; support crates provide utilities. Each crate has its own rustdoc, see API (rustdoc).
The agent loop, security-policy enforcement, SOP engine, cron scheduler, SubAgent lifecycle, and RPC layer for zerocode. Depends on every other core and edge crate.
Notable submodules:
agent/: the main request/response loop, streaming, tool-call orchestrationsecurity/: policy types, sandbox detection, OTP, emergency stopsop/: Standard Operating Procedure engine (see SOP β Overview)subagent/: SubAgent spawning and lifecycle (see Delegation & SubAgents)cron/,daemon/,heartbeat/: scheduling and long-running process managementskillforge/,skills/: skill compilation and executionservice/: systemd / launchctl / Windows Service integrationrpc/: the RPC layer for zerocode
TOML schema and its validation. Handles:
- Autonomy level enum (
ReadOnly/Supervised/Full) - Encrypted secrets store (local key file)
- Workspace resolution (env vars, Homebrew paths, XDG, container detection)
- Schema versioning and migration
All user-facing config keys are documented in Reference β Config, which is generated from this crate.
The kernel ABI. Defines the core public traits, including:
ModelProvider: LLM client interface with streaming capability flagsChannel: inbound/outbound messaging surfaceTool: agent-callable capabilitiesMemory: conversation storage and retrievalObserver: typed metrics/observability sink
The runtime depends only on these traits, not on concrete implementations. This is what makes provider/channel/tool additions a matter of implementing a trait rather than patching the core.
All LLM client implementations plus the routing and retry wrappers. See Model Providers β Overview for the list.
Structure:
traits.rs: re-exports fromzeroclaw-apiplus provider-internal helpersanthropic.rs,openai.rs,ollama.rs, β¦: one file per native providercompatible.rs: a single OpenAI-compatible implementation reused by 20+ providers (Groq, Mistral, xAI, Venice, etc.)router.rs: hint-based per-call model route selectionreliable.rs: same-provider retry / backoff / API-key rotation wrapperstreaming.rs: SSE parsing, token estimation, tool-call deltas
30+ messaging integrations. See Channels β Overview for the catalogue.
All channels implement the Channel trait from zeroclaw-api. Each is feature-gated, a minimal build includes only the channels you compile in.
The orchestrator/ submodule handles message streaming, draft updates, multi-message splits, and the ACP server.
HTTP/WebSocket gateway. Exposes the runtime over:
- REST API (sessions, memory, status, cron management)
- WebSocket for streaming responses
- Web dashboard (static assets + auth)
- Webhook endpoints (inbound from channels that push)
Pairing is required by default; [gateway.allow_public_bind = true] enables binding to 0.0.0.0.
Callable tools the agent invokes. Not to be confused with CLI zeroclaw subcommands.
Includes: browser, http_request, web_search, shell, file_read, file_write, hardware probes (hardware_board_info, hardware_memory_read), and more. See Tools β Overview.
Each tool is registered via factory and described to the model via Fluent-localised strings.
Conversation memory and retrieval. SQLite is the default backend; PostgreSQL is available behind --features memory-postgres for multi-instance deployments that need a shared, concurrent-write store. Optional:
- Embedding backends (OpenAI, Ollama, local)
- Vector retrieval over stored conversations (pgvector when on PostgreSQL)
- Memory consolidation (summaries, fact extraction)
Model-side tool-call syntax parsing. Handles variations between providers:
- OpenAI-style
tool_callsJSON - Anthropic-style
<tool_use>blocks - Qwen/Ollama's function-call formats
- Native tool-call streaming deltas
Sandboxed WASM plugin host: loads component-model plugins (tool, channel, memory, skill bundles) in-process under WASI with per-call fuel and memory limits. See Developing β Plugin protocol.
Hardware abstraction: GPIO, I2C, SPI, USB. Platform-gated. See Hardware β Overview.
The single emission surface for every log event in the workspace. Owns
the on-disk JSONL schema (LogEvent), the alias-bound attribution
registry (ATTRIBUTION_FIELDS + COMPOSITE_PREFIXES), the
tracing-subscriber Layer that captures every tracing::* call, the
record! and scope! macros, the rolling-trim writer, the
paginated cursor reader behind /api/logs, and the bridge to the
typed Observer for Prometheus / OTel consumers. See
architecture/logging.md.
The sanctioned wrapper around tokio::spawn. Provides the spawn!
macro, which instruments every background task with the caller's
current attribution span so a record! emitted inside the spawned
future inherits the parent's agent_alias / channel / session_key.
Call sites use spawn! instead of tokio::spawn directly.
Process-level support: debouncers, watchdogs, the SQLite session
backend. Not a tracing/metrics layer, that's zeroclaw-log. See
Runtime state and persistence for the
state ownership and durability boundaries across config, sessions, memory,
logs, costs, cron, and gateway metadata.
Derive macros for config schema, tool registration, and channel registration. Saves boilerplate across the workspace.
Terminal UI, built as a separate app under apps/zerocode/. It is its own workspace member with no zeroclaw-* crate dependency (see Docs & Translations β zerocode strings for its independent i18n catalogue).
Specialised hardware support used by the hardware submodule. Out-of-scope unless you're bringing up specific peripherals.
The microkernel roadmap (RFC #5574) defines a feature-flag taxonomy. The practical upshot for a user:
default: a sensible core buildci-all: everything on, for CIchannel-<name>: opt-in per channel (e.g.channel-matrix,channel-discord)hardware: enable hardware subsystemgateway,acp-bridge,whatsapp-web: opt-in capability groups
Providers are not feature-gated; they all compile in. Channel selection is the main per-build knob. Read the top-level Cargo.toml [features] table for the full list.