claw-core-protocol
Async Rust client and protocol types for the claw_core daemon.
The claw_core daemon provides session-managed terminal execution over a Unix socket (JSON protocol). This crate gives you:
- Protocol types —
RpcRequest,RpcResponse, method-specific param/result structs - Async client —
ClawCoreClientwith typed convenience methods
Quick start
use ;
async
With ZeroClaw
ZeroClaw can use this crate via an optional feature flag:
Then enable in ~/.zeroclaw/config.toml:
[]
= true
= "/tmp/trl.sock"
# auto_session = true # create/destroy session per call (default)
# default_timeout_s = 60 # command timeout (default)
This adds a claw_core_exec tool that the agent can use for session-managed command execution with timeouts, alongside the built-in shell tool.
Protocol
All communication is line-delimited JSON over a Unix socket (default: /tmp/trl.sock).
Methods
| Method | Description |
|---|---|
system.ping |
Health check (returns uptime, version) |
system.stats |
Runtime statistics |
session.create |
Create a terminal session |
session.list |
List active sessions |
session.info |
Get session details |
session.destroy |
Terminate a session |
exec.run |
Execute a command (buffered, waits for completion) |
Error codes
| Code | Meaning |
|---|---|
SESSION_NOT_FOUND |
No session with given ID |
SESSION_BUSY |
Session already running a command |
COMMAND_TIMEOUT |
Command exceeded timeout |
INVALID_PARAMS |
Missing or malformed parameters |
INTERNAL_ERROR |
Unexpected runtime error |
RESOURCE_PRESSURE |
System under resource pressure |
MAX_SESSIONS_REACHED |
Session limit reached |
Requirements
- The claw_core daemon must be running and listening on the configured socket path.
- Start the daemon:
claw_core(or./target/release/claw_core). - Default socket:
/tmp/trl.sock(override withTRL_SOCKET_PATHenv var).
License
MIT