@prom.codes/memory-mcp 0.8.0 → 0.9.0

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 (3) hide show
  1. package/README.md +9 -4
  2. package/dist/bin.js +41 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,10 +18,15 @@ Docks under the server name `memory`, so tools resolve to `memory_read` /
18
18
  `--scope project` for a committable `.mcp.json`. Other hosts (Cursor, VS Code)
19
19
  use the same command/args in their own config.
20
20
 
21
- Then ask your agent to run `memory_setup` once per workspace it installs the
22
- memory protocol into your runtime rule files (CLAUDE.md, .cursor/rules,
23
- AGENTS.md) so the agent reads memory at session start and captures learnings at
24
- session end.
21
+ **Awareness so the agent actually uses memory.** A server only offers tools;
22
+ the agent uses them only if told to. On startup the server **auto-installs a
23
+ marked memory-protocol rule block** into the runtime config files you already
24
+ have (CLAUDE.md / AGENTS.md / .cursor / .augment) — idempotent, never creates a
25
+ new file, skipped for home/root, opt out with `PROMETHEUS_MEMORY_AUTO_SETUP=off`.
26
+ Those files load every session, so the agent reads memory at session start,
27
+ writes durable facts as they come up, and captures at the end — without being
28
+ asked. Run `memory_setup` to install into all detected runtimes (incl. creating
29
+ `AGENTS.md` if you have no config yet); `memory_status` shows what's installed.
25
30
 
26
31
  ## Configuration
27
32
 
package/dist/bin.js CHANGED
@@ -2285,6 +2285,7 @@ function composeFromEnv(opts) {
2285
2285
  const { id: rewriterId, provider: rewriter } = discoverMemoryRewriter(env);
2286
2286
  const temporal = discoverMemoryTemporal(env);
2287
2287
  const dedup = discoverMemoryDedup(env);
2288
+ const autoSetup = !/^(off|0|false|no)$/i.test(env.PROMETHEUS_MEMORY_AUTO_SETUP ?? "");
2288
2289
  const backend = new SqliteMemoryBackend(dbPath, {
2289
2290
  ...embedder !== void 0 ? { embedder } : {},
2290
2291
  ...reranker !== null ? { reranker } : {},
@@ -2309,6 +2310,7 @@ function composeFromEnv(opts) {
2309
2310
  rewriterId,
2310
2311
  temporalEnabled: temporal.enabled,
2311
2312
  dedupEnabled: dedup.enabled,
2313
+ autoSetup,
2312
2314
  rootIsHomeOrFsRoot: isHomeOrFilesystemRoot(workspaceRoot),
2313
2315
  close: () => backend.close()
2314
2316
  };
@@ -2466,7 +2468,7 @@ function assertNoSecrets(text) {
2466
2468
  }
2467
2469
 
2468
2470
  // dist/setup.js
2469
- import { existsSync } from "node:fs";
2471
+ import { existsSync, readFileSync } from "node:fs";
2470
2472
  import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
2471
2473
  import { dirname as dirname3, join as join4 } from "node:path";
2472
2474
  var MEMORY_RUNTIMES = [
@@ -2529,6 +2531,28 @@ function detectRuntimes(workspaceRoot) {
2529
2531
  const found = MEMORY_RUNTIMES.filter((rt) => existsSync(join4(workspaceRoot, TARGETS[rt].detect)));
2530
2532
  return found.length > 0 ? found : ["agents"];
2531
2533
  }
2534
+ function existingRuntimes(workspaceRoot) {
2535
+ return MEMORY_RUNTIMES.filter((rt) => existsSync(join4(workspaceRoot, TARGETS[rt].detect)));
2536
+ }
2537
+ function installedRuntimes(workspaceRoot) {
2538
+ return MEMORY_RUNTIMES.filter((rt) => {
2539
+ const p = join4(workspaceRoot, TARGETS[rt].relPath);
2540
+ if (!existsSync(p))
2541
+ return false;
2542
+ try {
2543
+ return readFileSync(p, "utf-8").includes(BLOCK_START);
2544
+ } catch {
2545
+ return false;
2546
+ }
2547
+ });
2548
+ }
2549
+ async function autoInstallExisting(workspaceRoot) {
2550
+ const results = [];
2551
+ for (const rt of existingRuntimes(workspaceRoot)) {
2552
+ results.push(await installRuntime(workspaceRoot, rt));
2553
+ }
2554
+ return results;
2555
+ }
2532
2556
  function upsertBlock(existing, block) {
2533
2557
  const marked = withMarkers(block);
2534
2558
  const start = existing.indexOf(BLOCK_START);
@@ -2924,6 +2948,12 @@ ${f.value}`);
2924
2948
  installed: true,
2925
2949
  project: { id: projectId, name: projectName, workspaceRoot },
2926
2950
  rootIsHomeOrFsRoot: deps.rootIsHomeOrFsRoot,
2951
+ rules: {
2952
+ // Which runtime configs carry the always-on memory protocol — the
2953
+ // signal that the agent will actually USE memory in future sessions.
2954
+ installed: deps.rootIsHomeOrFsRoot ? [] : installedRuntimes(workspaceRoot),
2955
+ autoSetup: deps.autoSetup
2956
+ },
2927
2957
  storage: { dbPath, projectFileMirror: mirrorToFiles },
2928
2958
  records: { total: stats.total, byScope: stats.byScope },
2929
2959
  embeddings: {
@@ -2950,7 +2980,7 @@ var SERVER_IDENTITY = {
2950
2980
  version: PROMETHEUS_VERSION,
2951
2981
  title: "prom.codes Memory"
2952
2982
  };
2953
- var SERVER_INSTRUCTIONS = "Persistent agent memory for this workspace. At the START of a session or task, call memory_read to recall facts, decisions and procedures from earlier sessions. When the user states a durable preference, decision or correction, store it with memory_write. Use memory_search for keyword recall when memory_read is not specific enough. At the END of a session, consolidate what was learned with memory_capture. Run memory_setup once per workspace to install the memory protocol into runtime rule files. Never store secrets, API keys or credentials \u2014 such writes are rejected.";
2983
+ 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.";
2954
2984
 
2955
2985
  // dist/bin.js
2956
2986
  function looksLikeMissingNativeBinding(msg) {
@@ -2992,6 +3022,15 @@ async function main() {
2992
3022
  if (composed.rootIsHomeOrFsRoot) {
2993
3023
  process.stderr.write(`prometheus-memory-mcp: workspace resolved to ${composed.workspaceRoot} (your home directory or a filesystem root) \u2014 project memories will NOT be mirrored to markdown there. Open a project folder (Claude Code passes it via CLAUDE_PROJECT_DIR) or set PROMETHEUS_WORKSPACE_ROOT. Call memory_status for details.
2994
3024
  `);
3025
+ } else if (composed.autoSetup) {
3026
+ void autoInstallExisting(composed.workspaceRoot).then((results) => {
3027
+ const wrote = results.filter((r) => r.action !== "unchanged");
3028
+ if (wrote.length > 0) {
3029
+ process.stderr.write(`prometheus-memory-mcp: auto-installed the memory rule into ${wrote.map((r) => r.runtime).join(", ")} (set PROMETHEUS_MEMORY_AUTO_SETUP=off to disable)
3030
+ `);
3031
+ }
3032
+ }).catch(() => {
3033
+ });
2995
3034
  }
2996
3035
  registerTools(server, composed);
2997
3036
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prom.codes/memory-mcp",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "prom.codes Memory — persistent, local-first agent memory as an MCP server.",
5
5
  "type": "module",
6
6
  "bin": {