openclaw-memory-hierarchical 0.3.0 → 0.3.1
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/worker.ts +20 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-memory-hierarchical",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Hierarchical (2048-style) autobiographical memory plugin for OpenClaw. Continuously summarizes conversations into layered first-person memories (L1 → L2 → L3).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
package/worker.ts
CHANGED
|
@@ -197,24 +197,29 @@ async function runWorkerWithLock(params: {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
// Phase 2:
|
|
200
|
+
// Phase 2: Merge until no more merges are possible at any level.
|
|
201
|
+
// Loop because a batch of L1→L2 merges may trigger L2→L3 merges.
|
|
201
202
|
let mergesPerformed = 0;
|
|
203
|
+
let didMerge = true;
|
|
204
|
+
while (didMerge && !signal?.aborted) {
|
|
205
|
+
didMerge = false;
|
|
206
|
+
for (const level of ["L1", "L2"] as const) {
|
|
207
|
+
if (signal?.aborted) {
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
202
210
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
level,
|
|
211
|
-
memoryConfig,
|
|
212
|
-
summarization,
|
|
213
|
-
agentId,
|
|
214
|
-
});
|
|
211
|
+
const merged = await maybeMergeLevel({
|
|
212
|
+
index,
|
|
213
|
+
level,
|
|
214
|
+
memoryConfig,
|
|
215
|
+
summarization,
|
|
216
|
+
agentId,
|
|
217
|
+
});
|
|
215
218
|
|
|
216
|
-
|
|
217
|
-
|
|
219
|
+
if (merged) {
|
|
220
|
+
mergesPerformed++;
|
|
221
|
+
didMerge = true;
|
|
222
|
+
}
|
|
218
223
|
}
|
|
219
224
|
}
|
|
220
225
|
|