superlocalmemory 3.0.12 → 3.0.14

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/LICENSE CHANGED
@@ -14,8 +14,9 @@ copies or substantial portions of the Software.
14
14
 
15
15
  ATTRIBUTION NOTICE:
16
16
  This software contains novel mathematical methods described in:
17
+ - arXiv:2603.14588 (SuperLocalMemory V3 — Information-Geometric Foundations)
17
18
  - arXiv:2603.02240 (SuperLocalMemory V2 — Bayesian Trust Defense)
18
- - Zenodo DOI: 10.5281/zenodo.19038659 (SuperLocalMemory V3 — Information-Geometric Foundations)
19
+ - Zenodo DOI: 10.5281/zenodo.19038659 (SuperLocalMemory V3)
19
20
 
20
21
  Academic use MUST cite the relevant paper.
21
22
  Commercial use MUST retain this notice, the NOTICE file, and visible attribution.
package/NOTICE CHANGED
@@ -42,7 +42,7 @@ PUBLICATIONS
42
42
  - V3 Paper: "SuperLocalMemory V3: Information-Geometric Foundations for
43
43
  Zero-LLM Enterprise Agent Memory"
44
44
  Zenodo DOI: 10.5281/zenodo.19038659
45
- arXiv: Submitted March 2026 (cs.AI, cs.IR, cs.LG)
45
+ arXiv: 2603.14588 (cs.AI, cs.IR, cs.LG)
46
46
 
47
47
  - V2 Paper: "SuperLocalMemory: Privacy-Preserving Multi-Agent Memory with
48
48
  Bayesian Trust Defense Against Memory Poisoning"
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  <p align="center">
13
13
  <a href="https://superlocalmemory.com"><img src="https://img.shields.io/badge/Website-superlocalmemory.com-ff6b35?style=for-the-badge" alt="Website"/></a>
14
- <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 Paper"/></a>
14
+ <a href="https://arxiv.org/abs/2603.14588"><img src="https://img.shields.io/badge/arXiv-2603.14588-b31b1b?style=for-the-badge&logo=arxiv&logoColor=white" alt="arXiv V3 Paper"/></a>
15
15
  <a href="https://zenodo.org/records/19038659"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.19038659-blue?style=for-the-badge&logo=doi&logoColor=white" alt="V3 DOI"/></a>
16
16
  </p>
17
17
 
