Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review: save brain cursor before memory sync, remove dead applyRemoteJsonl
Adam Eivydd74352122fb
diff --git a/server/services/brainStorage.js b/server/services/brainStorage.jsindex 71b562f6db..b4f87b9037 100644--- a/server/services/brainStorage.js+++ b/server/services/brainStorage.js@@ -612,25 +612,7 @@ export async function applyRemoteRecord(type, id, record, op) {});}-/**- * Apply a remote JSONL record (digests/reviews) — dedup by ID- */-export async function applyRemoteJsonl(type, record) {- return withRemoteLock(async () => {- const records = await loadJsonlStore(type);- if (records.some(r => r.id === record.id)) {- return { applied: false, reason: 'duplicate' };- }- await ensureBrainDir();- const line = JSON.stringify(record) + '\n';- await appendFile(FILES[type], line);- caches[type].data = null;- caches[type].timestamp = 0;-- return { applied: true };- });-}/*** Backfill originInstanceId on records missing it (run once at startup)diff --git a/server/services/syncOrchestrator.js b/server/services/syncOrchestrator.jsindex db17abbead..eee29992e6 100644--- a/server/services/syncOrchestrator.js+++ b/server/services/syncOrchestrator.js@@ -127,12 +127,18 @@ export async function syncWithPeer(peer) {try {const brainResult = await syncBrainFromPeer(peer, cursor);- const memoryResult = await syncMemoryFromPeer(peer, cursor);- // Persist both cursors in a single lock acquisition+ // Save brain cursor immediately so progress is preserved if memory sync failsawait withCursors(async (cursors) => {if (!cursors[peerId]) cursors[peerId] = {};cursors[peerId].brainSeq = brainResult.brainSeq;+ cursors[peerId].lastSyncAt = new Date().toISOString();+ });++ const memoryResult = await syncMemoryFromPeer(peer, cursor);++ await withCursors(async (cursors) => {+ if (!cursors[peerId]) cursors[peerId] = {};cursors[peerId].memorySeq = memoryResult.memorySeq;cursors[peerId].lastSyncAt = new Date().toISOString();});