openclaw-memory-decay 0.1.10 → 0.1.11
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/package.json +1 -1
- package/src/index.ts +16 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -304,6 +304,22 @@ const memoryDecayPlugin = {
|
|
|
304
304
|
api.logger.error(`Auto-save failed: ${err}`);
|
|
305
305
|
}
|
|
306
306
|
});
|
|
307
|
+
|
|
308
|
+
api.on("message_sent", async (event, ctx) => {
|
|
309
|
+
const content = event.content;
|
|
310
|
+
if (!content || content.length < MIN_MESSAGE_LENGTH) return;
|
|
311
|
+
|
|
312
|
+
try {
|
|
313
|
+
await client.store({
|
|
314
|
+
text: content,
|
|
315
|
+
importance: 0.3,
|
|
316
|
+
mtype: "episode",
|
|
317
|
+
speaker: "assistant",
|
|
318
|
+
});
|
|
319
|
+
} catch (err) {
|
|
320
|
+
api.logger.error(`Auto-save failed: ${err}`);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
307
323
|
}
|
|
308
324
|
|
|
309
325
|
// Compaction: save session summary before context is compressed
|