Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
Loading