CrabTalkCrabTalk

Protocol

The CrabTalk wire protocols — crabtalk.proto for clients, ext.proto for extensions, dual UDS and TCP transport.

CrabTalk uses two protobuf protocols over two transports. Clients (CLI, gateway) speak crabtalk.proto. Extensions (memory, search) speak ext.proto.

Two protocols

crabtalk.proto (client-daemon)

Used by crabtalk attach, the gateway service, and custom clients:

  • Send chat messages to agents
  • Stream responses (text deltas, tool calls, completions)
  • Manage sessions, config, and agent state

ext.proto (daemon-extension)

Used by extensions (crabtalk-search, custom extensions):

  • Capability handshake at startup
  • Tool schema registration
  • Tool call dispatch and results
  • Lifecycle callbacks (BuildAgent, BeforeRun, Compact, EventObserver, AfterRun, Infer, AfterCompact)

Transport

Unix domain socket

The daemon listens on ~/.crabtalk/crabtalk.sock. The CLI connects to this socket by default:

crabtalk attach ──→ crabtalk.sock ──→ crabtalk daemon

Override the socket path:

crabtalk --socket /path/to/custom.sock attach

TCP

The daemon also listens on TCP (localhost by default). The port is written to ~/.crabtalk/crabtalk.tcp:

crabtalk attach --tcp

TCP is used by the gateway service and enables remote connections.

Extension kinds

KindProtocolDirectionExample
extensionext.proto (UDS)Daemon → extensioncrabtalk-search
gatewaycrabtalk.proto (TCP)Service → daemoncrabtalk-telegram

Capabilities handshake

Extensions declare capabilities at startup via ExtReady:

CapabilityDescription
ToolsProvides tool schemas that agents can call
BuildAgentEnriches agent config at creation
BeforeRunInjects context before each agent execution
CompactEnhances context compaction prompts
EventObserverObserves agent lifecycle events
AfterRunRuns after each agent execution completes
InferRequests LLM inference from the daemon
AfterCompactRuns after context compaction completes
QueryResponds to structured queries

Wire format

Both protocols use length-prefixed protobuf 3 frames over the transport. The crabtalk-socket and crabtalk-tcp crates handle framing and codec.

Building on the protocol

Connect directly using the crabtalk-socket crate:

use crabtalk_socket::CrabTalkClient;

let client = CrabTalkClient::connect("/path/to/crabtalk.sock").await?;

What's next

  • CLI reference — commands that use the protocol
  • Event loop — how the daemon processes messages
  • Extensions — extension architecture and lifecycle
  • Hooks — how hooks compose with extensions

On this page