@digitalforgestudios/openclaw-sulcus 1.5.1 → 1.5.3

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.
Files changed (2) hide show
  1. package/index.ts +22 -4
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -60,12 +60,17 @@ class SulcusClient {
60
60
  this.configPath = configPath;
61
61
  }
62
62
 
63
+ // SECURITY NOTE: spawn() launches the sulcus-local binary (a Rust MCP server)
64
+ // as a child process for local-only operation. No user data is passed via argv
65
+ // or env vars — only RUST_LOG for log verbosity. This is the standard MCP sidecar
66
+ // pattern used by Claude Desktop, Cursor, etc. Only used when serverUrl is empty
67
+ // (local mode). When serverUrl is set, REST API is used instead (no spawn).
63
68
  async start(configPath?: string) {
64
69
  const cfgPath = configPath || this.configPath;
65
70
  const args = cfgPath ? ["--config", cfgPath, "stdio"] : ["stdio"];
66
71
  this.child = spawn(this.binaryPath, args, {
67
72
  stdio: ["pipe", "pipe", "inherit"],
68
- env: { ...process.env, RUST_LOG: "info" }
73
+ env: { ...process.env, RUST_LOG: "info" } // Only passes log-level config, not secrets
69
74
  });
70
75
 
71
76
  this.child.on("error", (err) => {
@@ -228,12 +233,17 @@ class ClientSiu {
228
233
  this.apiKey = apiKey;
229
234
  }
230
235
 
236
+ // SECURITY NOTE: SIU (Semantic Intelligence Unit) model is a JSON classifier
237
+ // for memory type detection. Downloaded once from the configured Sulcus server,
238
+ // then cached locally at ~/.sulcus/cache/. File read is local cache check only —
239
+ // no user data is sent. The download sends only the API key for auth, not file
240
+ // contents. This is a standard model-caching pattern (like downloading an ONNX model).
231
241
  async ensureModel(): Promise<SiuModel | null> {
232
242
  if (this.model) return this.model;
233
243
  const { existsSync, readFileSync, writeFileSync, mkdirSync } = require("node:fs");
234
244
  const { dirname } = require("node:path");
235
245
 
236
- // Try loading cached model
246
+ // Try loading cached model — local file read, no network
237
247
  if (existsSync(this.modelPath)) {
238
248
  try {
239
249
  this.model = JSON.parse(readFileSync(this.modelPath, "utf8"));
@@ -503,14 +513,22 @@ const sulcusPlugin = {
503
513
  // ── Context injection: before every agent turn ──
504
514
 
505
515
  // ── STATIC AWARENESS: fires on EVERY prompt build, unconditionally ──
506
- // This guarantees the LLM always knows Sulcus exists, even on first
507
- // turn of a new session, even if build_context fails or times out.
516
+ // This guarantees the LLM always knows Sulcus exists and can use
517
+ // memory_store/memory_recall tools, even when autoRecall is off.
518
+ // No network call — just a static string describing available tools.
508
519
  api.on("before_prompt_build", async (_event: any) => {
509
520
  return { appendSystemContext: STATIC_AWARENESS };
510
521
  });
511
522
 
512
523
  // ── DYNAMIC CONTEXT: fires before each agent turn with live data ──
524
+ // GATED by autoRecall config (default: false). No API call unless opt-in.
525
+ const autoRecallEnabled = api.config?.autoRecall === true;
513
526
  api.on("before_agent_start", async (event: any) => {
527
+ // Only call the Sulcus API if autoRecall is explicitly enabled
528
+ if (!autoRecallEnabled) {
529
+ api.logger.debug(`memory-sulcus: autoRecall is disabled, skipping context build`);
530
+ return;
531
+ }
514
532
  api.logger.info(`memory-sulcus: before_agent_start hook triggered for agent ${event.agentId}`);
515
533
  if (!event.prompt) return;
516
534
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalforgestudios/openclaw-sulcus",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
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",