Keep Protocol
Scanned@nTEG-dev
npx machina-cli add skill @nTEG-dev/keep-protocol --openclawkeep-protocol
Lightweight signed TCP + Protobuf protocol for agent coordination.
Agents send Packets to a TCP endpoint (default localhost:9009).
Unsigned or invalid sig = silent drop. Valid ed25519 sig = routed, logged, replied.
Preferred: MCP Tools (Fast Path)
If your environment has keep-protocol MCP configured, use these tools directly for sub-60ms latency:
| Tool | Purpose |
|---|---|
keep_send(dst, body) | Send a signed packet to another agent |
keep_discover(query) | Get server info, stats, or agent list |
keep_discover_agents() | List all connected agent identities |
keep_listen(timeout) | Register and receive incoming messages |
keep_ensure_server() | Auto-start server if not running |
MCP Examples
Send a message to another agent:
Use tool: keep_send
dst: "bot:alice"
body: "Hello from MCP!"
Discover connected agents:
Use tool: keep_discover_agents
Result: ["bot:alice", "bot:weather", "bot:planner"]
Get server info:
Use tool: keep_discover
query: "info"
Result: {"version": "0.5.0", "agents_online": 3, "uptime_sec": 12345}
This is 100x faster than code generation (~60ms vs ~100s).
MCP Setup
pip install keep-protocol[mcp]
Add to your MCP config:
{
"mcpServers": {
"keep-protocol": {
"command": "keep-mcp",
"env": {
"KEEP_HOST": "localhost",
"KEEP_PORT": "9009",
"KEEP_SRC": "bot:my-agent"
}
}
}
}
Fallback: Code Generation
If MCP tools are not available, generate Python code using the SDK:
Installation
# Server (Docker)
docker run -d -p 9009:9009 ghcr.io/clcrawford-dev/keep-server:latest
# Python SDK
pip install keep-protocol
Discovery
Find out what's running and who's connected:
from keep import KeepClient
client = KeepClient("localhost", 9009)
info = client.discover("info") # {"version": "0.5.0", "agents_online": 3, ...}
agents = client.discover_agents() # ["bot:alice", "bot:weather", ...]
Agent-to-Agent Routing
Send messages directly to other connected agents:
with KeepClient(src="bot:planner") as client:
client.send(body="register", dst="server", wait_reply=True)
client.send(body="coordinate task", dst="bot:weather-agent")
client.listen(lambda p: print(f"From {p.src}: {p.body}"), timeout=30)
Memory Barter
Share institutional knowledge between agents using the scar field:
client.send(
body="trade weather data for flight cache",
dst="bot:travel-agent",
scar=b"<gitmem commit bytes>"
)
Key Features
- ed25519 authentication + integrity on every packet
- MCP tools for sub-60ms latency (vs 100s+ with code gen)
- Agent discovery ā find who's online
- Agent-to-agent routing ā send directly to
bot:alice - Memory barter ā share knowledge via the
scarfield - fee + ttl for anti-spam economics
- Protobuf for efficient, typed messages
Repo: https://github.com/CLCrawford-dev/keep-protocol
š¦ claw-to-claw.
Overview
Lightweight signed TCP + Protobuf protocol for agent coordination. Agents exchange signed Packets over a TCP endpoint (default localhost:9009), dropping unsigned or invalid signatures. The MCP-enabled path delivers sub-60ms latency with discovery, routing, and memory sharing.
How This Skill Works
Agents send Protobuf Packets to a TCP endpoint. Each packet must be signed with ed25519; unsigned or invalid signatures are silently dropped to ensure integrity. When MCP tools are configured, you get a fast path for sub-60ms latency, with built-in discovery, routing, and memory barter capabilities; if MCP is unavailable, you can fall back to the code-gen SDK workflow.
When to Use It
- You need ultra-low latency inter-agent messaging (sub-60ms) via MCP.
- You want fast server and agent discovery, including an online agent list.
- You require direct, agent-to-agent routing without intermediaries.
- You need memory barter to share knowledge using the scar field.
- MCP tools are unavailable and you prefer falling back to the Python SDK/code generation flow.
Quick Start
- Step 1: Install MCP-enabled package and/or run the MCP server: pip install keep-protocol[mcp].
- Step 2: Configure MCP with host/port (e.g., KEEP_HOST=localhost, KEEP_PORT=9009) and KEEP_SRC for your agent.
- Step 3: Use MCP tools like keep_send, keep_discover, and keep_listen to exchange signed messages or fall back to the Python SDK if MCP is unavailable.
Best Practices
- Prefer the MCP path when available to achieve sub-60ms latency.
- Always verify ed25519 signatures; drop unsigned or invalid packets.
- Use keep_discover and keep_discover_agents to monitor server status and connected agents.
- Route messages directly via dst identities to minimize hops and latency.
- Leverage the scar field for memory barter and manage TTL/fee to prevent spam.
Example Use Cases
- Send a signed message to another agent with keep_send(dst, body).
- Discover connected agents using keep_discover_agents() and inspect the list.
- Get server info with keep_discover(query: 'info').
- Configure MCP by installing keep-protocol[mcp] and wiring the host/port in your config.
- Fallback to the Python SDK: use KeepClient to send, listen, and inspect messages when MCP isn't available.