@justfortytwo/memory 0.1.1 → 0.1.3

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
@@ -96,13 +96,13 @@ DB_PATH=./memory.db npm run migrate
96
96
  DB_PATH=./memory.db EMBED_MODEL=qwen3-embedding:0.6b fortytwo-memory
97
97
  ```
98
98
 
99
- The `bin` is `fortytwo-memory` → `dist/index.js`. You can also `npx -y
100
- @justfortytwo/memory` once published.
99
+ The `bin` is `fortytwo-memory` → `dist/index.js`. You can also run it with
100
+ `npx -y @justfortytwo/memory` (it is published to npm).
101
101
 
102
102
  ### As a library
103
103
 
104
104
  ```ts
105
- import { openDb, runMigrations, OllamaEmbedder, store, recall } from '@justfortytwo/memory';
105
+ import { openDb, runMigrations, OllamaEmbedder, store, recall, deleteByIds } from '@justfortytwo/memory';
106
106
 
107
107
  const h = openDb('memory.db');
108
108
  await runMigrations(h.k);
@@ -110,8 +110,19 @@ const embedder = new OllamaEmbedder();
110
110
 
111
111
  await store(h, embedder, { content: 'the deploy script lives in scripts/deploy.sh', source: 'owner', observed: 'stated' });
112
112
  const hits = await recall(h, embedder, 'how do I deploy?', 5);
113
+
114
+ deleteByIds(h, [hits[0].id]); // hard-delete (row + vector + FTS); returns the count removed
113
115
  ```
114
116
 
117
+ ### Deleting memories
118
+
119
+ `deleteByIds(h, ids)` hard-deletes memories — the row, its vector, and its FTS
120
+ entry — so nothing resurfaces in `recall`/`lexical`/`query`. It is intentionally
121
+ a **library API and NOT an MCP tool**: deletion is an owner-privileged operation,
122
+ and exposing it to the assistant's turn loop would let prompt-injected content
123
+ trick it into erasing memories. Selecting *which* ids to remove (by query, tag,
124
+ date range, …) is the caller's job — see `@justfortytwo/installer`'s `forget`.
125
+
115
126
  ## As a Claude Code plugin
116
127
 
117
128
  `.claude-plugin/plugin.json` declares the plugin; `.mcp.json` registers the
@@ -9,7 +9,7 @@ export declare class FakeEmbedder implements Embedder {
9
9
  constructor(dim?: number);
10
10
  embed(text: string): Promise<Vec>;
11
11
  }
12
- /** Calls a local Ollama /api/embeddings endpoint. */
12
+ /** Calls an Ollama /api/embeddings endpoint (local or remote). */
13
13
  export declare class OllamaEmbedder implements Embedder {
14
14
  private model;
15
15
  private baseUrl;
package/dist/embedder.js CHANGED
@@ -21,7 +21,7 @@ export class FakeEmbedder {
21
21
  return v;
22
22
  }
23
23
  }
24
- /** Calls a local Ollama /api/embeddings endpoint. */
24
+ /** Calls an Ollama /api/embeddings endpoint (local or remote). */
25
25
  export class OllamaEmbedder {
26
26
  model;
27
27
  baseUrl;
@@ -30,7 +30,8 @@ export class OllamaEmbedder {
30
30
  this.baseUrl = baseUrl;
31
31
  }
32
32
  async embed(text) {
33
- const res = await fetch(`${this.baseUrl}/api/embeddings`, {
33
+ // Strip a trailing slash so a base URL like `https://host/` doesn't yield `host//api/...`.
34
+ const res = await fetch(`${this.baseUrl.replace(/\/$/, '')}/api/embeddings`, {
34
35
  method: 'POST',
35
36
  headers: { 'content-type': 'application/json' },
36
37
  body: JSON.stringify({ model: this.model, prompt: text }),
@@ -1 +1 @@
1
- {"version":3,"file":"embedder.js","sourceRoot":"","sources":["../src/embedder.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,WAAW,CAAC,CAAM;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;AAC3D,CAAC;AAED,uEAAuE;AACvE,MAAM,OAAO,YAAY;IACH;IAApB,YAAoB,MAAM,IAAI;QAAV,QAAG,GAAH,GAAG,CAAO;IAAG,CAAC;IAClC,KAAK,CAAC,KAAK,CAAC,IAAY;QACtB,MAAM,CAAC,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG,UAAU,KAAK,CAAC,CAAC;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAA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,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAED,kEAAkE;AAClE,MAAM,OAAO,cAAc;IAEf;IACA;IAFV,YACU,QAAQ,sBAAsB,EAC9B,UAAU,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,wBAAwB;QADjE,UAAK,GAAL,KAAK,CAAyB;QAC9B,YAAO,GAAP,OAAO,CAA0D;IACxE,CAAC;IACJ,KAAK,CAAC,KAAK,CAAC,IAAY;QACtB,2FAA2F;QAC3F,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,EAAE;YAC3E,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SAC1D,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,CAAC,MAAM,IAAI,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC5F,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA4B,CAAC;QAC3D,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justfortytwo/memory",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Standalone semantic-memory MCP server (SQLite + sqlite-vec + Ollama embedder). persona-agnostic.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "type": "module",
16
16
  "engines": {
17
- "node": ">=18"
17
+ "node": ">=20"
18
18
  },
19
19
  "bin": {
20
20
  "fortytwo-memory": "dist/index.js"
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@modelcontextprotocol/sdk": "^1.0.0",
43
- "better-sqlite3": "^11.0.0",
43
+ "better-sqlite3": "^12.0.0",
44
44
  "knex": "^3.1.0",
45
45
  "sqlite-vec": "^0.1.6"
46
46
  },