@mingxy/cerebro 1.5.8 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/hooks.ts +6 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingxy/cerebro",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "description": "Cerebro persistent memory plugin for OpenCode — auto-recall, auto-capture, 9 memory tools with clustering",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/hooks.ts CHANGED
@@ -334,6 +334,7 @@ export function compactingHook(client: OmemClient, containerTags: string[], tui:
334
334
  }
335
335
 
336
336
  const processedMessageIds = new Set<string>();
337
+ const pluginStartTime = Date.now();
337
338
 
338
339
  export function sessionIdleHook(
339
340
  omemClient: OmemClient,
@@ -377,6 +378,11 @@ export function sessionIdleHook(
377
378
  const msgId = msg.info?.id;
378
379
  if (!msgId || processedMessageIds.has(msgId)) continue;
379
380
 
381
+ // Skip messages created before this plugin instance started
382
+ // (prevents replaying entire session history on restart)
383
+ const msgTime = msg.info?.createdAt ? new Date(msg.info.createdAt).getTime() : 0;
384
+ if (msgTime > 0 && msgTime < pluginStartTime) continue;
385
+
380
386
  const role = msg.info?.role;
381
387
  if (role !== "user" && role !== "assistant") continue;
382
388