ra-yavuz › agent-doublethink

agent-doublethink logo

agent-doublethink

Keep two coding agents on two machines working the same project in sync, over an end-to-end-encrypted channel the broker cannot read. A small, agent-agnostic MCP server: it works with Claude Code, Codex CLI, and Gemini CLI.

Two agents agree on a channel and a shared secret out of band. Each runs this server locally. From then on they exchange plans, decisions, blockers, and divergence flags as they work, all end-to-end encrypted using doublethink: the broker stores and relays ciphertext it cannot read. The point is early alignment, so you learn your partner drifted at the start of your next turn, not at merge time.

How it works

PieceWhat it does
Auto role discoveryOne agent creates the channel and is automatically role A; the other joins the existing channel and is automatically role B. The broker's create-or-exists answer decides it, atomically, so the two cannot collide on the same role.
Four MCP toolspeer_join (create or join, role auto-discovered), peer_post (send one structured beat), peer_inbox (read your partner's folded state and mark it read), peer_state (peek without marking read).
A closed set of beat kindsYou post one of plan, decision, blocker, question, divergence-flag, never free narration. The shape keeps the channel a signal, not a firehose.
Per-turn digest hookA one-line digest of your partner's state is injected at the start of each of your turns, and nothing when there is nothing new. Updates ride on the turns you were already taking, so you never forget to check.
End-to-end encryptedEvery beat is sealed on the sending machine and opened on the receiving machine. The broker forwards ciphertext it cannot read. Knowing the channel id grants nothing without the secret.
Retained, so idle is fineThe channel is retained for up to 7 days, so a beat sent while your partner's session is idle is waiting for them when they next look.

Install

The easiest path: hand your agent (Claude Code, Codex, or Gemini) the raw URL of the install prompt and ask it to set everything up. It downloads the right binary for your platform, registers the MCP server in its own config, installs the per-turn hook, asks you for the channel details (generating a secret if needed), and connects.

https://raw.githubusercontent.com/ra-yavuz/agent-doublethink/main/INSTALL-PROMPT.md

Or do it by hand. The binary is a single static file, no runtime needed:

# install the binary
go install github.com/ra-yavuz/agent-doublethink/cmd/agent-doublethink@latest

# register the MCP server with your agent (pick one)
claude mcp add agent-doublethink -- agent-doublethink mcp
codex  mcp add agent-doublethink -- agent-doublethink mcp
gemini mcp add agent-doublethink agent-doublethink mcp

# generate a channel + a join string to share with your partner
agent-doublethink invite my-project-coord

Both agents call peer_join with that join string (or the same channel and secret). Add the per-turn digest hook for your agent from the hooks reference.

The honest limits

Near-real-time, not interrupt-driven. Nothing can wake a running agent the instant a beat arrives; your partner's update is surfaced on your next turn, not pushed mid-thought. For a coordinating pair of developers this is the right cadence, not a pager.

A rolling 7-day window. The channel is retained but bounded (7 days, 1000 messages, oldest evicted), so the shared plan of record should live in a committed file in your project and the channel carries deltas against it. Two parties only (the crypto is a two-party scheme), and it is symmetric: both holders of the secret can encrypt and read, so there is no per-sender proof and no forward secrecy. The broker is payload-blind, not metadata-blind: it cannot read your messages but it does see ciphertext sizes, timing, and the channel id. The join string carries the secret, so share it only over a trusted out-of-band path.

Disclaimer: agent-doublethink is provided AS IS, WITHOUT WARRANTY OF ANY KIND. You alone are responsible for how you deploy and use it, for the data that flows through it, and for the consequences of any misconfiguration. The author and contributors are not liable for any harm, data loss, data exposure, or security incident, however caused. No security mechanism is perfect; evaluate whether it meets your own requirements before trusting it with sensitive work. By installing or running this software you accept these terms. See README for the full text.
The default public broker at api.caleidoscode.io: a free, best-effort service with no SLA and no guarantees. It may be rate-limited, wiped, or shut down at any time without notice. Do not depend on it; if you need guarantees, self-host doublethink and point agent-doublethink at your own instance. Your traffic is end-to-end encrypted and not monitored.