superlocalmemory 2.7.5 → 2.8.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 (174) hide show
  1. package/CHANGELOG.md +120 -155
  2. package/README.md +115 -89
  3. package/api_server.py +2 -12
  4. package/docs/PATTERN-LEARNING.md +64 -199
  5. package/docs/example_graph_usage.py +4 -6
  6. package/install.ps1 +226 -0
  7. package/install.sh +59 -0
  8. package/mcp_server.py +83 -7
  9. package/package.json +3 -10
  10. package/scripts/generate-thumbnails.py +3 -5
  11. package/skills/slm-build-graph/SKILL.md +1 -1
  12. package/skills/slm-list-recent/SKILL.md +1 -1
  13. package/skills/slm-recall/SKILL.md +1 -1
  14. package/skills/slm-remember/SKILL.md +1 -1
  15. package/skills/slm-show-patterns/SKILL.md +1 -1
  16. package/skills/slm-status/SKILL.md +1 -1
  17. package/skills/slm-switch-profile/SKILL.md +1 -1
  18. package/src/agent_registry.py +7 -18
  19. package/src/auth_middleware.py +3 -5
  20. package/src/auto_backup.py +3 -7
  21. package/src/behavioral/__init__.py +49 -0
  22. package/src/behavioral/behavioral_listener.py +203 -0
  23. package/src/behavioral/behavioral_patterns.py +275 -0
  24. package/src/behavioral/cross_project_transfer.py +206 -0
  25. package/src/behavioral/outcome_inference.py +194 -0
  26. package/src/behavioral/outcome_tracker.py +193 -0
  27. package/src/behavioral/tests/__init__.py +4 -0
  28. package/src/behavioral/tests/test_behavioral_integration.py +108 -0
  29. package/src/behavioral/tests/test_behavioral_patterns.py +150 -0
  30. package/src/behavioral/tests/test_cross_project_transfer.py +142 -0
  31. package/src/behavioral/tests/test_mcp_behavioral.py +139 -0
  32. package/src/behavioral/tests/test_mcp_report_outcome.py +117 -0
  33. package/src/behavioral/tests/test_outcome_inference.py +107 -0
  34. package/src/behavioral/tests/test_outcome_tracker.py +96 -0
  35. package/src/cache_manager.py +4 -6
  36. package/src/compliance/__init__.py +48 -0
  37. package/src/compliance/abac_engine.py +149 -0
  38. package/src/compliance/abac_middleware.py +116 -0
  39. package/src/compliance/audit_db.py +215 -0
  40. package/src/compliance/audit_logger.py +148 -0
  41. package/src/compliance/retention_manager.py +289 -0
  42. package/src/compliance/retention_scheduler.py +186 -0
  43. package/src/compliance/tests/__init__.py +4 -0
  44. package/src/compliance/tests/test_abac_enforcement.py +95 -0
  45. package/src/compliance/tests/test_abac_engine.py +124 -0
  46. package/src/compliance/tests/test_abac_mcp_integration.py +118 -0
  47. package/src/compliance/tests/test_audit_db.py +123 -0
  48. package/src/compliance/tests/test_audit_logger.py +98 -0
  49. package/src/compliance/tests/test_mcp_audit.py +128 -0
  50. package/src/compliance/tests/test_mcp_retention_policy.py +125 -0
  51. package/src/compliance/tests/test_retention_manager.py +131 -0
  52. package/src/compliance/tests/test_retention_scheduler.py +99 -0
  53. package/src/db_connection_manager.py +2 -12
  54. package/src/embedding_engine.py +61 -669
  55. package/src/embeddings/__init__.py +47 -0
  56. package/src/embeddings/cache.py +70 -0
  57. package/src/embeddings/cli.py +113 -0
  58. package/src/embeddings/constants.py +47 -0
  59. package/src/embeddings/database.py +91 -0
  60. package/src/embeddings/engine.py +247 -0
  61. package/src/embeddings/model_loader.py +145 -0
  62. package/src/event_bus.py +3 -13
  63. package/src/graph/__init__.py +36 -0
  64. package/src/graph/build_helpers.py +74 -0
  65. package/src/graph/cli.py +87 -0
  66. package/src/graph/cluster_builder.py +188 -0
  67. package/src/graph/cluster_summary.py +148 -0
  68. package/src/graph/constants.py +47 -0
  69. package/src/graph/edge_builder.py +162 -0
  70. package/src/graph/entity_extractor.py +95 -0
  71. package/src/graph/graph_core.py +226 -0
  72. package/src/graph/graph_search.py +231 -0
  73. package/src/graph/hierarchical.py +207 -0
  74. package/src/graph/schema.py +99 -0
  75. package/src/graph_engine.py +45 -1451
  76. package/src/hnsw_index.py +3 -7
  77. package/src/hybrid_search.py +36 -683
  78. package/src/learning/__init__.py +27 -12
  79. package/src/learning/adaptive_ranker.py +50 -12
  80. package/src/learning/cross_project_aggregator.py +2 -12
  81. package/src/learning/engagement_tracker.py +2 -12
  82. package/src/learning/feature_extractor.py +175 -43
  83. package/src/learning/feedback_collector.py +7 -12
  84. package/src/learning/learning_db.py +180 -12
  85. package/src/learning/project_context_manager.py +2 -12
  86. package/src/learning/source_quality_scorer.py +2 -12
  87. package/src/learning/synthetic_bootstrap.py +2 -12
  88. package/src/learning/tests/__init__.py +2 -0
  89. package/src/learning/tests/test_adaptive_ranker.py +2 -6
  90. package/src/learning/tests/test_adaptive_ranker_v28.py +60 -0
  91. package/src/learning/tests/test_aggregator.py +2 -6
  92. package/src/learning/tests/test_auto_retrain_v28.py +35 -0
  93. package/src/learning/tests/test_e2e_ranking_v28.py +82 -0
  94. package/src/learning/tests/test_feature_extractor_v28.py +93 -0
  95. package/src/learning/tests/test_feedback_collector.py +2 -6
  96. package/src/learning/tests/test_learning_db.py +2 -6
  97. package/src/learning/tests/test_learning_db_v28.py +110 -0
  98. package/src/learning/tests/test_learning_init_v28.py +48 -0
  99. package/src/learning/tests/test_outcome_signals.py +48 -0
  100. package/src/learning/tests/test_project_context.py +2 -6
  101. package/src/learning/tests/test_schema_migration.py +319 -0
  102. package/src/learning/tests/test_signal_inference.py +11 -13
  103. package/src/learning/tests/test_source_quality.py +2 -6
  104. package/src/learning/tests/test_synthetic_bootstrap.py +3 -7
  105. package/src/learning/tests/test_workflow_miner.py +2 -6
  106. package/src/learning/workflow_pattern_miner.py +2 -12
  107. package/src/lifecycle/__init__.py +54 -0
  108. package/src/lifecycle/bounded_growth.py +239 -0
  109. package/src/lifecycle/compaction_engine.py +226 -0
  110. package/src/lifecycle/lifecycle_engine.py +302 -0
  111. package/src/lifecycle/lifecycle_evaluator.py +225 -0
  112. package/src/lifecycle/lifecycle_scheduler.py +130 -0
  113. package/src/lifecycle/retention_policy.py +285 -0
  114. package/src/lifecycle/tests/__init__.py +4 -0
  115. package/src/lifecycle/tests/test_bounded_growth.py +193 -0
  116. package/src/lifecycle/tests/test_compaction.py +179 -0
  117. package/src/lifecycle/tests/test_lifecycle_engine.py +137 -0
  118. package/src/lifecycle/tests/test_lifecycle_evaluation.py +177 -0
  119. package/src/lifecycle/tests/test_lifecycle_scheduler.py +127 -0
  120. package/src/lifecycle/tests/test_lifecycle_search.py +109 -0
  121. package/src/lifecycle/tests/test_mcp_compact.py +149 -0
  122. package/src/lifecycle/tests/test_mcp_lifecycle_status.py +114 -0
  123. package/src/lifecycle/tests/test_retention_policy.py +162 -0
  124. package/src/mcp_tools_v28.py +280 -0
  125. package/src/memory-profiles.py +2 -12
  126. package/src/memory-reset.py +2 -12
  127. package/src/memory_compression.py +2 -12
  128. package/src/memory_store_v2.py +76 -20
  129. package/src/migrate_v1_to_v2.py +2 -12
  130. package/src/pattern_learner.py +29 -975
  131. package/src/patterns/__init__.py +24 -0
  132. package/src/patterns/analyzers.py +247 -0
  133. package/src/patterns/learner.py +267 -0
  134. package/src/patterns/scoring.py +167 -0
  135. package/src/patterns/store.py +223 -0
  136. package/src/patterns/terminology.py +138 -0
  137. package/src/provenance_tracker.py +4 -14
  138. package/src/query_optimizer.py +4 -6
  139. package/src/rate_limiter.py +2 -6
  140. package/src/search/__init__.py +20 -0
  141. package/src/search/cli.py +77 -0
  142. package/src/search/constants.py +26 -0
  143. package/src/search/engine.py +239 -0
  144. package/src/search/fusion.py +122 -0
  145. package/src/search/index_loader.py +112 -0
  146. package/src/search/methods.py +162 -0
  147. package/src/search_engine_v2.py +4 -6
  148. package/src/setup_validator.py +7 -13
  149. package/src/subscription_manager.py +2 -12
  150. package/src/tree/__init__.py +59 -0
  151. package/src/tree/builder.py +183 -0
  152. package/src/tree/nodes.py +196 -0
  153. package/src/tree/queries.py +252 -0
  154. package/src/tree/schema.py +76 -0
  155. package/src/tree_manager.py +10 -711
  156. package/src/trust/__init__.py +45 -0
  157. package/src/trust/constants.py +66 -0
  158. package/src/trust/queries.py +157 -0
  159. package/src/trust/schema.py +95 -0
  160. package/src/trust/scorer.py +299 -0
  161. package/src/trust/signals.py +95 -0
  162. package/src/trust_scorer.py +39 -697
  163. package/src/webhook_dispatcher.py +2 -12
  164. package/ui/app.js +1 -1
  165. package/ui/index.html +3 -0
  166. package/ui/js/agents.js +1 -1
  167. package/ui/js/core.js +21 -5
  168. package/ui/js/profiles.js +29 -7
  169. package/ui_server.py +2 -14
  170. package/ATTRIBUTION.md +0 -140
  171. package/docs/ARCHITECTURE-V2.5.md +0 -190
  172. package/docs/GRAPH-ENGINE.md +0 -503
  173. package/docs/architecture-diagram.drawio +0 -405
  174. package/docs/plans/2026-02-13-benchmark-suite.md +0 -1349
