superlocalmemory 3.4.5 → 3.4.7

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 (226) hide show
  1. package/ide/hooks/tool-event-hook.sh +46 -0
  2. package/package.json +1 -1
  3. package/pyproject.toml +1 -1
  4. package/src/superlocalmemory/attribution/mathematical_dna.py +1 -1
  5. package/src/superlocalmemory/attribution/signer.py +1 -1
  6. package/src/superlocalmemory/attribution/watermark.py +1 -1
  7. package/src/superlocalmemory/cli/__init__.py +1 -1
  8. package/src/superlocalmemory/cli/commands.py +1 -1
  9. package/src/superlocalmemory/cli/daemon.py +56 -26
  10. package/src/superlocalmemory/cli/json_output.py +1 -1
  11. package/src/superlocalmemory/cli/main.py +1 -1
  12. package/src/superlocalmemory/cli/migrate_cmd.py +1 -1
  13. package/src/superlocalmemory/cli/pending_store.py +1 -1
  14. package/src/superlocalmemory/cli/post_install.py +1 -1
  15. package/src/superlocalmemory/cli/service_installer.py +1 -1
  16. package/src/superlocalmemory/cli/setup_wizard.py +1 -1
  17. package/src/superlocalmemory/code_graph/__init__.py +1 -1
  18. package/src/superlocalmemory/code_graph/blast_radius.py +1 -1
  19. package/src/superlocalmemory/code_graph/bridge/__init__.py +1 -1
  20. package/src/superlocalmemory/code_graph/bridge/entity_resolver.py +1 -1
  21. package/src/superlocalmemory/code_graph/bridge/event_listeners.py +1 -1
  22. package/src/superlocalmemory/code_graph/bridge/fact_enricher.py +1 -1
  23. package/src/superlocalmemory/code_graph/bridge/hebbian_linker.py +1 -1
  24. package/src/superlocalmemory/code_graph/bridge/temporal_checker.py +1 -1
  25. package/src/superlocalmemory/code_graph/changes.py +1 -1
  26. package/src/superlocalmemory/code_graph/communities.py +1 -1
  27. package/src/superlocalmemory/code_graph/config.py +1 -1
  28. package/src/superlocalmemory/code_graph/database.py +1 -1
  29. package/src/superlocalmemory/code_graph/extractors/__init__.py +1 -1
  30. package/src/superlocalmemory/code_graph/extractors/python.py +1 -1
  31. package/src/superlocalmemory/code_graph/extractors/typescript.py +1 -1
  32. package/src/superlocalmemory/code_graph/flows.py +1 -1
  33. package/src/superlocalmemory/code_graph/git_hooks.py +1 -1
  34. package/src/superlocalmemory/code_graph/graph_engine.py +1 -1
  35. package/src/superlocalmemory/code_graph/graph_store.py +1 -1
  36. package/src/superlocalmemory/code_graph/incremental.py +1 -1
  37. package/src/superlocalmemory/code_graph/models.py +1 -1
  38. package/src/superlocalmemory/code_graph/parser.py +1 -1
  39. package/src/superlocalmemory/code_graph/resolver.py +1 -1
  40. package/src/superlocalmemory/code_graph/search.py +1 -1
  41. package/src/superlocalmemory/code_graph/service.py +1 -1
  42. package/src/superlocalmemory/code_graph/watcher.py +1 -1
  43. package/src/superlocalmemory/compliance/abac.py +1 -1
  44. package/src/superlocalmemory/compliance/audit.py +1 -1
  45. package/src/superlocalmemory/compliance/eu_ai_act.py +1 -1
  46. package/src/superlocalmemory/compliance/gdpr.py +1 -1
  47. package/src/superlocalmemory/compliance/lifecycle.py +1 -1
  48. package/src/superlocalmemory/compliance/retention.py +1 -1
  49. package/src/superlocalmemory/compliance/scheduler.py +1 -1
  50. package/src/superlocalmemory/core/config.py +1 -1
  51. package/src/superlocalmemory/core/consolidation_engine.py +52 -1
  52. package/src/superlocalmemory/core/embedding_worker.py +1 -1
  53. package/src/superlocalmemory/core/embeddings.py +1 -1
  54. package/src/superlocalmemory/core/engine.py +17 -1
  55. package/src/superlocalmemory/core/engine_wiring.py +21 -1
  56. package/src/superlocalmemory/core/graph_analyzer.py +15 -1
  57. package/src/superlocalmemory/core/health_monitor.py +1 -1
  58. package/src/superlocalmemory/core/hooks.py +1 -1
  59. package/src/superlocalmemory/core/maintenance.py +1 -1
  60. package/src/superlocalmemory/core/maintenance_scheduler.py +1 -1
  61. package/src/superlocalmemory/core/modes.py +1 -1
  62. package/src/superlocalmemory/core/ollama_embedder.py +1 -1
  63. package/src/superlocalmemory/core/profiles.py +1 -1
  64. package/src/superlocalmemory/core/recall_pipeline.py +16 -3
  65. package/src/superlocalmemory/core/recall_worker.py +1 -1
  66. package/src/superlocalmemory/core/registry.py +1 -1
  67. package/src/superlocalmemory/core/reranker_worker.py +1 -1
  68. package/src/superlocalmemory/core/store_pipeline.py +1 -1
  69. package/src/superlocalmemory/core/summarizer.py +1 -1
  70. package/src/superlocalmemory/core/worker_pool.py +1 -1
  71. package/src/superlocalmemory/dynamics/activation_guided_quantization.py +1 -1
  72. package/src/superlocalmemory/dynamics/eap_scheduler.py +1 -1
  73. package/src/superlocalmemory/dynamics/ebbinghaus_langevin_coupling.py +1 -1
  74. package/src/superlocalmemory/dynamics/fisher_langevin_coupling.py +1 -1
  75. package/src/superlocalmemory/encoding/auto_linker.py +1 -1
  76. package/src/superlocalmemory/encoding/cognitive_consolidator.py +1 -1
  77. package/src/superlocalmemory/encoding/consolidator.py +1 -1
  78. package/src/superlocalmemory/encoding/context_generator.py +1 -1
  79. package/src/superlocalmemory/encoding/emotional.py +1 -1
  80. package/src/superlocalmemory/encoding/entity_resolver.py +1 -1
  81. package/src/superlocalmemory/encoding/entropy_gate.py +1 -1
  82. package/src/superlocalmemory/encoding/fact_extractor.py +1 -1
  83. package/src/superlocalmemory/encoding/foresight.py +1 -1
  84. package/src/superlocalmemory/encoding/graph_builder.py +1 -1
  85. package/src/superlocalmemory/encoding/observation_builder.py +1 -1
  86. package/src/superlocalmemory/encoding/scene_builder.py +1 -1
  87. package/src/superlocalmemory/encoding/signal_inference.py +1 -1
  88. package/src/superlocalmemory/encoding/temporal_parser.py +1 -1
  89. package/src/superlocalmemory/encoding/temporal_validator.py +1 -1
  90. package/src/superlocalmemory/encoding/type_router.py +1 -1
  91. package/src/superlocalmemory/hooks/__init__.py +1 -1
  92. package/src/superlocalmemory/hooks/auto_capture.py +1 -1
  93. package/src/superlocalmemory/hooks/auto_invoker.py +1 -1
  94. package/src/superlocalmemory/hooks/auto_parameterize.py +1 -1
  95. package/src/superlocalmemory/hooks/auto_recall.py +1 -1
  96. package/src/superlocalmemory/hooks/claude_code_hooks.py +1 -1
  97. package/src/superlocalmemory/hooks/hook_handlers.py +1 -1
  98. package/src/superlocalmemory/hooks/ide_connector.py +1 -1
  99. package/src/superlocalmemory/hooks/rules_engine.py +1 -1
  100. package/src/superlocalmemory/infra/__init__.py +1 -1
  101. package/src/superlocalmemory/infra/auth_middleware.py +1 -1
  102. package/src/superlocalmemory/infra/backup.py +1 -1
  103. package/src/superlocalmemory/infra/cache_manager.py +1 -1
  104. package/src/superlocalmemory/infra/event_bus.py +1 -1
  105. package/src/superlocalmemory/infra/heartbeat_monitor.py +1 -1
  106. package/src/superlocalmemory/infra/pid_manager.py +1 -1
  107. package/src/superlocalmemory/infra/process_reaper.py +1 -1
  108. package/src/superlocalmemory/infra/rate_limiter.py +1 -1
  109. package/src/superlocalmemory/infra/webhook_dispatcher.py +1 -1
  110. package/src/superlocalmemory/ingestion/__init__.py +1 -1
  111. package/src/superlocalmemory/ingestion/adapter_manager.py +1 -1
  112. package/src/superlocalmemory/ingestion/base_adapter.py +1 -1
  113. package/src/superlocalmemory/ingestion/calendar_adapter.py +1 -1
  114. package/src/superlocalmemory/ingestion/credentials.py +1 -1
  115. package/src/superlocalmemory/ingestion/gmail_adapter.py +1 -1
  116. package/src/superlocalmemory/ingestion/parsers.py +1 -1
  117. package/src/superlocalmemory/ingestion/transcript_adapter.py +1 -1
  118. package/src/superlocalmemory/learning/adaptive.py +1 -1
  119. package/src/superlocalmemory/learning/assertion_miner.py +310 -0
  120. package/src/superlocalmemory/learning/behavioral.py +1 -1
  121. package/src/superlocalmemory/learning/behavioral_listener.py +1 -1
  122. package/src/superlocalmemory/learning/bootstrap.py +1 -1
  123. package/src/superlocalmemory/learning/consolidation_quantization_worker.py +1 -1
  124. package/src/superlocalmemory/learning/consolidation_worker.py +25 -9
  125. package/src/superlocalmemory/learning/cross_project.py +1 -1
  126. package/src/superlocalmemory/learning/database.py +1 -1
  127. package/src/superlocalmemory/learning/entity_compiler.py +1 -1
  128. package/src/superlocalmemory/learning/features.py +1 -1
  129. package/src/superlocalmemory/learning/forgetting_scheduler.py +1 -1
  130. package/src/superlocalmemory/learning/outcomes.py +1 -1
  131. package/src/superlocalmemory/learning/project_context.py +1 -1
  132. package/src/superlocalmemory/learning/quantization_scheduler.py +1 -1
  133. package/src/superlocalmemory/learning/ranker.py +1 -1
  134. package/src/superlocalmemory/learning/signals.py +1 -1
  135. package/src/superlocalmemory/learning/workflows.py +1 -1
  136. package/src/superlocalmemory/llm/backbone.py +1 -1
  137. package/src/superlocalmemory/math/ebbinghaus.py +1 -1
  138. package/src/superlocalmemory/math/fisher.py +1 -1
  139. package/src/superlocalmemory/math/fisher_quantized.py +1 -1
  140. package/src/superlocalmemory/math/hopfield.py +1 -1
  141. package/src/superlocalmemory/math/langevin.py +1 -1
  142. package/src/superlocalmemory/math/polar_quant.py +1 -1
  143. package/src/superlocalmemory/math/qjl.py +1 -1
  144. package/src/superlocalmemory/math/sheaf.py +1 -1
  145. package/src/superlocalmemory/math/turbo_quant.py +1 -1
  146. package/src/superlocalmemory/mcp/resources.py +1 -1
  147. package/src/superlocalmemory/mcp/server.py +17 -2
  148. package/src/superlocalmemory/mcp/shared.py +1 -1
  149. package/src/superlocalmemory/mcp/tools.py +1 -1
  150. package/src/superlocalmemory/mcp/tools_active.py +1 -1
  151. package/src/superlocalmemory/mcp/tools_code_graph.py +1 -1
  152. package/src/superlocalmemory/mcp/tools_core.py +1 -1
  153. package/src/superlocalmemory/mcp/tools_learning.py +221 -0
  154. package/src/superlocalmemory/mcp/tools_mesh.py +55 -12
  155. package/src/superlocalmemory/mcp/tools_v28.py +23 -1
  156. package/src/superlocalmemory/mcp/tools_v3.py +1 -1
  157. package/src/superlocalmemory/mcp/tools_v33.py +1 -1
  158. package/src/superlocalmemory/mesh/__init__.py +1 -1
  159. package/src/superlocalmemory/mesh/broker.py +194 -38
  160. package/src/superlocalmemory/parameterization/__init__.py +1 -1
  161. package/src/superlocalmemory/parameterization/pattern_extractor.py +35 -1
  162. package/src/superlocalmemory/parameterization/pii_filter.py +1 -1
  163. package/src/superlocalmemory/parameterization/prompt_injector.py +1 -1
  164. package/src/superlocalmemory/parameterization/prompt_lifecycle.py +1 -1
  165. package/src/superlocalmemory/parameterization/soft_prompt_generator.py +7 -1
  166. package/src/superlocalmemory/retrieval/agentic.py +1 -1
  167. package/src/superlocalmemory/retrieval/ann_index.py +1 -1
  168. package/src/superlocalmemory/retrieval/bm25_channel.py +1 -1
  169. package/src/superlocalmemory/retrieval/bridge_discovery.py +1 -1
  170. package/src/superlocalmemory/retrieval/channel_registry.py +1 -1
  171. package/src/superlocalmemory/retrieval/engine.py +1 -1
  172. package/src/superlocalmemory/retrieval/entity_channel.py +1 -1
  173. package/src/superlocalmemory/retrieval/forgetting_filter.py +1 -1
  174. package/src/superlocalmemory/retrieval/fusion.py +1 -1
  175. package/src/superlocalmemory/retrieval/hopfield_channel.py +1 -1
  176. package/src/superlocalmemory/retrieval/profile_channel.py +1 -1
  177. package/src/superlocalmemory/retrieval/quantization_aware_search.py +1 -1
  178. package/src/superlocalmemory/retrieval/reranker.py +1 -1
  179. package/src/superlocalmemory/retrieval/semantic_channel.py +1 -1
  180. package/src/superlocalmemory/retrieval/spreading_activation.py +1 -1
  181. package/src/superlocalmemory/retrieval/strategy.py +1 -1
  182. package/src/superlocalmemory/retrieval/temporal_channel.py +1 -1
  183. package/src/superlocalmemory/retrieval/vector_store.py +1 -1
  184. package/src/superlocalmemory/server/api.py +1 -1
  185. package/src/superlocalmemory/server/routes/__init__.py +1 -1
  186. package/src/superlocalmemory/server/routes/adapters.py +1 -1
  187. package/src/superlocalmemory/server/routes/agents.py +2 -2
  188. package/src/superlocalmemory/server/routes/backup.py +2 -2
  189. package/src/superlocalmemory/server/routes/behavioral.py +125 -2
  190. package/src/superlocalmemory/server/routes/compliance.py +2 -2
  191. package/src/superlocalmemory/server/routes/data_io.py +2 -2
  192. package/src/superlocalmemory/server/routes/entity.py +1 -1
  193. package/src/superlocalmemory/server/routes/events.py +2 -2
  194. package/src/superlocalmemory/server/routes/helpers.py +2 -2
  195. package/src/superlocalmemory/server/routes/ingest.py +1 -1
  196. package/src/superlocalmemory/server/routes/learning.py +2 -2
  197. package/src/superlocalmemory/server/routes/lifecycle.py +2 -2
  198. package/src/superlocalmemory/server/routes/memories.py +2 -2
  199. package/src/superlocalmemory/server/routes/mesh.py +25 -7
  200. package/src/superlocalmemory/server/routes/profiles.py +2 -2
  201. package/src/superlocalmemory/server/routes/stats.py +26 -7
  202. package/src/superlocalmemory/server/routes/v3_api.py +1 -1
  203. package/src/superlocalmemory/server/routes/ws.py +2 -2
  204. package/src/superlocalmemory/server/ui.py +1 -1
  205. package/src/superlocalmemory/server/unified_daemon.py +42 -1
  206. package/src/superlocalmemory/storage/access_control.py +1 -1
  207. package/src/superlocalmemory/storage/access_log.py +1 -1
  208. package/src/superlocalmemory/storage/database.py +1 -1
  209. package/src/superlocalmemory/storage/embedding_migrator.py +1 -1
  210. package/src/superlocalmemory/storage/migration_v33.py +1 -1
  211. package/src/superlocalmemory/storage/migrations.py +1 -1
  212. package/src/superlocalmemory/storage/models.py +1 -1
  213. package/src/superlocalmemory/storage/quantized_store.py +1 -1
  214. package/src/superlocalmemory/storage/schema.py +1 -1
  215. package/src/superlocalmemory/storage/schema_code_graph.py +1 -1
  216. package/src/superlocalmemory/storage/schema_v32.py +1 -1
  217. package/src/superlocalmemory/storage/schema_v343.py +75 -1
  218. package/src/superlocalmemory/storage/schema_v347.py +136 -0
  219. package/src/superlocalmemory/storage/v2_migrator.py +1 -1
  220. package/src/superlocalmemory/trust/gate.py +1 -1
  221. package/src/superlocalmemory/trust/provenance.py +1 -1
  222. package/src/superlocalmemory/trust/scorer.py +1 -1
  223. package/src/superlocalmemory/trust/signals.py +1 -1
  224. package/src/superlocalmemory/ui/js/behavioral.js +174 -3
  225. package/src/superlocalmemory.egg-info/PKG-INFO +5 -12
  226. package/src/superlocalmemory.egg-info/SOURCES.txt +3 -0
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env bash
2
+ # SuperLocalMemory V3.4.7 — Tool Event Learning Hook
3
+ # Copyright (c) 2026 Varun Pratap Bhardwaj
4
+ # Licensed under AGPL-3.0-or-later
5
+ #
6
+ # PostToolUse hook that logs tool events to SLM for behavioral learning.
7
+ # Fires after every tool call. Lightweight — no LLM calls, just HTTP POST.
8
+ # All data stays 100% local.
9
+ #
10
+ # Installation: slm init (auto-registers) or manually add to settings.json:
11
+ # { "type": "PostToolUse", "matcher": "*",
12
+ # "command": "bash /path/to/tool-event-hook.sh",
13
+ # "timeout": 5000 }
14
+
15
+ set -euo pipefail
16
+
17
+ # Read stdin (Claude Code passes JSON with tool_name, input, output)
18
+ INPUT=$(cat)
19
+
20
+ # Extract tool name and event info
21
+ TOOL_NAME=$(echo "$INPUT" | python3 -c "
22
+ import sys, json
23
+ try:
24
+ d = json.load(sys.stdin)
25
+ print(d.get('tool_name', d.get('tool', 'unknown')))
26
+ except:
27
+ print('unknown')
28
+ " 2>/dev/null || echo "unknown")
29
+
30
+ # Skip logging for our own tools (avoid recursion)
31
+ case "$TOOL_NAME" in
32
+ log_tool_event|get_assertions|reinforce_assertion|contradict_assertion)
33
+ exit 0
34
+ ;;
35
+ esac
36
+
37
+ # Get daemon port
38
+ PORT=8765
39
+ PORT_FILE="$HOME/.superlocalmemory/daemon.port"
40
+ [ -f "$PORT_FILE" ] && PORT=$(cat "$PORT_FILE" 2>/dev/null || echo 8765)
41
+
42
+ # Log event to SLM daemon (fire and forget, 2s timeout)
43
+ curl -s -m 2 -X POST "http://127.0.0.1:${PORT}/api/v3/tool-event" \
44
+ -H "Content-Type: application/json" \
45
+ -d "{\"tool_name\": \"${TOOL_NAME}\", \"event_type\": \"complete\"}" \
46
+ >/dev/null 2>&1 || true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superlocalmemory",
3
- "version": "3.4.5",
3
+ "version": "3.4.7",
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.4.5"
3
+ version = "3.4.7"
4
4
  description = "Information-geometric agent memory with mathematical guarantees"
5
5
  readme = "README.md"
6
6
  license = {text = "AGPL-3.0-or-later"}
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Self-enforcing inter-layer parameter constraints.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Cryptographic signing for content attribution and tamper detection.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Steganographic watermarking using zero-width Unicode characters.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """SuperLocalMemory V3 — CLI package."""
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """CLI command implementations.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """SLM Daemon — client functions for communicating with the unified daemon.
@@ -232,39 +232,69 @@ def _wait_for_daemon(timeout: int = 60) -> bool:
232
232
 
233
233
 
234
234
  def stop_daemon() -> bool:
235
- """Stop the running daemon gracefully.
235
+ """Stop ALL SLM daemon processes and their workers.
236
236
 
237
- v3.4.3: Uses psutil for cross-platform process termination.
238
- Falls back to os.kill if psutil unavailable.
237
+ v3.4.7: Nuclear cleanup finds and kills ALL processes matching
238
+ superlocalmemory.server.unified_daemon, embedding_worker, recall_worker,
239
+ reranker_worker. Not just the PID file daemon. Multiple daemons can
240
+ accumulate from rapid restarts, MCP warmups, and concurrent sessions.
239
241
  """
240
- if not _PID_FILE.exists():
241
- return True
242
+ killed = 0
243
+
242
244
  try:
243
- pid = int(_PID_FILE.read_text().strip())
245
+ import psutil
246
+ my_pid = os.getpid()
247
+ targets = [
248
+ "superlocalmemory.server.unified_daemon",
249
+ "superlocalmemory.core.embedding_worker",
250
+ "superlocalmemory.core.recall_worker",
251
+ "superlocalmemory.core.reranker_worker",
252
+ ]
253
+
254
+ for proc in psutil.process_iter(["pid", "cmdline"]):
255
+ try:
256
+ if proc.pid == my_pid:
257
+ continue
258
+ cmdline = " ".join(proc.info.get("cmdline") or [])
259
+ if any(t in cmdline for t in targets):
260
+ # Kill children first, then process
261
+ for child in proc.children(recursive=True):
262
+ try:
263
+ child.kill()
264
+ killed += 1
265
+ except (psutil.NoSuchProcess, psutil.AccessDenied):
266
+ pass
267
+ proc.kill()
268
+ killed += 1
269
+ except (psutil.NoSuchProcess, psutil.AccessDenied):
270
+ pass
244
271
 
245
- # Cross-platform termination via psutil
272
+ except ImportError:
273
+ # Fallback: pkill by pattern
246
274
  try:
247
- import psutil
248
- proc = psutil.Process(pid)
249
- proc.terminate() # SIGTERM on Unix, TerminateProcess on Windows
250
- proc.wait(timeout=10)
251
- except ImportError:
252
- # Fallback: direct signal (works on Unix, may fail on Windows)
253
- os.kill(pid, signal.SIGTERM)
254
- for _ in range(20):
255
- time.sleep(0.5)
256
- try:
257
- os.kill(pid, 0)
258
- except ProcessLookupError:
259
- break
275
+ import subprocess as _sp
276
+ for pattern in [
277
+ "superlocalmemory.server.unified_daemon",
278
+ "superlocalmemory.core.embedding_worker",
279
+ "superlocalmemory.core.recall_worker",
280
+ "superlocalmemory.core.reranker_worker",
281
+ ]:
282
+ result = _sp.run(
283
+ ["pkill", "-9", "-f", pattern],
284
+ capture_output=True, timeout=5,
285
+ )
286
+ if result.returncode == 0:
287
+ killed += 1
260
288
  except Exception:
261
289
  pass
262
290
 
263
- _PID_FILE.unlink(missing_ok=True)
264
- _PORT_FILE.unlink(missing_ok=True)
265
- return True
266
- except Exception:
267
- return False
291
+ # Clean up PID/port files
292
+ _PID_FILE.unlink(missing_ok=True)
293
+ _PORT_FILE.unlink(missing_ok=True)
294
+
295
+ if killed:
296
+ logger.info("Stopped %d SLM processes", killed)
297
+ return True
268
298
 
269
299
 
270
300
  # ---------------------------------------------------------------------------
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Shared JSON envelope for agent-native CLI output.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """SuperLocalMemory V3 — CLI entry point.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Migration CLI command implementation."""
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Pending memory store — zero-loss async remember (Option C).
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Post-install script for npm package.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """OS-level service installer — daemon survives reboots.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Interactive setup wizard for first-time configuration.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Code Knowledge Graph for SuperLocalMemory.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """BlastRadius — bidirectional BFS impact analysis.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Bridge Module
4
4
 
5
5
  """Bridge between code_graph.db and SLM memory.db.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Bridge Module
