@prom.codes/memory-mcp 0.11.3 → 0.11.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.
Files changed (2) hide show
  1. package/dist/bin.js +51 -19
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -34,11 +34,43 @@ var LANGUAGE_IDS = [
34
34
  ];
35
35
 
36
36
  // ../shared/dist/update-check.js
37
+ import { exec } from "node:child_process";
37
38
  import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
38
39
  import { homedir } from "node:os";
39
40
  import { join } from "node:path";
40
41
  import { fileURLToPath } from "node:url";
41
- var UPGRADE_COMMAND = "npm install -g @prom.codes/context-mcp @prom.codes/memory-mcp @prom.codes/saver --ignore-scripts=false --foreground-scripts";
42
+ var UPGRADE_BASE = "npm install -g @prom.codes/context-mcp @prom.codes/memory-mcp @prom.codes/saver";
43
+ var NATIVE_BUILD_PACKAGES = "better-sqlite3,tree-sitter";
44
+ function upgradeCommandFor(npmMajor) {
45
+ if (npmMajor !== null && npmMajor >= 12) {
46
+ return `${UPGRADE_BASE} --allow-scripts=${NATIVE_BUILD_PACKAGES}`;
47
+ }
48
+ return `${UPGRADE_BASE} --ignore-scripts=false --foreground-scripts`;
49
+ }
50
+ var UPGRADE_COMMAND = upgradeCommandFor(null);
51
+ var npmMajorPromise;
52
+ function detectNpmMajor(execImpl = exec) {
53
+ if (npmMajorPromise === void 0) {
54
+ npmMajorPromise = new Promise((resolvePromise) => {
55
+ try {
56
+ execImpl("npm --version", { timeout: 4e3, windowsHide: true }, (err, stdout) => {
57
+ if (err) {
58
+ resolvePromise(null);
59
+ return;
60
+ }
61
+ const m = /(\d+)\./.exec(String(stdout).trim());
62
+ resolvePromise(m ? Number(m[1]) : null);
63
+ });
64
+ } catch {
65
+ resolvePromise(null);
66
+ }
67
+ });
68
+ }
69
+ return npmMajorPromise;
70
+ }
71
+ async function resolveUpgradeCommand(execImpl = exec) {
72
+ return upgradeCommandFor(await detectNpmMajor(execImpl));
73
+ }
42
74
  async function packageIdentity(binImportMetaUrl) {
43
75
  try {
44
76
  const binPath = fileURLToPath(binImportMetaUrl);
@@ -108,7 +140,7 @@ async function syncAvailabilityMarker(dir, name, current, latest, updateAvailabl
108
140
  name,
109
141
  current,
110
142
  latest,
111
- command: UPGRADE_COMMAND,
143
+ command: await resolveUpgradeCommand(),
112
144
  notedAt: Date.now()
113
145
  };
114
146
  await mkdir(dir, { recursive: true }).catch(() => void 0);
@@ -231,7 +263,7 @@ function notify(log, name, current, latest) {
231
263
 
232
264
  // ../shared/dist/update-info.js
233
265
  async function buildUpdateStatus(pkgName, currentVersion, options = {}) {
234
- const base = { current: currentVersion, command: UPGRADE_COMMAND };
266
+ const base = { current: currentVersion, command: await resolveUpgradeCommand() };
235
267
  if (options.isDevBuild === true) {
236
268
  return {
237
269
  ...base,
@@ -261,7 +293,7 @@ async function buildUpdateStatus(pkgName, currentVersion, options = {}) {
261
293
 
262
294
  // ../shared/dist/workspace-root.js
263
295
  import { homedir as homedir2 } from "node:os";
264
- import { dirname, resolve } from "node:path";
296
+ import { dirname, join as join2, resolve } from "node:path";
265
297
  function isHomeOrFilesystemRoot(root) {
266
298
  const abs = resolve(root);
267
299
  if (abs === "")
@@ -276,18 +308,18 @@ function isHomeOrFilesystemRoot(root) {
276
308
  // ../shared/dist/heartbeat.js
277
309
  import { mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
278
310
  import { homedir as homedir3 } from "node:os";
279
- import { join as join2 } from "node:path";
311
+ import { join as join3 } from "node:path";
280
312
  var DEFAULT_HEARTBEAT_INTERVAL_MS = 6e4;
281
313
  var STALE_AFTER_MS = 5 * 6e4;
282
314
  function defaultStatusDir(env = process.env) {
283
315
  const override = (env.PROMETHEUS_STATUS_DIR ?? "").trim();
284
316
  if (override !== "")
285
317
  return override;
286
- return join2(homedir3(), ".prometheus", "status");
318
+ return join3(homedir3(), ".prometheus", "status");
287
319
  }
288
320
  function startHeartbeat(options) {
289
321
  const dir = options.dir ?? defaultStatusDir(options.env ?? process.env);
290
- const file = join2(dir, `${options.server}-${process.pid}.json`);
322
+ const file = join3(dir, `${options.server}-${process.pid}.json`);
291
323
  const intervalMs = options.intervalMs ?? DEFAULT_HEARTBEAT_INTERVAL_MS;
292
324
  let record = {
293
325
  server: options.server,
@@ -397,7 +429,7 @@ function createIdleWatchdog(options) {
397
429
  // dist/composition.js
398
430
  import { createHash } from "node:crypto";
399
431
  import { homedir as homedir4 } from "node:os";
400
- import { basename, join as join3, resolve as resolve2 } from "node:path";
432
+ import { basename, join as join4, resolve as resolve2 } from "node:path";
401
433
 
402
434
  // ../embeddings-openai-compat/dist/index.js
403
435
  var DEFAULT_BATCH = 96;
@@ -2478,7 +2510,7 @@ function projectIdFor(workspaceRoot) {
2478
2510
  return createHash("sha256").update(abs).digest("hex").slice(0, 16);
2479
2511
  }
2480
2512
  function defaultMemoryDbPath() {
2481
- return join3(homedir4(), ".prometheus", "memory.db");
2513
+ return join4(homedir4(), ".prometheus", "memory.db");
2482
2514
  }
2483
2515
  function intEnv(env, name, def) {
2484
2516
  const raw = env[name];
@@ -2921,7 +2953,7 @@ function assertNoSecrets(text) {
2921
2953
  // dist/setup.js
2922
2954
  import { existsSync, readFileSync as readFileSync2 } from "node:fs";
2923
2955
  import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
2924
- import { dirname as dirname3, join as join5 } from "node:path";
2956
+ import { dirname as dirname3, join as join6 } from "node:path";
2925
2957
  var MEMORY_RUNTIMES = [
2926
2958
  "claude-code",
2927
2959
  "cursor",
@@ -2965,13 +2997,13 @@ alwaysApply: true
2965
2997
  var TARGETS = {
2966
2998
  "claude-code": { relPath: "CLAUDE.md", mode: "block", detect: "CLAUDE.md" },
2967
2999
  cursor: {
2968
- relPath: join5(".cursor", "rules", "prometheus-memory.mdc"),
3000
+ relPath: join6(".cursor", "rules", "prometheus-memory.mdc"),
2969
3001
  mode: "file",
2970
3002
  fileContent: CURSOR_FRONTMATTER + withMarkers(RULE_BLOCK) + "\n",
2971
3003
  detect: ".cursor"
2972
3004
  },
2973
3005
  augment: {
2974
- relPath: join5(".augment", "rules", "prometheus-memory.md"),
3006
+ relPath: join6(".augment", "rules", "prometheus-memory.md"),
2975
3007
  mode: "file",
2976
3008
  fileContent: withMarkers(RULE_BLOCK) + "\n",
2977
3009
  detect: ".augment"
@@ -2979,15 +3011,15 @@ var TARGETS = {
2979
3011
  agents: { relPath: "AGENTS.md", mode: "block", detect: "AGENTS.md" }
2980
3012
  };
2981
3013
  function detectRuntimes(workspaceRoot) {
2982
- const found = MEMORY_RUNTIMES.filter((rt) => existsSync(join5(workspaceRoot, TARGETS[rt].detect)));
3014
+ const found = MEMORY_RUNTIMES.filter((rt) => existsSync(join6(workspaceRoot, TARGETS[rt].detect)));
2983
3015
  return found.length > 0 ? found : ["agents"];
2984
3016
  }
2985
3017
  function existingRuntimes(workspaceRoot) {
2986
- return MEMORY_RUNTIMES.filter((rt) => existsSync(join5(workspaceRoot, TARGETS[rt].detect)));
3018
+ return MEMORY_RUNTIMES.filter((rt) => existsSync(join6(workspaceRoot, TARGETS[rt].detect)));
2987
3019
  }
2988
3020
  function installedRuntimes(workspaceRoot) {
2989
3021
  return MEMORY_RUNTIMES.filter((rt) => {
2990
- const p = join5(workspaceRoot, TARGETS[rt].relPath);
3022
+ const p = join6(workspaceRoot, TARGETS[rt].relPath);
2991
3023
  if (!existsSync(p))
2992
3024
  return false;
2993
3025
  try {
@@ -3016,7 +3048,7 @@ function upsertBlock(existing, block) {
3016
3048
  }
3017
3049
  async function installRuntime(workspaceRoot, runtime) {
3018
3050
  const target = TARGETS[runtime];
3019
- const absPath = join5(workspaceRoot, target.relPath);
3051
+ const absPath = join6(workspaceRoot, target.relPath);
3020
3052
  const exists = existsSync(absPath);
3021
3053
  const before = exists ? await readFile3(absPath, "utf-8") : "";
3022
3054
  const after = target.mode === "file" ? target.fileContent : upsertBlock(before, RULE_BLOCK);
@@ -3423,7 +3455,7 @@ ${f.value}`);
3423
3455
  embeddingsError = err instanceof Error ? err.message : String(err);
3424
3456
  }
3425
3457
  }
3426
- const update = await buildUpdateStatus("@prom.codes/memory-mcp", "0.11.3", { isDevBuild: false });
3458
+ const update = await buildUpdateStatus("@prom.codes/memory-mcp", "0.11.4", { isDevBuild: false });
3427
3459
  const summary = deps.rootIsHomeOrFsRoot ? `Memory at ${dbPath}: ${stats.total} records, but the workspace resolved to ${workspaceRoot} (home/root) \u2014 open a project folder so memories scope and mirror correctly.` : `Memory at ${dbPath}: ${stats.total} records for project "${projectName}".${update.updateAvailable === true ? ` Update available: ${update.current} \u2192 ${update.latest} (ask me to run update via the context server's update_servers tool).` : ""}`;
3428
3460
  return textResult({
3429
3461
  installed: true,
@@ -3459,7 +3491,7 @@ ${f.value}`);
3459
3491
  // dist/server.js
3460
3492
  var SERVER_IDENTITY = {
3461
3493
  name: "prometheus-memory-mcp",
3462
- version: "0.11.3",
3494
+ version: "0.11.4",
3463
3495
  title: "prom.codes Memory"
3464
3496
  };
3465
3497
  var SERVER_INSTRUCTIONS = "Persistent agent memory for this workspace \u2014 USE IT PROACTIVELY; the user will not tell you to. Protocol:\n1. ONE-TIME: if this workspace has no Prometheus memory rule yet, call memory_setup now (idempotent) so the protocol is installed into the runtime rule files and survives future sessions. (The server also auto-installs it on startup when a project rule file already exists \u2014 memory_setup covers the rest.)\n2. SESSION START: before any non-trivial task, call memory_read to recall facts, decisions and procedures from earlier sessions.\n3. DURING WORK: when the user states a durable preference, decision, correction or project fact, store it with memory_write (semantic for facts, procedural for how-tos) \u2014 without being asked.\n4. LOOK-UP: use memory_search for keyword recall when memory_read is not specific enough.\n5. SESSION END: consolidate what was learned with memory_capture.\nCall memory_status anytime to check what is stored and whether the rule is installed. Never store secrets, API keys or credentials \u2014 such writes are rejected.";
@@ -3468,7 +3500,7 @@ var SERVER_INSTRUCTIONS = "Persistent agent memory for this workspace \u2014 USE
3468
3500
  function looksLikeMissingNativeBinding(msg) {
3469
3501
  return /bindings file|better_sqlite3\.node|could not locate the bindings|node_module_version|was compiled against a different|invalid elf|\.node['"\s]/i.test(msg);
3470
3502
  }
3471
- var NATIVE_BINDING_HINT = '\nThis looks like the native `better-sqlite3` module failed to load \u2014 usually\nbecause npm `ignore-scripts=true` (corporate hardening) made `npx` skip the\nnative build, so the binary was never produced. Fix it once, keeping your\nhardening intact:\n npm install -g @prom.codes/memory-mcp --ignore-scripts=false --foreground-scripts\nthen point Claude Code at the built binary instead of npx:\n claude mcp add memory -- node "$(npm root -g)/@prom.codes/memory-mcp/dist/bin.js"\nDocs: https://prom.codes/docs/mcp/claude-code\n';
3503
+ var NATIVE_BINDING_HINT = '\nThis looks like the native `better-sqlite3` module failed to load \u2014 the\ninstall script that builds it was skipped, so the binary was never produced.\nOn npm v12+ install scripts are opt-in by default; on older npm it\'s usually\n`ignore-scripts=true` hardening. Install globally, allowing the native build,\nthen point Claude Code at the built binary instead of npx:\n npm v12+: npm install -g @prom.codes/memory-mcp --allow-scripts=better-sqlite3\n npm \u2264 11: npm install -g @prom.codes/memory-mcp --ignore-scripts=false --foreground-scripts\n claude mcp add memory -- node "$(npm root -g)/@prom.codes/memory-mcp/dist/bin.js"\nDocs: https://prom.codes/docs/guides/troubleshooting#could-not-locate-the-bindings-file\n';
3472
3504
  async function main() {
3473
3505
  const env = process.env;
3474
3506
  const explicitRoot = (env.PROMETHEUS_WORKSPACE_ROOT ?? "").trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prom.codes/memory-mcp",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "prom.codes Memory — persistent, local-first agent memory as an MCP server.",
5
5
  "type": "module",
6
6
  "bin": {