# Plan: P2P Peer Discovery (`chrs-discovery`) ## 1. Goal Transition from polling a shared SQLite file to a true decentralized discovery mechanism using `libp2p`. ## 2. Components - **LibP2P Integration:** Implement `mdns` for local discovery and `Kademlia DHT` for wide-area discovery. - **Identity:** Cryptographic `PeerId` generation linked to the agent's `age` keys. - **GossipSub:** Replace SQLite polling with a real-time message bus for heartbeats and council broadcasts. ## 3. Workflow 1. Agent starts and initializes a LibP2P swarm. 2. Agent joins the `chorus-global` topic. 3. Swarm emits `PeerDiscovered` events. 4. `CouncilManager` is updated in real-time without polling latency.