superlocalmemory 2.8.2 → 2.8.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.
Files changed (70) hide show
  1. package/README.md +7 -5
  2. package/api_server.py +5 -0
  3. package/bin/slm.bat +3 -3
  4. package/docs/SECURITY-QUICK-REFERENCE.md +214 -0
  5. package/install.ps1 +11 -11
  6. package/mcp_server.py +3 -3
  7. package/package.json +2 -2
  8. package/requirements-core.txt +16 -18
  9. package/requirements-learning.txt +8 -8
  10. package/requirements.txt +9 -7
  11. package/scripts/prepack.js +33 -0
  12. package/scripts/verify-v27.ps1 +301 -0
  13. package/src/agent_registry.py +32 -28
  14. package/src/auto_backup.py +12 -6
  15. package/src/cache_manager.py +2 -2
  16. package/src/compression/__init__.py +25 -0
  17. package/src/compression/cli.py +150 -0
  18. package/src/compression/cold_storage.py +217 -0
  19. package/src/compression/config.py +72 -0
  20. package/src/compression/orchestrator.py +133 -0
  21. package/src/compression/tier2_compressor.py +228 -0
  22. package/src/compression/tier3_compressor.py +153 -0
  23. package/src/compression/tier_classifier.py +148 -0
  24. package/src/db_connection_manager.py +5 -5
  25. package/src/event_bus.py +24 -22
  26. package/src/hnsw_index.py +3 -3
  27. package/src/learning/__init__.py +5 -4
  28. package/src/learning/adaptive_ranker.py +14 -265
  29. package/src/learning/bootstrap/__init__.py +69 -0
  30. package/src/learning/bootstrap/constants.py +93 -0
  31. package/src/learning/bootstrap/db_queries.py +316 -0
  32. package/src/learning/bootstrap/sampling.py +82 -0
  33. package/src/learning/bootstrap/text_utils.py +71 -0
  34. package/src/learning/cross_project_aggregator.py +58 -57
  35. package/src/learning/db/__init__.py +40 -0
  36. package/src/learning/db/constants.py +44 -0
  37. package/src/learning/db/schema.py +279 -0
  38. package/src/learning/learning_db.py +15 -234
  39. package/src/learning/ranking/__init__.py +33 -0
  40. package/src/learning/ranking/constants.py +84 -0
  41. package/src/learning/ranking/helpers.py +278 -0
  42. package/src/learning/source_quality_scorer.py +66 -65
  43. package/src/learning/synthetic_bootstrap.py +28 -310
  44. package/src/memory/__init__.py +36 -0
  45. package/src/memory/cli.py +205 -0
  46. package/src/memory/constants.py +39 -0
  47. package/src/memory/helpers.py +28 -0
  48. package/src/memory/schema.py +166 -0
  49. package/src/memory-profiles.py +94 -86
  50. package/src/memory-reset.py +187 -185
  51. package/src/memory_compression.py +2 -2
  52. package/src/memory_store_v2.py +34 -354
  53. package/src/migrate_v1_to_v2.py +11 -10
  54. package/src/patterns/analyzers.py +104 -100
  55. package/src/patterns/learner.py +17 -13
  56. package/src/patterns/scoring.py +25 -21
  57. package/src/patterns/store.py +40 -38
  58. package/src/patterns/terminology.py +53 -51
  59. package/src/provenance_tracker.py +2 -2
  60. package/src/qualixar_attribution.py +1 -1
  61. package/src/search/engine.py +16 -14
  62. package/src/search/index_loader.py +13 -11
  63. package/src/setup_validator.py +160 -158
  64. package/src/subscription_manager.py +20 -18
  65. package/src/tree/builder.py +66 -64
  66. package/src/tree/nodes.py +103 -97
  67. package/src/tree/queries.py +142 -137
  68. package/src/tree/schema.py +46 -42
  69. package/src/webhook_dispatcher.py +3 -3
  70. package/ui_server.py +7 -4
package/README.md CHANGED
@@ -14,6 +14,7 @@
14
14
  </p>
15
15
 
16
16
  <p align="center">
17
+ <a href="https://arxiv.org/abs/2603.02240"><img src="https://img.shields.io/badge/arXiv-2603.02240-b31b1b?style=for-the-badge&logo=arxiv&logoColor=white" alt="arXiv"/></a>
17
18
  <a href="https://zenodo.org/records/18709670"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.18709670-blue?style=for-the-badge&logo=doi&logoColor=white" alt="DOI"/></a>
