How alexrudloff/clawchat works
ClawChat is a peer-to-peer encrypted messaging gateway for agents on different machines. Agents invoke the CLI, which communicates with a local daemon; the daemon selects an identity, routes messages, and sends them over authenticated libp2p sessions to remote gateways. Those gateways deliver messages to their own identities. The README also documents multi-identity isolation, peer exchange, NAT traversal, per-identity access controls, and OpenClaw wake configuration. Some subsystem wiring is supported only by README or source-index references; the graph omits uncertain links.
Main entry points: server.ts Gateway Daemon · keys.ts Identity and Attestation · session.ts Encrypted Session · cli.ts CLI Commands
Components 17
Local Client
- CLI Commands
src/cli.ts - Gateway Setup
src/cli/gateway.ts
Gateway Runtime
- Gateway Daemon
src/daemon/server.ts - Message Routing
src/daemon/message-router.ts
Identity and Policy
- Identity Runtime
src/daemon/identity-manager.ts - Gateway Configuration
src/daemon/gateway-config.ts - Identity and Attestation
src/identity/keys.ts - Stacks Wallet
src/identity/wallet.ts - Identity ACL and Wake
src/types/gateway.ts
P2P Transport
- Libp2p Node
src/net/libp2p-node.ts - SNaP2P Authentication
src/net/snap2p-protocol.ts - Encrypted Session
src/net/session.ts - Noise Encryption
src/crypto/noise.ts - Wire Framing
src/wire/framing.ts - PX-1 Peer Exchange
src/net/px1.ts
Other components
- Agent
- Remote Gateway
Connections 20
- Agent → CLI Commands: invokes
README.md - CLI Commands → Gateway Daemon: uses IPC
README.md - Gateway Setup → Gateway Configuration: configures
src/cli/gateway.ts - CLI Commands → Gateway Daemon: calls commands
src/cli.ts - Gateway Daemon → Gateway Configuration: loads
src/daemon/server.ts - Gateway Daemon → Identity Runtime: manages identities
src/daemon/server.ts - Gateway Daemon → Message Routing: routes messages
src/daemon/server.ts - Identity Runtime → Identity and Attestation: loads identity
src/daemon/identity-manager.ts - Identity and Attestation → Stacks Wallet: derives wallet
src/identity/keys.ts - Gateway Configuration → Identity ACL and Wake: defines settings
src/types/gateway.ts - Gateway Daemon → Libp2p Node: starts node
src/daemon/server.ts - Gateway Daemon → SNaP2P Authentication: starts handler
src/daemon/server.ts - Gateway Daemon → PX-1 Peer Exchange: exchanges peers
src/daemon/server.ts - Libp2p Node → Remote Gateway: connects P2P
README.md - SNaP2P Authentication → Identity and Attestation: creates attestations
src/net/snap2p-protocol.ts - SNaP2P Authentication → Wire Framing: encodes messages
src/net/snap2p-protocol.ts - Encrypted Session → Noise Encryption: encrypts payloads
src/net/session.ts - Encrypted Session → Wire Framing: frames messages
src/net/session.ts - Encrypted Session → Identity and Attestation: creates attestations
src/net/session.ts - PX-1 Peer Exchange → Libp2p Node: uses node
src/net/px1.ts