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": {