superlocalmemory 2.3.0

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.
Files changed (100) hide show
  1. package/ATTRIBUTION.md +140 -0
  2. package/CHANGELOG.md +1749 -0
  3. package/LICENSE +21 -0
  4. package/README.md +600 -0
  5. package/bin/aider-smart +72 -0
  6. package/bin/slm +202 -0
  7. package/bin/slm-npm +73 -0
  8. package/bin/slm.bat +195 -0
  9. package/bin/slm.cmd +10 -0
  10. package/bin/superlocalmemoryv2:list +3 -0
  11. package/bin/superlocalmemoryv2:profile +3 -0
  12. package/bin/superlocalmemoryv2:recall +3 -0
  13. package/bin/superlocalmemoryv2:remember +3 -0
  14. package/bin/superlocalmemoryv2:reset +3 -0
  15. package/bin/superlocalmemoryv2:status +3 -0
  16. package/completions/slm.bash +58 -0
  17. package/completions/slm.zsh +76 -0
  18. package/configs/antigravity-mcp.json +13 -0
  19. package/configs/chatgpt-desktop-mcp.json +7 -0
  20. package/configs/claude-desktop-mcp.json +15 -0
  21. package/configs/codex-mcp.toml +13 -0
  22. package/configs/cody-commands.json +29 -0
  23. package/configs/continue-mcp.yaml +14 -0
  24. package/configs/continue-skills.yaml +26 -0
  25. package/configs/cursor-mcp.json +15 -0
  26. package/configs/gemini-cli-mcp.json +11 -0
  27. package/configs/jetbrains-mcp.json +11 -0
  28. package/configs/opencode-mcp.json +12 -0
  29. package/configs/perplexity-mcp.json +9 -0
  30. package/configs/vscode-copilot-mcp.json +12 -0
  31. package/configs/windsurf-mcp.json +16 -0
  32. package/configs/zed-mcp.json +12 -0
  33. package/docs/ARCHITECTURE.md +877 -0
  34. package/docs/CLI-COMMANDS-REFERENCE.md +425 -0
  35. package/docs/COMPETITIVE-ANALYSIS.md +210 -0
  36. package/docs/COMPRESSION-README.md +390 -0
  37. package/docs/GRAPH-ENGINE.md +503 -0
  38. package/docs/MCP-MANUAL-SETUP.md +720 -0
  39. package/docs/MCP-TROUBLESHOOTING.md +787 -0
  40. package/docs/PATTERN-LEARNING.md +363 -0
  41. package/docs/PROFILES-GUIDE.md +453 -0
  42. package/docs/RESET-GUIDE.md +353 -0
  43. package/docs/SEARCH-ENGINE-V2.2.0.md +748 -0
  44. package/docs/SEARCH-INTEGRATION-GUIDE.md +502 -0
  45. package/docs/UI-SERVER.md +254 -0
  46. package/docs/UNIVERSAL-INTEGRATION.md +432 -0
  47. package/docs/V2.2.0-OPTIONAL-SEARCH.md +666 -0
  48. package/docs/WINDOWS-INSTALL-README.txt +34 -0
  49. package/docs/WINDOWS-POST-INSTALL.txt +45 -0
  50. package/docs/example_graph_usage.py +148 -0
  51. package/hooks/memory-list-skill.js +130 -0
  52. package/hooks/memory-profile-skill.js +284 -0
  53. package/hooks/memory-recall-skill.js +109 -0
  54. package/hooks/memory-remember-skill.js +127 -0
  55. package/hooks/memory-reset-skill.js +274 -0
  56. package/install-skills.sh +436 -0
  57. package/install.ps1 +417 -0
  58. package/install.sh +755 -0
  59. package/mcp_server.py +585 -0
  60. package/package.json +94 -0
  61. package/requirements-core.txt +24 -0
  62. package/requirements.txt +10 -0
  63. package/scripts/postinstall.js +126 -0
  64. package/scripts/preuninstall.js +57 -0
  65. package/skills/slm-build-graph/SKILL.md +423 -0
  66. package/skills/slm-list-recent/SKILL.md +348 -0
  67. package/skills/slm-recall/SKILL.md +325 -0
  68. package/skills/slm-remember/SKILL.md +194 -0
  69. package/skills/slm-status/SKILL.md +363 -0
  70. package/skills/slm-switch-profile/SKILL.md +442 -0
  71. package/src/__pycache__/cache_manager.cpython-312.pyc +0 -0
  72. package/src/__pycache__/embedding_engine.cpython-312.pyc +0 -0
  73. package/src/__pycache__/graph_engine.cpython-312.pyc +0 -0
  74. package/src/__pycache__/hnsw_index.cpython-312.pyc +0 -0
  75. package/src/__pycache__/hybrid_search.cpython-312.pyc +0 -0
  76. package/src/__pycache__/memory-profiles.cpython-312.pyc +0 -0
  77. package/src/__pycache__/memory-reset.cpython-312.pyc +0 -0
  78. package/src/__pycache__/memory_compression.cpython-312.pyc +0 -0
  79. package/src/__pycache__/memory_store_v2.cpython-312.pyc +0 -0
  80. package/src/__pycache__/migrate_v1_to_v2.cpython-312.pyc +0 -0
  81. package/src/__pycache__/pattern_learner.cpython-312.pyc +0 -0
  82. package/src/__pycache__/query_optimizer.cpython-312.pyc +0 -0
  83. package/src/__pycache__/search_engine_v2.cpython-312.pyc +0 -0
  84. package/src/__pycache__/setup_validator.cpython-312.pyc +0 -0
  85. package/src/__pycache__/tree_manager.cpython-312.pyc +0 -0
  86. package/src/cache_manager.py +520 -0
  87. package/src/embedding_engine.py +671 -0
  88. package/src/graph_engine.py +970 -0
  89. package/src/hnsw_index.py +626 -0
  90. package/src/hybrid_search.py +693 -0
  91. package/src/memory-profiles.py +518 -0
  92. package/src/memory-reset.py +485 -0
  93. package/src/memory_compression.py +999 -0
  94. package/src/memory_store_v2.py +1088 -0
  95. package/src/migrate_v1_to_v2.py +638 -0
  96. package/src/pattern_learner.py +898 -0
  97. package/src/query_optimizer.py +513 -0
  98. package/src/search_engine_v2.py +403 -0
  99. package/src/setup_validator.py +479 -0
  100. package/src/tree_manager.py +720 -0
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Memory Recall CLI Skill
4
+ * Search and retrieve memories with advanced filtering
5
+ */
6
+
7
+ const { execFile } = require('child_process');
8
+ const { promisify } = require('util');
9
+ const path = require('path');
10
+
11
+ const execFileAsync = promisify(execFile);
12
+
13
+ async function memoryRecallSkill() {
14
+ const memoryScript = path.join(process.env.HOME, '.claude-memory', 'memory_store_v2.py');
15
+ const args = process.argv.slice(2);
16
+
17
+ // Show help if no args or --help
18
+ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
19
+ console.log(`
20
+ ╔══════════════════════════════════════════════════════════╗
21
+ ║ ║
22
+ ║ SuperLocalMemory V2 - Recall (Search Memories) ║
23
+ ║ ║
24
+ ╚══════════════════════════════════════════════════════════╝
25
+
26
+ Search your memory store using semantic search and filters.
27
+ Finds relevant memories using TF-IDF similarity and metadata.
28
+
29
+ Usage: memory-recall <query> [options]
30
+
31
+ Arguments:
32
+ <query> Search query (required)
33
+
34
+ Options:
35
+ --limit <n> Maximum results to return (default: 10)
36
+
37
+ Examples:
38
+ memory-recall "authentication bug"
39
+
40
+ memory-recall "API configuration" --limit 5
41
+
42
+ memory-recall "security best practices"
43
+
44
+ memory-recall "user preferences"
45
+
46
+ Output Format:
47
+ • Ranked by relevance (TF-IDF cosine similarity)
48
+ • Shows: ID, Content, Tags, Importance, Timestamp
49
+ • Higher scores = better matches
50
+
51
+ Notes:
52
+ • Uses local TF-IDF search (no external APIs)
53
+ • Searches content, summary, and tags
54
+ • Empty query returns recent memories
55
+ • Use quotes for multi-word queries
56
+ `);
57
+ return;
58
+ }
59
+
60
+ // Parse query and options
61
+ let query = null;
62
+ const pythonArgs = ['search'];
63
+
64
+ for (let i = 0; i < args.length; i++) {
65
+ const arg = args[i];
66
+
67
+ if (arg === '--limit' && i + 1 < args.length) {
68
+ // Note: V1 store doesn't support --limit in search, will truncate output instead
69
+ i++; // Skip but don't add to pythonArgs
70
+ } else if (!arg.startsWith('--') && query === null) {
71
+ query = arg;
72
+ }
73
+ }
74
+
75
+ // Validate query
76
+ if (!query || query.trim().length === 0) {
77
+ console.log(`
78
+ ❌ ERROR: Search query required
79
+
80
+ Usage: memory-recall <query> [options]
81
+
82
+ Example:
83
+ memory-recall "search term" --limit 10
84
+
85
+ Use --help for more information
86
+ `);
87
+ return;
88
+ }
89
+
90
+ // Add query to Python args
91
+ pythonArgs.push(query);
92
+
93
+ try {
94
+ const { stdout, stderr } = await execFileAsync('python3', [memoryScript, ...pythonArgs]);
95
+
96
+ if (stderr) {
97
+ console.error('⚠️ Warning:', stderr);
98
+ }
99
+
100
+ console.log(stdout);
101
+
102
+ } catch (error) {
103
+ console.error('❌ Error searching memories:', error.message);
104
+ if (error.stdout) console.log(error.stdout);
105
+ if (error.stderr) console.error(error.stderr);
106
+ }
107
+ }
108
+
109
+ memoryRecallSkill();
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Memory Remember CLI Skill
4
+ * Save memories with tags, project context, and importance levels
5
+ */
6
+
7
+ const { execFile } = require('child_process');
8
+ const { promisify } = require('util');
9
+ const path = require('path');
10
+
11
+ const execFileAsync = promisify(execFile);
12
+
13
+ async function memoryRememberSkill() {
14
+ const memoryScript = path.join(process.env.HOME, '.claude-memory', 'memory_store_v2.py');
15
+ const args = process.argv.slice(2);
16
+
17
+ // Show help if no args or --help
18
+ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
19
+ console.log(`
20
+ ╔══════════════════════════════════════════════════════════╗
21
+ ║ ║
22
+ ║ SuperLocalMemory V2 - Remember (Save Memory) ║
23
+ ║ ║
24
+ ╚══════════════════════════════════════════════════════════╝
25
+
26
+ Save important information to your persistent memory store.
27
+ Memories are indexed, searchable, and integrated with graph knowledge.
28
+
29
+ Usage: memory-remember <content> [options]
30
+
31
+ Arguments:
32
+ <content> The memory content to save (required)
33
+
34
+ Options:
35
+ --tags <tag1,tag2> Comma-separated tags for categorization
36
+ --project <path> Project path context
37
+
38
+ Examples:
39
+ memory-remember "API key stored in .env file" --tags security,config
40
+
41
+ memory-remember "User prefers tabs over spaces"
42
+
43
+ memory-remember "Bug in auth.js line 42" --project ~/work/app --tags bug
44
+
45
+ memory-remember "Meeting notes: Q1 launch March 15" --tags meeting,deadline
46
+
47
+ Notes:
48
+ • Content is deduplicated automatically
49
+ • Tags enable fast filtering during recall
50
+ • Project context links memories to codebases
51
+ • Use semantic search to find related memories
52
+ `);
53
+ return;
54
+ }
55
+
56
+ // Parse content (first non-flag argument) and options
57
+ let content = null;
58
+ let tags = null;
59
+ let project = null;
60
+
61
+ let i = 0;
62
+ while (i < args.length) {
63
+ const arg = args[i];
64
+
65
+ if (arg === '--tags' && i + 1 < args.length) {
66
+ tags = args[i + 1];
67
+ i += 2; // Skip flag and value
68
+ } else if (arg === '--project' && i + 1 < args.length) {
69
+ project = args[i + 1];
70
+ i += 2; // Skip flag and value
71
+ } else if (!arg.startsWith('--') && content === null) {
72
+ content = arg;
73
+ i++;
74
+ } else {
75
+ i++;
76
+ }
77
+ }
78
+
79
+ // Validate content
80
+ if (!content || content.trim().length === 0) {
81
+ console.log(`
82
+ ❌ ERROR: Memory content required
83
+
84
+ Usage: memory-remember <content> [options]
85
+
86
+ Example:
87
+ memory-remember "Important information here" --tags example
88
+
89
+ Use --help for more information
90
+ `);
91
+ return;
92
+ }
93
+
94
+ // Build Python command: add <content> [--project <path>] [--tags tag1,tag2]
95
+ const pythonArgs = ['add', content];
96
+
97
+ if (project) {
98
+ pythonArgs.push('--project', project);
99
+ }
100
+
101
+ if (tags) {
102
+ pythonArgs.push('--tags', tags);
103
+ }
104
+
105
+ try {
106
+ const { stdout, stderr } = await execFileAsync('python3', [memoryScript, ...pythonArgs]);
107
+
108
+ if (stderr) {
109
+ console.error('⚠️ Warning:', stderr);
110
+ }
111
+
112
+ console.log(stdout);
113
+ console.log('✅ Memory saved successfully\n');
114
+
115
+ // Show helpful next steps
116
+ console.log('Next steps:');
117
+ console.log(' • Use `memory-recall <query>` to search this memory');
118
+ console.log(' • Use `memory-list` to see recent memories');
119
+
120
+ } catch (error) {
121
+ console.error('❌ Error saving memory:', error.message);
122
+ if (error.stdout) console.log(error.stdout);
123
+ if (error.stderr) console.error(error.stderr);
124
+ }
125
+ }
126
+
127
+ memoryRememberSkill();
@@ -0,0 +1,274 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Memory Reset CLI Skill
4
+ * Provides /memory-reset command with safety warnings
5
+ */
6
+
7
+ const { execFile } = require('child_process');
8
+ const { promisify } = require('util');
9
+ const path = require('path');
10
+ const readline = require('readline');
11
+
12
+ const execFileAsync = promisify(execFile);
13
+
14
+ const rl = readline.createInterface({
15
+ input: process.stdin,
16
+ output: process.stdout
17
+ });
18
+
19
+ const question = (query) => new Promise((resolve) => rl.question(query, resolve));
20
+
21
+ async function memoryResetSkill() {
22
+ const resetScript = path.join(process.env.HOME, '.claude-memory', 'memory-reset.py');
23
+ const args = process.argv.slice(2); // Get command line arguments
24
+
25
+ // Show help if no args
26
+ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
27
+ console.log(`
28
+ ╔══════════════════════════════════════════════════════════╗
29
+ ║ ║
30
+ ║ SuperLocalMemory V2 - Reset Commands ║
31
+ ║ ║
32
+ ╚══════════════════════════════════════════════════════════╝
33
+
34
+ Usage: /memory-reset <command> [options]
35
+
36
+ Commands:
37
+ status Show current memory system status (SAFE)
38
+ soft Clear all memories, keep V2 schema (⚠️ DESTRUCTIVE)
39
+ hard --confirm Delete everything, reinitialize (🔴 NUCLEAR)
40
+ layer --layers X Clear specific layers only (⚠️ SELECTIVE)
41
+
42
+ Examples:
43
+ /memory-reset status
44
+ /memory-reset soft
45
+ /memory-reset hard --confirm
46
+ /memory-reset layer --layers graph patterns
47
+
48
+ ⚠️ WARNING: soft/hard/layer operations create automatic backups
49
+ but will delete data. Always check status first!
50
+
51
+ Quick commands:
52
+ /memory-status Alias for: /memory-reset status
53
+ /memory-soft-reset Alias for: /memory-reset soft
54
+ `);
55
+ rl.close();
56
+ return;
57
+ }
58
+
59
+ const command = args[0];
60
+
61
+ // STATUS command (safe, no warnings)
62
+ if (command === 'status') {
63
+ try {
64
+ const { stdout } = await execFileAsync('python', [resetScript, 'status']);
65
+ console.log(stdout);
66
+ } catch (error) {
67
+ console.error('❌ Error:', error.message);
68
+ }
69
+ rl.close();
70
+ return;
71
+ }
72
+
73
+ // SOFT RESET command (destructive, show warning)
74
+ if (command === 'soft') {
75
+ console.log(`
76
+ ╔══════════════════════════════════════════════════════════╗
77
+ ║ ⚠️ WARNING ⚠️ ║
78
+ ╚══════════════════════════════════════════════════════════╝
79
+
80
+ SOFT RESET will:
81
+ ✓ Delete ALL memories from current profile
82
+ ✓ Clear graph data (nodes, edges, clusters)
83
+ ✓ Clear learned identity patterns
84
+ ✓ Clear tree structure
85
+ ✓ Create automatic backup before deletion
86
+ ✓ Keep V2 schema structure intact
87
+
88
+ What it WON'T delete:
89
+ ✓ Python code (graph_engine.py, etc.)
90
+ ✓ Other profiles (if using profile system)
91
+ ✓ Documentation files
92
+
93
+ Backup location: ~/.claude-memory/backups/pre-reset-[timestamp].db
94
+ `);
95
+
96
+ const answer = await question('Proceed with soft reset? (yes/no): ');
97
+
98
+ if (answer.toLowerCase() === 'yes') {
99
+ try {
100
+ const { stdout } = await execFileAsync('python', [resetScript, 'soft']);
101
+ console.log(stdout);
102
+ } catch (error) {
103
+ console.error('❌ Error:', error.message);
104
+ }
105
+ } else {
106
+ console.log('\nCancelled. No changes made.');
107
+ }
108
+
109
+ rl.close();
110
+ return;
111
+ }
112
+
113
+ // HARD RESET command (nuclear, extra warnings)
114
+ if (command === 'hard') {
115
+ if (!args.includes('--confirm')) {
116
+ console.log(`
117
+ ❌ ERROR: Hard reset requires --confirm flag
118
+
119
+ HARD RESET is DESTRUCTIVE and will:
120
+ 🔴 Delete the ENTIRE database file
121
+ 🔴 Remove ALL memories permanently
122
+ 🔴 Remove ALL graph data permanently
123
+ 🔴 Remove ALL learned patterns permanently
124
+
125
+ This is the NUCLEAR option. Use only if:
126
+ - You want to completely start over
127
+ - You're sure you don't need any current data
128
+ - You've manually backed up anything important
129
+
130
+ A backup will be created automatically, but this is irreversible
131
+ within the system.
132
+
133
+ To proceed, use:
134
+ /memory-reset hard --confirm
135
+ `);
136
+ rl.close();
137
+ return;
138
+ }
139
+
140
+ console.log(`
141
+ ╔══════════════════════════════════════════════════════════╗
142
+ ║ 🔴 DANGER ZONE 🔴 ║
143
+ ╚══════════════════════════════════════════════════════════╝
144
+
145
+ HARD RESET will:
146
+ 🔴 DELETE the entire database file (memory.db)
147
+ 🔴 DESTROY all memories (cannot undo within system)
148
+ 🔴 ERASE all graph relationships
149
+ 🔴 REMOVE all learned patterns
150
+ 🔴 Reinitialize fresh V2 schema
151
+
152
+ What it KEEPS:
153
+ ✓ Python code
154
+ ✓ Virtual environment
155
+ ✓ Documentation
156
+ ✓ Backups (one will be created now)
157
+
158
+ This is the MOST DESTRUCTIVE option.
159
+
160
+ Backup location: ~/.claude-memory/backups/pre-reset-[timestamp].db
161
+ `);
162
+
163
+ const answer = await question('Type "DELETE EVERYTHING" to confirm: ');
164
+
165
+ if (answer === 'DELETE EVERYTHING') {
166
+ try {
167
+ const { stdout } = await execFileAsync('python', [
168
+ resetScript,
169
+ 'hard',
170
+ '--confirm'
171
+ ]);
172
+ console.log(stdout);
173
+ } catch (error) {
174
+ console.error('❌ Error:', error.message);
175
+ }
176
+ } else {
177
+ console.log('\nCancelled. No changes made.');
178
+ console.log('(You must type exactly "DELETE EVERYTHING" to confirm)');
179
+ }
180
+
181
+ rl.close();
182
+ return;
183
+ }
184
+
185
+ // LAYER RESET command (selective)
186
+ if (command === 'layer') {
187
+ const layersIndex = args.indexOf('--layers');
188
+
189
+ if (layersIndex === -1 || layersIndex === args.length - 1) {
190
+ console.log(`
191
+ ❌ ERROR: --layers flag required with layer names
192
+
193
+ Usage: /memory-reset layer --layers <layer1> [layer2] [layer3]
194
+
195
+ Available layers:
196
+ graph - Clear graph nodes, edges, clusters (keeps memories)
197
+ patterns - Clear learned identity patterns (keeps memories)
198
+ tree - Clear hierarchical structure (keeps memories)
199
+ archive - Clear compressed memory archives
200
+
201
+ Examples:
202
+ /memory-reset layer --layers graph
203
+ /memory-reset layer --layers graph patterns
204
+ /memory-reset layer --layers graph patterns tree
205
+
206
+ This is SELECTIVE - only specified layers are cleared.
207
+ Memories remain intact unless you clear 'archive' layer.
208
+ `);
209
+ rl.close();
210
+ return;
211
+ }
212
+
213
+ const layers = args.slice(layersIndex + 1);
214
+
215
+ console.log(`
216
+ ╔══════════════════════════════════════════════════════════╗
217
+ ║ ⚠️ SELECTIVE LAYER RESET ⚠️ ║
218
+ ╚══════════════════════════════════════════════════════════╝
219
+
220
+ Will clear these layers: ${layers.join(', ')}
221
+
222
+ What this does:
223
+ ${layers.includes('graph') ? '✓ Clears graph nodes, edges, clusters' : ''}
224
+ ${layers.includes('patterns') ? '✓ Clears learned identity patterns' : ''}
225
+ ${layers.includes('tree') ? '✓ Clears hierarchical tree structure' : ''}
226
+ ${layers.includes('archive') ? '✓ Clears compressed memory archives' : ''}
227
+
228
+ What it KEEPS:
229
+ ✓ Raw memories (unless clearing archive)
230
+ ✓ Unaffected layers
231
+ ✓ All backups
232
+
233
+ You can rebuild cleared layers:
234
+ - Graph: python graph_engine.py build
235
+ - Patterns: python pattern_learner.py update
236
+ - Tree: python tree_manager.py build_tree
237
+
238
+ Backup location: ~/.claude-memory/backups/pre-reset-[timestamp].db
239
+ `);
240
+
241
+ const answer = await question('Proceed with layer reset? (yes/no): ');
242
+
243
+ if (answer.toLowerCase() === 'yes') {
244
+ try {
245
+ const { stdout } = await execFileAsync('python', [
246
+ resetScript,
247
+ 'layer',
248
+ '--layers',
249
+ ...layers
250
+ ]);
251
+ console.log(stdout);
252
+ } catch (error) {
253
+ console.error('❌ Error:', error.message);
254
+ }
255
+ } else {
256
+ console.log('\nCancelled. No changes made.');
257
+ }
258
+
259
+ rl.close();
260
+ return;
261
+ }
262
+
263
+ // Unknown command
264
+ console.log(`
265
+ ❌ Unknown command: ${command}
266
+
267
+ Valid commands: status, soft, hard, layer
268
+
269
+ Use: /memory-reset --help for more information
270
+ `);
271
+ rl.close();
272
+ }
273
+
274
+ memoryResetSkill();