@hasna/mementos 0.14.28 → 0.14.29

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 CHANGED
@@ -20,7 +20,8 @@ mementos setup agents
20
20
 
21
21
  `mementos setup agents` registers the hosted `mementos-mcp` server in Claude
22
22
  Code, Codex, OpenCode, and Antigravity config files. It also writes managed
23
- diagnostic snippets under `~/.config/mementos/agent-integrations`.
23
+ diagnostic snippets and host-specific memory instructions under
24
+ `~/.config/mementos/agent-integrations`.
24
25
 
25
26
  ## MCP
26
27
 
@@ -42,4 +43,7 @@ Claude Code also receives `UserPromptSubmit`, `SessionStart`, and `Stop` hook
42
43
  entries that call `mementos hook ...` and return hosted memory as hook context.
43
44
  Codex does not expose a native hook file in `~/.codex/config.toml`, so the
44
45
  installer registers MCP there and keeps the injection command in the managed
45
- integration snippets.
46
+ integration snippets. OpenCode and Antigravity receive the same MCP registration
47
+ plus host instruction files that tell the agent to use `memory.search`,
48
+ `memory.save`, and `mementos inject` as the hosted fallback path when native
49
+ hooks are unavailable.
@@ -1 +1 @@
1
- {"version":3,"file":"agent-setup.d.ts","sourceRoot":"","sources":["../src/agent-setup.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,8DAA+D,CAAC;AAElG,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OA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,UAAU,EAAE,IAAI,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,iBAAsB,GAAG,cAAc,CAkDnF;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,2BAAgC,GAAG,oBAAoB,CAyBlG;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,iBAAsB,GAAG,cAAc,CAqCjF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,SAAwB;;;EAStE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAW9D"}
package/dist/cli.js CHANGED
@@ -15,6 +15,10 @@ function buildAgentSetupPlan(options = {}) {
15
15
  const hookCommand = "mementos hook stop";
16
16
  const injectCommand = "mementos inject";
17
17
  const files = [
18
+ {
19
+ path: join(baseDir, "mementos-instructions.md"),
20
+ content: renderSharedInstructions({ apiUrl, injectCommand, mcpCommand })
21
+ },
18
22
  {
19
23
  path: join(baseDir, "mementos-injection.md"),
20
24
  content: renderInjectionInstructions({ apiUrl, injectCommand })
@@ -31,6 +35,10 @@ function buildAgentSetupPlan(options = {}) {
31
35
  }
32
36
  ];
33
37
  for (const host of hosts) {
38
+ files.push({
39
+ path: join(baseDir, `${host}-instructions.md`),
40
+ content: renderHostInstructions(host, { apiUrl, injectCommand, mcpCommand })
41
+ });
34
42
  files.push({
35
43
  path: join(baseDir, `${host}.json`),
36
44
  content: `${JSON.stringify(renderHostConfig(host, { apiUrl, hookCommand, injectCommand, mcpCommand }), null, 2)}
@@ -155,11 +163,13 @@ function renderHostConfig(host, commands) {
155
163
  host,
156
164
  install: "bun install -g @hasna/mementos",
157
165
  remoteOnly: true,
166
+ nativeHooks: hasNativeHooks(host),
158
167
  mcp: renderMcpServerConfig(commands).mcpServers.mementos,
159
168
  hooks: {
160
169
  stop: commands.hookCommand,
161
170
  injection: commands.injectCommand
162
- }
171
+ },
172
+ instructions: `${host}-instructions.md`
163
173
  };
164
174
  }
165
175
  function renderManagedHostConfig(host, commands) {
@@ -173,8 +183,15 @@ function renderManagedHostConfig(host, commands) {
173
183
  inject: commands.injectCommand,
174
184
  stopHook: commands.hookCommand
175
185
  },
186
+ injection: {
187
+ nativeHooks: hasNativeHooks(host),
188
+ fallbackCommand: commands.injectCommand,
189
+ mcpTools: ["memory.search", "memory.save", "memory.get", "memory.update", "memory.delete", "memory.usage"]
190
+ },
176
191
  files: {
177
192
  integrationDir: commands.baseDir,
193
+ sharedInstructions: join(commands.baseDir, "mementos-instructions.md"),
194
+ hostInstructions: join(commands.baseDir, `${host}-instructions.md`),
178
195
  injectionInstructions: join(commands.baseDir, "mementos-injection.md"),
179
196
  stopHook: join(commands.baseDir, "mementos-stop-hook.sh")
180
197
  }
@@ -455,6 +472,63 @@ MEMENTOS_API_URL=${apiUrl} MEMENTOS_API_TOKEN=$MEMENTOS_API_TOKEN ${injectComman
455
472
  This command reads hosted memory through the mementos.md API and prints a prompt-ready block.
456
473
  `;
457
474
  }
475
+ function renderSharedInstructions({
476
+ apiUrl,
477
+ injectCommand,
478
+ mcpCommand
479
+ }) {
480
+ return `# mementos.md Agent Instructions
481
+
482
+ Use mementos.md as hosted durable memory for this agent host.
483
+
484
+ - The MCP server command is \`${mcpCommand}\`.
485
+ - The hosted API is \`${apiUrl}\`.
486
+ - Use \`memory.search\` before non-trivial project work.
487
+ - Use \`memory.save\` for durable decisions, root causes, and reusable context.
488
+ - If the host does not provide a native hook, run \`${injectCommand} "<current task or question>"\` and include the returned hosted context in the next prompt.
489
+ - Do not create or depend on a local memory database for the SaaS package.
490
+ `;
491
+ }
492
+ function renderHostInstructions(host, commands) {
493
+ const common = renderSharedInstructions(commands);
494
+ if (host === "claude-code") {
495
+ return `${common}
496
+ ## Claude Code
497
+
498
+ Claude Code has native mementos hooks installed by \`mementos setup agents\`.
499
+ Use the mementos MCP server for explicit memory operations and let the
500
+ \`UserPromptSubmit\`, \`SessionStart\`, and \`Stop\` hooks inject hosted context.
501
+ `;
502
+ }
503
+ if (host === "codex") {
504
+ return `${common}
505
+ ## Codex
506
+
507
+ Codex does not have a mementos native hook in its config file. Use the
508
+ mementos MCP server for durable memory and run \`${commands.injectCommand}\`
509
+ when you need prompt-ready hosted context before a turn.
510
+ `;
511
+ }
512
+ if (host === "opencode") {
513
+ return `${common}
514
+ ## OpenCode
515
+
516
+ Use the mementos MCP server for durable memory. When OpenCode cannot invoke a
517
+ native lifecycle hook, run \`${commands.injectCommand}\` with the active task
518
+ or error text and paste the hosted context into the next prompt.
519
+ `;
520
+ }
521
+ return `${common}
522
+ ## Antigravity
523
+
524
+ Use the mementos MCP server for durable memory. When Antigravity cannot invoke
525
+ a native lifecycle hook, run \`${commands.injectCommand}\` with the active task
526
+ or error text and include the hosted context before continuing.
527
+ `;
528
+ }
529
+ function hasNativeHooks(host) {
530
+ return host === "claude-code";
531
+ }
458
532
  function renderHookScript(command) {
459
533
  return `#!/usr/bin/env bash
460
534
  set -euo pipefail
package/dist/index.js CHANGED
@@ -146,7 +146,7 @@ function readErrorMessage(payload, status) {
146
146
  }
147
147
  // src/mcp-runtime.ts
148
148
  import { createInterface } from "readline";
149
- var MEMENTOS_MCP_VERSION = "0.14.28";
149
+ var MEMENTOS_MCP_VERSION = "0.14.29";
150
150
  var AUTHLESS_SCHEMA = {
151
151
  type: "object",
152
152
  properties: {},
@@ -358,6 +358,10 @@ function buildAgentSetupPlan(options = {}) {
358
358
  const hookCommand = "mementos hook stop";
359
359
  const injectCommand = "mementos inject";
360
360
  const files = [
361
+ {
362
+ path: join(baseDir, "mementos-instructions.md"),
363
+ content: renderSharedInstructions({ apiUrl, injectCommand, mcpCommand })
364
+ },
361
365
  {
362
366
  path: join(baseDir, "mementos-injection.md"),
363
367
  content: renderInjectionInstructions({ apiUrl, injectCommand })
@@ -374,6 +378,10 @@ function buildAgentSetupPlan(options = {}) {
374
378
  }
375
379
  ];
376
380
  for (const host of hosts) {
381
+ files.push({
382
+ path: join(baseDir, `${host}-instructions.md`),
383
+ content: renderHostInstructions(host, { apiUrl, injectCommand, mcpCommand })
384
+ });
377
385
  files.push({
378
386
  path: join(baseDir, `${host}.json`),
379
387
  content: `${JSON.stringify(renderHostConfig(host, { apiUrl, hookCommand, injectCommand, mcpCommand }), null, 2)}
@@ -498,11 +506,13 @@ function renderHostConfig(host, commands) {
498
506
  host,
499
507
  install: "bun install -g @hasna/mementos",
500
508
  remoteOnly: true,
509
+ nativeHooks: hasNativeHooks(host),
501
510
  mcp: renderMcpServerConfig(commands).mcpServers.mementos,
502
511
  hooks: {
503
512
  stop: commands.hookCommand,
504
513
  injection: commands.injectCommand
505
- }
514
+ },
515
+ instructions: `${host}-instructions.md`
506
516
  };
507
517
  }
508
518
  function renderManagedHostConfig(host, commands) {
@@ -516,8 +526,15 @@ function renderManagedHostConfig(host, commands) {
516
526
  inject: commands.injectCommand,
517
527
  stopHook: commands.hookCommand
518
528
  },
529
+ injection: {
530
+ nativeHooks: hasNativeHooks(host),
531
+ fallbackCommand: commands.injectCommand,
532
+ mcpTools: ["memory.search", "memory.save", "memory.get", "memory.update", "memory.delete", "memory.usage"]
533
+ },
519
534
  files: {
520
535
  integrationDir: commands.baseDir,
536
+ sharedInstructions: join(commands.baseDir, "mementos-instructions.md"),
537
+ hostInstructions: join(commands.baseDir, `${host}-instructions.md`),
521
538
  injectionInstructions: join(commands.baseDir, "mementos-injection.md"),
522
539
  stopHook: join(commands.baseDir, "mementos-stop-hook.sh")
523
540
  }
@@ -798,6 +815,63 @@ MEMENTOS_API_URL=${apiUrl} MEMENTOS_API_TOKEN=$MEMENTOS_API_TOKEN ${injectComman
798
815
  This command reads hosted memory through the mementos.md API and prints a prompt-ready block.
799
816
  `;
800
817
  }
818
+ function renderSharedInstructions({
819
+ apiUrl,
820
+ injectCommand,
821
+ mcpCommand
822
+ }) {
823
+ return `# mementos.md Agent Instructions
824
+
825
+ Use mementos.md as hosted durable memory for this agent host.
826
+
827
+ - The MCP server command is \`${mcpCommand}\`.
828
+ - The hosted API is \`${apiUrl}\`.
829
+ - Use \`memory.search\` before non-trivial project work.
830
+ - Use \`memory.save\` for durable decisions, root causes, and reusable context.
831
+ - If the host does not provide a native hook, run \`${injectCommand} "<current task or question>"\` and include the returned hosted context in the next prompt.
832
+ - Do not create or depend on a local memory database for the SaaS package.
833
+ `;
834
+ }
835
+ function renderHostInstructions(host, commands) {
836
+ const common = renderSharedInstructions(commands);
837
+ if (host === "claude-code") {
838
+ return `${common}
839
+ ## Claude Code
840
+
841
+ Claude Code has native mementos hooks installed by \`mementos setup agents\`.
842
+ Use the mementos MCP server for explicit memory operations and let the
843
+ \`UserPromptSubmit\`, \`SessionStart\`, and \`Stop\` hooks inject hosted context.
844
+ `;
845
+ }
846
+ if (host === "codex") {
847
+ return `${common}
848
+ ## Codex
849
+
850
+ Codex does not have a mementos native hook in its config file. Use the
851
+ mementos MCP server for durable memory and run \`${commands.injectCommand}\`
852
+ when you need prompt-ready hosted context before a turn.
853
+ `;
854
+ }
855
+ if (host === "opencode") {
856
+ return `${common}
857
+ ## OpenCode
858
+
859
+ Use the mementos MCP server for durable memory. When OpenCode cannot invoke a
860
+ native lifecycle hook, run \`${commands.injectCommand}\` with the active task
861
+ or error text and paste the hosted context into the next prompt.
862
+ `;
863
+ }
864
+ return `${common}
865
+ ## Antigravity
866
+
867
+ Use the mementos MCP server for durable memory. When Antigravity cannot invoke
868
+ a native lifecycle hook, run \`${commands.injectCommand}\` with the active task
869
+ or error text and include the hosted context before continuing.
870
+ `;
871
+ }
872
+ function hasNativeHooks(host) {
873
+ return host === "claude-code";
874
+ }
801
875
  function renderHookScript(command) {
802
876
  return `#!/usr/bin/env bash
803
877
  set -euo pipefail
@@ -1,5 +1,5 @@
1
1
  import { MementosRemoteClient } from "./remote-client";
2
- export declare const MEMENTOS_MCP_VERSION = "0.14.28";
2
+ export declare const MEMENTOS_MCP_VERSION = "0.14.29";
3
3
  export interface RemoteMcpTool {
4
4
  name: string;
5
5
  description: string;
package/dist/mcp.js CHANGED
@@ -151,7 +151,7 @@ function readErrorMessage(payload, status) {
151
151
  }
152
152
 
153
153
  // src/mcp-runtime.ts
154
- var MEMENTOS_MCP_VERSION = "0.14.28";
154
+ var MEMENTOS_MCP_VERSION = "0.14.29";
155
155
  var AUTHLESS_SCHEMA = {
156
156
  type: "object",
157
157
  properties: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.14.28",
3
+ "version": "0.14.29",
4
4
  "description": "Remote-only mementos.md SaaS CLI and MCP client",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",