Multi-machine Claude Code, over Telegram

Drive your whole Claude Code fleet from one chat.

belfry bridges every Claude Code session across every machine to one Telegram bot — and when the host owning the bot dies, another takes over in about one minute and hands back when it returns.

Self-healing fleet ~30–90s failover Node ≥ 20 MIT · open source

Two flows, one bot

What belfry does

Anthropic's bundled plugin:telegram handles bidirectional chat for one specific session. belfry is a massive expansion: bidirectional, multi-terminal, multi-host. Install once, subscribe the projects you care about, and every session — wherever it runs — shares the same chat.

Outbound

Status fans into one feed

A chokidar watcher reads /tmp/claude-dashboard/<slug>.json files. When a subscribed slug enters a state you care about (ready, error), it composes a 3-line message with the last user prompt + last Claude response and pushes it to your bot.

Per-slug throttle and coalesce keep fan-out bursts from spamming you. Optional Haiku summarizer turns long prompts into a lock-screen-friendly ping.

Inbound

Replies route back to the right terminal

Each session runs a tiny belfry-mcp stdio plugin that registers with the daemon and long-polls for replies. When one arrives, it emits MCP notifications/claude/channel to inject the text into its parent Claude — same path your keyboard goes through.

Quote-reply is the primary route; /<slug> message body is the fallback. Anything from a chat ID other than yours is silently dropped.

No single point of failure

The fleet

belfry is no longer one host relaying one terminal. Every machine you run joins a mesh over Tailscale, shares the one Telegram bot, and covers for the others. The highest-priority host that can reach Telegram owns the bot; lose it — to process death, or just a dead path to Telegram — and a standby takes over in ~30–90s, then hands back when the primary recovers.

one Telegram bot send_to send_to CURRENT OWNER Jinn j · Linux (WSL) Primary workstation + Telegram bot owner AGENTS belfry claudelike-bar web-design STANDBY Erebus e · Windows NUC Always-on worker + failover standby AGENTS erebus-master (keeper) gmail-watcher plex-manager STANDBY Severin s · NAS · Linux Network storage (NAS) + always-on services AGENTS system-monitor config-agent DESIGNATED LEAD · COMING ONLINE Fornax f · Raspberry Pi Pi-hole + Unbound DNS ADS-B flight tracking · tasks AGENTS pi-hole adsb/dump1090 scheduler one Telegram bot CURRENT OWNER Jinn j · Linux (WSL) Primary workstation + Telegram bot owner AGENTS belfry claudelike-bar web-design STANDBY Erebus e · Windows NUC Always-on worker + failover standby AGENTS erebus-master (keeper) gmail-watcher plex-manager STANDBY Severin s · NAS · Linux Network storage (NAS) + always-on services AGENTS system-monitor config-agent DESIGNATED LEAD · COMING ONLINE Fornax f · Raspberry Pi Pi-hole + Unbound DNS ADS-B flight tracking · tasks AGENTS pi-hole adsb/dump1090 scheduler
Four owner-capable machines, one bell. The highest-priority host that can reach Telegram holds it — so with Fornax, the designated always-on lead, not yet powered, Jinn currently owns the bot. When the host holding the bell drops, a reachable standby takes over in ~30–90s and hands back to the highest-priority host on recovery. Sessions message each other across hosts with send_to.

Priority failover & handback

A fixed priority rank decides who holds the bot — the highest-priority host that can currently reach Telegram. Lose the owner to process death or a dead path to Telegram, and the next-highest standby takes the bell in ~30–90s.

When the primary recovers, it reclaims automatically — no manual failback.

Agent-to-agent send_to

Sessions message each other directly, on the same box or across hosts, addressed <letter>/<slug>. One session can hand a task to another — e/erebus-master, j/web-design — and the reply routes straight back.

Federated DM

DM a session living on another host straight from Telegram. /keeper resolves to e/erebus-master, the daemon relays across the mesh, and the reply threads back to your chat — as if it were local.

Two processes per host, one owns the bot

Architecture

Each host runs a daemon that owns its Telegram link and a loopback registry; each session attaches a small belfry-mcp plugin. Daemons federate over the /fed mesh on Tailscale — no multiplexer, no keystroke injection, and the local terminal stays sovereign.

Two processes per host: the daemon owns the Telegram link and registry; each session runs a tiny belfry-mcp plugin attached over loopback. Daemons gossip peer state across the /fed mesh — the highest-priority host that can reach Telegram owns the bot.

Read this first

Trust model

Belfry's threat model is short, but the consequences are sharp. Your bot token + chat ID together are equivalent to a shell credential.

Token = shell credential

Inbound messages from your chat ID are injected into the matching session as user input — same path your keyboard goes through. Treat BELFRY_TOKEN like an SSH key, not a webhook URL.

One chat, one user

Inbound from any chat ID other than BELFRY_CHAT_ID is silently dropped. Don't add the bot to a group whose chat ID could collide; don't expand the allowlist without thinking through who that gives shell-equivalent access to.

Registry stays on loopback

The registry binds 127.0.0.1 and gates every endpoint on a 32-byte bearer token. Other UIDs can't register fake slugs or call /send. Cross-host traffic never touches it directly — it rides the separate, bearer-gated /fed mesh. Don't rebind to 0.0.0.0.

Rotate on suspicion

If a token leaks, message @BotFather → /revoke. The old token is dead instantly at the API edge. Update your launcher's secret store and restart belfry.

Tight tmp perms

/tmp/claude-dashboard/ should be 0700 with files 0600. The daemon warns at startup if it finds wider modes — chmod 700 to tighten. Otherwise prompt and response text in last_response is readable by other UIDs.

The brain is opt-in egress

belfry's conversational brain and summarizer run on your Claude.ai subscription via OAuth — no API key. When they run, prompt + response pairs go to Claude.ai, the same data path your interactive Claude Code sessions already use. No subscription (or no claude on PATH) and the brain simply doesn't start; summarize falls back to a local truncate. Voice transcription is a separate opt-in — notes leave the host only when BELFRY_TRANSCRIBE_KEY is set.

The mesh is fail-closed

The /fed mesh refuses to start without BELFRY_FED_TOKEN. Every cross-host call is bearer-gated; a peer that can't present the token is ignored. No token, no mesh — it fails closed, never open.

Nothing is logged

belfry records event metadata only — slug, state, timing. No prompt or response text is written to disk or carried across the mesh. What you say to a session stays on that session's host.

Five minutes, six commands

Quick start

Single-user, single-platform (Telegram). Start on one host; add machines to the mesh later. No SDK; only runtime dep is chokidar.

  1. Create a bot

    Message @BotFather → /newbot. Save the token.

  2. Get your chat ID

    Send the bot any message, then call getUpdates and copy message.chat.id.

    curl https://api.telegram.org/bot<TOKEN>/getUpdates
  3. Configure subscriptions

    Copy docs/belfry.jsonc.example to ~/.claude/belfry.jsonc and edit the whitelist of slugs.

  4. Run the daemon

    Pass credentials via env. Belfry never reads tokens from disk.

    BELFRY_TOKEN=<token> BELFRY_CHAT_ID=<chat-id> node bin/belfry.js
  5. Wire each session for inbound

    Add belfry-mcp to the projects you want to drive — drop a .mcp.json at the project root pointing at bin/belfry-mcp.js and restart the Claude Code session. See docs/install-mcp.md.

  6. (Optional) install the status hook

    For status JSONs without claudelike-bar, run belfry-install-hook from each project root. It adds belfry-hook to the project's .claude/settings.json and skips if it detects another writer of the convention.