@alex900530/claude-persistent-memory 1.0.6 → 1.0.8

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/bin/setup.js CHANGED
@@ -161,9 +161,9 @@ function setupHooks() {
161
161
  ok(' Hooks configured (5 hooks).');
162
162
  }
163
163
 
164
- // ── [4/5] .gitignore ────────────────────────────────────────────────────────
164
+ // ── [4/6] .gitignore ────────────────────────────────────────────────────────
165
165
  function setupGitignore() {
166
- log('[4/5] Updating .gitignore ...');
166
+ log('[4/6] Updating .gitignore ...');
167
167
 
168
168
  const entries = ['.claude-memory/', '.claude-memory.config.js', '.claude/', '.mcp.json'];
169
169
  let content = '';
@@ -187,9 +187,43 @@ function setupGitignore() {
187
187
  }
188
188
  }
189
189
 
190
- // ── [5/5] Services ──────────────────────────────────────────────────────────
190
+ // ── [5/6] Pre-download embedding model ───────────────────────────────────────
191
+ async function setupModel() {
192
+ log('[5/6] Preparing embedding model (bge-m3) ...');
193
+
194
+ const os = require('os');
195
+ const cacheDir = path.join(os.homedir(), '.cache', 'huggingface', 'transformers-js');
196
+ const modelDir = path.join(cacheDir, 'Xenova', 'bge-m3', 'onnx');
197
+
198
+ // Check if model is already cached
199
+ if (fs.existsSync(path.join(modelDir, 'model.onnx_data'))) {
200
+ const stat = fs.statSync(path.join(modelDir, 'model.onnx_data'));
201
+ if (stat.size > 300 * 1024 * 1024) { // > 300MB = likely complete
202
+ ok(` Model already cached (${(stat.size / 1024 / 1024 / 1024).toFixed(1)}GB).`);
203
+ return;
204
+ }
205
+ warn(' Incomplete model cache detected, re-downloading ...');
206
+ }
207
+
208
+ log(' Downloading model (~2GB, this may take a few minutes) ...');
209
+ try {
210
+ // Resolve from package's own dependencies
211
+ const transformersPath = require.resolve('@huggingface/transformers', { paths: [PKG_DIR] });
212
+ const { pipeline, env } = await import(transformersPath);
213
+ env.cacheDir = cacheDir;
214
+ const extractor = await pipeline('feature-extraction', 'Xenova/bge-m3', { device: 'cpu' });
215
+ // Quick test to verify model works
216
+ await extractor('test', { pooling: 'cls', normalize: true });
217
+ ok(' Model downloaded and verified.');
218
+ } catch (e) {
219
+ warn(` Model download failed: ${e.message}`);
220
+ warn(' The embedding server will retry on first start.');
221
+ }
222
+ }
223
+
224
+ // ── [6/6] Services ──────────────────────────────────────────────────────────
191
225
  function setupServices() {
192
- log('[5/5] Setting up background services ...');
226
+ log('[6/6] Setting up background services ...');
193
227
 
194
228
  // Check if Azure credentials are configured
195
229
  let hasCredentials = false;
@@ -411,6 +445,7 @@ async function main() {
411
445
  setupMCP();
412
446
  setupHooks();
413
447
  setupGitignore();
448
+ await setupModel();
414
449
  setupServices();
415
450
  }
416
451
 
package/bin/uninstall.js CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Uninstall script for claude-persistent-memory
4
- * Removes services, MCP config, and hooks. Does NOT delete .claude-memory/ data.
4
+ * Removes MCP config, hooks, and config file. Does NOT delete .claude-memory/ data.
5
+ * Background services (launchd/systemd) are kept since they are shared across projects.
5
6
  */
6
7
 
7
8
  const fs = require('fs');
@@ -44,9 +45,9 @@ function removeServices() {
44
45
  }
45
46
  }
46
47
 
47
- // ── [2/4] Remove MCP entry ──────────────────────────────────────────────────
48
+ // ── [1/3] Remove MCP entry ──────────────────────────────────────────────────
48
49
  function removeMCP() {
49
- log('[2/4] Cleaning .mcp.json ...');
50
+ log('[1/3] Cleaning .mcp.json ...');
50
51
  try {
51
52
  const data = JSON.parse(fs.readFileSync(MCP_FILE, 'utf8'));
52
53
  if (data.mcpServers && data.mcpServers.memory) {
@@ -64,9 +65,9 @@ function removeMCP() {
64
65
  }
65
66
  }
66
67
 
67
- // ── [3/4] Remove hooks ──────────────────────────────────────────────────────
68
+ // ── [2/3] Remove hooks ──────────────────────────────────────────────────────
68
69
  function removeHooks() {
69
- log('[3/4] Cleaning .claude/settings.json hooks ...');
70
+ log('[2/3] Cleaning .claude/settings.json hooks ...');
70
71
  try {
71
72
  const data = JSON.parse(fs.readFileSync(SETTINGS_FILE, 'utf8'));
72
73
  if (!data.hooks) { log(' No hooks found.'); return; }
@@ -97,9 +98,9 @@ function removeHooks() {
97
98
  }
98
99
  }
99
100
 
100
- // ── [4/4] Remove config ─────────────────────────────────────────────────────
101
+ // ── [3/3] Remove config ─────────────────────────────────────────────────────
101
102
  function removeConfig() {
102
- log('[4/4] Removing config ...');
103
+ log('[3/3] Removing config ...');
103
104
  if (fs.existsSync(CONFIG_FILE)) {
104
105
  fs.unlinkSync(CONFIG_FILE);
105
106
  ok(' Removed .claude-memory.config.js');
@@ -111,7 +112,6 @@ console.log('');
111
112
  log('Uninstalling claude-persistent-memory ...');
112
113
  console.log('');
113
114
 
114
- removeServices();
115
115
  removeMCP();
116
116
  removeHooks();
117
117
  removeConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alex900530/claude-persistent-memory",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Persistent memory system for Claude Code — hybrid BM25 + vector search, LLM-driven structuring, automatic clustering",
5
5
  "main": "lib/memory-db.js",
6
6
  "bin": {