18
19
  <a href="https://zenodo.org/records/18709670"><img src="https://img.shields.io/badge/Zenodo-Research_Paper-1682D4?style=for-the-badge&logo=zenodo&logoColor=white" alt="Zenodo"/></a>
19
20
  <a href="https://www.researchgate.net/publication/400976053"><img src="https://img.shields.io/badge/ResearchGate-Paper-00CCBB?style=for-the-badge&logo=researchgate&logoColor=white" alt="ResearchGate"/></a>
@@ -55,21 +56,22 @@ The paper presents SuperLocalMemory's architecture for defending against OWASP A
55
56
 
56
57
  | Platform | Link |
57
58
  |----------|------|
59
+ | **arXiv** | [arXiv:2603.02240](https://arxiv.org/abs/2603.02240) |
58
60
  | **Zenodo** (CERN) | [DOI: 10.5281/zenodo.18709670](https://zenodo.org/records/18709670) |
59
61
  | **ResearchGate** | [Publication Page](https://www.researchgate.net/publication/400976053) |
60
- | **arXiv** | Submission under review |
61
62
  | **Research Portfolio** | [superlocalmemory.com/research](https://superlocalmemory.com/research) |
62
63
 
63
64
  If you use SuperLocalMemory in your research, please cite:
64
65
 
65
66
  ```bibtex
66
- @misc{bhardwaj2026superlocalmemory,
67
+ @article{bhardwaj2026superlocalmemory,
67
68
  title={SuperLocalMemory: Privacy-Preserving Multi-Agent Memory with Bayesian Trust Defense Against Memory Poisoning},
68
69
  author={Bhardwaj, Varun Pratap},
69
70
  year={2026},
70
- doi={10.5281/zenodo.18709670},
71
- url={https://zenodo.org/records/18709670},
72
- note={Preprint}
71
+ eprint={2603.02240},
72
+ archivePrefix={arXiv},
73
+ primaryClass={cs.AI},
74
+ url={https://arxiv.org/abs/2603.02240}
73
75
  }
74
76
  ```
75
77
 
package/api_server.py CHANGED
@@ -18,6 +18,8 @@ from fastapi.responses import HTMLResponse, JSONResponse
18
18
  from pydantic import BaseModel
19
19
  import uvicorn
20
20
 
21
+ from security_middleware import SecurityHeadersMiddleware
22
+
21
23
  # Import local modules
22
24
  import sys
23
25
  sys.path.insert(0, str(Path(__file__).parent / "src"))
@@ -37,6 +39,9 @@ app = FastAPI(
37
39
  version="2.0.0"
38
40
  )
39
41
 
42
+ # Security middleware (add first for proper header application)
43
+ app.add_middleware(SecurityHeadersMiddleware)
44
+
40
45
  # Mount static files
41
46
  UI_DIR.mkdir(exist_ok=True)
42
47
  app.mount("/static", StaticFiles(directory=str(UI_DIR)), name="static")
package/bin/slm.bat CHANGED
@@ -49,7 +49,7 @@ exit /b 1
49
49
 
50
50
  REM Parse command
51
51
  if "%1"=="" (
52
- echo SuperLocalMemory V2.1.0 - Universal AI Memory System
52
+ echo SuperLocalMemory - Universal AI Memory System
53
53
  echo.
54
54
  echo Usage: slm [command] [options]
55
55
  echo.
@@ -145,7 +145,7 @@ if exist "%INSTALL_DIR%\memory-profiles.py" (
145
145
  exit /b %ERRORLEVEL%
146
146
 
147
147
  :show_help
148
- echo SuperLocalMemory V2.1.0 - Universal AI Memory System
148
+ echo SuperLocalMemory - Universal AI Memory System
149
149
  echo.
150
150
  echo Usage: slm [command] [options]
151
151
  echo.
@@ -188,7 +188,7 @@ echo Report issues: https://github.com/varun369/SuperLocalMemoryV2/issues
188
188
  exit /b 0
189
189
 
190
190
  :show_version
191
- echo SuperLocalMemory V2.1.0-universal
191
+ echo SuperLocalMemory V2.8.3
192
192
  echo Copyright (c) 2026 Varun Pratap Bhardwaj
193
193
  echo Licensed under MIT License
194
194
  echo Repository: https://github.com/varun369/SuperLocalMemoryV2
@@ -0,0 +1,214 @@
1
+ # Security Quick Reference — For Developers
2
+
3
+ **Last Updated:** March 4, 2026
4
+
5
+ ## TL;DR — Safe Coding Patterns
6
+
7
+ ### ✅ DO THIS (Safe)
8
+
9
+ ```javascript
10
+ // Safe: Use textContent for plain text
11
+ element.textContent = userContent;
12
+
13
+ // Safe: Use escapeHtml() before DOM insertion
14
+ element.innerHTML = escapeHtml(userContent);
15
+
16
+ // Safe: Create elements programmatically
17
+ const div = document.createElement('div');
18
+ div.textContent = userContent;
19
+ parent.appendChild(div);
20
+ ```
21
+
22
+ ### ❌ DON'T DO THIS (Dangerous)
23
+
24
+ ```javascript
25
+ // DANGEROUS: Direct assignment with user content
26
+ element.innerHTML = userContent; // XSS VULNERABLE
27
+
28
+ // DANGEROUS: Using code evaluation with user input
29
+ // Never use eval, Function constructor, or similar
30
+
31
+ // DANGEROUS: Inline event handlers with user content
32
+ element.setAttribute('onclick', userCode); // XSS VULNERABLE
33
+ ```
34
+
35
+ ## Security Checklist — Before Committing
36
+
37
+ - [ ] No direct innerHTML assignments without escapeHtml()
38
+ - [ ] All user content either uses textContent or is escaped
39
+ - [ ] No code evaluation with user input
40
+ - [ ] No inline event handlers with dynamic content
41
+ - [ ] All API endpoints return explicit Content-Type
42
+ - [ ] SQL queries use parameterized statements (never string concatenation)
43
+ - [ ] No secrets in code or config files
44
+ - [ ] Run security tests: pytest tests/test_security_headers.py -v
45
+
46
+ ## Common Patterns
47
+
48
+ ### Rendering User-Generated Content
49
+
50
+ **Pattern 1: Plain Text Only**
51
+ ```javascript
52
+ const contentDiv = document.getElementById('memory-content');
53
+ contentDiv.textContent = memory.content; // Automatically safe
54
+ ```
55
+
56
+ **Pattern 2: Mixed Content (HTML Structure + User Text)**
57
+ ```javascript
58
+ const html = `
59
+ <div class="memory-card">
60
+ <h3>${escapeHtml(memory.title)}</h3>
61
+ <p>${escapeHtml(memory.content)}</p>
62
+ <span class="badge">${escapeHtml(memory.category)}</span>
63
+ </div>
64
+ `;
65
+ container.innerHTML = html;
66
+ ```
67
+
68
+ **Pattern 3: Building DOM Programmatically (Most Secure)**
69
+ ```javascript
70
+ const card = document.createElement('div');
71
+ card.className = 'memory-card';
72
+
73
+ const title = document.createElement('h3');
74
+ title.textContent = memory.title;
75
+
76
+ const content = document.createElement('p');
77
+ content.textContent = memory.content;
78
+
79
+ card.appendChild(title);
80
+ card.appendChild(content);
81
+ container.appendChild(card);
82
+ ```
83
+
84
+ ### FastAPI Routes
85
+
86
+ **Safe Pattern:**
87
+ ```python
88
+ @router.get("/api/memories")
89
+ async def get_memories():
90
+ # FastAPI automatically sets Content-Type: application/json
91
+ return {
92
+ "memories": memories, # User content here is safe in JSON
93
+ "total": len(memories)
94
+ }
95
+ ```
96
+
97
+ **SQL Queries:**
98
+ ```python
99
+ # SAFE: Parameterized query
100
+ cursor.execute("SELECT * FROM memories WHERE id = ?", (memory_id,))
101
+
102
+ # DANGEROUS: String concatenation (SQL injection)
103
+ # Never use f-strings or concatenation for SQL queries
104
+ ```
105
+
106
+ ## Testing XSS Protection
107
+
108
+ ```python
109
+ # Test that XSS payloads are handled safely
110
+ def test_xss_payload():
111
+ payload = "<script>alert('xss')</script>"
112
+
113
+ # This should be safe when:
114
+ # 1. Returned as JSON with Content-Type: application/json
115
+ # 2. Rendered with escapeHtml() on client
116
+ # 3. Protected by CSP headers
117
+
118
+ response = client.get(f"/api/memory?content={payload}")
119
+ assert response.headers["Content-Type"] == "application/json"
120
+ assert response.headers["X-Content-Type-Options"] == "nosniff"
121
+ ```
122
+
123
+ ## Security Headers Reference
124
+
125
+ All responses include these headers automatically via SecurityHeadersMiddleware:
126
+
127
+ - X-Content-Type-Options: nosniff
128
+ - X-Frame-Options: DENY
129
+ - X-XSS-Protection: 1; mode=block
130
+ - Content-Security-Policy: (comprehensive policy)
131
+ - Referrer-Policy: strict-origin-when-cross-origin
132
+ - Cache-Control: no-store (API endpoints only)
133
+
134
+ **Don't override these headers** unless you have a specific security reason and understand the implications.
135
+
136
+ ## CORS Configuration
137
+
138
+ Current allowed origins:
139
+ - http://localhost:8765
140
+ - http://127.0.0.1:8765
141
+ - http://localhost:8417
142
+ - http://127.0.0.1:8417
143
+
144
+ **To add a new origin:**
145
+ 1. Add to the allow_origins list in ui_server.py
146
+ 2. Document why it's needed
147
+ 3. Never use wildcard * in production
148
+
149
+ ## When to Update Security
150
+
151
+ ### Add New Route
152
+ - [ ] Verify return type has explicit Content-Type
153
+ - [ ] Test with XSS payloads
154
+ - [ ] Add test case to test_security_headers.py
155
+
156
+ ### Add New JavaScript
157
+ - [ ] Use textContent for plain text
158
+ - [ ] Use escapeHtml() for mixed content
159
+ - [ ] Test rendering with XSS payloads
160
+
161
+ ### Modify Security Headers
162
+ - [ ] Document reason in commit message
163
+ - [ ] Update SECURITY.md
164
+ - [ ] Run full security test suite
165
+ - [ ] Consider security implications
166
+
167
+ ## Resources
168
+
169
+ - **Full Security Policy:** See SECURITY.md
170
+ - **Security Enhancement Details:** .backup/security-enhancement-2026-03-04.md
171
+ - **Security Tests:** tests/test_security_headers.py
172
+ - **Middleware Source:** security_middleware.py
173
+ - **Client-Side Escaping:** ui/app.js (escapeHtml function)
174
+
175
+ ## Quick Test Commands
176
+
177
+ ```bash
178
+ # Run security tests only
179
+ pytest tests/test_security_headers.py -v
180
+
181
+ # Run all tests
182
+ pytest tests/ -x -q
183
+
184
+ # Manual verification (browser)
185
+ python3 ui_server.py
186
+ # Open http://localhost:8765
187
+ # DevTools → Network → Check response headers
188
+ ```
189
+
190
+ ## Red Flags — Stop and Review
191
+
192
+ If you see any of these patterns, STOP and review:
193
+
194
+ - innerHTML with user content (without escaping)
195
+ - Code evaluation functions anywhere
196
+ - String concatenation in SQL queries
197
+ - CORS with wildcard *
198
+ - User input in event handler attributes
199
+ - Disabling CSP or security headers
200
+ - Secrets or API keys in code
201
+
202
+ ## When in Doubt
203
+
204
+ **Ask these questions:**
205
+ 1. Could a user inject a script tag here?
206
+ 2. Is this content escaped before rendering?
207
+ 3. Does this SQL query use parameters?
208
+ 4. Could this header configuration weaken security?
209
+
210
+ **If unsure:** Use the safest pattern (textContent or programmatic DOM creation).
211
+
212
+ ---
213
+
214
+ **Remember:** Defense in depth. We have multiple layers (headers, CSP, escaping). Use all of them.
package/install.ps1 CHANGED
@@ -1,10 +1,18 @@
1
1
  # ============================================================================
2
- # SuperLocalMemory V2.2.0 - Windows Installation Script (PowerShell)
2
+ # SuperLocalMemory V2.8.3 - Windows Installation Script (PowerShell)
3
3
  # Copyright (c) 2026 Varun Pratap Bhardwaj
4
4
  # Licensed under MIT License
5
5
  # Repository: https://github.com/varun369/SuperLocalMemoryV2
6
6
  # ============================================================================
7
7
 
8
+ # IMPORTANT: param() must be the FIRST executable statement in PowerShell
9
+ param(
10
+ [switch]$NonInteractive,
11
+ [switch]$Auto,
12
+ [switch]$Yes,
13
+ [switch]$y
14
+ )
15
+
8
16
  $ErrorActionPreference = "Stop"
9
17
 
10
18
  $INSTALL_DIR = Join-Path $env:USERPROFILE ".claude-memory"
@@ -16,14 +24,6 @@ if (-not [Environment]::UserInteractive) {
16
24
  $NON_INTERACTIVE = $true
17
25
  }
18
26
 
19
- # Parse command line arguments
20
- param(
21
- [switch]$NonInteractive,
22
- [switch]$Auto,
23
- [switch]$Yes,
24
- [switch]$y
25
- )
26
-
27
27
  if ($NonInteractive -or $Auto -or $Yes -or $y) {
28
28
  $NON_INTERACTIVE = $true
29
29
  }
@@ -31,7 +31,7 @@ if ($NonInteractive -or $Auto -or $Yes -or $y) {
31
31
  # Print banner
32
32
  Write-Host ""
33
33
  Write-Host "=================================================================="
34
- Write-Host " SuperLocalMemory V2.2.0 - Windows Installation "
34
+ Write-Host " SuperLocalMemory V2.8.3 - Windows Installation "
35
35
  Write-Host " by Varun Pratap Bhardwaj "
36
36
  Write-Host " https://github.com/varun369/SuperLocalMemoryV2 "
37
37
  Write-Host "=================================================================="
@@ -552,7 +552,7 @@ Write-Host "=================================================================="
552
552
  Write-Host " Optional Features Available "
553
553
  Write-Host "=================================================================="
554
554
  Write-Host ""
555
- Write-Host "SuperLocalMemory V2.2.0 includes optional features:"
555
+ Write-Host "SuperLocalMemory includes optional features:"
556
556
  Write-Host ""
557
557
  Write-Host " 1) Advanced Search (~1.5GB, 5-10 min)"
558
558
  Write-Host " - Semantic search with sentence transformers"
package/mcp_server.py CHANGED
@@ -203,7 +203,7 @@ _agent_registry = None
203
203
  _provenance_tracker = None
204
204
 
205
205
 
206
- def get_agent_registry():
206
+ def get_agent_registry() -> Optional[Any]:
207
207
  """Get shared AgentRegistry singleton (v2.5+). Returns None if unavailable."""
208
208
  global _agent_registry
209
209
  if not PROVENANCE_AVAILABLE:
@@ -213,7 +213,7 @@ def get_agent_registry():
213
213
  return _agent_registry
214
214
 
215
215
 
216
- def get_provenance_tracker():
216
+ def get_provenance_tracker() -> Optional[Any]:
217
217
  """Get shared ProvenanceTracker singleton (v2.5+). Returns None if unavailable."""
218
218
  global _provenance_tracker
219
219
  if not PROVENANCE_AVAILABLE:
@@ -226,7 +226,7 @@ def get_provenance_tracker():
226
226
  _trust_scorer = None
227
227
 
228
228
 
229
- def get_trust_scorer():
229
+ def get_trust_scorer() -> Optional[Any]:
230
230
  """Get shared TrustScorer singleton (v2.6+). Returns None if unavailable."""
231
231
  global _trust_scorer
232
232
  if not TRUST_AVAILABLE:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superlocalmemory",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "description": "Your AI Finally Remembers You - Local-first intelligent memory system for AI assistants. Works with Claude, Cursor, Windsurf, VS Code/Copilot, Codex, and 17+ AI tools. 100% local, zero cloud dependencies.",
5
5
  "keywords": [
6
6
  "ai-memory",
@@ -46,7 +46,7 @@
46
46
  "superlocalmemory": "./bin/slm-npm"
47
47
  },
48
48
  "scripts": {
49
- "prepack": "find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null; find . -name '*.pyc' -delete 2>/dev/null; true",
49
+ "prepack": "node scripts/prepack.js",
50
50
  "postinstall": "node scripts/postinstall.js",
51
51
  "preuninstall": "node scripts/preuninstall.js",
52
52
  "test": "echo \"Run: npm install -g . && slm status\" && exit 0"
@@ -1,24 +1,22 @@
1
- # SuperLocalMemory V2.2.0 - Core Required Dependencies
1
+ # SuperLocalMemory - Core Feature Dependencies
2
2
  # ============================================================================
3
- # These packages are REQUIRED for core features (graph & patterns)
4
- # Install automatically during setup for smooth user experience
3
+ # Required for knowledge graph and web dashboard.
4
+ # Core memory operations work without these (stdlib only).
5
5
  #
6
- # Download size: ~50MB
7
- # Installation time: 1-2 minutes
8
- #
9
- # Install with: pip3 install -r requirements-core.txt
6
+ # Download size: ~50MB | Install time: 1-2 minutes
7
+ # Install: pip3 install -r requirements-core.txt
10
8
  # ============================================================================
11
9
 
12
- # Knowledge Graph - Required for graph_engine.py
13
- python-igraph>=0.10.0
14
- leidenalg>=0.9.0
15
- scikit-learn>=1.3.0 # Required for TF-IDF vectorization
10
+ # Knowledge Graph
11
+ python-igraph>=0.10.0,<2.0.0
12
+ leidenalg>=0.9.0,<1.0.0
13
+ scikit-learn>=1.3.0,<2.0.0
16
14
 
17
- # Web Dashboard - Required for ui_server.py
18
- fastapi>=0.109.0
19
- uvicorn[standard]>=0.27.0
20
- python-multipart>=0.0.6
15
+ # Web Dashboard
16
+ fastapi>=0.109.0,<1.0.0
17
+ uvicorn[standard]>=0.27.0,<1.0.0
18
+ python-multipart>=0.0.6,<1.0.0
21
19
 
22
- # Performance - JSON and caching
23
- orjson>=3.9.0
24
- diskcache>=5.6.0
20
+ # Performance
21
+ orjson>=3.9.0,<4.0.0
22
+ diskcache>=5.6.0,<6.0.0
@@ -1,12 +1,12 @@
1
- # SuperLocalMemory v2.7 - Learning Dependencies
1
+ # SuperLocalMemory - Learning Dependencies
2
2
  # ============================================================================
3
- # Optional but recommended. Enables intelligent pattern learning and
4
- # personalized recall ranking.
5
- #
6
- # If installation fails, core features work normally (v2.6 behavior).
7
- # To install: pip3 install -r requirements-learning.txt
3
+ # Optional but recommended. Enables intelligent pattern learning
4
+ # and personalized recall ranking.
8
5
  #
6
+ # If installation fails, core features work normally.
7
+ # Install: pip3 install -r requirements-learning.txt
9
8
  # Download size: ~30MB
10
9
  # ============================================================================
11
- lightgbm>=4.0.0
12
- scipy>=1.9.0
10
+
11
+ lightgbm>=4.0.0,<5.0.0
12
+ scipy>=1.9.0,<2.0.0
package/requirements.txt CHANGED
@@ -1,10 +1,12 @@
1
- # SuperLocalMemory V2 - Core Requirements
1
+ # SuperLocalMemory - Core Requirements
2
2
  # ============================================================================
3
- # SuperLocalMemory V2.2.0 has ZERO core dependencies
4
- # All functionality works with Python 3.8+ standard library only
3
+ # Core memory operations (store, recall, search) work with Python 3.8+
4
+ # standard library only no required dependencies.
5
5
  #
6
- # For optional advanced features, see:
7
- # - requirements-full.txt (all optional features)
8
- # - requirements-ui.txt (web dashboard only)
9
- # - requirements-search.txt (advanced search only)
6
+ # Advanced features (knowledge graph, dashboard, semantic search) require
7
+ # optional dependencies listed in the other requirements files:
8
+ # - requirements-core.txt (graph + dashboard)
9
+ # - requirements-search.txt (semantic search)
10
+ # - requirements-learning.txt (ML-based ranking)
11
+ # - requirements-full.txt (everything)
10
12
  # ============================================================================
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * SuperLocalMemory - Cross-platform prepack cleanup
4
+ *
5
+ * Removes __pycache__ directories and .pyc files before npm pack.
6
+ * Works on Windows, macOS, and Linux.
7
+ */
8
+
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ function removePycache(dir) {
13
+ if (!fs.existsSync(dir)) return;
14
+
15
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
16
+ for (const entry of entries) {
17
+ const fullPath = path.join(dir, entry.name);
18
+
19
+ if (entry.isDirectory()) {
20
+ if (entry.name === '__pycache__' || entry.name === 'node_modules') {
21
+ if (entry.name === '__pycache__') {
22
+ fs.rmSync(fullPath, { recursive: true, force: true });
23
+ }
24
+ continue;
25
+ }
26
+ removePycache(fullPath);
27
+ } else if (entry.isFile() && entry.name.endsWith('.pyc')) {
28
+ fs.unlinkSync(fullPath);
29
+ }
30
+ }
31
+ }
32
+
33
+ removePycache(process.cwd());