OpenClaw Agent Mesh
Provide a minimal but real agent-to-agent communication layer for OpenClaw instances.
Use the bundled scripts to initialize identity, scan a local network range, exchange contact requests, approve peers, and send signed direct messages.
Require explicit acceptance before trusted communication begins.
V1 scope
Implement only these capabilities:
- - local identity generation
- LAN discovery by probing peer endpoints
- contact request creation
- contact approval or rejection
- trusted peer storage
- direct signed message creation and delivery
- inbox verification and acknowledgement
- lightweight HTTP server for discovery, contact-request intake, and message intake
Do not claim NAT traversal, full mesh routing, or multi-party consensus in V1.
Files and local state
Store mesh state outside the skill folder.
Use this default path unless the user specifies another one:
Expected files:
- -
identity.json — local agent identity - INLINECODE2 — local signing key
- INLINECODE3 — trusted peers
- INLINECODE4 — pending inbound contact requests
- INLINECODE5 — outbound contact requests
- INLINECODE6 — verified inbound messages
- INLINECODE7 — sent messages
- INLINECODE8 — reserved for future versions
Workflow
1. Initialize local identity
Run scripts/mesh.py init.
This creates a signing keypair and an identity card with:
- - INLINECODE10
- INLINECODE11
- INLINECODE12
- INLINECODE13
- INLINECODE14
- INLINECODE15
Set the endpoint to a reachable HTTP URL if the node should receive requests from peers.
2. Scan for nearby peers
Run scripts/mesh.py scan with a base URL template or a list of candidate URLs.
Scanning in V1 is HTTP discovery, not raw port scanning.
Probe each candidate at:
Treat discovered nodes as untrusted until approved.
3. Send a contact request
Run scripts/mesh.py request-contact.
Send a signed request to a discovered node’s inbox endpoint.
The receiver stores the request as pending.
4. Approve or reject the request
Run scripts/mesh.py list-requests then approve-request or reject-request.
Approval writes the peer into the trust store.
Rejection leaves no trusted relationship.
5. Send a direct message
Run scripts/mesh.py send-message only after trust exists.
The sender signs the message envelope.
The receiver verifies signature, timestamp, and trust status before accepting.
6. Verify delivery
Run scripts/mesh.py list-messages or inspect stored message JSON files.
Use acknowledgements to confirm receipt.
Transport model
V1 uses simple HTTP JSON endpoints:
- - INLINECODE24
- INLINECODE25
- INLINECODE26
Run scripts/server.py to expose these endpoints from a node that should be discoverable or receive peer traffic.
Example:
If the user does not yet have a server to receive HTTP traffic, use the scripts to generate and inspect signed payloads locally first.
Guardrails
- - Require explicit approval before trusting a peer.
- Never auto-accept unknown peers.
- Never send private keys over the network.
- Prefer signed JSON envelopes with timestamps and message IDs.
- Reject stale or malformed messages.
- Keep V1 limited to point-to-point trust and messaging.
References
- - Read
references/protocol.md for the JSON message model. - Read
references/verification.md for trust and signature checks.
Deliverables
When using this skill, produce one or more of:
- - a configured local mesh identity
- a peer discovery result set
- a pending or approved contact request
- a verified direct-message flow
- a troubleshooting checklist for failed trust or message delivery
OpenClaw Agent Mesh
为OpenClaw实例提供最小但真实的代理间通信层。
使用捆绑脚本初始化身份、扫描本地网络范围、交换联系请求、批准对等节点,并发送签名直连消息。
在可信通信开始前需要明确接受。
V1 范围
仅实现以下能力:
- - 本地身份生成
- 通过探测对等端点进行局域网发现
- 联系请求创建
- 联系批准或拒绝
- 可信对等节点存储
- 直连签名消息创建与投递
- 收件箱验证与确认
- 用于发现、联系请求接收和消息接收的轻量级HTTP服务器
V1版本不宣称支持NAT穿透、全网状路由或多方共识。
文件与本地状态
将网格状态存储在技能文件夹之外。
除非用户指定其他路径,否则使用以下默认路径:
- - ~/.openclaw/agent-mesh/
预期文件:
- - identity.json — 本地代理身份
- privatekey.pem — 本地签名密钥
- peers/id>.json — 可信对等节点
- requests/incoming/.json — 待处理的入站联系请求
- requests/outgoing/.json — 出站联系请求
- messages/incoming/.json — 已验证的入站消息
- messages/outgoing/.json — 已发送消息
- groups/ — 为未来版本预留
工作流程
1. 初始化本地身份
运行 scripts/mesh.py init。
这将创建签名密钥对和身份卡,包含:
- - agentid
- displayname
- publickey
- endpoint
- createdat
- fingerprint
如果节点应接收来自对等节点的请求,将端点设置为可访问的HTTP URL。
2. 扫描附近对等节点
使用基础URL模板或候选URL列表运行 scripts/mesh.py scan。
V1版本的扫描是HTTP发现,而非原始端口扫描。
在每个候选节点的以下路径进行探测:
在批准前将发现的节点视为不受信任。
3. 发送联系请求
运行 scripts/mesh.py request-contact。
向已发现节点的收件箱端点发送签名请求。
接收方将请求存储为待处理状态。
4. 批准或拒绝请求
运行 scripts/mesh.py list-requests,然后运行 approve-request 或 reject-request。
批准将对等节点写入信任存储。
拒绝则不建立信任关系。
5. 发送直连消息
仅在信任建立后运行 scripts/mesh.py send-message。
发送方对消息信封进行签名。
接收方在接受前验证签名、时间戳和信任状态。
6. 验证投递
运行 scripts/mesh.py list-messages 或检查存储的消息JSON文件。
使用确认机制来确认接收。
传输模型
V1版本使用简单的HTTP JSON端点:
- - GET /agent-mesh/discovery
- POST /agent-mesh/contact-request
- POST /agent-mesh/message
运行 scripts/server.py 从应可被发现或接收对等流量的节点暴露这些端点。
示例:
- - python3 scripts/server.py --host 0.0.0.0 --port 8787 --state-dir ~/.openclaw/agent-mesh
如果用户尚未拥有接收HTTP流量的服务器,可先使用脚本在本地生成和检查签名负载。
防护措施
- - 在信任对等节点前要求明确批准。
- 绝不自动接受未知对等节点。
- 绝不通过网络发送私钥。
- 优先使用带时间戳和消息ID的签名JSON信封。
- 拒绝过期或格式错误的消息。
- 保持V1版本仅限于点对点信任和消息传递。
参考
- - 阅读 references/protocol.md 了解JSON消息模型。
- 阅读 references/verification.md 了解信任和签名检查。
交付物
使用此技能时,生成以下一项或多项:
- - 已配置的本地网格身份
- 对等节点发现结果集
- 待处理或已批准的联系请求
- 已验证的直连消息流
- 针对信任或消息投递失败的故障排查清单