diff --git a/v3/@claude-flow/memory/src/auto-memory-bridge.ts b/v3/@claude-flow/memory/src/auto-memory-bridge.ts index 9142cb1458..9eec1b63f3 100644 --- a/v3/@claude-flow/memory/src/auto-memory-bridge.ts +++ b/v3/@claude-flow/memory/src/auto-memory-bridge.ts @@ -200,8 +200,10 @@ export class AutoMemoryBridge extends EventEmitter { private lastSyncTime: number = 0; private syncTimer: ReturnType | null = null; private insights: MemoryInsight[] = []; - /** Track AgentDB IDs of insights already written to files during this session */ + /** Track AgentDB keys of insights already written to files during this session */ private syncedInsightKeys = new Set(); + /** Monotonic counter to prevent key collisions within the same ms */ + private insightCounter = 0; constructor(backend: IMemoryBackend, config: AutoMemoryBridgeConfig = {}) { super();