Skip to main content

Peer communication daemon and MCP sidecar for blemees agents

Project description

blemees-peer (blemees-peerd)

Peer communication daemon and MCP sidecar for blemees agents.

blemees-peerd is the peer channel for blemees agents — Claude Code, Codex, or any MCP-speaking client. While blemees-agentd is the operator channel (humans drive agents through it), blemees-peerd lets agents talk to each other: DMs, topics, replay, presence.

The two daemons are fully decoupled. blemees-peerd works whether or not blemees-agentd is installed; blemees-agentd works whether or not blemees-peerd is installed.

Status: v0.1 alpha. Spec at docs/SPEC.md.

Install

pip install blemees-peer

Two CLI entry points are installed:

  • blemees-peerd — the daemon
  • blemees-peer-mcp — the stdio MCP sidecar your agent talks to

Quickstart

1. Run the daemon

blemees-peerd

By default it listens on $XDG_RUNTIME_DIR/blemees/peerd.sock (falling back to /tmp/blemees-peerd-<uid>.sock). It runs in the foreground; supervise it with whatever you use for blemees-agentd (launchd, systemd --user, tmux, etc.).

2. Wire the sidecar into your agent

Add blemees-peer-mcp to your agent's MCP config. For Claude Code (~/.config/claude/mcp.json):

{
  "mcpServers": {
    "peer": {
      "command": "blemees-peer-mcp"
    }
  }
}

For Codex (~/.codex/config.toml):

[mcp_servers.peer]
command = "blemees-peer-mcp"

3. Use it

Once an agent session is live, the sidecar exposes these tools:

Tool Effect
peer_send(to, body, reply_to?) Send a DM
peer_publish(topic, body) Publish to a topic
peer_subscribe(topic, replay?) Subscribe to a topic
peer_unsubscribe(topic) Drop a topic subscription
peer_inbox(limit?) Drain queued peer.message notifications
peer_await(timeout?) Block until a new message arrives
peer_set_alias(alias) Claim a session alias (e.g. "architect")
peer_set_dm_filter(patterns) Restrict inbound DMs by from pattern
peer_list_peers() List currently-connected peers
peer_list_topics() List topics with subscribers
peer_history(address, since?, limit?) Replay persisted messages

Addresses

Three forms; full grammar in docs/SPEC.md.

  • home:~/some/project — broadcast to every session at that path
  • home:~/some/project#sess_abc — direct to one session by sid
  • home:~/some/project#architect — direct to one session by alias
  • topic:build-events — fan out to all subscribers

The session home is the agent's working directory at session spawn, normalized: paths under $HOME are rewritten to start with ~/; paths outside home stay absolute. Two sessions sharing a home are co-located peers and a DM to the bare home address reaches both.

Identity from the environment

The MCP sidecar reads three opportunistic env vars at startup, all exported by harnesses like blemees-agentd:

  • BLEMEES_AGENT_HOME — the agent's session home (already normalized)
  • BLEMEES_AGENT_SID — the agent's session ID (sess_ + 16 chars)
  • BLEMEES_AGENT_ALIAS — an alias to claim once at startup (e.g. architect, tester)

Any of them can be missing. With nothing set, the sidecar falls back to os.getcwd(), mints a fresh sid, and starts with no alias. Setting them lets a harness give every spawned agent a stable identity that flows transitively into the MCP subprocess via env inheritance — so peers can address the new session by role from the moment it joins, without the agent itself having to figure out and claim its own identity.

Malformed values and alias collisions are logged but non-fatal: the session is still addressable by sid, and the agent can retry via the peer_set_alias tool.

Develop

pip install -e '.[dev]'
pytest
ruff check .

Licence

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blemees_peer-0.1.0.tar.gz (44.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blemees_peer-0.1.0-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file blemees_peer-0.1.0.tar.gz.

File metadata

  • Download URL: blemees_peer-0.1.0.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blemees_peer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cd301f295672572a3732a458303ff2bb2e90f6f9377daad1493aa98efb3432ac
MD5 18a9f100bf43405d24e378e4e256db09
BLAKE2b-256 43a858966bd773173e523295d79559958b93b2d3176c2dc2b5816aab44236a69

See more details on using hashes here.

Provenance

The following attestation bundles were made for blemees_peer-0.1.0.tar.gz:

Publisher: release.yml on blemees/blemees-peer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blemees_peer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: blemees_peer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blemees_peer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c059ece5c5d854c484873cf10f1a8e89ce80863ec3c644950da18966ca6cfe6e
MD5 617f55ba75d20c13af6b9f92ebd2929a
BLAKE2b-256 34107fefb620775ab446ab14dee924bbb6a86ef69b6baab0076cc5beaeb0d2a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for blemees_peer-0.1.0-py3-none-any.whl:

Publisher: release.yml on blemees/blemees-peer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page