@@ -1,16 +1,6 @@
1
1
  #!/usr/bin/env python3
2
- """
3
- SuperLocalMemory V2 - Webhook Dispatcher
4
- Copyright (c) 2026 Varun Pratap Bhardwaj
5
- Licensed under MIT License
6
-
7
- Repository: https://github.com/varun369/SuperLocalMemoryV2
8
- Author: Varun Pratap Bhardwaj (Solution Architect)
9
-
10
- NOTICE: This software is protected by MIT License.
11
- Attribution must be preserved in all copies or derivatives.
12
- """
13
-
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2026 SuperLocalMemory (superlocalmemory.com)
14
4
  """
15
5
  WebhookDispatcher — Delivers events via HTTP POST to configured webhook URLs.
16
6
 
package/ui/app.js CHANGED
@@ -1436,7 +1436,7 @@ async function loadAgents() {
1436
1436
  var protoBadge = document.createElement('span');
1437
1437
  var protocolColors = {
1438
1438
  'mcp': 'bg-primary', 'cli': 'bg-success', 'rest': 'bg-info',
1439
- 'python': 'bg-secondary', 'a2a': 'bg-warning'
1439
+ 'python': 'bg-secondary'
1440
1440
  };
1441
1441
  protoBadge.className = 'badge ' + (protocolColors[agent.protocol] || 'bg-secondary');
1442
1442
  protoBadge.textContent = agent.protocol;
package/ui/index.html CHANGED
@@ -649,6 +649,9 @@
649
649
  </button>
650
650
  </div>
651
651
  <span class="text-white-50 d-none d-md-inline" id="navbar-subtitle">Knowledge Graph Explorer</span>
652
+ <button class="btn btn-sm theme-toggle" id="refresh-dashboard-btn" onclick="refreshDashboard()" title="Refresh Dashboard" style="padding:4px 8px;">
653
+ <i class="bi bi-arrow-clockwise" aria-hidden="true"></i>
654
+ </button>
652
655
  <button class="theme-toggle" id="theme-toggle" onclick="toggleDarkMode()" aria-label="Toggle dark mode">
653
656
  <i class="bi bi-sun-fill" id="theme-icon" aria-hidden="true"></i>
654
657
  </button>
package/ui/js/agents.js CHANGED
@@ -70,7 +70,7 @@ async function loadAgents() {
70
70
  var protoBadge = document.createElement('span');
71
71
  var protocolColors = {
72
72
  'mcp': 'bg-primary', 'cli': 'bg-success', 'rest': 'bg-info',
73
- 'python': 'bg-secondary', 'a2a': 'bg-warning'
73
+ 'python': 'bg-secondary'
74
74
  };
75
75
  protoBadge.className = 'badge ' + (protocolColors[agent.protocol] || 'bg-secondary');
76
76
  protoBadge.textContent = agent.protocol;
package/ui/js/core.js CHANGED
@@ -182,16 +182,32 @@ async function loadStats() {
182
182
  try {
183
183
  var response = await fetch('/api/stats');
184
184
  var data = await response.json();
185
- animateCounter('stat-memories', data.overview.total_memories);
186
- animateCounter('stat-clusters', data.overview.total_clusters);
187
- animateCounter('stat-nodes', data.overview.graph_nodes);
188
- animateCounter('stat-edges', data.overview.graph_edges);
189
- populateFilters(data.categories, data.projects);
185
+ var ov = data.overview || {};
186
+ animateCounter('stat-memories', ov.total_memories || 0);
187
+ animateCounter('stat-clusters', ov.total_clusters || 0);
188
+ animateCounter('stat-nodes', ov.graph_nodes || 0);
189
+ animateCounter('stat-edges', ov.graph_edges || 0);
190
+ populateFilters(data.categories || [], data.projects || []);
190
191
  } catch (error) {
191
192
  console.error('Error loading stats:', error);
193
+ // On error (fresh install, server starting), show 0 instead of "-"
194
+ animateCounter('stat-memories', 0);
195
+ animateCounter('stat-clusters', 0);
196
+ animateCounter('stat-nodes', 0);
197
+ animateCounter('stat-edges', 0);
192
198
  }
193
199
  }
194
200
 
201
+ // Refresh entire dashboard — called by the refresh button in the header
202
+ function refreshDashboard() {
203
+ loadProfiles();
204
+ loadStats();
205
+ if (typeof loadGraph === 'function') loadGraph();
206
+ if (typeof loadMemories === 'function') loadMemories();
207
+ if (typeof loadEventStats === 'function') loadEventStats();
208
+ if (typeof loadAgents === 'function') loadAgents();
209
+ }
210
+
195
211
  function populateFilters(categories, projects) {
196
212
  var categorySelect = document.getElementById('filter-category');
197
213
  var projectSelect = document.getElementById('filter-project');
package/ui/js/profiles.js CHANGED
@@ -10,15 +10,34 @@ async function loadProfiles() {
10
10
  var profiles = data.profiles || [];
11
11
  var active = data.active_profile || 'default';
12
12
 
13
- profiles.forEach(function(p) {
13
+ if (profiles.length === 0) {
14
+ // Fresh install fallback — show default profile
14
15
  var opt = document.createElement('option');
15
- opt.value = p.name;
16
- opt.textContent = p.name + (p.memory_count ? ' (' + p.memory_count + ')' : '');
17
- if (p.name === active) opt.selected = true;
16
+ opt.value = 'default';
17
+ opt.textContent = 'default (0)';
18
+ opt.selected = true;
18
19
  select.appendChild(opt);
19
- });
20
+ } else {
21
+ profiles.forEach(function(p) {
22
+ var opt = document.createElement('option');
23
+ opt.value = p.name;
24
+ opt.textContent = p.name + ' (' + (p.memory_count || 0) + ')';
25
+ if (p.name === active) opt.selected = true;
26
+ select.appendChild(opt);
27
+ });
28
+ }
20
29
  } catch (error) {
21
30
  console.error('Error loading profiles:', error);
31
+ // On error, ensure dropdown shows at least 'default'
32
+ var select = document.getElementById('profile-select');
33
+ if (select && select.options.length === 0) {
34
+ select.textContent = '';
35
+ var opt = document.createElement('option');
36
+ opt.value = 'default';
37
+ opt.textContent = 'default';
38
+ opt.selected = true;
39
+ select.appendChild(opt);
40
+ }
22
41
  }
23
42
  }
24
43
 
@@ -53,8 +72,11 @@ async function createProfile(nameOverride) {
53
72
  showToast('Profile "' + name + '" created');
54
73
  var input = document.getElementById('new-profile-name');
55
74
  if (input) input.value = '';
56
- loadProfiles();
57
- loadProfilesTable();
75
+ // Force reload with small delay to ensure backend has persisted
76
+ setTimeout(function() {
77
+ loadProfiles();
78
+ if (typeof loadProfilesTable === 'function') loadProfilesTable();
79
+ }, 300);
58
80
  } catch (error) {
59
81
  console.error('Error creating profile:', error);
60
82
  showToast('Error creating profile');
package/ui_server.py CHANGED
@@ -1,16 +1,6 @@
1
1
  #!/usr/bin/env python3
2
- """
3
- SuperLocalMemory V2 - Intelligent Local Memory System
4
- Copyright (c) 2026 Varun Pratap Bhardwaj
5
- Licensed under MIT License
6
-
7
- Repository: https://github.com/varun369/SuperLocalMemoryV2
8
- Author: Varun Pratap Bhardwaj (Solution Architect)
9
-
10
- NOTICE: This software is protected by MIT License.
11
- Attribution must be preserved in all copies or derivatives.
12
- """
13
-
2
+ # SPDX-License-Identifier: MIT
3
+ # Copyright (c) 2026 SuperLocalMemory (superlocalmemory.com)
14
4
  """
