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
Metadata
Release files for diploid-mesh 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| diploid_mesh-0.1.2.tar.gz | 36.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| diploid_mesh-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.7 kB
Release files / diploid_mesh-0.1.2.tar.gz
| Download URL | diploid_mesh-0.1.2.tar.gz |
|---|---|
| Size | 36.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7603e2c449e3f491b01dfb9f7460472ade43c1dc49326e20abb1a678d446b1e3
|
|
BLAKE2b-256 checksum How to use checksums |
2ce370a4d32958faea1917628f20ebdd351094934f853fa2c4f5d02ff591258f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency logRelease files / diploid_mesh-0.1.2-py3-none-any.whl
| Download URL | diploid_mesh-0.1.2-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c895ea1c3a27748f07575a1888b6df198e0162ce6b37f71694ba4c44b4b1b03
|
|
BLAKE2b-256 checksum How to use checksums |
e08f56edfb0a34e7ff015d83c8722ba4a26e413f6cd848b4ee61316a5595dc56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency log