@unblocklabs/unblock-memory 0.2.3 → 0.2.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/README.md +12 -5
- package/dist/src/config.d.ts +1 -0
- package/dist/src/config.js +9 -5
- package/dist/src/manager.d.ts +1 -0
- package/dist/src/manager.js +4 -0
- package/dist/src/plugin.js +16 -2
- package/dist/src/runtime.d.ts +5 -1
- package/dist/src/runtime.js +6 -3
- package/openclaw.plugin.json +9 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Workspace-native memory for OpenClaw, powered internally by `@unblocklabs/qmd`.
|
|
4
4
|
It keeps one warm QMD store per agent and exposes the standard `memory_search`
|
|
5
|
-
and `memory_get` tools. Search uses semantic chunking v2 and QMD
|
|
6
|
-
a reranker.
|
|
5
|
+
and `memory_get` tools. Search uses semantic chunking v2 and direct QMD vector
|
|
6
|
+
search without query expansion or a reranker, so only the embedding model loads.
|
|
7
7
|
|
|
8
8
|
Optional memory analysis uses those same stored vectors in the same SQLite
|
|
9
9
|
index. It does not re-embed memory, copy vectors, or create another database.
|
|
@@ -39,6 +39,8 @@ directories, or globs into named corpora:
|
|
|
39
39
|
entries: {
|
|
40
40
|
"unblock-memory": {
|
|
41
41
|
config: {
|
|
42
|
+
// Default: avoid repeated model cold starts after idle periods.
|
|
43
|
+
keepEmbeddingModelWarm: true,
|
|
42
44
|
corpora: [
|
|
43
45
|
{
|
|
44
46
|
name: "memory",
|
|
@@ -73,6 +75,10 @@ omitted, the plugin creates a `memory` corpus containing `MEMORY.md`, `USER.md`,
|
|
|
73
75
|
and `memory/**/*.md`. Explicit configuration must include exactly one `memory`
|
|
74
76
|
corpus; other unique names may be added for custom material.
|
|
75
77
|
|
|
78
|
+
`keepEmbeddingModelWarm` defaults to `true`, keeping the embedding model and
|
|
79
|
+
context resident after first use. Set it to `false` to restore QMD's five-minute
|
|
80
|
+
idle unload behavior.
|
|
81
|
+
|
|
76
82
|
`memory_search` searches every configured corpus by default. Pass
|
|
77
83
|
`corpora: ["projects"]` to search selected corpora or `corpora: ["all"]` to
|
|
78
84
|
request all of them explicitly. Search results include their corpus name and
|
|
@@ -107,9 +113,10 @@ channel and group conversations; add `direct` explicitly to include DMs. Run
|
|
|
107
113
|
check its progress or result. Projections are private derived Markdown
|
|
108
114
|
under the agent's `unblock-memory/sessions` state directory and can be rebuilt
|
|
109
115
|
from OpenClaw at any time. Session results include provider, chat type,
|
|
110
|
-
conversation identity, and start time
|
|
111
|
-
clustering index as file memory. This phase does not sync
|
|
112
|
-
on a schedule; refreshes are manual through
|
|
116
|
+
conversation identity, and start time as an ISO 8601 timestamp. They participate
|
|
117
|
+
in the same search and clustering index as file memory. This phase does not sync
|
|
118
|
+
sessions at startup or on a schedule; refreshes are manual through
|
|
119
|
+
`memory_sync_sessions`.
|
|
113
120
|
|
|
114
121
|
Indexes live at `~/.openclaw/agents/<agentId>/unblock-memory/index.sqlite` (or the
|
|
115
122
|
equivalent configured OpenClaw state directory). The first lookup builds the
|
package/dist/src/config.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export type CorpusConfig = FileCorpusConfig | SessionCorpusConfig;
|
|
|
14
14
|
export declare const DEFAULT_CORPORA: readonly FileCorpusConfig[];
|
|
15
15
|
export type UnblockMemoryConfig = {
|
|
16
16
|
corpora: readonly CorpusConfig[];
|
|
17
|
+
keepEmbeddingModelWarm: boolean;
|
|
17
18
|
analysis: {
|
|
18
19
|
executable?: string;
|
|
19
20
|
};
|
package/dist/src/config.js
CHANGED
|
@@ -65,16 +65,20 @@ function resolveCorpora(value) {
|
|
|
65
65
|
}
|
|
66
66
|
export function resolveConfig(value) {
|
|
67
67
|
if (value === undefined || value === null) {
|
|
68
|
-
return { corpora: DEFAULT_CORPORA, analysis: {} };
|
|
68
|
+
return { corpora: DEFAULT_CORPORA, keepEmbeddingModelWarm: true, analysis: {} };
|
|
69
69
|
}
|
|
70
70
|
if (typeof value !== "object" || Array.isArray(value)) {
|
|
71
71
|
throw new Error("unblock-memory config must be an object");
|
|
72
72
|
}
|
|
73
73
|
const config = value;
|
|
74
|
-
assertOnlyKeys(config, ["corpora", "analysis"], "config");
|
|
74
|
+
assertOnlyKeys(config, ["corpora", "keepEmbeddingModelWarm", "analysis"], "config");
|
|
75
75
|
const corpora = resolveCorpora(config.corpora);
|
|
76
|
+
if (config.keepEmbeddingModelWarm !== undefined && typeof config.keepEmbeddingModelWarm !== "boolean") {
|
|
77
|
+
throw new Error("unblock-memory keepEmbeddingModelWarm must be a boolean");
|
|
78
|
+
}
|
|
79
|
+
const keepEmbeddingModelWarm = config.keepEmbeddingModelWarm ?? true;
|
|
76
80
|
if (config.analysis === undefined)
|
|
77
|
-
return { corpora, analysis: {} };
|
|
81
|
+
return { corpora, keepEmbeddingModelWarm, analysis: {} };
|
|
78
82
|
if (!config.analysis || typeof config.analysis !== "object" || Array.isArray(config.analysis)) {
|
|
79
83
|
throw new Error("unblock-memory analysis must be an object");
|
|
80
84
|
}
|
|
@@ -82,9 +86,9 @@ export function resolveConfig(value) {
|
|
|
82
86
|
assertOnlyKeys(analysis, ["executable"], "analysis");
|
|
83
87
|
const configured = analysis.executable;
|
|
84
88
|
if (configured === undefined)
|
|
85
|
-
return { corpora, analysis: {} };
|
|
89
|
+
return { corpora, keepEmbeddingModelWarm, analysis: {} };
|
|
86
90
|
if (typeof configured !== "string" || !configured.trim() || !isAbsolute(configured.trim())) {
|
|
87
91
|
throw new Error("unblock-memory analysis.executable must be an absolute non-empty path");
|
|
88
92
|
}
|
|
89
|
-
return { corpora, analysis: { executable: configured.trim() } };
|
|
93
|
+
return { corpora, keepEmbeddingModelWarm, analysis: { executable: configured.trim() } };
|
|
90
94
|
}
|
package/dist/src/manager.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare class QmdMemoryManager implements MemorySearchManagerContract {
|
|
|
31
31
|
workspaceDir: string;
|
|
32
32
|
sources: readonly ResolvedSource[];
|
|
33
33
|
storeFactory?: () => Promise<ManagerStore>;
|
|
34
|
+
keepModelsWarm?: boolean;
|
|
34
35
|
analysisExecutable?: string;
|
|
35
36
|
analysisRunner?: AnalysisRunner;
|
|
36
37
|
sessions?: ManagerSessionConfig;
|
package/dist/src/manager.js
CHANGED
|
@@ -137,6 +137,7 @@ export class QmdMemoryManager {
|
|
|
137
137
|
#workspaceDir;
|
|
138
138
|
#sources;
|
|
139
139
|
#storeFactory;
|
|
140
|
+
#keepModelsWarm;
|
|
140
141
|
#analysisExecutable;
|
|
141
142
|
#analysisRunner;
|
|
142
143
|
#sessions;
|
|
@@ -157,6 +158,7 @@ export class QmdMemoryManager {
|
|
|
157
158
|
this.#workspaceDir = params.workspaceDir;
|
|
158
159
|
this.#sources = new Map(params.sources.map((source) => [source.collection, source]));
|
|
159
160
|
this.#storeFactory = params.storeFactory;
|
|
161
|
+
this.#keepModelsWarm = params.keepModelsWarm ?? true;
|
|
160
162
|
this.#analysisExecutable = params.analysisExecutable;
|
|
161
163
|
this.#analysisRunner = params.analysisRunner ?? runAnalysisWorker;
|
|
162
164
|
this.#sessions = params.sessions;
|
|
@@ -240,6 +242,7 @@ export class QmdMemoryManager {
|
|
|
240
242
|
const { createStore } = await qmdModule;
|
|
241
243
|
const store = await createStore({
|
|
242
244
|
dbPath: this.#dbPath,
|
|
245
|
+
keepModelsWarm: this.#keepModelsWarm,
|
|
243
246
|
config: {
|
|
244
247
|
collections: Object.fromEntries([...this.#sources.values()].map((source) => [
|
|
245
248
|
source.collection,
|
|
@@ -436,6 +439,7 @@ export class QmdMemoryManager {
|
|
|
436
439
|
limit: opts?.maxResults ?? 5,
|
|
437
440
|
minScore: opts?.minScore ?? 0.3,
|
|
438
441
|
allowedPaths,
|
|
442
|
+
expand: false,
|
|
439
443
|
});
|
|
440
444
|
return hits.flatMap((hit) => {
|
|
441
445
|
const collection = /^qmd:\/\/([^/]+)\//.exec(hit.file)?.[1];
|
package/dist/src/plugin.js
CHANGED
|
@@ -58,7 +58,18 @@ function createSearchTool(runtime, ctx) {
|
|
|
58
58
|
minScore,
|
|
59
59
|
signal,
|
|
60
60
|
});
|
|
61
|
-
return jsonResult({
|
|
61
|
+
return jsonResult({
|
|
62
|
+
results: results.map((result) => result.session
|
|
63
|
+
? {
|
|
64
|
+
...result,
|
|
65
|
+
session: {
|
|
66
|
+
...result.session,
|
|
67
|
+
startedAt: new Date(result.session.startedAt).toISOString(),
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
: result),
|
|
71
|
+
provider: "unblock-memory",
|
|
72
|
+
});
|
|
62
73
|
},
|
|
63
74
|
};
|
|
64
75
|
}
|
|
@@ -272,7 +283,10 @@ export function resolveFlushPlan(params = {}) {
|
|
|
272
283
|
}
|
|
273
284
|
export function registerUnblockMemory(api) {
|
|
274
285
|
const config = resolveConfig(api.pluginConfig);
|
|
275
|
-
const runtime = new QmdMemoryRuntime(config.corpora,
|
|
286
|
+
const runtime = new QmdMemoryRuntime(config.corpora, {
|
|
287
|
+
analysisExecutable: config.analysis.executable,
|
|
288
|
+
keepEmbeddingModelWarm: config.keepEmbeddingModelWarm,
|
|
289
|
+
});
|
|
276
290
|
const capability = {
|
|
277
291
|
deterministicRecallToolName: "memory_search",
|
|
278
292
|
supportsPrivateTranscriptRecall: false,
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -40,7 +40,11 @@ type StoredRunningSessionSync = Extract<StoredSessionSyncStatus, {
|
|
|
40
40
|
export declare function recoverInterruptedSessionSync(directory: string, statusPath: string, stale: StoredRunningSessionSync): Promise<SessionSyncStatus>;
|
|
41
41
|
export declare class QmdMemoryRuntime implements MemoryPluginRuntimeContract {
|
|
42
42
|
#private;
|
|
43
|
-
constructor(corpora: readonly CorpusConfig[],
|
|
43
|
+
constructor(corpora: readonly CorpusConfig[], options?: {
|
|
44
|
+
analysisExecutable?: string;
|
|
45
|
+
keepEmbeddingModelWarm?: boolean;
|
|
46
|
+
stateRoot?: string;
|
|
47
|
+
});
|
|
44
48
|
getMemorySearchManager(params: {
|
|
45
49
|
cfg: OpenClawConfig;
|
|
46
50
|
agentId: string;
|
package/dist/src/runtime.js
CHANGED
|
@@ -65,12 +65,14 @@ export async function recoverInterruptedSessionSync(directory, statusPath, stale
|
|
|
65
65
|
export class QmdMemoryRuntime {
|
|
66
66
|
#corpora;
|
|
67
67
|
#analysisExecutable;
|
|
68
|
+
#keepEmbeddingModelWarm;
|
|
68
69
|
#stateRoot;
|
|
69
70
|
#managers = new Map();
|
|
70
|
-
constructor(corpora,
|
|
71
|
+
constructor(corpora, options = {}) {
|
|
71
72
|
this.#corpora = corpora;
|
|
72
|
-
this.#analysisExecutable = analysisExecutable;
|
|
73
|
-
this.#
|
|
73
|
+
this.#analysisExecutable = options.analysisExecutable;
|
|
74
|
+
this.#keepEmbeddingModelWarm = options.keepEmbeddingModelWarm ?? true;
|
|
75
|
+
this.#stateRoot = options.stateRoot ?? resolveStateDir();
|
|
74
76
|
}
|
|
75
77
|
async getMemorySearchManager(params) {
|
|
76
78
|
let pending = this.#managers.get(params.agentId);
|
|
@@ -203,6 +205,7 @@ export class QmdMemoryRuntime {
|
|
|
203
205
|
workspaceDir,
|
|
204
206
|
dbPath: join(stateDir, "index.sqlite"),
|
|
205
207
|
sources,
|
|
208
|
+
keepModelsWarm: this.#keepEmbeddingModelWarm,
|
|
206
209
|
analysisExecutable: this.#analysisExecutable,
|
|
207
210
|
...(sessionCorpus && sessionSource ? {
|
|
208
211
|
sessions: {
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "unblock-memory",
|
|
3
3
|
"name": "Unblock Memory",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
5
|
"description": "Indexes, retrieves, and analyzes configured workspace memory with existing QMD vectors.",
|
|
6
6
|
"kind": "memory",
|
|
7
7
|
"activation": { "onStartup": false },
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"memory_fetch_cluster": { "replaySafe": true }
|
|
15
15
|
},
|
|
16
16
|
"uiHints": {
|
|
17
|
+
"keepEmbeddingModelWarm": {
|
|
18
|
+
"label": "Keep Embedding Model Warm",
|
|
19
|
+
"help": "Keep the QMD embedding model resident after first use. Disable to unload it after five minutes without model activity."
|
|
20
|
+
},
|
|
17
21
|
"corpora": {
|
|
18
22
|
"label": "Memory Corpora",
|
|
19
23
|
"help": "Named groups of exact Markdown files, directories, or globs. Relative paths resolve from each agent workspace."
|
|
@@ -27,6 +31,10 @@
|
|
|
27
31
|
"type": "object",
|
|
28
32
|
"additionalProperties": false,
|
|
29
33
|
"properties": {
|
|
34
|
+
"keepEmbeddingModelWarm": {
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"default": true
|
|
37
|
+
},
|
|
30
38
|
"corpora": {
|
|
31
39
|
"type": "array",
|
|
32
40
|
"minItems": 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unblocklabs/unblock-memory",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Workspace-native memory for OpenClaw, powered by QMD",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"preflight": "npm run knip && npm run build && npm run typecheck && npm test && npm run plugin:inspect && npm run plugin:inspect:runtime && npm pack --dry-run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@unblocklabs/qmd": "https://github.com/unblocklabs-ai/qmd/releases/download/v2.9.
|
|
33
|
+
"@unblocklabs/qmd": "https://github.com/unblocklabs-ai/qmd/releases/download/v2.9.2/unblocklabs-qmd-2.9.2.tgz",
|
|
34
34
|
"chokidar": "5.0.0",
|
|
35
35
|
"picomatch": "^4.0.5",
|
|
36
36
|
"typebox": "1.3.6"
|