15
5
  SuperLocalMemory V2.5.0 - FastAPI UI Server
16
6
  App initialization, middleware, static mount, and router registration.
@@ -69,8 +59,6 @@ app.add_middleware(
69
59
  "http://127.0.0.1:8765",
70
60
  "http://localhost:8417", # MCP
71
61
  "http://127.0.0.1:8417",
72
- "http://localhost:8766", # A2A (planned)
73
- "http://127.0.0.1:8766",
74
62
  ],
75
63
  allow_credentials=True,
76
64
  allow_methods=["*"],
package/ATTRIBUTION.md DELETED
@@ -1,140 +0,0 @@
1
- # Attribution & Creator Information
2
-
3
- ## Solution Architect & Creator
4
-
5
- **SuperLocalMemory V2** was architected, designed, and created by:
6
-
7
- ### **Varun Pratap Bhardwaj**
8
- - **GitHub**: [@varun369](https://github.com/varun369)
9
- - **Role**: Solution Architect & Original Creator
10
- - **Year**: 2026
11
-
12
- ---
13
-
14
- ## Attribution Requirements
15
-
16
- This project is licensed under the MIT License with the following attribution requirements:
17
-
18
- ### ✅ Required Attribution
19
-
20
- 1. **In Source Code**: All derivative works MUST retain the copyright notice and attribution headers in source files.
21
-
22
- 2. **In Documentation**: Any documentation, README, or public-facing materials MUST include:
23
- > "Built with SuperLocalMemory V2 by Varun Pratap Bhardwaj"
24
-
25
- 3. **In Binary Distributions**: Runtime attribution MUST be preserved in:
26
- - Startup messages
27
- - Version information
28
- - Help text
29
- - About dialogs
30
-
31
- 4. **In Modified Versions**: Any modifications or forks MUST clearly state:
32
- - Original creator: Varun Pratap Bhardwaj
33
- - Link to original repository
34
- - Nature of modifications
35
-
36
- ### ❌ Prohibited Uses
37
-
38
- While this project is open source under MIT License, the following are explicitly prohibited:
39
-
40
- 1. **No Credit Removal**: Removing or obscuring attribution to the original creator
41
- 2. **No Impersonation**: Claiming original authorship or primary creatorship
42
- 3. **No Rebranding**: Releasing as a different project without clear attribution
43
- 4. **No Commercial Misrepresentation**: Selling services based on this work without acknowledging the original creator
44
-
45
- ---
46
-
47
- ## Architecture Credit
48
-
49
- The following innovative architectural decisions and implementations are credited to **Varun Pratap Bhardwaj**:
50
-
51
- ### Core Architecture
52
- 1. **Dual Integration Pattern**: MCP Server + Agent Skills + CLI (three-tier fallback)
53
- 2. **Zero-Duplication Design**: Single SQLite database shared across all interfaces
54
- 3. **Universal Tool Support**: One installation works with 15+ IDEs and AI tools
55
- 4. **Profile Isolation System**: Complete memory separation via symlink-based profiles
56
-
57
- ### Technical Innovations
58
- 1. **TF-IDF Entity Extraction**: Automatic knowledge graph building from natural language
59
- 2. **Leiden Clustering**: Community detection for topic grouping
60
- 3. **Three-Method Search**: Semantic + Graph + Full-text hybrid search
61
- 4. **Pattern Learning**: Automatic coding preference detection
62
- 5. **Progressive Disclosure**: Skills system with metadata-first loading
63
-
64
- ### Integration Strategy
65
- 1. **Auto-Configuration**: Automatic IDE detection and config file updates
66
- 2. **Backup-First Safety**: Original configs preserved before modification
67
- 3. **Comprehensive Fallbacks**: Graceful degradation from MCP → Skills → CLI
68
- 4. **Cross-Platform Design**: Works identically on macOS, Linux, Windows
69
-
70
- ---
71
-
72
- ## Digital Signature
73
-
74
- This section contains cryptographic verification data. **DO NOT REMOVE.**
75
-
76
- ```
77
- CREATOR_SIGNATURE_V2
78
- ===================================
79
- Creator: Varun Pratap Bhardwaj
80
- GitHub: varun369
81
- Repository: SuperLocalMemoryV2
82
- Architecture Date: 2026-01-15
83
- Release Date: 2026-02-07
84
- Signature: VBPB-SLM-V2-2026-ARCHITECT
85
- Verification Hash: sha256:c9f3d1a8b5e2f4c6d8a9b3e7f1c4d6a8b9c3e7f2d5a8c1b4e6f9d2a7c5b8e1
86
- ===================================
87
- ```
88
-
89
- ---
90
-
91
- ## How to Attribute This Project
92
-
93
- ### In README Files
94
- ```markdown
95
- ## Built With
96
- - [SuperLocalMemory V2](https://github.com/varun369/SuperLocalMemoryV2) by Varun Pratap Bhardwaj
97
- ```
98
-
99
- ### In Source Code Comments
100
- ```python
101
- # Based on SuperLocalMemory V2 by Varun Pratap Bhardwaj
102
- # Original: https://github.com/varun369/SuperLocalMemoryV2
103
- ```
104
-
105
- ### In Documentation
106
- ```
107
- This project uses SuperLocalMemory V2, created by Varun Pratap Bhardwaj.
108
- ```
109
-
110
- ### In About/Help Text
111
- ```
112
- Powered by SuperLocalMemory V2
113
- Created by Varun Pratap Bhardwaj
114
- https://github.com/varun369/SuperLocalMemoryV2
115
- ```
116
-
117
- ---
118
-
119
- ## Enforcement
120
-
121
- Per MIT License terms, attribution is REQUIRED. Violations may result in:
122
- 1. Removal from community support channels
123
- 2. Public notice of attribution violation
124
- 3. Requests to hosting platforms for compliance
125
-
126
- **The MIT License requires attribution preservation in all copies and substantial portions of the Software.**
127
-
128
- ---
129
-
130
- ## Contact
131
-
132
- For licensing questions, commercial partnerships, or attribution clarifications:
133
- - **GitHub Issues**: https://github.com/varun369/SuperLocalMemoryV2/issues
134
- - **Discussions**: https://github.com/varun369/SuperLocalMemoryV2/discussions
135
-
136
- ---
137
-
138
- **Remember**: Open source thrives on proper attribution. Give credit where it's due.
139
-
140
- *Last Updated: February 7, 2026*
@@ -1,190 +0,0 @@
1
- # SuperLocalMemory V2.5 Architecture — "Your AI Memory Has a Heartbeat"
2
-
3
- **Version:** 2.5.0 | **Date:** February 12, 2026 | **Author:** Varun Pratap Bhardwaj
4
-
5
- ---
6
-
7
- ## What Changed in v2.5
8
-
9
- SuperLocalMemory transforms from **passive storage** (filing cabinet) to **active coordination layer** (nervous system). Every memory write, update, delete, or recall now triggers real-time events visible across all connected tools.
10
-
11
- ### Before v2.5 (Passive)
12
- ```
13
- Claude writes memory → saved to SQLite → done (silent)
14
- Cursor reads memory → returned → done (silent)
15
- ```
16
-
17
- ### After v2.5 (Active)
18
- ```
19
- Claude writes memory → saved to SQLite → Event Bus fires
20
- ├── SSE → Dashboard shows it live
21
- ├── Agent registered in registry
22
- ├── Trust signal recorded
23
- ├── Provenance tracked
24
- └── Webhook dispatched (if configured)
25
- ```
26
-
27
- ---
28
-
29
- ## System Architecture
30
-
31
- ```
32
- ┌─────────────────────────────────────────────────────────────┐
33
- │ ACCESS LAYER │
34
- │ MCP Server │ CLI │ REST API │ Skills │ Python Import │ A2A │
35
- └──────────────────────┬──────────────────────────────────────┘
36
-
37
- ┌──────────────────────┴──────────────────────────────────────┐
38
- │ MEMORY STORE V2 │
39
- │ ┌─────────────────────────────────────────────────────────┐ │
40
- │ │ DbConnectionManager (Singleton) │ │
41
- │ │ ├── WAL Mode (concurrent reads + serialized writes) │ │
42
- │ │ ├── Busy Timeout (5s wait, not fail) │ │
43
- │ │ ├── Thread-Local Read Pool │ │
44
- │ │ ├── Serialized Write Queue (threading.Queue) │ │
45
- │ │ └── Post-Write Hooks → Event Bus │ │
46
- │ └─────────────────────────────────────────────────────┘ │
47
- │ │
48
- │ On every write: │
49
- │ ├── EventBus.emit() → memory_events table + SSE + WS + WH │
50
- │ ├── ProvenanceTracker → created_by, source_protocol columns │
51
- │ ├── AgentRegistry → agent tracking + write/recall counters │
52
- │ └── TrustScorer → signal collection (silent, no enforcement)│
53
- └──────────────────────────────────────────────────────────────┘
54
-
55
- ┌──────────────────────┴──────────────────────────────────────┐
56
- │ STORAGE LAYER │
57
- │ SQLite (single file: ~/.claude-memory/memory.db) │
58
- │ │
59
- │ Tables: │
60
- │ ├── memories (+ provenance columns: created_by, │
61
- │ │ source_protocol, trust_score, provenance_chain) │
62
- │ ├── memory_events (event log with tiered retention) │
63
- │ ├── subscriptions (durable + ephemeral event subscriptions) │
64
- │ ├── agent_registry (connected agents + statistics) │
65
- │ ├── trust_signals (trust signal audit trail) │
66
- │ ├── graph_nodes, graph_edges, graph_clusters (knowledge graph)│
67
- │ ├── identity_patterns (learned preferences) │
68
- │ ├── sessions, creator_metadata │
69
- │ └── memories_fts (FTS5 full-text search index) │
70
- └──────────────────────────────────────────────────────────────┘
71
-
72
- ┌──────────────────────┴──────────────────────────────────────┐
73
- │ DASHBOARD LAYER │
74
- │ FastAPI UI Server (modular routes) │
75
- │ ├── 8 route modules in routes/ directory │
76
- │ ├── 28 API endpoints │
77
- │ ├── SSE /events/stream (real-time, cross-process) │
78
- │ ├── WebSocket /ws/updates │
79
- │ ├── 13 modular JS files in ui/js/ │
80
- │ └── 8 dashboard tabs (Graph, Memories, Clusters, Patterns, │
81
- │ Timeline, Live Events, Agents, Settings) │
82
- └──────────────────────────────────────────────────────────────┘
83
- ```
84
-
85
- ---
86
-
87
- ## New Components (v2.5)
88
-
89
- | Component | File | Purpose |
90
- |-----------|------|---------|
91
- | **DbConnectionManager** | `src/db_connection_manager.py` | WAL mode, busy timeout, read pool, write queue, post-write hooks |
92
- | **EventBus** | `src/event_bus.py` | Event emission, persistence, in-memory buffer, tiered retention |
93
- | **SubscriptionManager** | `src/subscription_manager.py` | Durable + ephemeral event subscriptions with filters |
94
- | **WebhookDispatcher** | `src/webhook_dispatcher.py` | Background HTTP POST delivery with retry logic |
95
- | **AgentRegistry** | `src/agent_registry.py` | Agent tracking, write/recall counters, protocol detection |
96
- | **ProvenanceTracker** | `src/provenance_tracker.py` | Memory origin tracking (who, how, trust, lineage) |
97
- | **TrustScorer** | `src/trust_scorer.py` | Bayesian trust scoring with decay, burst detection |
98
-
99
- ## New Database Tables (v2.5)
100
-
101
- | Table | Columns | Purpose |
102
- |-------|---------|---------|
103
- | `memory_events` | id, event_type, memory_id, source_agent, source_protocol, payload, importance, tier, created_at | Event log with tiered retention |
104
- | `subscriptions` | id, subscriber_id, channel, filter, webhook_url, durable, last_event_id | Event subscriptions |
105
- | `agent_registry` | id, agent_id, agent_name, protocol, first_seen, last_seen, memories_written, memories_recalled, trust_score, metadata | Agent tracking |
106
- | `trust_signals` | id, agent_id, signal_type, delta, old_score, new_score, context, created_at | Trust audit trail |
107
-
108
- ## New Columns on `memories` Table (v2.5)
109
-
110
- | Column | Type | Default | Purpose |
111
- |--------|------|---------|---------|
112
- | `created_by` | TEXT | 'user' | Agent ID that created this memory |
113
- | `source_protocol` | TEXT | 'cli' | Protocol used (mcp, cli, rest, python, a2a) |
114
- | `trust_score` | REAL | 1.0 | Trust score at creation time |
115
- | `provenance_chain` | TEXT | '[]' | JSON derivation lineage |
116
-
117
- ---
118
-
119
- ## Event Types
120
-
121
- | Event | Trigger |
122
- |-------|---------|
123
- | `memory.created` | New memory written |
124
- | `memory.updated` | Existing memory modified |
125
- | `memory.deleted` | Memory removed |
126
- | `memory.recalled` | Memory retrieved by an agent |
127
- | `graph.updated` | Knowledge graph rebuilt |
128
- | `pattern.learned` | New pattern detected |
129
- | `agent.connected` | New agent connects |
130
- | `agent.disconnected` | Agent disconnects |
131
-
132
- ## Event Retention Tiers
133
-
134
- | Tier | Window | Kept |
135
- |------|--------|------|
136
- | Hot | 0-48h | All events |
137
- | Warm | 2-14d | Importance >= 5 only |
138
- | Cold | 14-30d | Daily aggregates |
139
- | Archive | 30d+ | Pruned (stats in pattern_learner) |
140
-
141
- ---
142
-
143
- ## Trust Scoring (Silent Collection — v2.5)
144
-
145
- All agents start at trust 1.0. Signals adjust the score with a Bayesian decay factor that stabilizes over time.
146
-
147
- | Signal | Delta | When |
148
- |--------|-------|------|
149
- | `high_importance_write` | +0.015 | Memory with importance >= 7 |
150
- | `memory_recalled_by_others` | +0.02 | Another agent finds this memory useful |
151
- | `quick_delete` | -0.03 | Memory deleted within 1 hour |
152
- | `high_volume_burst` | -0.02 | >20 writes in 5 minutes |
153
-
154
- **v2.5:** Silent collection only. **v2.6:** Trust-weighted recall ranking. **v3.0:** Active enforcement.
155
-
156
- ---
157
-
158
- ## API Endpoints (28 total)
159
-
160
- | Route | Method | Module | Purpose |
161
- |-------|--------|--------|---------|
162
- | `/` | GET | ui_server.py | Dashboard |
163
- | `/health` | GET | ui_server.py | Health check |
164
- | `/api/memories` | GET | routes/memories.py | List memories |
165
- | `/api/graph` | GET | routes/memories.py | Knowledge graph data |
166
- | `/api/search` | POST | routes/memories.py | Semantic search |
167
- | `/api/clusters` | GET | routes/memories.py | Cluster info |
168
- | `/api/clusters/{id}` | GET | routes/memories.py | Cluster detail |
169
- | `/api/stats` | GET | routes/stats.py | System statistics |
170
- | `/api/timeline` | GET | routes/stats.py | Timeline aggregation |
171
- | `/api/patterns` | GET | routes/stats.py | Learned patterns |
172
- | `/api/profiles` | GET | routes/profiles.py | List profiles |
173
- | `/api/profiles/{n}/switch` | POST | routes/profiles.py | Switch profile |
174
- | `/api/profiles/create` | POST | routes/profiles.py | Create profile |
175
- | `/api/profiles/{n}` | DELETE | routes/profiles.py | Delete profile |
176
- | `/api/export` | GET | routes/data_io.py | Export memories |
177
- | `/api/import` | POST | routes/data_io.py | Import memories |
178
- | `/api/backup/*` | GET/POST | routes/backup.py | Backup management |
179
- | `/events/stream` | GET | routes/events.py | SSE real-time stream |
180
- | `/api/events` | GET | routes/events.py | Event polling |
181
- | `/api/events/stats` | GET | routes/events.py | Event statistics |
182
- | `/api/agents` | GET | routes/agents.py | Agent list |
183
- | `/api/agents/stats` | GET | routes/agents.py | Agent statistics |
184
- | `/api/trust/stats` | GET | routes/agents.py | Trust overview |
185
- | `/api/trust/signals/{id}` | GET | routes/agents.py | Agent trust signals |
186
- | `/ws/updates` | WS | routes/ws.py | WebSocket |
187
-
188
- ---
189
-
190
- *SuperLocalMemory V2.5 — Created by Varun Pratap Bhardwaj. MIT License.*