diploid-mesh
Bidirectional mesh integration for diploid-agent. It makes a diploid-agent a full mesh peer, compatible with hermes-mesh and openclaw-mesh.
What it does
- Receives Ed25519-signed
[mesh]webhooks on/mesh/receive(and the OpenClaw alias/plugins/openclaw-mesh/webhook). - Wakes the diploid runtime with mesh context so the agent can reply.
- Exposes MCP tools (
mesh_send,mesh_list,mesh_register,mesh_sync,mesh_publish,mesh_health,mesh_deregister). - Enforces the mesh contract: replay windows,
THREAD_CLOSED, DSN exemption, andreplysemantics. - Nudges and hard-caps
mesh_sendcalls per ACP turn. - Strengthens prompt discipline with a top-of-prompt
SYSTEM — MESH REPLY RULECTA that commands the agent to usemesh_sendand keep mesh traffic out of normal assistant text. - Mirrors sent mesh messages to Telegram as
System: [mesh] ...notices whenharness.notifications.mesh_telegram_floatis enabled. - Stores per-chat mesh state (
chat_mesh_state.json) and a prompt block teaching the agent the CTA contract. - Surfaces a
## Recent meshblock with the most recent open or closed threads so the agent has thread context even when the transientcurrent_meshhas been cleared. - Relies on
mesh-peer-registryfor shared envelope parsing, identity, crypto, and registry primitives.
Install
From PyPI (recommended)
pip install diploid-mesh
diploid-mesh requires diploid-agent>=0.4.0 and mesh-peer-registry>=0.1.7.
From source
pip install -e /path/to/mesh-peer-registry
pip install -e /path/to/diploid-mesh
Message lifecycle
reply=yes(default): the recipient runs an ACP turn and may respond. The MCP server nudges the model to usereply=endaftermax_message_in_turn_suggestionsends and hard-blocks atmax_sends_per_turn.reply=no: the recipient runs an ACP turn to perform work. The prompt says "only reply in an exceptional case," and the MCP server gives the same nudge/cap asreply=yesbut the model is expected to avoid sending.reply=end: the recipient runs an ACP turn but the MCP server hard-blocks allmesh_sendcalls; this is the last message in the thread.- DSNs (
[mesh-dsn]body prefix): delivery-status notifications are recorded, not replied to, and do not start a turn.
Chat routing
Inbound mesh messages are mapped to a diploid chat_id using harness.mesh.chat_mapping and harness.mesh.chat_map:
chat_mapping: session— thesessionenvelope token is looked up inchat_map. If it matches a key, the message goes to that chat. If it does not match, the sender is looked up inchat_map. If that does not match, the message falls back tofallback_chat_id.chat_mapping: per_sender— the sender name is looked up inchat_mapand falls back tofallback_chat_id.chat_mapping: single— every message goes tofallback_chat_id.
When fallback_chat_id is a real Telegram numeric chat id, unmapped known
peers are routed to that Telegram chat. Only when the fallback is not a
Telegram chat (e.g. mesh:inbox) does a known but unmapped peer get its own
mesh:<sender> session. This keeps messages from Hermes, OpenClaw, and other
agents from landing in phantom sessions on diploid-agent instances that are
backed by Telegram.
Per-turn send cap
harness.mesh.max_sends_per_turn hard-limits how many mesh_send calls the agent can make within a single active ACP turn. The default is 3.
harness.mesh.max_message_in_turn_suggestion is a soft nudge threshold. After that many mesh_send calls, the tool result appends a note suggesting the next send use reply=end to close the thread. This lets the LLM infer the graceful close.
reply=end always overrides the cap to 0, blocking all mesh_send for that turn.
Configure diploid-agent
Add to harness.yaml:
harness:
mesh:
enabled: true
agent_name: diploid-0
private_key_path: ~/.mesh/keys/diploid-0.pem
vault_path: ~/.mesh
registry_url: http://127.0.0.1:8646
chat_mapping: per_sender
fallback_chat_id: mesh:inbox
ingress_module: diploid_mesh.ingress
mcp_enabled: true
plugins:
- name: mesh
enabled: true
module: diploid_mesh
prompt_slot: mesh
first_prompt_only: false
prompt_order: 50
max_prompt_chars: 4096
state_file: chat_mesh_state.json
mcp_server:
name: diploid-mesh
command: python
args:
- -m
- diploid_mesh.mcp
- --chat-id
- '{chat_id}'
- --sessions-root
- '{sessions_root}'
- --harness-url
- '{harness_url}'
env:
- MESH_AGENT_NAME=diploid-0
- MESH_PRIVATE_KEY_PATH=/home/diploid/.mesh/keys/diploid-0.pem
- MESH_VAULT_PATH=/home/diploid/.mesh
The diploid-mesh MCP server must be able to call back to the harness URL. The
--harness-url argument is required if it is not passed via the HARNESS_URL
environment variable (newer diploid-agent versions inject HARNESS_URL
automatically for all MCP children).
Floating mesh messages to Telegram
Set in runtime-overrides.yaml (or live via /config):
notifications:
enabled: true
outbox_delivery: true
mesh_telegram_float: true
After every successful mesh_send, a system message such as
System: [mesh] diploid-0 → hermes-0: pong (action=info) (reply=end) (id=...)
is delivered to the sender's Telegram chat, so the human operator sees the mesh
traffic without the agent leaking it into assistant text.
Prepare the vault
mkdir -p ~/.mesh/agents/hermes-0
Write ~/.mesh/agents/hermes-0/identity.yaml:
id: hermes-0
name: hermes-0
description: Hermes gateway peer
role: gateway
transports:
hermes_webhook:
protocol: hermes-webhook
url: http://127.0.0.1:8123/mesh/receive
auth:
public_key: |
-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----
And the reciprocal identity for diploid-0 in ~/.mesh/agents/diploid-0/identity.yaml.
Test
python -m pytest
Fleet interop tests (require a running Hermes gateway) are marked with pytest.mark.fleet:
python -m pytest -m fleet
Cross-harness mesh
The mesh is one protocol shared by three runtimes:
- Hermes agents use
hermes-mesh, which adds ameshplatform adapter andmesh_send/mesh_listtools. - OpenClaw agents use
openclaw-mesh, a plugin that receives[mesh]webhooks and injects them as agent turns. - diploid-agent agents use
diploid-mesh(this repo), a state plugin that exposes the same envelope and MCP tools over the diploid harness.
All three use the same mesh-peer-registry server and the same on-disk vault format (mesh/agents/<name>/identity.yaml), so a Hermes agent can mesh_send to a diploid agent, and a diploid agent can reply to an OpenClaw agent, without a custom translator.
Hermes fleet mesh-peer-registry OpenClaw diploid-agent
│ │ │ │
│ [mesh] + Ed25519 sig │ │ [mesh] + sig │
└────────────webhook─────┼──────────────────┼────────────────▶│
│ public keys / │ │
│ peer URLs │ │
The registry is optional for loopback-only fleets — a shared file-based vault (~/.mesh/agents) is enough — but it makes multi-host discovery simple.
Project links
- Source: https://github.com/emiltsoi/diploid-mesh
- Mesh protocol / shared primitives: https://github.com/emiltsoi/mesh-peer-registry
- Hermes gateway bridge: https://github.com/emiltsoi/hermes-mesh
- OpenClaw bridge: https://github.com/emiltsoi/openclaw-mesh
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diploid_mesh-0.1.1.tar.gz.
File metadata
- Download URL: diploid_mesh-0.1.1.tar.gz
- Upload date:
- Size: 35.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95646c2ab28f2e7ccee7a1fd3b8745cd2c5b4f5620e8d962fbbdd8bf23233790
|
|
| MD5 |
21cb79e3e94f8e7fcb1ac9a80bbf7230
|
|
| BLAKE2b-256 |
e0d00e757397ca667a28b3942af8a1745620531163c0b03e7ffeff9bff53cf0d
|
Provenance
The following attestation bundles were made for diploid_mesh-0.1.1.tar.gz:
Publisher:
publish.yml on emiltsoi/diploid-mesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
diploid_mesh-0.1.1.tar.gz -
Subject digest:
95646c2ab28f2e7ccee7a1fd3b8745cd2c5b4f5620e8d962fbbdd8bf23233790 - Sigstore transparency entry: 2774592794
- Sigstore integration time:
-
Permalink:
emiltsoi/diploid-mesh@d3ba5f1a9a645ba904cf56b3dc02518bb23c30b4 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/emiltsoi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d3ba5f1a9a645ba904cf56b3dc02518bb23c30b4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file diploid_mesh-0.1.1-py3-none-any.whl.
File metadata
- Download URL: diploid_mesh-0.1.1-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6de5df8d733c0c8d9be8c42efb633d1113d3625b9b8071572ac3f1ae85ed3c1
|
|
| MD5 |
e75475840727acb51d79269a65995f9a
|
|
| BLAKE2b-256 |
839fd1fc4b34aed65f277ab29845e9dacc2520d1d61aac85fd5d8bd9e02aae64
|
Provenance
The following attestation bundles were made for diploid_mesh-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on emiltsoi/diploid-mesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
diploid_mesh-0.1.1-py3-none-any.whl -
Subject digest:
b6de5df8d733c0c8d9be8c42efb633d1113d3625b9b8071572ac3f1ae85ed3c1 - Sigstore transparency entry: 2774592888
- Sigstore integration time:
-
Permalink:
emiltsoi/diploid-mesh@d3ba5f1a9a645ba904cf56b3dc02518bb23c30b4 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/emiltsoi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d3ba5f1a9a645ba904cf56b3dc02518bb23c30b4 -
Trigger Event:
push
-
Statement type: