@mysten-incubation/memwal-mcp 0.0.14-dev.4 → 0.0.14-dev.5

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/dist/index.js CHANGED
@@ -14,6 +14,8 @@ import { recoverPendingLogin, formatStrandedLoginNotice } from "./recovery.js";
14
14
  import { runAuthRequiredServer } from "./auth-required.js";
15
15
  import { notePendingLoginSuccess, runBridge } from "./bridge.js";
16
16
  import { loginFlow } from "./login.js";
17
+ import { autoSaveStatus, autoSaveSummary, markConsentPending, pendingConsentNotice, publishHookState, setAutoSave, AUTO_SAVE_ENV, } from "./auto-save.js";
18
+ import { askAutoSaveConsent, consentOutcomeNotice } from "./consent.js";
17
19
  import { log, note } from "./logger.js";
18
20
  /** Per-environment URL shortcuts. `--dev`/`--staging`/`--local` set both
19
21
  * relayer + web in one flag. Explicit `--relayer` / `--web-url` override. */
@@ -25,7 +27,7 @@ const ENV_PRESETS = {
25
27
  };
26
28
  /** Bare words that are commands rather than values. An unknown flag must not
27
29
  * swallow one as its argument. */
28
- const POSITIONALS = new Set(["login", "approve-project", "revoke-project"]);
30
+ const POSITIONALS = new Set(["login", "approve-project", "revoke-project", "auto-save", "on", "off", "status"]);
29
31
  export function parseArgs(argv) {
30
32
  const out = {
31
33
  help: false,
@@ -58,6 +60,21 @@ export function parseArgs(argv) {
58
60
  case "revoke-project":
59
61
  out.revokeProject = true;
60
62
  break;
63
+ case "auto-save":
64
+ case "--auto-save": {
65
+ // `auto-save` on its own reports the state rather than
66
+ // changing it — a bare subcommand must never be read as
67
+ // consent to turn automatic saving on.
68
+ const value = argv[i + 1]?.toLowerCase();
69
+ if (value === "on" || value === "off" || value === "status") {
70
+ out.autoSave = value;
71
+ i++;
72
+ }
73
+ else {
74
+ out.autoSave = "status";
75
+ }
76
+ break;
77
+ }
61
78
  case "--prod":
62
79
  case "--dev":
63
80
  case "--staging":
@@ -140,6 +157,36 @@ export async function main(argv = process.argv.slice(2)) {
140
157
  printHelp();
141
158
  return;
142
159
  }
160
+ // Republish the resolved opt-in for the plugin hooks before anything else
161
+ // runs. The hooks do no resolution of their own — they read this file or
162
+ // they fail safe to "off" (WALM-642) — so every start-up refreshes it,
163
+ // including the ones that return early below. Best effort by design: a
164
+ // read-only home must not stop the server, and a hook that finds nothing
165
+ // already behaves as off.
166
+ publishHookState();
167
+ // Runs before the credential paths below: reading or flipping the opt-in
168
+ // does not need an account, and a user deciding whether to enable
169
+ // automatic memory should not be pushed through a browser login first.
170
+ if (args.autoSave) {
171
+ if (args.autoSave === "status") {
172
+ note(autoSaveSummary());
173
+ return;
174
+ }
175
+ const enabled = args.autoSave === "on";
176
+ const { path } = setAutoSave(enabled);
177
+ note(enabled
178
+ ? `Automatic memory is ON. The agent may now save durable facts without being asked; ` +
179
+ `credentials are still excluded and stripped before any write. Saved to ${path}.`
180
+ : `Automatic memory is OFF. Facts are saved only when you ask for them. Saved to ${path}.`);
181
+ const status = autoSaveStatus();
182
+ if (status.source === "env" && status.enabled !== enabled) {
183
+ // The file was written, but this process would still answer the
184
+ // other way — say so rather than let the setting look ignored.
185
+ note(`Note: ${AUTO_SAVE_ENV}=${process.env[AUTO_SAVE_ENV]} is set in this environment ` +
186
+ `and overrides the file. Unset it for the saved choice to take effect.`);
187
+ }
188
+ return;
189
+ }
143
190
  if (args.logout) {
144
191
  const cleared = clearCreds();
145
192
  // Explicit sign-out discards the write-ahead record too. Without this
@@ -357,6 +404,13 @@ export async function main(argv = process.argv.slice(2)) {
357
404
  // tool from the MCP client) opens the correct dashboard. Before
358
405
  // this fix `--dev` was silently dropped here and the flow always
359
406
  // routed to prod (https://memory.walrus.xyz).
407
+ // No credentials and no terminal: a brand-new install being set up
408
+ // through an MCP client. Stamp it now, while we can still tell it
409
+ // apart from a long-standing user — otherwise a sign-in through the
410
+ // `memwal_login` tool would later be indistinguishable from one,
411
+ // and automatic saving would switch itself on with nobody having
412
+ // been asked (WALM-642).
413
+ markConsentPending();
360
414
  const handoff = await runAuthRequiredServer({ relayerUrl, webUrl, label, namespace });
361
415
  if (handoff) {
362
416
  // The user completed `memwal_login` in this SAME session: the
@@ -377,6 +431,9 @@ export async function main(argv = process.argv.slice(2)) {
377
431
  delegateAddress: handoff.creds.delegateAddress,
378
432
  credentialsPath: credsPath(),
379
433
  });
434
+ const pendingAfterLogin = pendingConsentNotice();
435
+ if (pendingAfterLogin)
436
+ note(pendingAfterLogin);
380
437
  await runBridge(handoff.creds, { relayerUrl, webUrl, label, namespace }, handoff.pendingLines);
381
438
  }
382
439
  return;
@@ -385,6 +442,10 @@ export async function main(argv = process.argv.slice(2)) {
385
442
  note("Walrus Memory MCP is not authorized yet — opening browser to connect your Sui wallet.");
386
443
  creds = await loginFlow({ relayerUrl, webUrl, label });
387
444
  note(`Authorized as ${creds.walletAddress.slice(0, 10)}...`);
445
+ // Before the question is put, not after: if the user abandons the
446
+ // prompt, the install must still read as "never answered" rather than
447
+ // fall through to the pre-existing-user rule and start saving.
448
+ markConsentPending();
388
449
  }
389
450
  else {
390
451
  log.info("creds.loaded", {
@@ -404,6 +465,11 @@ export async function main(argv = process.argv.slice(2)) {
404
465
  // user is the one looking at stdout — there's no MCP client to bridge
405
466
  // with, so hanging the process is the wrong default.
406
467
  if (process.stdin.isTTY) {
468
+ // The one moment there is demonstrably a human here. Consent is asked
469
+ // on a terminal and nowhere else — never as an MCP tool, a tool
470
+ // description or an instruction, because a model answering this is not
471
+ // the user answering it (WALM-642).
472
+ await askForConsentIfOwed();
407
473
  note(``);
408
474
  if (wasLoggedIn) {
409
475
  note(`✅ Already authorized as ${creds.walletAddress.slice(0, 10)}...${creds.walletAddress.slice(-6)}`);
@@ -415,12 +481,46 @@ export async function main(argv = process.argv.slice(2)) {
415
481
  note(`✅ Login complete. Credentials saved to ${credsPath()}`);
416
482
  }
417
483
  note(``);
484
+ // The one moment a human is guaranteed to be looking at this output —
485
+ // so it is where the automatic-save choice gets surfaced (WALM-642).
486
+ note(autoSaveSummary());
487
+ note(``);
418
488
  note(`Next: add this package to your MCP client config (Cursor / Claude Desktop / etc).`);
419
489
  note(`See \`memwal-mcp --help\` for ready-to-paste snippets.`);
420
490
  return;
421
491
  }
492
+ // Non-interactive from here on. Say the state once on stderr — there is no
493
+ // one to ask, and a prompt on this stdin would hang the server forever.
494
+ const pending = pendingConsentNotice();
495
+ if (pending)
496
+ note(pending);
422
497
  await runBridge(creds, { relayerUrl, webUrl, label, namespace });
423
498
  }
499
+ /**
500
+ * Put the consent question to the user, if it is still owed one.
501
+ *
502
+ * Silent when the question has been answered, when `MEMWAL_AUTO_SAVE` has
503
+ * settled it, or when the input stream ends without an answer — in that last
504
+ * case the state stays unset and the question comes back next time, rather than
505
+ * a choice being recorded that nobody made. A declined answer is written once
506
+ * and never asked about again.
507
+ */
508
+ async function askForConsentIfOwed() {
509
+ if (!autoSaveStatus().pendingConsent)
510
+ return;
511
+ const answer = await askAutoSaveConsent({
512
+ input: process.stdin,
513
+ output: process.stderr,
514
+ isTTY: process.stdin.isTTY === true,
515
+ });
516
+ if (answer === null) {
517
+ note("No answer recorded — automatic memory is unchanged and you will be " +
518
+ "asked again next time. Set it directly with `memwal-mcp auto-save on|off`.");
519
+ return;
520
+ }
521
+ const { path } = setAutoSave(answer);
522
+ note(consentOutcomeNotice(answer, path));
523
+ }
424
524
  function printHelp() {
425
525
  process.stderr.write(helpText() + "\n");
426
526
  }
@@ -457,6 +557,23 @@ export function helpText() {
457
557
  " required again if the account,",
458
558
  " delegate key or relayer changes.",
459
559
  " memwal-mcp revoke-project Withdraw that approval.",
560
+ " memwal-mcp auto-save on|off Turn automatic memory on or off.",
561
+ " ON once you agree to it: `login` asks",
562
+ " in the terminal the first time, and",
563
+ " nothing is saved unprompted until you",
564
+ " answer. Saved memories are permanent",
565
+ " — Walrus is immutable storage — so",
566
+ " you can stop saving new ones but",
567
+ " cannot delete one already saved.",
568
+ " Credentials (passwords, API keys,",
569
+ " tokens, private keys, seed phrases,",
570
+ " auth headers, URLs with an embedded",
571
+ " user:password) are stripped before",
572
+ " any write either way — a safety net,",
573
+ " not a guarantee. Stored in",
574
+ " settings.json next to",
575
+ " credentials.json.",
576
+ " memwal-mcp auto-save Report the current setting.",
460
577
  " memwal-mcp --help Show this help.",
461
578
  "",
462
579
  "Options:",
@@ -494,6 +611,9 @@ export function helpText() {
494
611
  " Must be an ABSOLUTE path outside the",
495
612
  " project; anything else is refused.",
496
613
  " MEMWAL_NAMESPACE same as --namespace",
614
+ " MEMWAL_AUTO_SAVE=1 Automatic memory for this server",
615
+ " only; overrides settings.json and",
616
+ " skips the login question. 0 = off.",
497
617
  " MEMWAL_MCP_DEBUG=1 Verbose stderr logging.",
498
618
  "",
499
619
  "Minimal MCP client config (Cursor, Claude Desktop, etc.):",
@@ -537,6 +657,8 @@ export function helpText() {
537
657
  }
538
658
  // Re-exports — handy if someone wants to embed this in another tool.
539
659
  export { loadCreds, saveCreds, clearCreds, credsPath, resolveCreds, approveProjectCreds, revokeProjectCredsApproval, formatProjectCredsNotice, formatProjectCredsStorageWarning, } from "./auth.js";
660
+ export { isAutoSaveEnabled, isConsentPending, autoSaveStatus, setAutoSave, markConsentPending, publishHookState, settingsPath, hookStatePath, } from "./auto-save.js";
661
+ export { askAutoSaveConsent, interpretConsentAnswer, CONSENT_PROMPT } from "./consent.js";
540
662
  export { loginFlow } from "./login.js";
541
663
  export { runBridge } from "./bridge.js";
542
664
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACH,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,wBAAwB,EACxB,gCAAgC,EAChC,SAAS,EACT,YAAY,EACZ,0BAA0B,GAC7B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC/E,OA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E;QACvE,uEAAuE;QACvE,oEAAoE;QACpE,yEAAyE;QACzE,uEAAuE;QACvE,wDAAwD;QACxD,4DAA4D;QAC5D,EAAE;QACF,2DAA2D;QAC3D,KAAK;QACL,qBAAqB;QACrB,mBAAmB;QACnB,2BAA2B;QAC3B,yDAAyD;QACzD,SAAS;QACT,OAAO;QACP,KAAK;QACL,EAAE;QACF,wDAAwD;QACxD,KAAK;QACL,qBAAqB;QACrB,mBAAmB;QACnB,2BAA2B;QAC3B,mBAAmB;QACnB,kDAAkD;QAClD,wDAAwD;QACxD,WAAW;QACX,SAAS;QACT,OAAO;QACP,KAAK;QACL,EAAE;QACF,wEAAwE;QACxE,KAAK;QACL,qBAAqB;QACrB,mBAAmB;QACnB,2BAA2B;QAC3B,mBAAmB;QACnB,kDAAkD;QAClD,iCAAiC;QACjC,WAAW;QACX,SAAS;QACT,OAAO;QACP,KAAK;QACL,EAAE;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,qEAAqE;AACrE,OAAO,EACH,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,gCAAgC,GACnC,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACH,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,wBAAwB,EACxB,gCAAgC,EAChC,SAAS,EACT,YAAY,EACZ,0BAA0B,GAC7B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,qBAAqB,E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E,OAAO,EACH,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,gCAAgC,GACnC,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,aAAa,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -1,28 +1,24 @@
1
1
  /**
2
- * MCP `instructions` payloads for the two local initialize responders.
2
+ * Build the signed-in instruction payload for a given opt-in state.
3
3
  *
4
- * Clients inject this field into the model's system prompt during the
5
- * `initialize` handshake, before any `tools/list`. That makes it the only
6
- * proactive-usage channel that survives lazy tool loading, which is what broke
7
- * proactive save/recall in the first place (WALM-324): the guidance used to
8
- * live only in tool descriptions, and clients stopped putting those in context
9
- * until a tool was explicitly loaded.
10
- *
11
- * Both local responders need their own copy because the bridge answers
12
- * `initialize` itself and SUPPRESSES the relayer's reply (see
13
- * `buildLocalInitializeResult` in bridge.ts). Without this, the relayer's
14
- * instructions are correct but unreachable for every stdio client.
4
+ * Exported separately from the resolver so tests can pin both branches without
5
+ * touching the filesystem or the environment.
6
+ */
7
+ export declare function buildProactiveInstructions(opts: {
8
+ autoSave: boolean;
9
+ }): string;
10
+ /**
11
+ * The payload for THIS process, resolved from the user's opt-in at call time.
15
12
  *
16
- * The relayer keeps a separate copy in
17
- * services/server/scripts/mcp/server.ts, which serves the direct HTTP/OAuth
18
- * connector path. It cannot share this module: that file belongs to the
19
- * standalone `memwal-server-scripts` npm package with no workspace link here.
20
- * Keep the two in sync, except: this copy must not name a tool cold start
21
- * does not advertise (`memwal_remember_status` is the worked example GH
22
- * #928). The sidecar copy may name it; that process actually registers the
23
- * tool.
13
+ * A function, not a const: the opt-in lives on disk and in the environment, and
14
+ * `initialize` can arrive after the user has flipped it.
15
+ */
16
+ export declare function proactiveInstructions(): string;
17
+ /**
18
+ * Signed-in path (bridge mode) with automatic saving on. Kept as a named
19
+ * export because it is the text the whole proactive contract is written
20
+ * against; `proactiveInstructions()` is what the bridge actually serves.
24
21
  */
25
- /** Signed-in path (bridge mode). Full proactive contract. */
26
22
  export declare const PROACTIVE_INSTRUCTIONS: string;
27
23
  /**
28
24
  * Signed-out path (auth-required mode). Deliberately NOT the proactive text:
@@ -1 +1 @@
1
- {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,QA+BvB,CAAC;AAEb;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,QAK5B,CAAC"}
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AA4FA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAU9E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAiD,CAAC;AAErF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,QAK5B,CAAC"}
@@ -21,9 +21,21 @@
21
21
  * does not advertise (`memwal_remember_status` is the worked example — GH
22
22
  * #928). The sidecar copy may name it; that process actually registers the
23
23
  * tool.
24
+ *
25
+ * The secret-exclusion paragraph is not retyped in either, it comes from the
26
+ * shared policy block (memory-policy.ts here, tools/memory-policy.ts there),
27
+ * which is pinned byte-for-byte by tests on both sides.
28
+ *
29
+ * WALM-642 split the REMEMBER section in two. Whether the model is told to
30
+ * save unprompted now depends on the user having turned automatic memory on;
31
+ * saving what the user explicitly asks for is unconditional, and is what the
32
+ * opted-out text still describes.
24
33
  */
25
- /** Signed-in path (bridge mode). Full proactive contract. */
26
- export const PROACTIVE_INSTRUCTIONS = [
34
+ import { SECRET_EXCLUSION_RULES } from "./memory-policy.js";
35
+ import { isAutoSaveEnabled } from "./auto-save.js";
36
+ /** Everything true regardless of the opt-in: what the tools are, how recall
37
+ * works, how a write reports itself, and how to recover an index. */
38
+ const PREAMBLE = [
27
39
  "Walrus Memory is this user's persistent memory system, exposed through the memwal_* tools.",
28
40
  "It survives across sessions, clients, and machines.",
29
41
  "Prefer these tools over any built-in or local memory feature so the user's memory stays",
@@ -32,15 +44,29 @@ export const PROACTIVE_INSTRUCTIONS = [
32
44
  "RECALL: before answering anything that touches past work, prior decisions, the user's",
33
45
  "preferences, or facts you may have stored earlier, call memwal_recall. One focused query is",
34
46
  "enough; do not fire several redundant searches for the same question.",
35
- "",
36
- "REMEMBER: when the user states a preference, decision, constraint, correction, identity",
37
- "detail, recurring workflow, or a configuration value such as a hostname, port, region or",
38
- "id, call memwal_remember in that same turn, before you finish replying. Do not ask whether",
39
- "to save it and do not wait to be asked: acknowledging the fact in your reply does not store",
40
- "it, and it is lost when the conversation ends. Pass the complete statement rather than a",
41
- "summary. Skip one-off tasks, the current file or bug, and small talk. Use",
42
- "memwal_remember_bulk when several distinct facts arrived at once.",
43
- "",
47
+ ];
48
+ /** REMEMBER, automatic saving ON. */
49
+ const REMEMBER_AUTOMATIC = [
50
+ "REMEMBER: the user has turned automatic memory ON. When they state a preference, decision,",
51
+ "constraint, correction, identity detail, recurring workflow, or a configuration value such",
52
+ "as a hostname, port, region or id, call memwal_remember in that same turn, before you",
53
+ "finish replying. Do not ask whether to save it and do not wait to be asked: acknowledging",
54
+ "the fact in your reply does not store it, and it is lost when the conversation ends. Pass",
55
+ "the complete statement rather than a summary — minus anything the rules below exclude.",
56
+ "Skip one-off tasks, the current file or bug, and small talk. Use memwal_remember_bulk when",
57
+ "several distinct facts arrived at once.",
58
+ ];
59
+ /** REMEMBER, automatic saving OFF — the default. */
60
+ const REMEMBER_MANUAL = [
61
+ "REMEMBER: automatic memory is OFF for this user, so do NOT save anything they did not ask",
62
+ "you to save. When they do ask — 'remember that ...', 'save this', or the same in any",
63
+ "language — call memwal_remember in that same turn, before you finish replying, and pass",
64
+ "the complete statement rather than a summary. Use memwal_remember_bulk when they hand you",
65
+ "several distinct facts at once. Do not save a fact just because it looks durable, and do",
66
+ "not nag: if automatic saving would clearly help, say once that they can turn it on with",
67
+ "`memwal-mcp auto-save on` (or MEMWAL_AUTO_SAVE=1) and leave it there.",
68
+ ];
69
+ const WRITE_CONTRACT = [
44
70
  "By default memwal_remember and memwal_remember_bulk return in ~1s once the relayer has",
45
71
  "accepted the job (job_id / job_ids). The Walrus write continues in the background (~30-60s)",
46
72
  "and the fact is NOT stored yet. That is the normal result. Do not claim it is saved.",
@@ -49,12 +75,48 @@ export const PROACTIVE_INSTRUCTIONS = [
49
75
  "whole batch). Only a blob_id in the tool reply means the fact is already stored (that",
50
76
  "happens when an optional wait budget was set and the write finished).",
51
77
  "",
78
+ "Storage is append-only and encrypted: a fact that lands cannot be edited or deleted. That",
79
+ "is why the exclusions below are absolute rather than a preference, and why the write path",
80
+ "strips credential shapes from whatever you send and tells you what it removed.",
81
+ "",
52
82
  "RECOVER: if memwal_recall unexpectedly returns nothing for a namespace that has been used",
53
83
  "before, call memwal_restore to rebuild the index from Walrus.",
54
84
  "",
55
85
  "If a memwal_* tool is not currently loaded, load it and use it. Never tell the user that",
56
86
  "memory is unavailable, and never substitute your own memory for these tools.",
57
- ].join("\n");
87
+ ];
88
+ /**
89
+ * Build the signed-in instruction payload for a given opt-in state.
90
+ *
91
+ * Exported separately from the resolver so tests can pin both branches without
92
+ * touching the filesystem or the environment.
93
+ */
94
+ export function buildProactiveInstructions(opts) {
95
+ return [
96
+ ...PREAMBLE,
97
+ "",
98
+ ...(opts.autoSave ? REMEMBER_AUTOMATIC : REMEMBER_MANUAL),
99
+ "",
100
+ SECRET_EXCLUSION_RULES,
101
+ "",
102
+ ...WRITE_CONTRACT,
103
+ ].join("\n");
104
+ }
105
+ /**
106
+ * The payload for THIS process, resolved from the user's opt-in at call time.
107
+ *
108
+ * A function, not a const: the opt-in lives on disk and in the environment, and
109
+ * `initialize` can arrive after the user has flipped it.
110
+ */
111
+ export function proactiveInstructions() {
112
+ return buildProactiveInstructions({ autoSave: isAutoSaveEnabled() });
113
+ }
114
+ /**
115
+ * Signed-in path (bridge mode) with automatic saving on. Kept as a named
116
+ * export because it is the text the whole proactive contract is written
117
+ * against; `proactiveInstructions()` is what the bridge actually serves.
118
+ */
119
+ export const PROACTIVE_INSTRUCTIONS = buildProactiveInstructions({ autoSave: true });
58
120
  /**
59
121
  * Signed-out path (auth-required mode). Deliberately NOT the proactive text:
60
122
  * without credentials every memory tool fails, so telling the model to save
@@ -1 +1 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,4FAA4F;IAC5F,qDAAqD;IACrD,yFAAyF;IACzF,mCAAmC;IACnC,EAAE;IACF,uFAAuF;IACvF,6FAA6F;IAC7F,uEAAuE;IACvE,EAAE;IACF,yFAAyF;IACzF,0FAA0F;IAC1F,4FAA4F;IAC5F,6FAA6F;IAC7F,0FAA0F;IAC1F,2EAA2E;IAC3E,mEAAmE;IACnE,EAAE;IACF,wFAAwF;IACxF,6FAA6F;IAC7F,sFAAsF;IACtF,2FAA2F;IAC3F,4FAA4F;IAC5F,uFAAuF;IACvF,uEAAuE;IACvE,EAAE;IACF,2FAA2F;IAC3F,+DAA+D;IAC/D,EAAE;IACF,0FAA0F;IAC1F,8EAA8E;CACjF,CAAC,IAAI,CAAC,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B;IAClE,OAAO;QACH,GAAG,QAAQ;QACX,EAAE;QACF,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,eAAe,CAAC;QACzD,EAAE;QACF,sBAAsB;QACtB,EAAE;QACF,GAAG,cAAc;KACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB;IACjC,OAAO,0BAA0B,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;AACzE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,0BAA0B,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACtC,4FAA4F;IAC5F,gFAAgF;IAChF,gGAAgG;IAChG,wFAAwF;CAC3F,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Shared automatic-memory policy — the MCP client's copy.
3
+ *
4
+ * Consumed by `instructions.ts` (the MCP `instructions` field, which is the
5
+ * only proactive-usage channel that survives lazy tool loading) and by
6
+ * `auth-required.ts` (the cold-start / signed-out `tools/list`).
7
+ *
8
+ * WALM-642: before this module the secret rules did not exist at all, and the
9
+ * save guidance was written out three times — here, in the plugin hooks, and in
10
+ * the relayer sidecar's tool descriptions — with nothing tying them together.
11
+ * A preference stated next to a password was forwarded whole.
12
+ */
13
+ /**
14
+ * The secret-exclusion and do-not-save rules, stated verbatim by every
15
+ * automatic-save surface.
16
+ *
17
+ * These are model-facing rules, not enforcement. The programmatic backstop is
18
+ * the redactor in the relayer sidecar's write path
19
+ * (services/server/scripts/mcp/tools/redaction.ts), which runs before any text
20
+ * reaches the SDK.
21
+ */
22
+ export declare const SECRET_EXCLUSION_RULES: string;
23
+ /**
24
+ * One-line form, for surfaces with no room for the full block (a per-turn
25
+ * nudge, a tool description tail). It is a reminder of the block above, never a
26
+ * replacement for it: any surface that drives an automatic save states the full
27
+ * `SECRET_EXCLUSION_RULES`.
28
+ */
29
+ export declare const SECRET_EXCLUSION_SUMMARY: string;
30
+ /**
31
+ * Whether to save unprompted is the user's standing choice, and this is the
32
+ * sentence that says so. A direct request ("remember that ...") is never gated
33
+ * by it — the gate is only on saving something the user did not ask you to save.
34
+ */
35
+ export declare const AUTO_SAVE_OPT_IN_RULE: string;
36
+ /** Bumped whenever the text above changes, so a stale copy is identifiable. */
37
+ export declare const MEMORY_POLICY_VERSION = "2026-09-17.2";
38
+ //# sourceMappingURL=memory-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-policy.d.ts","sourceRoot":"","sources":["../src/memory-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuBH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,QAWxB,CAAC;AAEZ;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAI1B,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAMvB,CAAC;AAEZ,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,iBAAiB,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Shared automatic-memory policy — the MCP client's copy.
3
+ *
4
+ * Consumed by `instructions.ts` (the MCP `instructions` field, which is the
5
+ * only proactive-usage channel that survives lazy tool loading) and by
6
+ * `auth-required.ts` (the cold-start / signed-out `tools/list`).
7
+ *
8
+ * WALM-642: before this module the secret rules did not exist at all, and the
9
+ * save guidance was written out three times — here, in the plugin hooks, and in
10
+ * the relayer sidecar's tool descriptions — with nothing tying them together.
11
+ * A preference stated next to a password was forwarded whole.
12
+ */
13
+ // ─── memwal:policy-block:start ───────────────────────────────────────────────
14
+ // WALM-642. The lines between these two markers are BYTE-IDENTICAL in three
15
+ // files that cannot import one another, because the three packages have no
16
+ // workspace link:
17
+ //
18
+ // packages/mcp/src/memory-policy.ts — MCP client: initialize
19
+ // instructions + the
20
+ // cold-start tools/list
21
+ // packages/mcp/plugin/scripts/lib/memory-policy.mjs — plugin hooks: the
22
+ // guidance injected at
23
+ // SessionStart /
24
+ // UserPromptSubmit /
25
+ // PostToolUse
26
+ // services/server/scripts/mcp/tools/memory-policy.ts — relayer sidecar: the
27
+ // live tool descriptions
28
+ //
29
+ // The duplication is deliberate and pinned: `memory-policy-sync` tests on both
30
+ // sides extract this block from each file and compare the bytes, so editing one
31
+ // copy fails the suite until the other two match. Edit the block, then copy it
32
+ // verbatim — markers included — into the other two files.
33
+ /**
34
+ * The secret-exclusion and do-not-save rules, stated verbatim by every
35
+ * automatic-save surface.
36
+ *
37
+ * These are model-facing rules, not enforcement. The programmatic backstop is
38
+ * the redactor in the relayer sidecar's write path
39
+ * (services/server/scripts/mcp/tools/redaction.ts), which runs before any text
40
+ * reaches the SDK.
41
+ */
42
+ export const SECRET_EXCLUSION_RULES = [
43
+ "NEVER save a credential, even when it sits next to something worth saving: passwords,",
44
+ "API keys, access or refresh tokens, private keys, seed or recovery phrases, authorization",
45
+ "headers, session cookies, and connection strings or URLs that embed a user:password.",
46
+ "When a message mixes a preference with a credential, save the preference alone and leave",
47
+ "the credential out; never store the line verbatim.",
48
+ "If the user says not to save something ('don't save this', 'off the record', or the same",
49
+ "in any language), do not save it, and do not save a paraphrase of it either.",
50
+ "Do not store quoted or pasted third-party material — log excerpts, code, articles, other",
51
+ "people's messages — as if it were a fact about this user. Save only what the user is",
52
+ "telling you about themselves or their work, in your own words.",
53
+ ].join(" ");
54
+ /**
55
+ * One-line form, for surfaces with no room for the full block (a per-turn
56
+ * nudge, a tool description tail). It is a reminder of the block above, never a
57
+ * replacement for it: any surface that drives an automatic save states the full
58
+ * `SECRET_EXCLUSION_RULES`.
59
+ */
60
+ export const SECRET_EXCLUSION_SUMMARY = [
61
+ "Never save passwords, keys, tokens or other credentials — not even beside a fact worth",
62
+ "saving; honour an explicit 'do not save this'; never store pasted third-party content as",
63
+ "a fact about the user.",
64
+ ].join(" ");
65
+ /**
66
+ * Whether to save unprompted is the user's standing choice, and this is the
67
+ * sentence that says so. A direct request ("remember that ...") is never gated
68
+ * by it — the gate is only on saving something the user did not ask you to save.
69
+ */
70
+ export const AUTO_SAVE_OPT_IN_RULE = [
71
+ "Whether to save things the user did not ask you to save is their standing choice, made once",
72
+ "in a terminal. When automatic memory is on, save durable facts as they state them; when it is",
73
+ "off, save only what they ask you to save in that turn. That question is put by `memwal-mcp",
74
+ "login` and set by `memwal-mcp auto-save on|off` — never ask the user to answer it in chat,",
75
+ "and never answer it on their behalf.",
76
+ ].join(" ");
77
+ /** Bumped whenever the text above changes, so a stale copy is identifiable. */
78
+ export const MEMORY_POLICY_VERSION = "2026-09-17.2";
79
+ // ─── memwal:policy-block:end ─────────────────────────────────────────────────
80
+ //# sourceMappingURL=memory-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-policy.js","sourceRoot":"","sources":["../src/memory-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,gFAAgF;AAChF,4EAA4E;AAC5E,2EAA2E;AAC3E,kBAAkB;AAClB,EAAE;AACF,gFAAgF;AAChF,4EAA4E;AAC5E,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,wEAAwE;AACxE,4EAA4E;AAC5E,qEAAqE;AACrE,8EAA8E;AAC9E,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,0DAA0D;AAE1D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,uFAAuF;IACvF,2FAA2F;IAC3F,sFAAsF;IACtF,0FAA0F;IAC1F,oDAAoD;IACpD,0FAA0F;IAC1F,8EAA8E;IAC9E,0FAA0F;IAC1F,sFAAsF;IACtF,gEAAgE;CACnE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACpC,wFAAwF;IACxF,0FAA0F;IAC1F,wBAAwB;CAC3B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,6FAA6F;IAC7F,+FAA+F;IAC/F,4FAA4F;IAC5F,4FAA4F;IAC5F,sCAAsC;CACzC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AACpD,gFAAgF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten-incubation/memwal-mcp",
3
- "version": "0.0.14-dev.4",
3
+ "version": "0.0.14-dev.5",
4
4
  "description": "Walrus Memory MCP client — single-binary stdio MCP server that bridges Cursor / Claude Desktop / Antigravity / Claude Code to the Walrus Memory relayer. Handles browser-based wallet login on first run.",
5
5
  "type": "module",
6
6
  "engines": {