@digitalforgestudios/openclaw-sulcus 3.2.0 → 3.2.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/index.ts +23 -23
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -95,11 +95,11 @@ const hookHandlers: Record<string, HookHandler> = {
|
|
|
95
95
|
auto_recall: async (event: any, config: HookConfig, ctx: HookHandlerCtx) => {
|
|
96
96
|
const { sulcusMem, namespace, logger } = ctx;
|
|
97
97
|
if (!sulcusMem) return;
|
|
98
|
-
logger.info(`
|
|
98
|
+
logger.info(`sulcus: before_agent_start hook triggered for agent ${event.agentId}`);
|
|
99
99
|
if (!event.prompt) return;
|
|
100
100
|
try {
|
|
101
101
|
const limit = config.limit ?? 5;
|
|
102
|
-
logger.debug(`
|
|
102
|
+
logger.debug(`sulcus: searching context for prompt: ${event.prompt.substring(0, 50)}...`);
|
|
103
103
|
const res = await sulcusMem.search_memory(event.prompt, limit);
|
|
104
104
|
const results = res?.results ?? [];
|
|
105
105
|
if (!results || results.length === 0) {
|
|
@@ -110,11 +110,11 @@ const hookHandlers: Record<string, HookHandler> = {
|
|
|
110
110
|
` <memory id="${r.id}" heat="${(r.current_heat ?? r.score ?? 0).toFixed(2)}" type="${r.memory_type ?? "unknown"}">${r.label ?? r.pointer_summary ?? ""}</memory>`
|
|
111
111
|
).join("\n");
|
|
112
112
|
const context = `<sulcus_context token_budget="500" namespace="${namespace}">\n${items}\n</sulcus_context>`;
|
|
113
|
-
logger.info(`
|
|
113
|
+
logger.info(`sulcus: injecting ${results.length} recalled memories (${context.length} chars)`);
|
|
114
114
|
return { prependSystemContext: context };
|
|
115
115
|
} catch (e) {
|
|
116
116
|
// build_context failed — inject fallback so the LLM isn't flying blind
|
|
117
|
-
logger.warn(`
|
|
117
|
+
logger.warn(`sulcus: context build failed: ${e} — injecting fallback awareness`);
|
|
118
118
|
return { prependSystemContext: FALLBACK_AWARENESS };
|
|
119
119
|
}
|
|
120
120
|
},
|
|
@@ -124,7 +124,7 @@ const hookHandlers: Record<string, HookHandler> = {
|
|
|
124
124
|
* (e.g., agent_end where we want to log but not auto-record).
|
|
125
125
|
*/
|
|
126
126
|
none: async (event: any, _config: HookConfig, ctx: HookHandlerCtx) => {
|
|
127
|
-
ctx.logger.debug(`
|
|
127
|
+
ctx.logger.debug(`sulcus: hook fired (action=none) for agent ${event.agentId ?? "(unknown)"} (no-op)`);
|
|
128
128
|
},
|
|
129
129
|
};
|
|
130
130
|
|
|
@@ -160,19 +160,19 @@ class NativeLibLoader {
|
|
|
160
160
|
this.koffi = require("koffi");
|
|
161
161
|
} catch (e: any) {
|
|
162
162
|
this.error = `koffi not available: ${e.message}`;
|
|
163
|
-
logger.warn(`
|
|
163
|
+
logger.warn(`sulcus: ${this.error}`);
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// ── Load libsulcus_store.dylib ──
|
|
168
168
|
if (!existsSync(this.storeLibPath)) {
|
|
169
169
|
this.error = `libsulcus_store not found at ${this.storeLibPath}`;
|
|
170
|
-
logger.warn(`
|
|
170
|
+
logger.warn(`sulcus: ${this.error}`);
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
if (!existsSync(this.vectorsLibPath)) {
|
|
174
174
|
this.error = `libsulcus_vectors not found at ${this.vectorsLibPath}`;
|
|
175
|
-
logger.warn(`
|
|
175
|
+
logger.warn(`sulcus: ${this.error}`);
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -183,7 +183,7 @@ class NativeLibLoader {
|
|
|
183
183
|
this.fn_store_free = this.storeLib.func("sulcus_store_free_string", "void", ["char*"]);
|
|
184
184
|
} catch (e: any) {
|
|
185
185
|
this.error = `Failed to load libsulcus_store: ${e.message}`;
|
|
186
|
-
logger.warn(`
|
|
186
|
+
logger.warn(`sulcus: ${this.error}`);
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -194,7 +194,7 @@ class NativeLibLoader {
|
|
|
194
194
|
this.fn_vectors_free = this.vectorsLib.func("sulcus_vectors_free_string", "void", ["char*"]);
|
|
195
195
|
} catch (e: any) {
|
|
196
196
|
this.error = `Failed to load libsulcus_vectors: ${e.message}`;
|
|
197
|
-
logger.warn(`
|
|
197
|
+
logger.warn(`sulcus: ${this.error}`);
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
200
|
|
|
@@ -205,12 +205,12 @@ class NativeLibLoader {
|
|
|
205
205
|
const rc = this.fn_store_init(dataDir, port);
|
|
206
206
|
if (rc !== 0) {
|
|
207
207
|
this.error = `sulcus_store_init returned ${rc}`;
|
|
208
|
-
logger.warn(`
|
|
208
|
+
logger.warn(`sulcus: ${this.error}`);
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
211
|
} catch (e: any) {
|
|
212
212
|
this.error = `sulcus_store_init failed: ${e.message}`;
|
|
213
|
-
logger.warn(`
|
|
213
|
+
logger.warn(`sulcus: ${this.error}`);
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -219,12 +219,12 @@ class NativeLibLoader {
|
|
|
219
219
|
this.vectorsHandle = this.fn_vectors_create();
|
|
220
220
|
} catch (e: any) {
|
|
221
221
|
this.error = `sulcus_vectors_create failed: ${e.message}`;
|
|
222
|
-
logger.warn(`
|
|
222
|
+
logger.warn(`sulcus: ${this.error}`);
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
this.loaded = true;
|
|
227
|
-
logger.info(`
|
|
227
|
+
logger.info(`sulcus: native libs loaded (store: ${this.storeLibPath}, vectors: ${this.vectorsLibPath})`);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
// queryFn: async (sql: string, params: any[]) => any[]
|
|
@@ -414,7 +414,7 @@ const toolDefinitions: Record<string, ToolDefinition> = {
|
|
|
414
414
|
async (_id: string, params: any) => {
|
|
415
415
|
// Pre-send junk filter
|
|
416
416
|
if (isJunkMemory(params.content)) {
|
|
417
|
-
logger.debug(`
|
|
417
|
+
logger.debug(`sulcus: filtered junk memory: "${(params.content || "").substring(0, 50)}..."`);
|
|
418
418
|
return {
|
|
419
419
|
content: [{ type: "text", text: `Filtered: content looks like system noise, not a meaningful memory.` }],
|
|
420
420
|
details: { filtered: true, reason: "junk_pattern" }
|
|
@@ -580,7 +580,7 @@ const toolDefinitions: Record<string, ToolDefinition> = {
|
|
|
580
580
|
// ─── PLUGIN ──────────────────────────────────────────────────────────────────
|
|
581
581
|
|
|
582
582
|
const sulcusPlugin = {
|
|
583
|
-
id: "
|
|
583
|
+
id: "openclaw-sulcus",
|
|
584
584
|
name: "Sulcus vMMU",
|
|
585
585
|
description: "Sulcus-backed vMMU memory for OpenClaw — thermodynamic decay, reactive triggers, local-first",
|
|
586
586
|
kind: "memory" as const,
|
|
@@ -632,16 +632,16 @@ const sulcusPlugin = {
|
|
|
632
632
|
const embedFn = nativeLoader.makeEmbedFn();
|
|
633
633
|
sulcusMem = SulcusMem.create(queryFn, embedFn);
|
|
634
634
|
backendMode = "wasm";
|
|
635
|
-
api.logger.info(`
|
|
635
|
+
api.logger.info(`sulcus: SulcusMem created via WASM (wasm: ${wasmJsPath})`);
|
|
636
636
|
} catch (e: any) {
|
|
637
|
-
api.logger.warn(`
|
|
637
|
+
api.logger.warn(`sulcus: WASM load failed: ${e.message}`);
|
|
638
638
|
backendMode = "unavailable";
|
|
639
639
|
}
|
|
640
640
|
} else {
|
|
641
|
-
api.logger.warn(`
|
|
641
|
+
api.logger.warn(`sulcus: WASM module not found at ${wasmJsPath}`);
|
|
642
642
|
}
|
|
643
643
|
} else {
|
|
644
|
-
api.logger.warn(`
|
|
644
|
+
api.logger.warn(`sulcus: native libs unavailable — ${nativeLoader.error}`);
|
|
645
645
|
}
|
|
646
646
|
|
|
647
647
|
const isAvailable = sulcusMem !== null;
|
|
@@ -649,7 +649,7 @@ const sulcusPlugin = {
|
|
|
649
649
|
// Update static awareness with runtime info
|
|
650
650
|
STATIC_AWARENESS = buildStaticAwareness(backendMode, namespace);
|
|
651
651
|
|
|
652
|
-
api.logger.info(`
|
|
652
|
+
api.logger.info(`sulcus: registered (backend: ${backendMode}, namespace: ${namespace}, available: ${isAvailable})`);
|
|
653
653
|
|
|
654
654
|
// ── Shared deps for tool executors ──
|
|
655
655
|
const toolDeps: ToolDeps = {
|
|
@@ -683,7 +683,7 @@ const sulcusPlugin = {
|
|
|
683
683
|
if (handler) {
|
|
684
684
|
api.on(hookName, (event: any) => handler(event, hookConfig, handlerCtx));
|
|
685
685
|
} else {
|
|
686
|
-
api.logger.warn(`
|
|
686
|
+
api.logger.warn(`sulcus: unknown hook action "${hookConfig.action}" for hook "${hookName}"`);
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
|
|
@@ -700,7 +700,7 @@ const sulcusPlugin = {
|
|
|
700
700
|
};
|
|
701
701
|
api.registerTool(schema, toolDef.options);
|
|
702
702
|
} else {
|
|
703
|
-
api.logger.warn(`
|
|
703
|
+
api.logger.warn(`sulcus: unknown tool "${toolName}" in config — skipping`);
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalforgestudios/openclaw-sulcus",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Sulcus — reactive, thermodynamic memory plugin for OpenClaw. Opt-in persistent memory with heat-based decay, semantic search, and cross-agent sync. Auto-recall and auto-capture disabled by default.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openclaw",
|