openclaw-amem 2.1.3 → 2.1.4

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.
package/dist/index.js CHANGED
@@ -3191,7 +3191,7 @@ function register(api) {
3191
3191
  logger.info(
3192
3192
  `openclaw-amem: registered (native TS, Qdrant, default agent_id=${defaultScope.agentId}, default collection=${pluginConfig.collection ?? "amem_notes (default)"}, per-agent scope resolved per call)`
3193
3193
  );
3194
- ensureCollection(pluginConfig.collection).catch((e) => {
3194
+ const checkCollection = () => ensureCollection(pluginConfig.collection).catch((e) => {
3195
3195
  if (e instanceof EmbeddingDimensionMismatchError || e instanceof EmbeddingModelMismatchError || e instanceof MixedEmbeddingModelsError) {
3196
3196
  logger.error(`openclaw-amem: memory is UNUSABLE \u2014 ${e.message}`);
3197
3197
  } else {
@@ -3614,56 +3614,53 @@ ${text}${hookWarning}` }],
3614
3614
  );
3615
3615
  logger.info("openclaw-amem: agent_end CRUD decision hook registered");
3616
3616
  }
3617
- scheduleNightly(
3618
- () => runNightly({
3619
- owedFile,
3620
- defaultAgent: resolveAgentId2(),
3621
- mergeDay: async (rawAgentId, day) => {
3622
- const scope = buildScope2(rawAgentId);
3623
- const merged = await mergeSimilarNotes(scope.agentId, scope.storageCtx, day);
3624
- if (merged > 0) logger.info(`openclaw-amem: merged ${merged} similar notes (${scope.agentId}, ${day})`);
3617
+ const nightlyJob = () => runNightly({
3618
+ owedFile,
3619
+ defaultAgent: resolveAgentId2(),
3620
+ mergeDay: async (rawAgentId, day) => {
3621
+ const scope = buildScope2(rawAgentId);
3622
+ const merged = await mergeSimilarNotes(scope.agentId, scope.storageCtx, day);
3623
+ if (merged > 0) logger.info(`openclaw-amem: merged ${merged} similar notes (${scope.agentId}, ${day})`);
3624
+ },
3625
+ after: [
3626
+ {
3627
+ name: "consolidation",
3628
+ run: async () => {
3629
+ logger.info("openclaw-amem: Running scheduled daily consolidation...");
3630
+ const merged = await consolidateMemories(defaultScope.agentId, logger, defaultScope.storageCtx);
3631
+ if (merged > 0) {
3632
+ logger.info(`openclaw-amem: Scheduled daily consolidation merged ${merged} pairs.`);
3633
+ }
3634
+ }
3625
3635
  },
3626
- after: [
3636
+ // Story 43: the cold half of the tiering split. The per-turn CRUD decision
3637
+ // runs on the fast model, which is safe but misses contradictions; this is
3638
+ // what catches them. Runs AFTER consolidation, as its own step, so neither
3639
+ // task can take the other down.
3640
+ //
3641
+ // Only batches that gained a note since the last run are re-read, so a
3642
+ // steady-state night costs a call or two rather than a full re-read.
3643
+ ...conflictSweepEnabled ? [
3627
3644
  {
3628
- name: "consolidation",
3645
+ name: "contradiction sweep",
3629
3646
  run: async () => {
3630
- logger.info("openclaw-amem: Running scheduled daily consolidation...");
3631
- const merged = await consolidateMemories(defaultScope.agentId, logger, defaultScope.storageCtx);
3632
- if (merged > 0) {
3633
- logger.info(`openclaw-amem: Scheduled daily consolidation merged ${merged} pairs.`);
3634
- }
3635
- }
3636
- },
3637
- // Story 43: the cold half of the tiering split. The per-turn CRUD decision
3638
- // runs on the fast model, which is safe but misses contradictions; this is
3639
- // what catches them. Runs AFTER consolidation, as its own step, so neither
3640
- // task can take the other down.
3641
- //
3642
- // Only batches that gained a note since the last run are re-read, so a
3643
- // steady-state night costs a call or two rather than a full re-read.
3644
- ...conflictSweepEnabled ? [
3645
- {
3646
- name: "contradiction sweep",
3647
- run: async () => {
3648
- const res = await conflictSweep(defaultScope.agentId, {
3649
- storageCtx: defaultScope.storageCtx,
3650
- logger
3651
- });
3652
- if (res.pairsFound > 0) {
3653
- logger.info(
3654
- `openclaw-amem: Contradiction sweep flagged ${res.pairsFound} pair(s)` + (res.retired > 0 ? `, retired ${res.retired}` : "") + ` (${res.batchesScanned} batch(es) read, ${res.batchesSkipped} unchanged).`
3655
- );
3656
- }
3647
+ const res = await conflictSweep(defaultScope.agentId, {
3648
+ storageCtx: defaultScope.storageCtx,
3649
+ logger
3650
+ });
3651
+ if (res.pairsFound > 0) {
3652
+ logger.info(
3653
+ `openclaw-amem: Contradiction sweep flagged ${res.pairsFound} pair(s)` + (res.retired > 0 ? `, retired ${res.retired}` : "") + ` (${res.batchesScanned} batch(es) read, ${res.batchesSkipped} unchanged).`
3654
+ );
3657
3655
  }
3658
3656
  }
3659
- ] : []
3660
- ],
3661
- inBackground: (work) => runInBackground(busySinceNow(), work),
3662
- preempted: (err) => err instanceof BackgroundPreempted,
3663
- logger
3664
- }),
3665
- (err) => logger.warn(`openclaw-amem: nightly job failed \u2014 ${err.message}`)
3666
- );
3657
+ }
3658
+ ] : []
3659
+ ],
3660
+ inBackground: (work) => runInBackground(busySinceNow(), work),
3661
+ preempted: (err) => err instanceof BackgroundPreempted,
3662
+ logger
3663
+ });
3667
3664
  if (typeof api.registerService === "function") {
3668
3665
  api.registerService({
3669
3666
  id: "amem-plugin",
@@ -3676,6 +3673,11 @@ ${text}${hookWarning}` }],
3676
3673
  "openclaw-amem: this OpenClaw does not report runs to plugins, so the nightly job cannot wait for them"
3677
3674
  );
3678
3675
  }
3676
+ scheduleNightly(
3677
+ nightlyJob,
3678
+ (err) => logger.warn(`openclaw-amem: nightly job failed \u2014 ${err.message}`)
3679
+ );
3680
+ void checkCollection();
3679
3681
  logger.info(`openclaw-amem: started (backend: amem-qdrant, default agentId: ${defaultScope.agentId})`);
3680
3682
  },
3681
3683
  stop() {
@@ -3,7 +3,7 @@
3
3
  "name": "amem",
4
4
  "description": "Catches memories that contradict each other. Notes rewrite themselves as new ones arrive, link into a graph, and stay separated per agent and per person. Runs on a small model. Requires a local Qdrant. 中文走 jieba 分词,提示词有中文版。",
5
5
  "icon": "https://amem.owo.lc/logo.png",
6
- "version": "2.1.3",
6
+ "version": "2.1.4",
7
7
  "kind": "memory",
8
8
  "contracts": {
9
9
  "tools": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-amem",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Catches memories that contradict each other. Notes rewrite themselves as new ones arrive, link into a graph, and stay separated per agent and per person. Runs on a small model. Requires a local Qdrant. 中文走 jieba 分词,提示词有中文版。",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@anthropic-ai/sdk": "^0.126.0",
19
+ "@anthropic-ai/sdk": "^0.127.0",
20
20
  "@huggingface/transformers": "^4.2.0",
21
21
  "@node-rs/jieba": "^2.0.1",
22
22
  "@qdrant/js-client-rest": "^1.18.0",