@prom.codes/memory-mcp 0.8.0 → 0.9.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/README.md +9 -4
- package/dist/bin.js +46 -2
- 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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
@@ -1599,6 +1599,7 @@ var SqliteMemoryBackend = class {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
this.db = new Database(dbPath);
|
|
1601
1601
|
this.db.pragma("journal_mode = WAL");
|
|
1602
|
+
this.db.pragma("synchronous = NORMAL");
|
|
1602
1603
|
this.db.exec(SCHEMA);
|
|
1603
1604
|
this.db.exec(FTS_SCHEMA);
|
|
1604
1605
|
this.db.exec(VEC_SCHEMA);
|
|
@@ -2033,6 +2034,10 @@ ${h.record.value}`
|
|
|
2033
2034
|
if (this.closed)
|
|
2034
2035
|
return;
|
|
2035
2036
|
this.closed = true;
|
|
2037
|
+
try {
|
|
2038
|
+
this.db.pragma("wal_checkpoint(TRUNCATE)");
|
|
2039
|
+
} catch {
|
|
2040
|
+
}
|
|
2036
2041
|
this.db.close();
|
|
2037
2042
|
}
|
|
2038
2043
|
};
|
|
@@ -2285,6 +2290,7 @@ function composeFromEnv(opts) {
|
|
|
2285
2290
|
const { id: rewriterId, provider: rewriter } = discoverMemoryRewriter(env);
|
|
2286
2291
|
const temporal = discoverMemoryTemporal(env);
|
|
2287
2292
|
const dedup = discoverMemoryDedup(env);
|
|
2293
|
+
const autoSetup = !/^(off|0|false|no)$/i.test(env.PROMETHEUS_MEMORY_AUTO_SETUP ?? "");
|
|
2288
2294
|
const backend = new SqliteMemoryBackend(dbPath, {
|
|
2289
2295
|
...embedder !== void 0 ? { embedder } : {},
|
|
2290
2296
|
...reranker !== null ? { reranker } : {},
|
|
@@ -2309,6 +2315,7 @@ function composeFromEnv(opts) {
|
|
|
2309
2315
|
rewriterId,
|
|
2310
2316
|
temporalEnabled: temporal.enabled,
|
|
2311
2317
|
dedupEnabled: dedup.enabled,
|
|
2318
|
+
autoSetup,
|
|
2312
2319
|
rootIsHomeOrFsRoot: isHomeOrFilesystemRoot(workspaceRoot),
|
|
2313
2320
|
close: () => backend.close()
|
|
2314
2321
|
};
|
|
@@ -2466,7 +2473,7 @@ function assertNoSecrets(text) {
|
|
|
2466
2473
|
}
|
|
2467
2474
|
|
|
2468
2475
|
// dist/setup.js
|
|
2469
|
-
import { existsSync } from "node:fs";
|
|
2476
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2470
2477
|
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
2471
2478
|
import { dirname as dirname3, join as join4 } from "node:path";
|
|
2472
2479
|
var MEMORY_RUNTIMES = [
|
|
@@ -2529,6 +2536,28 @@ function detectRuntimes(workspaceRoot) {
|
|
|
2529
2536
|
const found = MEMORY_RUNTIMES.filter((rt) => existsSync(join4(workspaceRoot, TARGETS[rt].detect)));
|
|
2530
2537
|
return found.length > 0 ? found : ["agents"];
|
|
2531
2538
|
}
|
|
2539
|
+
function existingRuntimes(workspaceRoot) {
|
|
2540
|
+
return MEMORY_RUNTIMES.filter((rt) => existsSync(join4(workspaceRoot, TARGETS[rt].detect)));
|
|
2541
|
+
}
|
|
2542
|
+
function installedRuntimes(workspaceRoot) {
|
|
2543
|
+
return MEMORY_RUNTIMES.filter((rt) => {
|
|
2544
|
+
const p = join4(workspaceRoot, TARGETS[rt].relPath);
|
|
2545
|
+
if (!existsSync(p))
|
|
2546
|
+
return false;
|
|
2547
|
+
try {
|
|
2548
|
+
return readFileSync(p, "utf-8").includes(BLOCK_START);
|
|
2549
|
+
} catch {
|
|
2550
|
+
return false;
|
|
2551
|
+
}
|
|
2552
|
+
});
|
|
2553
|
+
}
|
|
2554
|
+
async function autoInstallExisting(workspaceRoot) {
|
|
2555
|
+
const results = [];
|
|
2556
|
+
for (const rt of existingRuntimes(workspaceRoot)) {
|
|
2557
|
+
results.push(await installRuntime(workspaceRoot, rt));
|
|
2558
|
+
}
|
|
2559
|
+
return results;
|
|
2560
|
+
}
|
|
2532
2561
|
function upsertBlock(existing, block) {
|
|
2533
2562
|
const marked = withMarkers(block);
|
|
2534
2563
|
const start = existing.indexOf(BLOCK_START);
|
|
@@ -2924,6 +2953,12 @@ ${f.value}`);
|
|
|
2924
2953
|
installed: true,
|
|
2925
2954
|
project: { id: projectId, name: projectName, workspaceRoot },
|
|
2926
2955
|
rootIsHomeOrFsRoot: deps.rootIsHomeOrFsRoot,
|
|
2956
|
+
rules: {
|
|
2957
|
+
// Which runtime configs carry the always-on memory protocol — the
|
|
2958
|
+
// signal that the agent will actually USE memory in future sessions.
|
|
2959
|
+
installed: deps.rootIsHomeOrFsRoot ? [] : installedRuntimes(workspaceRoot),
|
|
2960
|
+
autoSetup: deps.autoSetup
|
|
2961
|
+
},
|
|
2927
2962
|
storage: { dbPath, projectFileMirror: mirrorToFiles },
|
|
2928
2963
|
records: { total: stats.total, byScope: stats.byScope },
|
|
2929
2964
|
embeddings: {
|
|
@@ -2950,7 +2985,7 @@ var SERVER_IDENTITY = {
|
|
|
2950
2985
|
version: PROMETHEUS_VERSION,
|
|
2951
2986
|
title: "prom.codes Memory"
|
|
2952
2987
|
};
|
|
2953
|
-
var SERVER_INSTRUCTIONS = "Persistent agent memory for this workspace.
|
|
2988
|
+
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
2989
|
|
|
2955
2990
|
// dist/bin.js
|
|
2956
2991
|
function looksLikeMissingNativeBinding(msg) {
|
|
@@ -2992,6 +3027,15 @@ async function main() {
|
|
|
2992
3027
|
if (composed.rootIsHomeOrFsRoot) {
|
|
2993
3028
|
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
3029
|
`);
|
|
3030
|
+
} else if (composed.autoSetup) {
|
|
3031
|
+
void autoInstallExisting(composed.workspaceRoot).then((results) => {
|
|
3032
|
+
const wrote = results.filter((r) => r.action !== "unchanged");
|
|
3033
|
+
if (wrote.length > 0) {
|
|
3034
|
+
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)
|
|
3035
|
+
`);
|
|
3036
|
+
}
|
|
3037
|
+
}).catch(() => {
|
|
3038
|
+
});
|
|
2995
3039
|
}
|
|
2996
3040
|
registerTools(server, composed);
|
|
2997
3041
|
};
|