superlocalmemory 3.4.17 → 3.4.19
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/CHANGELOG.md +19 -0
- package/package.json +1 -3
- package/pyproject.toml +10 -1
- package/src/superlocalmemory/cli/setup_wizard.py +30 -0
- package/src/superlocalmemory/core/embeddings.py +8 -2
- package/src/superlocalmemory/retrieval/reranker.py +4 -2
- package/src/superlocalmemory.egg-info/PKG-INFO +4 -1
- package/src/superlocalmemory.egg-info/requires.txt +3 -0
- package/docs/ARCHITECTURE.md +0 -149
- package/docs/api-reference.md +0 -284
- package/docs/auto-memory.md +0 -150
- package/docs/cli-reference.md +0 -327
- package/docs/cloud-backup.md +0 -174
- package/docs/compliance.md +0 -191
- package/docs/configuration.md +0 -182
- package/docs/getting-started.md +0 -102
- package/docs/ide-setup.md +0 -261
- package/docs/mcp-tools.md +0 -220
- package/docs/migration-from-v2.md +0 -170
- package/docs/profiles.md +0 -173
- package/docs/screenshots/01-dashboard-main.png +0 -0
- package/docs/screenshots/02-knowledge-graph.png +0 -0
- package/docs/screenshots/03-math-health.png +0 -0
- package/docs/screenshots/03-patterns-learning.png +0 -0
- package/docs/screenshots/04-learning-dashboard.png +0 -0
- package/docs/screenshots/04-recall-lab.png +0 -0
- package/docs/screenshots/05-behavioral-analysis.png +0 -0
- package/docs/screenshots/05-trust-dashboard.png +0 -0
- package/docs/screenshots/06-graph-communities.png +0 -0
- package/docs/screenshots/06-settings.png +0 -0
- package/docs/screenshots/07-memories-blurred.png +0 -0
- package/docs/skill-evolution.md +0 -256
- package/docs/troubleshooting.md +0 -310
- package/docs/v2-archive/ACCESSIBILITY.md +0 -291
- package/docs/v2-archive/ARCHITECTURE.md +0 -886
- package/docs/v2-archive/CLI-COMMANDS-REFERENCE.md +0 -425
- package/docs/v2-archive/COMPRESSION-README.md +0 -390
- package/docs/v2-archive/FRAMEWORK-INTEGRATIONS.md +0 -300
- package/docs/v2-archive/MCP-MANUAL-SETUP.md +0 -775
- package/docs/v2-archive/MCP-TROUBLESHOOTING.md +0 -787
- package/docs/v2-archive/PATTERN-LEARNING.md +0 -228
- package/docs/v2-archive/PROFILES-GUIDE.md +0 -453
- package/docs/v2-archive/RESET-GUIDE.md +0 -353
- package/docs/v2-archive/SEARCH-ENGINE-V2.2.0.md +0 -749
- package/docs/v2-archive/SEARCH-INTEGRATION-GUIDE.md +0 -502
- package/docs/v2-archive/UI-SERVER.md +0 -262
- package/docs/v2-archive/UNIVERSAL-INTEGRATION.md +0 -488
- package/docs/v2-archive/V2.2.0-OPTIONAL-SEARCH.md +0 -666
- package/docs/v2-archive/WINDOWS-INSTALL-README.txt +0 -34
- package/docs/v2-archive/WINDOWS-POST-INSTALL.txt +0 -45
- package/docs/v2-archive/example_graph_usage.py +0 -146
- package/ui/index.html +0 -1879
- package/ui/js/agents.js +0 -192
- package/ui/js/auto-settings.js +0 -399
- package/ui/js/behavioral.js +0 -276
- package/ui/js/clusters.js +0 -206
- package/ui/js/compliance.js +0 -252
- package/ui/js/core.js +0 -246
- package/ui/js/dashboard.js +0 -110
- package/ui/js/events.js +0 -178
- package/ui/js/fact-detail.js +0 -92
- package/ui/js/feedback.js +0 -333
- package/ui/js/graph-core.js +0 -447
- package/ui/js/graph-filters.js +0 -220
- package/ui/js/graph-interactions.js +0 -351
- package/ui/js/graph-ui.js +0 -214
- package/ui/js/ide-status.js +0 -102
- package/ui/js/init.js +0 -45
- package/ui/js/learning.js +0 -435
- package/ui/js/lifecycle.js +0 -298
- package/ui/js/math-health.js +0 -98
- package/ui/js/memories.js +0 -264
- package/ui/js/modal.js +0 -357
- package/ui/js/patterns.js +0 -93
- package/ui/js/profiles.js +0 -236
- package/ui/js/recall-lab.js +0 -292
- package/ui/js/search.js +0 -59
- package/ui/js/settings.js +0 -224
- package/ui/js/timeline.js +0 -32
- package/ui/js/trust-dashboard.js +0 -73
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
+
## [3.4.19] - 2026-04-17
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Recall cold-start eliminated. Embedding + reranker workers stay warm for 30 minutes by default instead of 2 minutes, so bursts of recalls no longer pay a 30-60 second model-load tax on every other query.
|
|
17
|
+
|
|
18
|
+
### New environment variables
|
|
19
|
+
- `SLM_EMBED_IDLE_TIMEOUT` — seconds to keep the embedding worker warm (default 1800). Set to 120 to restore pre-v3.4.19 behavior.
|
|
20
|
+
- `SLM_RERANKER_IDLE_TIMEOUT` — same, for the cross-encoder reranker (default 1800).
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## [3.4.18] - 2026-04-17
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- pip and npm installs now ship identical functionality. Semantic search and cross-encoder reranking work out of the box on pip (previously required `pip install superlocalmemory[search]`).
|
|
28
|
+
- First pip run auto-installs Claude Code hooks when Claude Code is detected, matching the npm postinstall experience.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
13
32
|
## [3.4.17] - 2026-04-17
|
|
14
33
|
|
|
15
34
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superlocalmemory",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.19",
|
|
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",
|
|
@@ -65,8 +65,6 @@
|
|
|
65
65
|
"src/",
|
|
66
66
|
"ide/",
|
|
67
67
|
"scripts/",
|
|
68
|
-
"ui/",
|
|
69
|
-
"docs/",
|
|
70
68
|
"pyproject.toml",
|
|
71
69
|
"README.md",
|
|
72
70
|
"LICENSE",
|
package/pyproject.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "superlocalmemory"
|
|
3
|
-
version = "3.4.
|
|
3
|
+
version = "3.4.19"
|
|
4
4
|
description = "Information-geometric agent memory with mathematical guarantees"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = {text = "AGPL-3.0-or-later"}
|
|
@@ -52,9 +52,18 @@ dependencies = [
|
|
|
52
52
|
# V3.4.3: Unified Brain
|
|
53
53
|
"psutil>=5.9.0",
|
|
54
54
|
"structlog>=24.0.0,<27.0.0",
|
|
55
|
+
# V3.4.18: Semantic search + cross-encoder reranker (npm install parity).
|
|
56
|
+
# Previously under [search] extra — pip users silently lost 30pp of recall
|
|
57
|
+
# quality vs. npm users. Now ships by default for both install paths.
|
|
58
|
+
"sentence-transformers[onnx]>=5.0.0",
|
|
59
|
+
"torch>=2.2.0",
|
|
60
|
+
"scikit-learn>=1.3.0,<2.0.0",
|
|
55
61
|
]
|
|
56
62
|
|
|
57
63
|
[project.optional-dependencies]
|
|
64
|
+
# `search` is now a no-op alias kept for backwards compatibility; the deps
|
|
65
|
+
# moved into core in v3.4.18. ``pip install superlocalmemory[search]`` still
|
|
66
|
+
# works but installs nothing extra.
|
|
58
67
|
search = [
|
|
59
68
|
"sentence-transformers[onnx]>=5.0.0",
|
|
60
69
|
"einops>=0.8.2",
|
|
@@ -621,6 +621,10 @@ def check_first_use(command: str) -> None:
|
|
|
621
621
|
|
|
622
622
|
Called from main.py before dispatching any command.
|
|
623
623
|
Skips for commands that don't need setup (setup, hook, --version, --help).
|
|
624
|
+
|
|
625
|
+
On first use, also auto-installs Claude Code hooks so pip installs have
|
|
626
|
+
the same "it just works" experience as npm installs (npm does this via
|
|
627
|
+
postinstall; pip has no postinstall, so we do it here).
|
|
624
628
|
"""
|
|
625
629
|
# Commands that work without setup
|
|
626
630
|
_SKIP_COMMANDS = {"setup", "init", "hook", "hooks", "reap", "mcp"}
|
|
@@ -641,6 +645,7 @@ def check_first_use(command: str) -> None:
|
|
|
641
645
|
_mark_complete()
|
|
642
646
|
except Exception:
|
|
643
647
|
pass
|
|
648
|
+
_maybe_install_hooks_on_first_use()
|
|
644
649
|
return
|
|
645
650
|
|
|
646
651
|
# Interactive: run the full wizard
|
|
@@ -648,6 +653,31 @@ def check_first_use(command: str) -> None:
|
|
|
648
653
|
print(" First time using SuperLocalMemory!")
|
|
649
654
|
print(" Running setup wizard...\n")
|
|
650
655
|
run_wizard()
|
|
656
|
+
_maybe_install_hooks_on_first_use()
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
def _maybe_install_hooks_on_first_use() -> None:
|
|
660
|
+
"""Install Claude Code hooks on first SLM run — matches npm postinstall.
|
|
661
|
+
|
|
662
|
+
Install/uninstall parity rules:
|
|
663
|
+
* Skip if the user explicitly opted out via ``slm hooks remove``
|
|
664
|
+
(creates ``~/.superlocalmemory/hooks/.hooks-disabled``).
|
|
665
|
+
* Skip if Claude Code isn't installed (no ``~/.claude/settings.json``
|
|
666
|
+
to merge into).
|
|
667
|
+
* Silent + best-effort: never fail a CLI command because of this.
|
|
668
|
+
"""
|
|
669
|
+
try:
|
|
670
|
+
opt_out = _SLM_HOME / "hooks" / ".hooks-disabled"
|
|
671
|
+
if opt_out.exists():
|
|
672
|
+
return
|
|
673
|
+
claude_settings = Path.home() / ".claude" / "settings.json"
|
|
674
|
+
if not claude_settings.exists():
|
|
675
|
+
return # Claude Code not installed — nothing to hook into.
|
|
676
|
+
from superlocalmemory.hooks.claude_code_hooks import install_hooks
|
|
677
|
+
install_hooks()
|
|
678
|
+
except Exception:
|
|
679
|
+
# Best-effort: parity-fallback, never block CLI.
|
|
680
|
+
pass
|
|
651
681
|
|
|
652
682
|
|
|
653
683
|
# ---------------------------------------------------------------------------
|
|
@@ -140,8 +140,14 @@ def release_embedding_lock() -> None:
|
|
|
140
140
|
_embedding_lock_fd = None
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
_IDLE_TIMEOUT_SECONDS =
|
|
144
|
-
# V3.3.12: Configurable via SLM_EMBED_IDLE_TIMEOUT env var (seconds)
|
|
143
|
+
_IDLE_TIMEOUT_SECONDS = 1800 # 30 minutes — keep model warm across bursty use.
|
|
144
|
+
# V3.3.12: Configurable via SLM_EMBED_IDLE_TIMEOUT env var (seconds).
|
|
145
|
+
# V3.4.19: Bumped from 120 → 1800 to eliminate the 30-60s cold-start pain
|
|
146
|
+
# when the embedding worker was killed too aggressively. Safety: the
|
|
147
|
+
# per-embed RSS self-check (SLM_EMBED_WORKER_RSS_LIMIT_MB, 4GB default) and
|
|
148
|
+
# the daemon memory watchdog (unified_daemon.py, 4GB/60s) still cap any
|
|
149
|
+
# runaway. To restore the old aggressive policy without redeploying, set
|
|
150
|
+
# ``SLM_EMBED_IDLE_TIMEOUT=120`` and ``slm restart``.
|
|
145
151
|
_IDLE_TIMEOUT_SECONDS = int(os.environ.get("SLM_EMBED_IDLE_TIMEOUT", _IDLE_TIMEOUT_SECONDS))
|
|
146
152
|
# V3.3.21: Configurable response timeout — 180s default, but batch ingestion
|
|
147
153
|
# (2-turn chunks across 10 conversations) needs 600s+ to survive cold-start
|
|
@@ -51,8 +51,10 @@ _live_rerankers: set[weakref.ref] = set()
|
|
|
51
51
|
|
|
52
52
|
logger = logging.getLogger(__name__)
|
|
53
53
|
|
|
54
|
-
_IDLE_TIMEOUT_SECONDS =
|
|
55
|
-
# V3.3.12: Configurable via SLM_RERANKER_IDLE_TIMEOUT env var
|
|
54
|
+
_IDLE_TIMEOUT_SECONDS = 1800 # 30 min — keep cross-encoder warm for active sessions.
|
|
55
|
+
# V3.3.12: Configurable via SLM_RERANKER_IDLE_TIMEOUT env var.
|
|
56
|
+
# V3.4.19: Bumped from 120 → 1800 in lock-step with the embedding worker.
|
|
57
|
+
# Set ``SLM_RERANKER_IDLE_TIMEOUT=120`` + ``slm restart`` to revert.
|
|
56
58
|
_IDLE_TIMEOUT_SECONDS = int(os.environ.get("SLM_RERANKER_IDLE_TIMEOUT", _IDLE_TIMEOUT_SECONDS))
|
|
57
59
|
_SUBPROCESS_RESPONSE_TIMEOUT = 180 # V3.3.12: 180s (was 120s) for stressed system respawns
|
|
58
60
|
_WORKER_RECYCLE_AFTER = 500 # Recycle after N requests
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: superlocalmemory
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.19
|
|
4
4
|
Summary: Information-geometric agent memory with mathematical guarantees
|
|
5
5
|
Author-email: Varun Pratap Bhardwaj <admin@superlocalmemory.com>
|
|
6
6
|
License: AGPL-3.0-or-later
|
|
@@ -48,6 +48,9 @@ Requires-Dist: rustworkx<1,>=0.15
|
|
|
48
48
|
Requires-Dist: watchdog<6,>=4.0
|
|
49
49
|
Requires-Dist: psutil>=5.9.0
|
|
50
50
|
Requires-Dist: structlog<27.0.0,>=24.0.0
|
|
51
|
+
Requires-Dist: sentence-transformers[onnx]>=5.0.0
|
|
52
|
+
Requires-Dist: torch>=2.2.0
|
|
53
|
+
Requires-Dist: scikit-learn<2.0.0,>=1.3.0
|
|
51
54
|
Provides-Extra: search
|
|
52
55
|
Requires-Dist: sentence-transformers[onnx]>=5.0.0; extra == "search"
|
|
53
56
|
Requires-Dist: einops>=0.8.2; extra == "search"
|
package/docs/ARCHITECTURE.md
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
# Architecture
|
|
2
|
-
> SuperLocalMemory V3 Documentation
|
|
3
|
-
> https://superlocalmemory.com | Part of Qualixar
|
|
4
|
-
|
|
5
|
-
A high-level overview of how SuperLocalMemory V3 stores, organizes, and retrieves your memories.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Design Principles
|
|
10
|
-
|
|
11
|
-
1. **Local-first.** Your data stays on your machine by default. Cloud is opt-in.
|
|
12
|
-
2. **Zero-configuration.** Install and forget. Memory capture and recall happen automatically.
|
|
13
|
-
3. **Multi-channel retrieval.** No single search method is best for every query. V3 combines four channels and picks the best results.
|
|
14
|
-
4. **Mathematically grounded.** Retrieval quality, consistency, and lifecycle management are backed by information geometry rather than heuristics.
|
|
15
|
-
|
|
16
|
-
## System Overview
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
Your IDE (Claude, Cursor, VS Code, ...)
|
|
20
|
-
|
|
|
21
|
-
| MCP Protocol
|
|
22
|
-
v
|
|
23
|
-
+------------------+
|
|
24
|
-
| MCP Server | 24 tools, 6 resources
|
|
25
|
-
+------------------+
|
|
26
|
-
|
|
|
27
|
-
v
|
|
28
|
-
+------------------+
|
|
29
|
-
| Memory Engine | Ingestion + Retrieval + Lifecycle
|
|
30
|
-
+------------------+
|
|
31
|
-
|
|
|
32
|
-
v
|
|
33
|
-
+------------------+
|
|
34
|
-
| SQLite Database | ~/.superlocalmemory/memory.db
|
|
35
|
-
+------------------+
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## How Memories Are Stored (Ingestion)
|
|
39
|
-
|
|
40
|
-
When you store a memory (or one is auto-captured), it passes through an 11-step pipeline:
|
|
41
|
-
|
|
42
|
-
| Step | What it does |
|
|
43
|
-
|------|-------------|
|
|
44
|
-
| 1. Metadata extraction | Timestamps, session context, source identification |
|
|
45
|
-
| 2. Entity extraction | People, projects, technologies, organizations mentioned |
|
|
46
|
-
| 3. Fact extraction | Discrete facts pulled from the text |
|
|
47
|
-
| 4. Emotion detection | Sentiment and emotional tone (frustration, confidence, etc.) |
|
|
48
|
-
| 5. Belief extraction | Opinions, preferences, and stated beliefs |
|
|
49
|
-
| 6. Entity resolution | Links mentions to canonical entities (e.g., "React" and "ReactJS" become one) |
|
|
50
|
-
| 7. Graph wiring | Connects entities and facts into a relationship graph |
|
|
51
|
-
| 8. Foresight tagging | Predicts what future queries this memory might answer |
|
|
52
|
-
| 9. Observation building | Creates structured observations for pattern learning |
|
|
53
|
-
| 10. Entropy gating | Filters out redundant or low-value information |
|
|
54
|
-
| 11. Storage | Writes to all indexes: semantic vectors, BM25 tokens, graph edges, temporal events |
|
|
55
|
-
|
|
56
|
-
In Mode A, all steps run locally without any LLM calls. In Modes B and C, the LLM enhances entity extraction and fact decomposition.
|
|
57
|
-
|
|
58
|
-
## How Memories Are Retrieved (Recall)
|
|
59
|
-
|
|
60
|
-
Every recall query runs through four independent retrieval channels, then fuses the results:
|
|
61
|
-
|
|
62
|
-
### The Four Channels
|
|
63
|
-
|
|
64
|
-
| Channel | How it works | Best for |
|
|
65
|
-
|---------|-------------|----------|
|
|
66
|
-
| **Semantic** | Vector similarity using sentence embeddings, enhanced by Fisher-Rao geometry | "Queries that mean the same thing but use different words" |
|
|
67
|
-
| **BM25** | Classic keyword matching with term frequency scoring | "Queries with specific names, codes, or exact terms" |
|
|
68
|
-
| **Entity Graph** | Traverses the relationship graph via spreading activation | "Who works with Maria?" or "What connects service A to service B?" |
|
|
69
|
-
| **Temporal** | Matches based on time references and event ordering | "What did we decide last Friday?" or "Changes since the sprint started" |
|
|
70
|
-
|
|
71
|
-
### Fusion and Ranking
|
|
72
|
-
|
|
73
|
-
1. Each channel returns its top candidates with scores
|
|
74
|
-
2. **Reciprocal Rank Fusion** (RRF) combines the four ranked lists into one
|
|
75
|
-
3. In Mode C, a **cross-encoder** reranks the top results for final precision
|
|
76
|
-
4. The top results are returned to your AI assistant
|
|
77
|
-
|
|
78
|
-
This multi-channel approach means V3 finds memories that any single search method would miss. A keyword search alone might miss paraphrased content. A vector search alone might miss exact names. The combination catches both.
|
|
79
|
-
|
|
80
|
-
## Three Operating Modes
|
|
81
|
-
|
|
82
|
-
| Mode | Retrieval | LLM Usage | Data Location |
|
|
83
|
-
|------|-----------|-----------|---------------|
|
|
84
|
-
| **A: Zero-Cloud** | 4-channel + math scoring | None | 100% local |
|
|
85
|
-
| **B: Local LLM** | 4-channel + local LLM reranking | Ollama (local) | 100% local |
|
|
86
|
-
| **C: Cloud LLM** | 4-channel + cross-encoder + agentic retrieval | Cloud provider | Queries sent to cloud |
|
|
87
|
-
|
|
88
|
-
Mode A is the default. It delivers strong recall quality using mathematical scoring without any network calls.
|
|
89
|
-
|
|
90
|
-
## Mathematical Foundations
|
|
91
|
-
|
|
92
|
-
V3 uses three mathematical layers. These are not academic additions — they solve specific practical problems.
|
|
93
|
-
|
|
94
|
-
### Fisher-Rao Similarity
|
|
95
|
-
|
|
96
|
-
**Problem:** Standard vector similarity treats all memories equally, regardless of how much evidence backs them.
|
|
97
|
-
|
|
98
|
-
**Solution:** Fisher-Rao geometry accounts for the statistical confidence of each memory's embedding. A memory accessed and confirmed many times gets a tighter confidence region. A memory stored once and never validated has wider uncertainty. Similarity scoring respects this difference.
|
|
99
|
-
|
|
100
|
-
**Effect:** Frequently validated memories rank higher. Uncertain memories are flagged for verification.
|
|
101
|
-
|
|
102
|
-
### Sheaf Consistency
|
|
103
|
-
|
|
104
|
-
**Problem:** Over time, you store contradictory memories. "We use PostgreSQL" and later "We migrated to MySQL." Simple retrieval returns both without flagging the conflict.
|
|
105
|
-
|
|
106
|
-
**Solution:** Sheaf cohomology detects when memories attached to the same entity or topic contradict each other. When a contradiction is found, the system marks the older memory as superseded and surfaces the newer one.
|
|
107
|
-
|
|
108
|
-
**Effect:** Recall returns consistent information. Contradictions are flagged for your review.
|
|
109
|
-
|
|
110
|
-
### Langevin Lifecycle
|
|
111
|
-
|
|
112
|
-
**Problem:** Memory databases grow endlessly. Old memories dilute retrieval quality.
|
|
113
|
-
|
|
114
|
-
**Solution:** Langevin dynamics models each memory's lifecycle — from Active (frequently accessed) through Warm, Cold, and eventually Archived. The transition is not based on simple time rules but on a self-organizing dynamic that balances recency, access frequency, and information value.
|
|
115
|
-
|
|
116
|
-
**Effect:** Active memories stay prominent. Stale memories fade gracefully. Storage stays efficient.
|
|
117
|
-
|
|
118
|
-
## EU AI Act Compliance
|
|
119
|
-
|
|
120
|
-
Mode A satisfies data sovereignty requirements under the EU AI Act by design:
|
|
121
|
-
|
|
122
|
-
- **No cloud dependency.** All memory operations run locally. No data leaves your machine.
|
|
123
|
-
- **Right to erasure.** `slm forget` deletes data locally. No cloud logs to purge.
|
|
124
|
-
- **Transparency.** The retrieval pipeline is auditable. No black-box LLM decisions in Mode A.
|
|
125
|
-
- **Risk classification.** A local retrieval system with no AI decision-making qualifies as minimal risk.
|
|
126
|
-
|
|
127
|
-
Mode C sends queries to a cloud LLM provider. In that mode, the cloud provider's compliance posture applies to those queries.
|
|
128
|
-
|
|
129
|
-
## Database
|
|
130
|
-
|
|
131
|
-
All data is stored in a single SQLite database:
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
~/.superlocalmemory/memory.db
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
The database uses WAL (Write-Ahead Logging) mode for safe concurrent access from multiple IDE connections.
|
|
138
|
-
|
|
139
|
-
Key table groups:
|
|
140
|
-
|
|
141
|
-
- **Core:** memories, sessions, profiles
|
|
142
|
-
- **Knowledge:** semantic_facts, kg_nodes, memory_edges, canonical_entities
|
|
143
|
-
- **Retrieval indexes:** bm25_tokens, memory_metadata, temporal_events
|
|
144
|
-
- **Math layers:** fisher_state, sheaf_sections, langevin_state
|
|
145
|
-
- **Compliance:** trust_scores, provenance, audit_trail, retention_policies
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
*SuperLocalMemory V3 — Copyright 2026 Varun Pratap Bhardwaj. Elastic License 2.0. Part of Qualixar.*
|
package/docs/api-reference.md
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
# API Reference
|
|
2
|
-
> SuperLocalMemory V3 Documentation
|
|
3
|
-
> https://superlocalmemory.com | Part of Qualixar
|
|
4
|
-
|
|
5
|
-
Use SuperLocalMemory programmatically from Python. This is for developers building integrations, custom workflows, or framework adapters.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install -g superlocalmemory
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Or, if you installed via npm, the Python package is available at:
|
|
16
|
-
|
|
17
|
-
```python
|
|
18
|
-
import sys
|
|
19
|
-
sys.path.insert(0, "/path/to/superlocalmemory/python")
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Quick Start
|
|
23
|
-
|
|
24
|
-
```python
|
|
25
|
-
from superlocalmemory.core.engine import MemoryEngine
|
|
26
|
-
from superlocalmemory.core.config import SLMConfig
|
|
27
|
-
|
|
28
|
-
# Initialize with default config (Mode A, default profile)
|
|
29
|
-
config = SLMConfig()
|
|
30
|
-
engine = MemoryEngine(config)
|
|
31
|
-
|
|
32
|
-
# Store a memory
|
|
33
|
-
engine.store("The API uses OAuth 2.0 with PKCE for mobile clients")
|
|
34
|
-
|
|
35
|
-
# Recall memories
|
|
36
|
-
results = engine.recall("authentication method for mobile")
|
|
37
|
-
for result in results:
|
|
38
|
-
print(f"[{result.score:.2f}] {result.content}")
|
|
39
|
-
|
|
40
|
-
# Clean up
|
|
41
|
-
engine.close()
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Configuration
|
|
45
|
-
|
|
46
|
-
### SLMConfig
|
|
47
|
-
|
|
48
|
-
```python
|
|
49
|
-
from superlocalmemory.core.config import SLMConfig
|
|
50
|
-
|
|
51
|
-
# Default configuration
|
|
52
|
-
config = SLMConfig()
|
|
53
|
-
|
|
54
|
-
# Custom configuration
|
|
55
|
-
config = SLMConfig(
|
|
56
|
-
mode="a", # "a", "b", or "c"
|
|
57
|
-
profile="work", # Active profile name
|
|
58
|
-
data_dir="~/.superlocalmemory", # Database location
|
|
59
|
-
embedding_model="all-MiniLM-L6-v2",
|
|
60
|
-
max_results=10,
|
|
61
|
-
)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
| Parameter | Type | Default | Description |
|
|
65
|
-
|-----------|------|---------|-------------|
|
|
66
|
-
| `mode` | str | `"a"` | Operating mode |
|
|
67
|
-
| `profile` | str | `"default"` | Active profile |
|
|
68
|
-
| `data_dir` | str | `"~/.superlocalmemory"` | Data directory |
|
|
69
|
-
| `embedding_model` | str | `"all-MiniLM-L6-v2"` | Sentence transformer model |
|
|
70
|
-
| `max_results` | int | `10` | Default max results for recall |
|
|
71
|
-
|
|
72
|
-
## Core Operations
|
|
73
|
-
|
|
74
|
-
### Store
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
# Basic store
|
|
78
|
-
memory_id = engine.store("React 19 uses the new compiler by default")
|
|
79
|
-
|
|
80
|
-
# Store with tags
|
|
81
|
-
memory_id = engine.store(
|
|
82
|
-
"Deploy to staging before 2pm on Fridays",
|
|
83
|
-
tags=["process", "deployment"]
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
# Store with metadata
|
|
87
|
-
memory_id = engine.store(
|
|
88
|
-
"Maria approved the new database schema",
|
|
89
|
-
metadata={"source": "slack", "channel": "#backend"}
|
|
90
|
-
)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Returns:** `int` — the ID of the stored memory.
|
|
94
|
-
|
|
95
|
-
### Recall
|
|
96
|
-
|
|
97
|
-
```python
|
|
98
|
-
# Basic recall
|
|
99
|
-
results = engine.recall("database schema approval")
|
|
100
|
-
|
|
101
|
-
# With limit
|
|
102
|
-
results = engine.recall("deployment schedule", limit=5)
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**Returns:** `list[RecallResult]`
|
|
106
|
-
|
|
107
|
-
Each `RecallResult` has:
|
|
108
|
-
|
|
109
|
-
| Attribute | Type | Description |
|
|
110
|
-
|-----------|------|-------------|
|
|
111
|
-
| `id` | int | Memory ID |
|
|
112
|
-
| `content` | str | Memory text |
|
|
113
|
-
| `score` | float | Relevance score (0.0 to 1.0) |
|
|
114
|
-
| `timestamp` | datetime | When the memory was stored |
|
|
115
|
-
| `tags` | list[str] | Tags attached to the memory |
|
|
116
|
-
| `metadata` | dict | Additional metadata |
|
|
117
|
-
|
|
118
|
-
### Recall with Trace
|
|
119
|
-
|
|
120
|
-
```python
|
|
121
|
-
# Get channel-by-channel breakdown
|
|
122
|
-
results = engine.recall_trace("who approved the schema")
|
|
123
|
-
|
|
124
|
-
for result in results:
|
|
125
|
-
print(f"[{result.score:.2f}] {result.content}")
|
|
126
|
-
print(f" Semantic: {result.trace.semantic:.2f}")
|
|
127
|
-
print(f" BM25: {result.trace.bm25:.2f}")
|
|
128
|
-
print(f" Entity: {result.trace.entity:.2f}")
|
|
129
|
-
print(f" Temporal: {result.trace.temporal:.2f}")
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Delete
|
|
133
|
-
|
|
134
|
-
```python
|
|
135
|
-
# Delete by ID
|
|
136
|
-
engine.delete(memory_id=42)
|
|
137
|
-
|
|
138
|
-
# Delete by query (deletes best match)
|
|
139
|
-
engine.delete(query="old staging credentials")
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### List Recent
|
|
143
|
-
|
|
144
|
-
```python
|
|
145
|
-
memories = engine.list_recent(limit=20)
|
|
146
|
-
for m in memories:
|
|
147
|
-
print(f"[{m.id}] {m.content[:80]}...")
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Profile Management
|
|
151
|
-
|
|
152
|
-
```python
|
|
153
|
-
# List profiles
|
|
154
|
-
profiles = engine.list_profiles()
|
|
155
|
-
|
|
156
|
-
# Switch profile
|
|
157
|
-
engine.switch_profile("client-acme")
|
|
158
|
-
|
|
159
|
-
# Create profile
|
|
160
|
-
engine.create_profile("new-project")
|
|
161
|
-
|
|
162
|
-
# Delete profile
|
|
163
|
-
engine.delete_profile("old-project")
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## Health and Diagnostics
|
|
167
|
-
|
|
168
|
-
```python
|
|
169
|
-
# System status
|
|
170
|
-
status = engine.status()
|
|
171
|
-
print(f"Mode: {status.mode}")
|
|
172
|
-
print(f"Profile: {status.profile}")
|
|
173
|
-
print(f"Memories: {status.memory_count}")
|
|
174
|
-
|
|
175
|
-
# Health check
|
|
176
|
-
health = engine.health()
|
|
177
|
-
print(f"Fisher-Rao: {health.fisher}")
|
|
178
|
-
print(f"Sheaf: {health.sheaf}")
|
|
179
|
-
print(f"Langevin: {health.langevin}")
|
|
180
|
-
|
|
181
|
-
# Consistency check
|
|
182
|
-
contradictions = engine.consistency_check()
|
|
183
|
-
for c in contradictions:
|
|
184
|
-
print(f"Conflict: '{c.memory_a}' vs '{c.memory_b}'")
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Framework Integrations
|
|
188
|
-
|
|
189
|
-
### LangChain
|
|
190
|
-
|
|
191
|
-
```python
|
|
192
|
-
from superlocalmemory.integrations.langchain import SLMMemory
|
|
193
|
-
|
|
194
|
-
memory = SLMMemory(mode="a", profile="langchain-app")
|
|
195
|
-
|
|
196
|
-
# Use as LangChain memory
|
|
197
|
-
from langchain.chains import ConversationChain
|
|
198
|
-
from langchain.llms import OpenAI
|
|
199
|
-
|
|
200
|
-
chain = ConversationChain(
|
|
201
|
-
llm=OpenAI(),
|
|
202
|
-
memory=memory,
|
|
203
|
-
)
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### LlamaIndex
|
|
207
|
-
|
|
208
|
-
```python
|
|
209
|
-
from superlocalmemory.integrations.llamaindex import SLMMemoryStore
|
|
210
|
-
|
|
211
|
-
store = SLMMemoryStore(mode="a", profile="llamaindex-app")
|
|
212
|
-
|
|
213
|
-
# Use as a LlamaIndex document store
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Direct MCP Integration
|
|
217
|
-
|
|
218
|
-
If you are building an MCP-compatible tool and want to add SLM as a backend:
|
|
219
|
-
|
|
220
|
-
```python
|
|
221
|
-
from superlocalmemory.mcp import create_mcp_server
|
|
222
|
-
|
|
223
|
-
server = create_mcp_server(
|
|
224
|
-
mode="a",
|
|
225
|
-
profile="my-tool",
|
|
226
|
-
)
|
|
227
|
-
|
|
228
|
-
# The server exposes all 24 tools and 6 resources
|
|
229
|
-
server.run()
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
## Context Manager
|
|
233
|
-
|
|
234
|
-
For scripts that need clean resource management:
|
|
235
|
-
|
|
236
|
-
```python
|
|
237
|
-
from superlocalmemory.core.engine import MemoryEngine
|
|
238
|
-
from superlocalmemory.core.config import SLMConfig
|
|
239
|
-
|
|
240
|
-
with MemoryEngine(SLMConfig()) as engine:
|
|
241
|
-
engine.store("Ephemeral context for this script run")
|
|
242
|
-
results = engine.recall("context")
|
|
243
|
-
# engine.close() called automatically
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
## Error Handling
|
|
247
|
-
|
|
248
|
-
```python
|
|
249
|
-
from superlocalmemory.core.exceptions import (
|
|
250
|
-
SLMError, # Base exception
|
|
251
|
-
ProfileNotFoundError,
|
|
252
|
-
MemoryNotFoundError,
|
|
253
|
-
ConfigError,
|
|
254
|
-
DatabaseError,
|
|
255
|
-
)
|
|
256
|
-
|
|
257
|
-
try:
|
|
258
|
-
engine.switch_profile("nonexistent")
|
|
259
|
-
except ProfileNotFoundError:
|
|
260
|
-
print("Profile does not exist. Create it first.")
|
|
261
|
-
|
|
262
|
-
try:
|
|
263
|
-
engine.delete(memory_id=99999)
|
|
264
|
-
except MemoryNotFoundError:
|
|
265
|
-
print("Memory not found.")
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
## Thread Safety
|
|
269
|
-
|
|
270
|
-
The `MemoryEngine` uses SQLite WAL mode and is safe for concurrent reads from multiple threads. Writes are serialized at the database level.
|
|
271
|
-
|
|
272
|
-
For multi-threaded applications, create one engine instance and share it:
|
|
273
|
-
|
|
274
|
-
```python
|
|
275
|
-
# Safe: one engine, multiple threads reading
|
|
276
|
-
engine = MemoryEngine(SLMConfig())
|
|
277
|
-
|
|
278
|
-
# Each thread can call engine.recall() concurrently
|
|
279
|
-
# Writes (engine.store()) are automatically serialized
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
*SuperLocalMemory V3 — Copyright 2026 Varun Pratap Bhardwaj. Elastic License 2.0. Part of Qualixar.*
|