@@ -277,7 +277,7 @@ Evaluated on the [LoCoMo benchmark](https://arxiv.org/abs/2402.09714) (Long Conv
277
277
  ### V3: Information-Geometric Foundations
278
278
  > **SuperLocalMemory V3: Information-Geometric Foundations for Zero-LLM Enterprise Agent Memory**
279
279
  > Varun Pratap Bhardwaj (2026)
280
- > [Zenodo DOI: 10.5281/zenodo.19038659](https://zenodo.org/records/19038659)
280
+ > [arXiv:2603.14588](https://arxiv.org/abs/2603.14588) | [Zenodo DOI: 10.5281/zenodo.19038659](https://zenodo.org/records/19038659)
281
281
 
282
282
  ### V2: Architecture & Engineering
283
283
  > **SuperLocalMemory: A Structured Local Memory Architecture for Persistent AI Agent Context**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superlocalmemory",
3
- "version": "3.0.12",
3
+ "version": "3.0.14",
4
4
  "description": "Information-geometric agent memory with mathematical guarantees. 4-channel retrieval, Fisher-Rao similarity, zero-LLM mode, EU AI Act compliant. Works with Claude, Cursor, Windsurf, and 17+ AI tools.",
5
5
  "keywords": [
6
6
  "ai-memory",
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "superlocalmemory"
3
- version = "3.0.12"
3
+ version = "3.0.14"
4
4
  description = "Information-geometric agent memory with mathematical guarantees"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -151,6 +151,7 @@ def cmd_forget(args: Namespace) -> None:
151
151
 
152
152
  config = SLMConfig.load()
153
153
  engine = MemoryEngine(config)
154
+ engine.initialize()
154
155
  facts = engine._db.get_all_facts(engine.profile_id)
155
156
  query_lower = args.query.lower()
156
157
  matches = [f for f in facts if query_lower in f.content.lower()]
@@ -191,6 +192,7 @@ def cmd_health(_args: Namespace) -> None:
191
192
 
192
193
  config = SLMConfig.load()
193
194
  engine = MemoryEngine(config)
195
+ engine.initialize()
194
196
  facts = engine._db.get_all_facts(engine.profile_id)
195
197
  fisher_count = sum(1 for f in facts if f.fisher_mean is not None)
196
198
  langevin_count = sum(1 for f in facts if f.langevin_position is not None)
@@ -216,6 +216,28 @@ CREATE INDEX IF NOT EXISTS idx_facts_interval
216
216
  # FTS5 virtual table on atomic_facts for full-text search
217
217
  # ---------------------------------------------------------------------------
218
218
 
219
+ _SQL_V2_MIGRATION_CLEANUP: Final[str] = """
220
+ -- Clean up stale V2 triggers that fire on active tables but reference
221
+ -- renamed backup FTS tables. The V2→V3 migration renames tables via
222
+ -- ALTER TABLE RENAME, which auto-updates trigger bodies to reference
223
+ -- _v2_bak_* tables but leaves FTS5 delete-command column names stale.
224
+ -- This causes: "table _v2_bak_*_fts has no column named *_fts"
225
+
226
+ -- Drop V2-era triggers on memories table (memories_ai/ad/au)
227
+ DROP TRIGGER IF EXISTS memories_ai;
228
+ DROP TRIGGER IF EXISTS memories_ad;
229
+ DROP TRIGGER IF EXISTS memories_au;
230
+
231
+ -- Drop stale V3 triggers (may have been corrupted by V2 rename)
232
+ DROP TRIGGER IF EXISTS atomic_facts_fts_insert;
233
+ DROP TRIGGER IF EXISTS atomic_facts_fts_delete;
234
+ DROP TRIGGER IF EXISTS atomic_facts_fts_update;
235
+
236
+ -- Drop renamed V2 backup FTS virtual tables (and their shadow tables)
237
+ DROP TABLE IF EXISTS "_v2_bak_atomic_facts_fts";
238
+ DROP TABLE IF EXISTS "_v2_bak_memories_fts";
239
+ """
240
+
219
241
  _SQL_ATOMIC_FACTS_FTS: Final[str] = """
220
242
  CREATE VIRTUAL TABLE IF NOT EXISTS atomic_facts_fts
221
243
  USING fts5(
@@ -226,8 +248,11 @@ CREATE VIRTUAL TABLE IF NOT EXISTS atomic_facts_fts
226
248
  );
227
249
 
228
250
  -- Triggers to keep FTS in sync with atomic_facts.
251
+ -- Always DROP+CREATE (not IF NOT EXISTS) to replace any stale triggers
252
+ -- left by V2 migration.
253
+
229
254
  -- INSERT trigger
230
- CREATE TRIGGER IF NOT EXISTS atomic_facts_fts_insert
255
+ CREATE TRIGGER atomic_facts_fts_insert
231
256
  AFTER INSERT ON atomic_facts
232
257
  BEGIN
233
258
  INSERT INTO atomic_facts_fts (rowid, fact_id, content)
@@ -235,7 +260,7 @@ BEGIN
235
260
  END;
236
261
 
237
262
  -- DELETE trigger
238
- CREATE TRIGGER IF NOT EXISTS atomic_facts_fts_delete
263
+ CREATE TRIGGER atomic_facts_fts_delete
239
264
  AFTER DELETE ON atomic_facts
240
265
  BEGIN
241
266
  INSERT INTO atomic_facts_fts (atomic_facts_fts, rowid, fact_id, content)
@@ -243,7 +268,7 @@ BEGIN
243
268
  END;
244
269
 
245
270
  -- UPDATE trigger
246
- CREATE TRIGGER IF NOT EXISTS atomic_facts_fts_update
271
+ CREATE TRIGGER atomic_facts_fts_update
247
272
  AFTER UPDATE OF content ON atomic_facts
248
273
  BEGIN
249
274
  INSERT INTO atomic_facts_fts (atomic_facts_fts, rowid, fact_id, content)
@@ -655,7 +680,9 @@ _DDL_ORDERED: Final[tuple[str, ...]] = (
655
680
  _SQL_COMPLIANCE_AUDIT,
656
681
  _SQL_BM25_TOKENS,
657
682
  _SQL_CONFIG,
658
- # FTS5 must come after atomic_facts (content table)
683
+ # V2 migration cleanup drop stale triggers/FTS before recreating
684
+ _SQL_V2_MIGRATION_CLEANUP,
685
+ # FTS5 must come after atomic_facts (content table) AND after cleanup
659
686
  _SQL_ATOMIC_FACTS_FTS,
660
687
  )
661
688
 
@@ -151,20 +151,33 @@ class V2Migrator:
151
151
  self._backup_db = self._v3_base / BACKUP_NAME
152
152
 
153
153
  def detect_v2(self) -> bool:
154
- """Check if a V2 installation exists."""
154
+ """Check if a V2 installation exists.
155
+
156
+ Returns False if .claude-memory is a symlink (already migrated).
157
+ """
158
+ if self._v2_base.is_symlink():
159
+ return False
155
160
  return self._v2_db.exists() and self._v2_db.is_file()
156
161
 
157
162
  def is_already_migrated(self) -> bool:
158
- """Check if migration has already been performed."""
163
+ """Check if migration has already been performed.
164
+
165
+ Detects migration by:
166
+ 1. .claude-memory is a symlink to .superlocalmemory (definitive)
167
+ 2. V3 schema tables exist in the V3 database
168
+ """
169
+ if self._v2_base.is_symlink():
170
+ return True
159
171
  if not self._v3_db.exists():
160
172
  return False
161
173
  try:
162
174
  conn = sqlite3.connect(str(self._v3_db))
163
175
  try:
164
- tables = [r[0] for r in conn.execute(
176
+ tables = {r[0] for r in conn.execute(
165
177
  "SELECT name FROM sqlite_master WHERE type='table'"
166
- ).fetchall()]
167
- return "semantic_facts" in tables and "v3_config" in tables
178
+ ).fetchall()}
179
+ # Check for actual V3 schema tables (not old migration markers)
180
+ return "atomic_facts" in tables and "canonical_entities" in tables
168
181
  finally:
169
182
  conn.close()
170
183
  except Exception:
@@ -217,12 +230,12 @@ class V2Migrator:
217
230
 
218
231
  Returns dict with migration stats.
219
232
  """
220
- if not self.detect_v2():
221
- return {"success": False, "error": "No V2 installation found"}
222
-
223
233
  if self.is_already_migrated():
224
234
  return {"success": True, "message": "Already migrated"}
225
235
 
236
+ if not self.detect_v2():
237
+ return {"success": False, "error": "No V2 installation found"}
238
+
226
239
  stats = {"steps": []}
227
240
 
228
241
  try:
@@ -268,6 +281,19 @@ class V2Migrator:
268
281
  # Disable FK enforcement for migrated DBs (V2 schema is incompatible)
269
282
  conn.execute("PRAGMA foreign_keys=OFF")
270
283
 
284
+ # Drop ALL triggers before renaming tables.
285
+ # ALTER TABLE RENAME auto-updates trigger bodies but corrupts
286
+ # FTS5 delete-command column names, causing:
287
+ # "table _v2_bak_*_fts has no column named *_fts"
288
+ v2_triggers = [r[0] for r in conn.execute(
289
+ "SELECT name FROM sqlite_master WHERE type='trigger'"
290
+ ).fetchall()]
291
+ for trigger in v2_triggers:
292
+ try:
293
+ conn.execute(f'DROP TRIGGER IF EXISTS "{trigger}"')
294
+ except Exception:
295
+ pass
296
+
271
297
  # Rename ALL tables with incompatible schemas (V2 + old alpha)
272
298
  # User data is in 'memories' table (already upgraded above)
273
299
  # Everything else is computed/derived and will be recreated by V3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superlocalmemory
3
- Version: 3.0.12
3
+ Version: 3.0.13
4
4
  Summary: Information-geometric agent memory with mathematical guarantees
5
5
  Author-email: Varun Pratap Bhardwaj <admin@superlocalmemory.com>
6
6
  License: MIT
@@ -58,7 +58,7 @@ Dynamic: license-file
58
58
 
59
59
  <p align="center">
60
60
  <a href="https://superlocalmemory.com"><img src="https://img.shields.io/badge/Website-superlocalmemory.com-ff6b35?style=for-the-badge" alt="Website"/></a>
61
- <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 Paper"/></a>
61
+ <a href="https://arxiv.org/abs/2603.14588"><img src="https://img.shields.io/badge/arXiv-2603.14588-b31b1b?style=for-the-badge&logo=arxiv&logoColor=white" alt="arXiv V3 Paper"/></a>
62
62
  <a href="https://zenodo.org/records/19038659"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.19038659-blue?style=for-the-badge&logo=doi&logoColor=white" alt="V3 DOI"/></a>
63
63
  </p>
64
64
 
@@ -324,7 +324,7 @@ Evaluated on the [LoCoMo benchmark](https://arxiv.org/abs/2402.09714) (Long Conv
324
324
  ### V3: Information-Geometric Foundations
325
325
  > **SuperLocalMemory V3: Information-Geometric Foundations for Zero-LLM Enterprise Agent Memory**
326
326
  > Varun Pratap Bhardwaj (2026)
327
- > [Zenodo DOI: 10.5281/zenodo.19038659](https://zenodo.org/records/19038659)
327
+ > [arXiv:2603.14588](https://arxiv.org/abs/2603.14588) | [Zenodo DOI: 10.5281/zenodo.19038659](https://zenodo.org/records/19038659)
328
328
 
329
329
  ### V2: Architecture & Engineering
330
330
  > **SuperLocalMemory: A Structured Local Memory Architecture for Persistent AI Agent Context**