4
4
 
5
5
  """Entity Resolver — match SLM fact text against code graph nodes.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Bridge Module
4
4
 
5
5
  """Event Listeners — bidirectional bridge between SLM events and code graph.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Bridge Module
4
4
 
5
5
  """Fact Enricher — append code metadata to fact descriptions.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Bridge Module
4
4
 
5
5
  """Hebbian Linker — code-aware association edge creation.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Bridge Module
4
4
 
5
5
  """Temporal Checker — invalidate memories about deleted/renamed code.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """ChangeAnalyzer — git diff to risk-scored change analysis.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """CommunityDetector — file-based community detection.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Configuration for the CodeGraph module.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Database manager for code_graph.db.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Base extractor ABC for language-specific AST extraction.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Python-specific AST extractor using tree-sitter S-expression queries.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """TypeScript/JavaScript AST extractor using tree-sitter.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """FlowDetector — entry point detection and execution flow tracing.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Git post-commit hook for automatic code graph updates.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """GraphEngine — rustworkx in-memory directed graph.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """GraphStore — thin graph-specific layer over CodeGraphDatabase.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """IncrementalUpdater — hash-based change detection + dependent tracing.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Data models for the CodeGraph module.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Multi-language tree-sitter parser with parallel execution.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """Cross-file import resolution with heuristic fallback.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """HybridSearch — FTS5 + vec0 + Reciprocal Rank Fusion.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """CodeGraphService — the main orchestrator.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory v3.4 — CodeGraph Module
4
4
 
5
5
  """CodeGraphWatcher — file system watcher with debounce.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Attribute-Based Access Control for memory operations.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Tamper-proof hash-chain audit log for compliance.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """SuperLocalMemory V3 — EU AI Act Compliance Verification.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """SuperLocalMemory V3 — GDPR Compliance.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """SuperLocalMemory V3 — Memory Lifecycle Management.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Named retention rules engine for compliance (GDPR, HIPAA, custom).
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Background scheduler that periodically enforces retention rules.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """SuperLocalMemory V3 — Configuration.
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Sleep-time consolidation engine (Phase 5).
@@ -127,6 +127,57 @@ class ConsolidationEngine:
127
127
  )
