Expand description
ZeroClaw API layer — trait definitions and shared types.
This crate defines the fundamental abstractions that all ZeroClaw subsystems depend on. No implementations, no heavy dependencies. Every other crate in the workspace depends on this. The compiler enforces that no implementation crate can import another without going through these interfaces.
§Traits
model_provider::ModelProvider— LLM inference backendschannel::Channel— messaging platform integrationstool::Tool— agent-callable capabilitiesmemory_traits::Memory— conversation memory backendsobservability_traits::Observer— metrics and tracingruntime_traits::RuntimeAdapter— execution environment adaptersperipherals_traits::Peripheral— hardware board integrations
Modules§
- agent
- attribution
- Alias-bound attribution surface used by every emission in the
workspace. Each “thing” that participates in an event (channel,
agent, tool, cron job, model provider, memory backend, peer group,
skill bundle, MCP bundle, session) implements
Attributable. Entry points openattribution_span!(thing)once at the start of their work; theLogCaptureLayerinzeroclaw-logwalks the span scope and fills the typed attribution slots automatically. - channel
- media
- memory_
traits - model_
provider - observability_
traits - peripherals_
traits - Peripheral trait — hardware boards (STM32, RPi GPIO) that expose tools.
- runtime_
traits - schema
- JSON Schema cleaning and validation for LLM tool-calling compatibility.
- session_
keys - Session key normalization shared across infra and memory backends.
- tool
- vad
- Voice Activity Detection trait and event types.
Macros§
- mock_
tool_ attribution - Bulk-impl
Attributablefor one or moreToolmock types in a test module. Every type getsRole::Tool(ToolKind::Plugin)and uses the mock’s ownname()as the alias — sufficient for test scaffolding where individual kinds don’t matter. - tool_
attribution - Boilerplate-collapsing macro: pair a concrete
Toolimpl with a matchingAttributableimpl that surfaces the suppliedToolKindand uses the tool’sname()as its alias.
Statics§
- NATIVE_
THINKING_ OVERRIDE - Native extended thinking parameters, set by the outer orchestration
functions and read by
run_tool_call_loopwhen buildingChatRequest. - TOOL_
CHOICE_ OVERRIDE - Override for tool choice mode, set by the agent loop. Read by model_providers that support native tool calling.
- TOOL_
LOOP_ SESSION_ KEY - Session key for the currently active session. Scoped by gateway and channel turns, read by SessionsCurrentTool.
- TOOL_
LOOP_ THREAD_ ID - Current thread/sender ID for per-sender rate limiting. Set by the agent loop, read by SecurityPolicy.