From 218836b50e3a05ad634ac49c329e043bb2a1e8b6 Mon Sep 17 00:00:00 2001 From: "SYM.BOT" Date: Mon, 30 Mar 2026 14:21:25 +0100 Subject: [PATCH] Send recent CMB anchors to new peers on connection When a peer connects, send up to 5 recent CMBs after state-sync. This enables the "Ask the Mesh" pattern (Section 13.6): a periodic agent that connects briefly can see questions asked before it joined and respond with relevant knowledge. Without this, the knowledge feed agent couldn't see Claude Code's question because each node has its own memory store. Now the daemon shares context on connection, exactly like peer-info gossip but for cognitive content. CMBs are E2E encrypted if shared secret is available. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/node.js | 22 ++++++++++++++++++++++ package.json | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/node.js b/lib/node.js index 7455b1e..0cb8d4a 100644 --- a/lib/node.js +++ b/lib/node.js @@ -703,6 +703,28 @@ class SymNode extends EventEmitter { const [h1, h2] = this._meshNode.coupledState(); peer.transport.send({ type: 'state-sync', h1, h2, confidence: 0.8 }); + // Send recent CMB anchors — enables the "Ask the Mesh" pattern. + // New peers need context to respond relevantly. Without this, + // a periodic agent that connects briefly can't see questions + // that were asked before it joined. See MMP Section 13.6. + const sharedSecret = this._peerSharedSecrets.get(peer.peerId); + const recentAnchors = this._store.recent(5); + for (const anchor of recentAnchors) { + if (!anchor.cmb) continue; + let cmb = anchor.cmb; + if (sharedSecret) { + cmb = this._encryptCMBForPeer(cmb, sharedSecret); + } + peer.transport.send({ + type: 'cmb', + timestamp: anchor.storedAt || anchor.timestamp, + cmb, + }); + } + if (recentAnchors.length > 0) { + this._log(`Sent ${recentAnchors.length} anchor CMB(s) to ${peer.name}`); + } + // Send wake channel if configured (legacy, for backward compat) if (this._wakeChannel) { peer.transport.send({ type: 'wake-channel', ...this._wakeChannel }); diff --git a/package.json b/package.json index e056c42..cd22f2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sym-bot/sym", - "version": "0.3.10", + "version": "0.3.11", "description": "Infrastructure and protocol for multi-agent collective intelligence", "main": "lib/node.js", "bin": {