128
128
  # Step 7: Cognitive Consolidation Quantization (Phase E)
129
129
  results["ccq"] = self._step7_ccq(profile_id)
130
+
131
+ # Step 8 (v3.4.7): Mine behavioral assertions from tool events.
132
+ try:
133
+ from superlocalmemory.learning.assertion_miner import AssertionMiner
134
+ miner = AssertionMiner(self._db.db_path)
135
+ results["assertions"] = miner.mine(profile_id)
136
+ except Exception as exc:
137
+ logger.debug("Assertion mining (non-fatal): %s", exc)
138
+ results["assertions"] = {"error": str(exc)}
139
+
140
+ # Step 9 (v3.4.7): Generate soft prompts from patterns + assertions.
141
+ # Previously the AutoParameterizeHook was never wired.
142
+ try:
143
+ from superlocalmemory.parameterization.pattern_extractor import PatternExtractor
144
+ from superlocalmemory.parameterization.soft_prompt_generator import SoftPromptGenerator
145
+ from superlocalmemory.parameterization.prompt_injector import PromptInjector
146
+ from superlocalmemory.parameterization.prompt_lifecycle import PromptLifecycleManager
147
+ from superlocalmemory.learning.behavioral import BehavioralPatternStore
148
+ # cross_project and workflow_miner may not exist yet — stub them
149
+ try:
150
+ from superlocalmemory.parameterization.cross_project import CrossProjectAggregator
151
+ except ImportError:
152
+ class CrossProjectAggregator:
153
+ def __init__(self, db): pass
154
+ def aggregate(self, *a, **kw): return []
155
+ try:
156
+ from superlocalmemory.parameterization.workflow_miner import WorkflowMiner
157
+ except ImportError:
158
+ class WorkflowMiner:
159
+ def __init__(self, db): pass
160
+ def mine(self, *a, **kw): return []
161
+ from superlocalmemory.hooks.auto_parameterize import AutoParameterizeHook
162
+ from superlocalmemory.core.config import ParameterizationConfig
163
+ from pathlib import Path as _Path
164
+
165
+ p_config = getattr(self._slm_config, "parameterization", ParameterizationConfig())
166
+ learning_db = str(_Path.home() / ".superlocalmemory" / "learning.db")
167
+ beh_store = BehavioralPatternStore(learning_db)
168
+ cross_proj = CrossProjectAggregator(self._db)
169
+ wf_miner = WorkflowMiner(self._db)
170
+ extractor = PatternExtractor(self._db, beh_store, cross_proj, wf_miner, p_config)
171
+ generator = SoftPromptGenerator(p_config)
172
+ injector = PromptInjector(self._db)
173
+ lifecycle = PromptLifecycleManager(self._db, p_config)
174
+ hook = AutoParameterizeHook(extractor, generator, injector, lifecycle, p_config)
175
+ sp_result = hook.on_consolidation_complete(profile_id)
176
+ results["soft_prompts"] = sp_result
177
+ except Exception as exc:
178
+ logger.debug("Soft prompt generation (non-fatal): %s", exc)
179
+ results["soft_prompts"] = {"error": str(exc)}
180
+
130
181
  results["success"] = True
131
182
  except Exception as exc:
132
183
  logger.warning(
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
2
- # Licensed under the Elastic License 2.0 - see LICENSE file
2
+ # Licensed under AGPL-3.0-or-later - see LICENSE file
3
3
  # Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
4
4
 
5
5
  """Subprocess embedding worker — isolates PyTorch memory from main process.