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,442 @@
1
+ ---
2
+ name: slm-switch-profile
3
+ description: Switch between memory profiles for project isolation and context management. Use when the user wants to change project context, separate work/personal memories, or manage multiple independent memory spaces. Each profile has its own database, graph, and patterns.
4
+ version: "2.1.0"
5
+ license: MIT
6
+ compatibility: "Requires SuperLocalMemory V2 installed at ~/.claude-memory/"
7
+ attribution:
8
+ creator: Varun Pratap Bhardwaj
9
+ role: Solution Architect & Original Creator
10
+ project: SuperLocalMemory V2
11
+ ---
12
+
13
+ # SuperLocalMemory: Switch Profile
14
+
15
+ Switch between memory profiles to maintain separate contexts for different projects or use cases.
16
+
17
+ ## Usage
18
+
19
+ ```bash
20
+ slm switch-profile <name> [--create]
21
+ ```
22
+
23
+ ## What are Profiles?
24
+
25
+ **Profiles = Isolated Memory Spaces**
26
+
27
+ Each profile has its own:
28
+ - ✅ **Separate database** - Zero context bleeding
29
+ - ✅ **Independent knowledge graph** - Project-specific relationships
30
+ - ✅ **Unique patterns** - Different coding preferences per project
31
+ - ✅ **Isolated history** - No cross-contamination
32
+
33
+ **Think of profiles as workspaces:**
34
+ - `default` - General use
35
+ - `work` - Work projects
36
+ - `personal` - Personal projects
37
+ - `client-acme` - Specific client work
38
+ - `experiment` - Testing/learning
39
+
40
+ ## Examples
41
+
42
+ ### Example 1: Switch to Existing Profile
43
+ ```bash
44
+ $ slm switch-profile work
45
+ ```
46
+
47
+ **Output:**
48
+ ```
49
+ 🔄 Switching profile: default → work
50
+
51
+ Profile Information:
52
+ Name: work
53
+ Created: 2026-01-20
54
+ Memories: 342
55
+ Last Used: 2026-02-05 09:15
56
+
57
+ ✅ Switched to profile "work"
58
+
59
+ Restart your AI tools (Cursor, ChatGPT, etc.) to use the new profile.
60
+ ```
61
+
62
+ ### Example 2: Create New Profile
63
+ ```bash
64
+ $ slm switch-profile client-acme --create
65
+ ```
66
+
67
+ **Output:**
68
+ ```
69
+ 🆕 Creating new profile: client-acme
70
+
71
+ Profile created successfully!
72
+ Location: ~/.claude-memory/profiles/client-acme/
73
+ Database: memory.db (empty)
74
+ Status: Active
75
+
76
+ ✅ Switched to profile "client-acme"
77
+
78
+ Next steps:
79
+ • Start saving memories: slm remember "..."
80
+ • AI tools will use this profile automatically
81
+ ```
82
+
83
+ ### Example 3: List All Profiles
84
+ ```bash
85
+ $ slm list-profiles
86
+ ```
87
+
88
+ **Output:**
89
+ ```
90
+ 📁 Available Profiles (4 total)
91
+
92
+ → work (active)
93
+ Created: 2026-01-20
94
+ Memories: 342
95
+ Size: 1.8 MB
96
+ Last used: 2 minutes ago
97
+
98
+ default
99
+ Created: 2026-01-15
100
+ Memories: 1,247
101
+ Size: 4.2 MB
102
+ Last used: 3 hours ago
103
+
104
+ personal
105
+ Created: 2026-01-22
106
+ Memories: 89
107
+ Size: 0.4 MB
108
+ Last used: Yesterday
109
+
110
+ client-acme
111
+ Created: 2026-02-07
112
+ Memories: 0
113
+ Size: 0 KB
114
+ Last used: Never
115
+ ```
116
+
117
+ ### Example 4: Return to Default
118
+ ```bash
119
+ $ slm switch-profile default
120
+ ```
121
+
122
+ **Always works** (default profile always exists)
123
+
124
+ ## Arguments
125
+
126
+ | Argument | Type | Required | Description |
127
+ |----------|------|----------|-------------|
128
+ | `<name>` | string | Yes | Profile name (lowercase, hyphens allowed) |
129
+ | `--create` | flag | No | Create profile if doesn't exist |
130
+ | `--force` | flag | No | Switch even if current profile has unsaved work |
131
+
132
+ ## Profile Naming Rules
133
+
134
+ **Valid:**
135
+ - Lowercase letters: `a-z`
136
+ - Numbers: `0-9`
137
+ - Hyphens: `-`
138
+ - Length: 1-64 characters
139
+
140
+ **Examples:**
141
+ - ✅ `work`
142
+ - ✅ `client-acme`
143
+ - ✅ `project-2024`
144
+ - ✅ `personal`
145
+
146
+ **Invalid:**
147
+ - ❌ `Work` (uppercase)
148
+ - ❌ `client_acme` (underscore)
149
+ - ❌ `client acme` (space)
150
+ - ❌ `client.acme` (period)
151
+
152
+ ## Use Cases
153
+
154
+ ### 1. Work/Personal Separation
155
+ ```bash
156
+ # Morning: Start work
157
+ slm switch-profile work
158
+ slm remember "Sprint planning: focus on auth system"
159
+
160
+ # Evening: Personal projects
161
+ slm switch-profile personal
162
+ slm remember "Learning Rust - ownership is tricky"
163
+ ```
164
+
165
+ **Benefit:** No mixing of work and personal context
166
+
167
+ ### 2. Multi-Client Consulting
168
+ ```bash
169
+ # Client A project
170
+ slm switch-profile client-a
171
+ slm remember "Client A uses AWS, prefers TypeScript"
172
+
173
+ # Client B project
174
+ slm switch-profile client-b
175
+ slm remember "Client B uses Azure, prefers C#"
176
+ ```
177
+
178
+ **Benefit:** Client-specific preferences and patterns
179
+
180
+ ### 3. Experimentation
181
+ ```bash
182
+ # Create throwaway profile for learning
183
+ slm switch-profile experiment --create
184
+ slm remember "Testing new framework..."
185
+
186
+ # Later: delete when done
187
+ slm delete-profile experiment
188
+ ```
189
+
190
+ **Benefit:** Safe experimentation without polluting main memory
191
+
192
+ ### 4. Project Isolation
193
+ ```bash
194
+ # Different tech stacks
195
+ slm switch-profile backend-api # Python/FastAPI
196
+ slm switch-profile frontend-app # React/TypeScript
197
+ slm switch-profile ml-pipeline # Python/PyTorch
198
+ ```
199
+
200
+ **Benefit:** Pattern learning adapts to each stack
201
+
202
+ ### 5. Team Shared Profiles (Advanced)
203
+ ```bash
204
+ # Sync profile to team folder
205
+ slm export-profile work > team-shared/work-profile.db
206
+
207
+ # Team members import
208
+ slm import-profile team-shared/work-profile.db --name work
209
+ ```
210
+
211
+ **Benefit:** Shared knowledge base for team
212
+
213
+ ## How Switching Works
214
+
215
+ ### Behind the Scenes
216
+
217
+ **1. Profile Structure:**
218
+ ```
219
+ ~/.claude-memory/
220
+ ├── memory.db ← Current active profile (symlink)
221
+ ├── profiles/
222
+ │ ├── default/
223
+ │ │ └── memory.db ← Default profile database
224
+ │ ├── work/
225
+ │ │ └── memory.db ← Work profile database
226
+ │ └── personal/
227
+ │ └── memory.db ← Personal profile database
228
+ └── current_profile ← Text file with active profile name
229
+ ```
230
+
231
+ **2. Switching Process:**
232
+ ```bash
233
+ $ slm switch-profile work
234
+ ```
235
+
236
+ - **Step 1:** Verify "work" profile exists
237
+ - **Step 2:** Update symlink: `memory.db` → `profiles/work/memory.db`
238
+ - **Step 3:** Write "work" to `current_profile` file
239
+ - **Step 4:** Notify user to restart AI tools
240
+
241
+ **3. AI Tools Read:**
242
+ - MCP server reads `~/.claude-memory/memory.db`
243
+ - Symlink automatically points to active profile
244
+ - Transparent to AI tools
245
+
246
+ ## Important Notes
247
+
248
+ ### Restart Required
249
+ **After switching, restart your AI tools:**
250
+ - **Cursor:** Cmd+Q, reopen
251
+ - **Claude Desktop:** Quit, reopen
252
+ - **ChatGPT:** Close, reopen
253
+ - **VS Code:** Reload window
254
+
255
+ **Why:** Tools cache database connection at startup
256
+
257
+ ### Profile Isolation is Complete
258
+ **Each profile has:**
259
+ - ❌ **NO access** to other profiles' memories
260
+ - ❌ **NO shared** knowledge graph
261
+ - ❌ **NO cross-profile** pattern learning
262
+
263
+ **This is by design** for true isolation.
264
+
265
+ ### Default Profile Special
266
+ - Always exists
267
+ - Cannot be deleted
268
+ - Safe fallback
269
+
270
+ ## Advanced Usage
271
+
272
+ ### Profile Management
273
+
274
+ **Create multiple profiles:**
275
+ ```bash
276
+ slm switch-profile work --create
277
+ slm switch-profile personal --create
278
+ slm switch-profile client-a --create
279
+ ```
280
+
281
+ **Backup profile:**
282
+ ```bash
283
+ cp -r ~/.claude-memory/profiles/work ~/.claude-memory/backups/work-2026-02-07
284
+ ```
285
+
286
+ **Delete profile:**
287
+ ```bash
288
+ slm delete-profile experiment
289
+ # Warning: This permanently deletes all memories!
290
+ ```
291
+
292
+ **Rename profile:**
293
+ ```bash
294
+ slm rename-profile old-name new-name
295
+ ```
296
+
297
+ ### Scripting & Automation
298
+
299
+ **Auto-switch by project directory:**
300
+ ```bash
301
+ # Add to .bashrc or .zshrc
302
+ function cd() {
303
+ builtin cd "$@"
304
+
305
+ # Check for .slm-profile file
306
+ if [ -f ".slm-profile" ]; then
307
+ profile=$(cat .slm-profile)
308
+ slm switch-profile "$profile" --quiet
309
+ fi
310
+ }
311
+ ```
312
+
313
+ **Usage:**
314
+ ```bash
315
+ # In project directory
316
+ echo "myapp" > .slm-profile
317
+
318
+ # CD into directory
319
+ cd ~/projects/myapp
320
+ # Automatically switches to "myapp" profile
321
+ ```
322
+
323
+ **Daily profile switching:**
324
+ ```bash
325
+ #!/bin/bash
326
+ # cron: 0 9 * * 1-5 (Mon-Fri at 9 AM)
327
+
328
+ slm switch-profile work
329
+ echo "Switched to work profile" | notify-send "SuperLocalMemory"
330
+ ```
331
+
332
+ ### Profile Statistics
333
+
334
+ **Compare profiles:**
335
+ ```bash
336
+ slm list-profiles --stats
337
+ ```
338
+
339
+ **Output:**
340
+ ```
341
+ Profile Memories Size Nodes Edges Patterns
342
+ default 1,247 4.2 MB 892 2,134 34
343
+ work 342 1.8 MB 256 789 12
344
+ personal 89 0.4 MB 67 145 4
345
+ ```
346
+
347
+ **Export profile summary:**
348
+ ```bash
349
+ slm profile-summary work > work-summary.txt
350
+ ```
351
+
352
+ ## Troubleshooting
353
+
354
+ ### "Profile not found"
355
+
356
+ **Cause:** Typo or profile doesn't exist
357
+
358
+ **Solution:**
359
+ ```bash
360
+ # List existing profiles
361
+ slm list-profiles
362
+
363
+ # Create if needed
364
+ slm switch-profile myprofile --create
365
+ ```
366
+
367
+ ### "Switch failed: Database locked"
368
+
369
+ **Cause:** AI tool still using old profile
370
+
371
+ **Solution:**
372
+ ```bash
373
+ # Kill all MCP servers
374
+ killall python3
375
+
376
+ # Try again
377
+ slm switch-profile work
378
+
379
+ # Restart AI tools
380
+ ```
381
+
382
+ ### "Memories disappeared after switching"
383
+
384
+ **Cause:** Switched to empty/different profile (working as intended)
385
+
386
+ **Solution:**
387
+ ```bash
388
+ # Check current profile
389
+ slm status | grep "Current Profile"
390
+
391
+ # Switch back to profile with memories
392
+ slm switch-profile default
393
+
394
+ # Or list all profiles to find the right one
395
+ slm list-profiles
396
+ ```
397
+
398
+ ### "AI tools still see old profile"
399
+
400
+ **Cause:** Didn't restart tools
401
+
402
+ **Solution:**
403
+ ```bash
404
+ # Must completely restart (not just reload)
405
+ # macOS: Cmd+Q, then reopen
406
+ # Windows/Linux: Close all windows, reopen
407
+ ```
408
+
409
+ ## Performance
410
+
411
+ | Operation | Time | Notes |
412
+ |-----------|------|-------|
413
+ | Switch profile | ~100ms | Instant |
414
+ | Create profile | ~200ms | Fast |
415
+ | List profiles | ~50ms | Very fast |
416
+
417
+ **Switching is fast** because it's just updating a symlink.
418
+
419
+ ## Notes
420
+
421
+ - **No data loss:** Switching never deletes memories
422
+ - **Profile persistence:** Memories stay in original profile
423
+ - **Tool transparency:** AI tools don't need special config per profile
424
+ - **Backup-friendly:** Each profile is separate directory
425
+
426
+ ## Related Commands
427
+
428
+ - `slm list-profiles` - Show all profiles
429
+ - `slm delete-profile <name>` - Delete a profile
430
+ - `slm rename-profile <old> <new>` - Rename profile
431
+ - `slm status` - Shows current profile
432
+ - `slm export-profile <name>` - Export to file
433
+ - `slm import-profile <file>` - Import from file
434
+
435
+ ---
436
+
437
+ **Created by:** [Varun Pratap Bhardwaj](https://github.com/varun369) (Solution Architect)
438
+ **Project:** SuperLocalMemory V2
439
+ **License:** MIT with attribution requirements (see [ATTRIBUTION.md](../../ATTRIBUTION.md))
440
+ **Repository:** https://github.com/varun369/SuperLocalMemoryV2
441
+
442
+ *Open source doesn't mean removing credit. Attribution must be preserved per MIT License terms.*