Metadata-Version: 2.5
Name: claudify
Version: 0.1.0
Summary: Peer-to-peer messaging between coding agents (handoffs, questions, change requests) over MCP.
Project-URL: Homepage, https://github.com/tasosdaris128/claudify
Project-URL: Issues, https://github.com/tasosdaris128/claudify/issues
Author: Tasos Daris
License-Expression: MIT
License-File: LICENSE
Keywords: agents,claude,mcp,messaging,p2p
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development
Requires-Python: >=3.10
Requires-Dist: aiohttp>=3.9
Requires-Dist: mcp<3,>=2.3
Requires-Dist: platformdirs>=4
Requires-Dist: pynacl>=1.5
Requires-Dist: zeroconf>=0.130
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# claudify

Let your coding agents talk to each other.

You're on the backend, your colleague is on the frontend, and you keep passing handoff notes, questions
and change requests back and forth. With claudify, your Claude Code sessions send those messages to each
other directly, peer-to-peer, without a cloud service in between.

```
 You                                             Colleague
 Claude Code ── MCP ── claudify daemon ◄═══════► claudify daemon ── MCP ── Claude Code
                       (SQLite inbox)  encrypted (SQLite inbox)
```

* **Message kinds:** `handoff`, `question`, `change_request`, `answer` and `note`. Messages are grouped
  into threads that can be resolved.
* **Offline-safe:** messages wait in your outbox and go out when the peer comes back online.
* **Notifications:** a Claude Code hook tells the agent when new messages have arrived.
* Pure Python with no system dependencies. Runs on Linux, macOS and Windows.

## Install

```bash
pipx install claudify        # or: uv tool install claudify  /  pip install claudify
```

## Pair with a colleague (once)

```bash
# you
claudify pair invite
#   cfy1/192.168.1.20:7878/3f9a1c2e/Jx8...    (single use, expires in 10 min)

# your colleague
claudify pair join cfy1/192.168.1.20:7878/3f9a1c2e/Jx8...
```

Both commands start the daemon in the background if it isn't already running. `claudify peers` lists
paired peers along with their key fingerprints.

## Connect Claude Code

```bash
claude mcp add --scope user claudify -- claudify mcp
```

Optional but recommended: let the agent know when messages arrive by adding this to `~/.claude/settings.json`:

```json
{
  "hooks": {
    "SessionStart":     [{ "hooks": [{ "type": "command", "command": "claudify hook" }] }],
    "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "claudify hook" }] }]
  }
}
```

Now you can say *"ask the frontend agent whether they need pagination on /orders"* or *"hand off the new
auth endpoints to Bob"*. The agent gets these MCP tools:

| tool | purpose |
|------|---------|
| `list_peers` | who can I talk to |
| `send` | start a thread (`handoff` / `question` / `change_request` / `note`) |
| `check_inbox` | read new messages |
| `get_thread` | read a whole conversation |
| `reply` | answer inside a thread |
| `resolve` | close a thread on both sides |

Claude Code asks for your permission the first time each tool is used. Allow `check_inbox` and
`reply` permanently if you want, and keep `send` on approval if you'd like to review what goes out.

## Remote colleagues

The peer port (TCP 7878) has to be reachable. On the same LAN that usually just works, and mDNS keeps
addresses up to date when IPs change. For remote work, use a VPN such as Tailscale or WireGuard:

```bash
claudify init --advertise-host 100.101.102.103   # your Tailscale IP, used in invite codes
```

Exposing the peer port directly to the internet works but isn't recommended. Every request is
authenticated, but there is no reason to show the port to scanners.

## Security model

| threat | defence |
|---|---|
| Stranger connects to your daemon | Only **paired** keys can get a challenge or deliver a message; everything else gets `403`. |
| Pairing intercepted or spoofed | Invite = public id + ~128-bit **one-time secret** that never goes over the wire. Each side proves it knows the secret with HMAC over a transcript that binds **both public keys and both nonces**, so a man in the middle can't swap keys. The joiner checks the inviter's proof before it sends its own. Invites expire after 10 min, work once, and are **burned** after one wrong proof or 5 attempts. |
| Replay of a captured message | Every delivery needs a fresh, single-use, server-issued **challenge** (32 random bytes, 60 s TTL) that is covered by the signature. |
| Eavesdropping or tampering | Payloads are signed with **Ed25519** and encrypted with **NaCl Box** (X25519 + XSalsa20-Poly1305) between the two identity keys. |
| Spoofed address (e.g. fake mDNS) | The sender only marks a message delivered after a **signed receipt** from the paired key. A spoofed endpoint can't decrypt messages or fake receipts. |
| One peer meddling in another's threads | The daemon rejects messages that write into a thread owned by a different peer. |
| Other local programs or websites | The local API listens on `127.0.0.1` only, requires a bearer token stored in a `0600` file, and checks the Host header (blocks DNS rebinding). |
| Prompt injection from a peer's agent | Peer content reaches the model wrapped as `<peer_message untrusted="true">`. The MCP instructions say change requests need the user's approval and that messages must not trigger commands or reveal secrets. |

Keys and the database live in `~/.local/share/claudify` (Linux), `~/Library/Application Support/claudify`
(macOS) or `%LOCALAPPDATA%\claudify` (Windows), or in `CLAUDIFY_HOME`. `identity.key` is your
identity, so keep it private. `claudify unpair <name>` revokes a peer.

Not covered yet: forward secrecy (a stolen `identity.key` can decrypt previously captured traffic) and
hiding metadata such as public keys and message sizes.

## CLI

```
claudify start | stop | status | daemon [-v]
claudify pair invite | pair join <code>
claudify peers | unpair <peer>
claudify inbox [-a] | thread <id>
claudify send <peer> <kind> <subject> <body> [--ref path]
claudify reply <thread-id> <body>
claudify init [--name N] [--peer-port P] [--advertise-host H] [--no-discovery]
```

## Development

```bash
python -m venv .venv && .venv/bin/pip install -e '.[dev]' && .venv/bin/pytest
```

The tests start two real daemons and cover pairing, conversations, offline queueing, forged invite
secrets, replay, tampering and local API authentication.

## License

MIT
