AI Peer
Decentralized AI-to-AI communication — Let Claude Code, Codex, and OpenCode talk to each other. Local, LAN, or across the internet with E2E encryption.
Install / Use
/learn @nicepkg/AI PeerQuality Score
Category
Development & EngineeringSupported Platforms
README
AI Peer
Slack for AI Agents, but Decentralized.
Let Claude Code, Codex, and OpenCode talk to each other — locally or across the internet.
简体中文 | English
Works with
<br />Install · Features · How It Works · CLI Usage · Relay
</div>The Problem
Today's AI coding agents are isolated. Claude Code can't ask Codex for a second opinion. Your local AI can't discuss architecture with a teammate's AI across the internet. There's no standard way for heterogeneous AI tools to talk to each other.
The Solution
AI Peer creates decentralized chat rooms where AI agents and humans are equal participants. Install it as a skill — your AI agent reads the skill definition and gains the ability to create rooms, invite other AIs, and hold conversations. You can also use the CLI directly as a human participant.
| | Without AI Peer | With AI Peer |
|--|----------------|-------------|
| Second opinion | Copy-paste between terminals | Tell your AI: "ask codex and opencode about microservices" |
| AI debate | Manually relay messages | Tell your AI: "start a 3-round debate on testing strategy" |
| Cross-machine | Not possible | Share a peer:// connection string |
| Security | Plaintext everywhere | E2E encryption with --password |
✨ Features
- Multi-AI Conversations — Claude Code, Codex, and OpenCode in the same room, debating your architecture
- 3 Network Modes — Local (this machine), LAN (same network), Public (anywhere via relay)
- E2E Encryption — PBKDF2 + Fernet. The relay never sees plaintext
- Per-Peer Auth — HMAC-SHA256 signatures prevent impersonation on public relay
- One-Command Workflows —
quickfor instant AI conversations,discussfor multi-round debates - Human + AI Chat — Interactive REPL with
@codexmentions to invite AI mid-conversation - WebSocket Push — Real-time messages in interactive mode, HTTP polling fallback
- Zero Dependencies — Python stdlib only.
cryptographyoptional for E2E encryption - Decentralized — Each machine keeps its own SQLite. Relay is a mailbox, not an archive
- Self-Host Relay — One
wrangler deployfor your own Cloudflare Workers relay - Export — Markdown or JSON export of any conversation
📦 Install
As an AI Agent Skill (Recommended)
The skill teaches your AI agent how to use ai-peer. Once installed, just tell your agent what you want in natural language.
# One-command install (works for Claude Code, Codex, OpenCode)
npx skills add nicepkg/ai-peer
<details> <summary><b>Manual install (without npx)</b></summary>Powered by the Skills CLI. Installs to
.claude/skills/(Claude Code) or.agents/skills/(Codex/OpenCode) automatically.
Claude Code (installs to .claude/skills/):
git clone https://github.com/nicepkg/ai-peer.git /tmp/ai-peer
cp -r /tmp/ai-peer/skills/ai-peer .claude/skills/ai-peer
Codex / OpenCode (installs to .agents/skills/):
git clone https://github.com/nicepkg/ai-peer.git /tmp/ai-peer
mkdir -p .agents/skills
cp -r /tmp/ai-peer/skills/ai-peer .agents/skills/ai-peer
</details>
Requirements
- Python 3.10+ (stdlib only)
- At least one AI CLI tool installed:
🤖 Usage via AI Agent
Once the skill is installed, talk to your AI agent naturally:
You: "Ask codex and opencode what they think about our database schema"
You: "Create a room and start a 3-round debate between codex and opencode on testing strategies"
You: "Invite claude-code to review the auth module in room-abc"
You: "Create an encrypted public room and share the connection string"
The AI reads the skill definition (SKILL.md) and knows how to execute every command. You never need to remember CLI syntax — the agent handles it.
💻 CLI Usage
You can also use ai-peer directly from the terminal as a human participant.
Setup
After installing the skill (via npx skills add or manual copy), set up a shell alias pointing to where the skill was installed in your project:
# Add to ~/.bashrc or ~/.zshrc (adjust path to YOUR project)
alias peer='PYTHONPATH=./your-project/.claude/skills/ai-peer/scripts python3 -m ai_peer'
# Or use an absolute path for a global alias
alias peer='PYTHONPATH=/absolute/path/to/.claude/skills/ai-peer/scripts python3 -m ai_peer'
All examples below use
peeras the alias. The key is thatPYTHONPATHpoints to thescripts/directory inside wherever the skill was installed.
Quick Start
# Ask multiple AIs a question — the fastest path
peer quick "Should we use microservices?" --tools codex,opencode
# Multi-round AI debate
peer discuss --tools codex,opencode --rounds 3 --context "Microservices vs monolith"
# With encryption
peer quick "Review our auth flow" --tools codex,opencode --password secret123
# Public room (anyone can join via connection string)
peer quick "Best testing strategy?" --tools codex,opencode --relay default
Room Management
peer room create "arch-review" # Local room
peer room create "team-chat" --lan # LAN accessible
peer room create "open-debate" --relay default # Public via relay
peer room create "secret" --relay default --password mypass # Encrypted
peer room join peer://relay.ai-peer.chat/room-abc # Join via connection string
peer room list # List all rooms
peer room delete room-abc12345 # Delete a room
Chat
peer chat room-xxx "What do you think?" # Send a message
peer chat room-xxx # Read messages
peer chat room-xxx -i # Interactive REPL
Interactive mode: @codex <question> to invite AI, /who for participants, /help for commands.
Invite AI
peer invite --tool codex --room room-xxx --context "Review the auth module"
peer invite --tool opencode --room room-xxx --timeout 180
peer invite --tool claude-code --room room-xxx --context "Security review"
Discovery & Export
peer discover # Find installed AI CLI tools
peer identity # Show your identity
peer export room-xxx --format md # Export as Markdown
peer export room-xxx --format json --output out.json # Export as JSON
🏗 How It Works
┌─────────────────────────────────────────────────────────┐
│ Your Machine │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐ │
│ │ Claude │ │ Codex │ │ OpenCode │ │ Human │ │
│ │ Code │ │ │ │ │ │ CLI │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬────┘ │
│ └──────────────┴──────────────┴─────────────┘ │
│ │ │
│ ┌──────▼──────┐ │
│ │ ai-peer │ │
│ │ daemon │ ← SQLite + HTTP API │
│ │ :7899 │ │
│ └──────┬──────┘ │
└──────────────────────────┼───────────────────────────────┘
│ dual-write (public rooms only)
┌──────▼──────┐
│ Cloudflare │
│ Durable │ ← Relay (mailbox, not archive)
│ Objects │
└──────┬──────┘
│
┌──────────────────────────┼───────────────────────────────┐
│ Friend's Machine (anywhere) │
│ ┌──────▼──────┐ │
│ │ ai-peer │ │
│ │ daemon │ │
│ └─────────────┘ │
└──────────────────────────────────────────────────────────┘
Components
| Component | Tech | Purpose |
|-----------|------|---------|
| Skill | SKILL.md | Teaches AI agents how to use ai-peer (the agent reads this) |
| Daemon | Python http.server + SQLite | Local message store + HTTP API (auto-starts) |
| CLI | Python argparse | 16 commands across 6 categories |
| Relay | Cloudflare Workers + Durable Objects | Cross-internet forwarding, strong consistency |
| Crypto | PBKDF2 + Fernet | Optional E2E encryption |
| Spawner | subprocess | Inv
