superlocalmemory 3.6.0 → 3.6.1
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 +51 -0
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/superlocalmemory/__init__.py +1 -1
- package/src/superlocalmemory/cli/optimize_cmd.py +5 -2
- package/src/superlocalmemory/cli/proxy_cmd.py +15 -6
- package/src/superlocalmemory/optimize/adapters/wrap.py +43 -13
- package/src/superlocalmemory/server/routes/optimize.py +1 -0
- package/src/superlocalmemory/ui/js/ng-shell.js +3 -0
- package/src/superlocalmemory.egg-info/PKG-INFO +142 -35
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,57 @@ All notable changes to SuperLocalMemory V3 will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.6.1] - 2026-06-07 — Optimize module fixes: proxy liveness probe, UI tab init, PyPI CI unblock
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **`slm proxy` AttributeError — wrong lifecycle function name:** `proxy_cmd.py` called
|
|
12
|
+
`lifecycle.ensure_running(port=port)` which does not exist. The function signature is
|
|
13
|
+
`ensure_proxy_running()` and is designed for daemon-internal use only (requires
|
|
14
|
+
`_store` to be initialised via `_set_config_store()`). In CLI subprocess context
|
|
15
|
+
`_store is None`, so `get_optimize_config()` returns `DEFAULT_OPTIMIZE_CONFIG` with
|
|
16
|
+
`proxy_enabled=False`, causing the function to return `False` immediately. Fix: replaced
|
|
17
|
+
the entire implementation with a direct `urllib.request` HTTP probe to
|
|
18
|
+
`http://127.0.0.1:8765/health` — correct in all execution contexts without any import
|
|
19
|
+
of `lifecycle`. Also corrected missing `proxy_enabled: True` in the fields dict written
|
|
20
|
+
to ConfigStore when `slm proxy --providers ...` is invoked.
|
|
21
|
+
- **`slm optimize status` always showed "Proxy: not running":** `optimize_cmd.py` called
|
|
22
|
+
`lifecycle.proxy_is_running()` which does not exist either. The call was caught by a
|
|
23
|
+
broad `except Exception: pass`, so `proxy_running` was silently always `False`. Fix:
|
|
24
|
+
same pattern — direct HTTP health probe to `http://127.0.0.1:8765/health` with a 1s
|
|
25
|
+
timeout. `slm optimize status` now accurately reflects proxy liveness.
|
|
26
|
+
- **Optimize pane UI always showing all toggles OFF:** `ng-shell.js`'s `triggerTabLoad()`
|
|
27
|
+
switch statement was completely missing the `'optimize-pane'` case. `initOptimizeTab()`
|
|
28
|
+
is defined and populates the UI from the live API, but it was never called when the user
|
|
29
|
+
switched to the Optimize tab — the pane rendered HTML defaults (all OFF) forever.
|
|
30
|
+
Fix: added `case 'optimize-pane': if (typeof initOptimizeTab === 'function') initOptimizeTab(); break;`
|
|
31
|
+
to the switch. Hard-refresh (`Cmd+Shift+R`) required after install.
|
|
32
|
+
- **`ConfigUpdateRequest` missing `proxy_enabled` field:** `server/routes/optimize.py`'s
|
|
33
|
+
`ConfigUpdateRequest` Pydantic model did not include `proxy_enabled`, so the UI could
|
|
34
|
+
not toggle proxy via the `PATCH /api/optimize/config` endpoint. Added
|
|
35
|
+
`proxy_enabled: bool | None = None` with the existing nullable pattern.
|
|
36
|
+
- **`pytest` `import file mismatch` blocking ALL PyPI CI since v3.5.6:** `tests/test_cli.py`
|
|
37
|
+
(a legacy file with 6 basic tests) coexisted with `tests/test_cli/` (a package directory
|
|
38
|
+
with `__init__.py`). Python 3.12 on Ubuntu resolves the package name `test_cli` to the
|
|
39
|
+
directory — pytest then tries to collect the file under a conflicting module path and
|
|
40
|
+
raises `import file mismatch: imported module 'tests.test_cli' has this __file__ ...
|
|
41
|
+
which is not the same as the test file`. Every PyPI publish attempt since v3.5.6 failed
|
|
42
|
+
silently at this step (npm publishes succeeded because the npm CI workflow skips pytest).
|
|
43
|
+
Fix: `git mv tests/test_cli.py tests/test_cli_core.py` — no tests dropped, no changes
|
|
44
|
+
to test logic, collision eliminated.
|
|
45
|
+
|
|
46
|
+
## [3.6.0] - 2026-06-07 — Optimize module: cache, compress, proxy (3-lever token-saving system)
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
- **Optimize module** — a 3-lever system for reducing LLM token spend through an SLM-hosted
|
|
50
|
+
proxy at `http://localhost:8765`. Levers: (1) **Cache** — exact and semantic caching of
|
|
51
|
+
LLM calls with separate TTLs; (2) **Compress** — prompt compression via CCR/code/prose
|
|
52
|
+
strategies; (3) **Align** — model routing. Proxy intercepts calls routed via
|
|
53
|
+
`ANTHROPIC_BASE_URL=http://localhost:8765` or the `withSLM(Anthropic())` SDK adapter.
|
|
54
|
+
- `slm optimize status|on|off|savings` CLI subcommands.
|
|
55
|
+
- `slm proxy` CLI to start/stop the proxy and configure providers.
|
|
56
|
+
- Dashboard Optimize pane at `http://localhost:8765/#optimize-pane` with live toggle UI.
|
|
57
|
+
- Separate `llmcache.db` for cache storage — never writes to `memory.db`.
|
|
58
|
+
|
|
8
59
|
## [3.5.9] - 2026-06-07 — Community bug fixes (issues #28, #29, PR #30) + zombie process hardening
|
|
9
60
|
|
|
10
61
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superlocalmemory",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.1",
|
|
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
|
@@ -28,7 +28,7 @@ if "OMP_NUM_THREADS" not in os.environ:
|
|
|
28
28
|
os.environ["OMP_NUM_THREADS"] = "2"
|
|
29
29
|
# ---------------------------------------------------------------------------
|
|
30
30
|
|
|
31
|
-
__version__ = "3.
|
|
31
|
+
__version__ = "3.6.1"
|
|
32
32
|
|
|
33
33
|
_REQUIRED_VERSIONS = {
|
|
34
34
|
"sentence_transformers": "5.3.0",
|
|
@@ -67,8 +67,11 @@ def cmd_optimize_status(args: Namespace) -> None:
|
|
|
67
67
|
|
|
68
68
|
proxy_running = False
|
|
69
69
|
try:
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
import urllib.request
|
|
71
|
+
_url = f"http://127.0.0.1:{OPTIMIZE_DEFAULT_PORT}/health"
|
|
72
|
+
_req = urllib.request.Request(_url, method="GET")
|
|
73
|
+
with urllib.request.urlopen(_req, timeout=1) as _resp:
|
|
74
|
+
proxy_running = _resp.status == 200
|
|
72
75
|
except Exception:
|
|
73
76
|
pass
|
|
74
77
|
|
|
@@ -20,12 +20,21 @@ def _get_store():
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def _ensure_running(port: int) -> bool:
|
|
23
|
-
"""
|
|
23
|
+
"""Liveness probe: return True if the SLM daemon is responding at *port*.
|
|
24
|
+
|
|
25
|
+
Calls GET /health with a 2-second timeout. The SLM daemon (which also acts
|
|
26
|
+
as the optimize proxy) is the process that answers on :8765; if it responds
|
|
27
|
+
the proxy layer is alive. We do NOT call lifecycle.ensure_proxy_running()
|
|
28
|
+
here because that function reads config via the daemon-internal store
|
|
29
|
+
(get_optimize_config/_store) which is None in a CLI subprocess context.
|
|
30
|
+
"""
|
|
24
31
|
try:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
import urllib.request
|
|
33
|
+
url = f"http://127.0.0.1:{port}/health"
|
|
34
|
+
req = urllib.request.Request(url, method="GET")
|
|
35
|
+
with urllib.request.urlopen(req, timeout=2) as resp:
|
|
36
|
+
return resp.status == 200
|
|
37
|
+
except Exception:
|
|
29
38
|
return False
|
|
30
39
|
|
|
31
40
|
|
|
@@ -54,7 +63,7 @@ def cmd_proxy(args: Namespace) -> None:
|
|
|
54
63
|
base_url=f"http://localhost:{port}",
|
|
55
64
|
)
|
|
56
65
|
|
|
57
|
-
fields: dict = {"providers": providers}
|
|
66
|
+
fields: dict = {"providers": providers, "proxy_enabled": True}
|
|
58
67
|
if no_compress:
|
|
59
68
|
fields["compress_enabled"] = False
|
|
60
69
|
if semantic:
|
|
@@ -16,6 +16,18 @@ from typing import Any
|
|
|
16
16
|
from superlocalmemory.optimize.adapters._agent_registry import AGENT_REGISTRY
|
|
17
17
|
from superlocalmemory.optimize.proxy.lifecycle import ensure_proxy_running, proxy_port
|
|
18
18
|
|
|
19
|
+
# Mechanisms that write static config files — need proxy *configured*, not alive.
|
|
20
|
+
_STATIC_MECHANISMS = {"settings-file", "config-file", "print-only"}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _proxy_configured() -> bool:
|
|
24
|
+
"""Return True if proxy_enabled=True in optimize.json (no liveness check)."""
|
|
25
|
+
try:
|
|
26
|
+
from superlocalmemory.optimize.config import get_optimize_config
|
|
27
|
+
return get_optimize_config().proxy_enabled
|
|
28
|
+
except Exception:
|
|
29
|
+
return False
|
|
30
|
+
|
|
19
31
|
|
|
20
32
|
def list_agents() -> list[str]:
|
|
21
33
|
"""Return all registered agent keys."""
|
|
@@ -42,19 +54,36 @@ def wrap_agent(
|
|
|
42
54
|
)
|
|
43
55
|
return 1
|
|
44
56
|
|
|
45
|
-
if not ensure_proxy_running():
|
|
46
|
-
print(
|
|
47
|
-
f"[slm wrap] proxy is not enabled in optimize.json — set "
|
|
48
|
-
f"`proxy_enabled: true` (port 8765) and re-run, or run "
|
|
49
|
-
f"`slm optimize on` first.",
|
|
50
|
-
file=sys.stderr,
|
|
51
|
-
)
|
|
52
|
-
return 1
|
|
53
|
-
|
|
54
57
|
port = proxy_port()
|
|
55
58
|
spec = AGENT_REGISTRY[agent_key]
|
|
56
59
|
mechanism = spec.get("mechanism", "print-only")
|
|
57
60
|
|
|
61
|
+
# Static mechanisms (settings-file, config-file) only write JSON — proxy
|
|
62
|
+
# doesn't need to be alive yet. env/subprocess mechanisms inject the proxy
|
|
63
|
+
# URL into a live process, so full liveness is required there.
|
|
64
|
+
# Static mechanisms (settings-file, config-file, print-only) write JSON and
|
|
65
|
+
# dry-run modes only print — neither needs the proxy to be alive right now.
|
|
66
|
+
# Only live subprocess launches (mechanism="env", dry_run=False) require the
|
|
67
|
+
# proxy to be running so the subprocess can actually connect.
|
|
68
|
+
needs_liveness = (mechanism not in _STATIC_MECHANISMS) and not dry_run
|
|
69
|
+
if needs_liveness:
|
|
70
|
+
if not ensure_proxy_running():
|
|
71
|
+
print(
|
|
72
|
+
f"[slm wrap] proxy is not enabled or not running — run "
|
|
73
|
+
f"`slm proxy` to start it, or `slm optimize on` first.",
|
|
74
|
+
file=sys.stderr,
|
|
75
|
+
)
|
|
76
|
+
return 1
|
|
77
|
+
else:
|
|
78
|
+
if not _proxy_configured():
|
|
79
|
+
print(
|
|
80
|
+
f"[slm wrap] proxy is not enabled in optimize.json — set "
|
|
81
|
+
f"`proxy_enabled: true` (port 8765) and re-run, or run "
|
|
82
|
+
f"`slm optimize on` first.",
|
|
83
|
+
file=sys.stderr,
|
|
84
|
+
)
|
|
85
|
+
return 1
|
|
86
|
+
|
|
58
87
|
if mechanism == "print-only":
|
|
59
88
|
print(f"[slm wrap] {agent_key}: manual instructions")
|
|
60
89
|
print(spec.get("help_text", ""))
|
|
@@ -135,6 +164,11 @@ def wrap_agent(
|
|
|
135
164
|
if not binary:
|
|
136
165
|
print(f"[slm wrap] {agent_key}: no binary specified", file=sys.stderr)
|
|
137
166
|
return 1
|
|
167
|
+
# dry_run: show intent without requiring the binary to be installed
|
|
168
|
+
if dry_run:
|
|
169
|
+
print(f"[slm wrap] would exec: {binary} {' '.join(agent_args)}")
|
|
170
|
+
print(f"[slm wrap] env: {env_vars}")
|
|
171
|
+
return 0
|
|
138
172
|
if shutil.which(binary) is None:
|
|
139
173
|
print(
|
|
140
174
|
f"[slm wrap] binary '{binary}' not found in PATH. "
|
|
@@ -145,10 +179,6 @@ def wrap_agent(
|
|
|
145
179
|
full_env = os.environ.copy()
|
|
146
180
|
for k, v in env_vars.items():
|
|
147
181
|
full_env[k] = v.replace("{port}", str(port))
|
|
148
|
-
if dry_run:
|
|
149
|
-
print(f"[slm wrap] would exec: {binary} {' '.join(agent_args)}")
|
|
150
|
-
print(f"[slm wrap] env: {env_vars}")
|
|
151
|
-
return 0
|
|
152
182
|
try:
|
|
153
183
|
return subprocess.call([binary, *agent_args], env=full_env)
|
|
154
184
|
except FileNotFoundError as exc:
|
|
@@ -27,6 +27,7 @@ _savings_estimator = _SavingsEstimator()
|
|
|
27
27
|
class ConfigUpdateRequest(BaseModel):
|
|
28
28
|
"""Partial config update — only provided fields are changed."""
|
|
29
29
|
enabled: bool | None = None
|
|
30
|
+
proxy_enabled: bool | None = None
|
|
30
31
|
cache_enabled: bool | None = None
|
|
31
32
|
semantic_enabled: bool | None = None
|
|
32
33
|
compress_enabled: bool | None = None
|
|
@@ -389,6 +389,9 @@
|
|
|
389
389
|
if (typeof loadAutoSettings === 'function') loadAutoSettings();
|
|
390
390
|
if (typeof updateModeUI === 'function') updateModeUI();
|
|
391
391
|
break;
|
|
392
|
+
case 'optimize-pane':
|
|
393
|
+
if (typeof initOptimizeTab === 'function') initOptimizeTab();
|
|
394
|
+
break;
|
|
392
395
|
}
|
|
393
396
|
}
|
|
394
397
|
|
|
@@ -94,17 +94,18 @@ Dynamic: license-file
|
|
|
94
94
|
<img src="https://superlocalmemory.com/assets/logo-mark.png" alt="SuperLocalMemory" width="200"/>
|
|
95
95
|
</p>
|
|
96
96
|
|
|
97
|
-
<h1 align="center">SuperLocalMemory V3.
|
|
98
|
-
<p align="center"><strong>
|
|
99
|
-
<p align="center"><code>v3.
|
|
97
|
+
<h1 align="center">SuperLocalMemory V3.6</h1>
|
|
98
|
+
<p align="center"><strong>Save up to 90% on every LLM API call. Cache. Compress. Remember.</strong><br/><em>The only local-first memory system that SKIPS repeat calls (100% saved), SHRINKS prompts 60-95%, and REMEMBERS everything — locally, for free. For Claude Code, Cursor, Windsurf, and any AI client.</em></p>
|
|
99
|
+
<p align="center"><code>v3.6.0 "Optimize"</code> — <strong>Cache & Compress & Align. Save up to 90% on every LLM API call — locally.</strong> One command: <code>slm wrap claude</code><br>Also includes v3.5 Scale-Ready: 6-channel recall <1s, CozoDB + LanceDB, Core Memory Block. Your database auto-migrates.</p>
|
|
100
100
|
<p align="center"><strong>Backed by 3 published research papers</strong> (arXiv preprints + Zenodo-archived) · <a href="https://arxiv.org/abs/2603.02240">arXiv:2603.02240</a> · <a href="https://arxiv.org/abs/2603.14588">arXiv:2603.14588</a> · <a href="https://arxiv.org/abs/2604.04514">arXiv:2604.04514</a></p>
|
|
101
101
|
|
|
102
102
|
<p align="center">
|
|
103
|
-
<code>+10.6pp vs Mem0 zero-LLM</code> · <code>85% Open-Domain (best zero-LLM score)</code> · <code>EU AI Act Ready</code>
|
|
103
|
+
<code>Saves up to 90% on LLM API costs</code> · <code>+10.6pp vs Mem0 zero-LLM</code> · <code>85% Open-Domain (best zero-LLM score)</code> · <code>EU AI Act Ready</code>
|
|
104
104
|
</p>
|
|
105
105
|
|
|
106
106
|
<p align="center">
|
|
107
107
|
<a href="https://arxiv.org/abs/2603.14588"><img src="https://img.shields.io/badge/arXiv-2603.14588-b31b1b?style=for-the-badge&logo=arxiv&logoColor=white" alt="arXiv Paper"/></a>
|
|
108
|
+
<a href="https://img.shields.io/badge/Saves_90%25_on_LLM_Costs-22c55e?style=for-the-badge"><img src="https://img.shields.io/badge/Saves_90%25_on_LLM_Costs-22c55e?style=for-the-badge" alt="Saves 90% on LLM Costs"/></a>
|
|
108
109
|
<a href="https://pypi.org/project/superlocalmemory/"><img src="https://img.shields.io/pypi/v/superlocalmemory?style=for-the-badge&logo=pypi&logoColor=white" alt="PyPI"/></a>
|
|
109
110
|
<a href="https://www.npmjs.com/package/superlocalmemory"><img src="https://img.shields.io/npm/v/superlocalmemory?style=for-the-badge&logo=npm&logoColor=white" alt="npm"/></a>
|
|
110
111
|
<a href="https://www.gnu.org/licenses/agpl-3.0"><img src="https://img.shields.io/badge/License-AGPL_v3-blue.svg?style=for-the-badge" alt="AGPL v3"/></a>
|
|
@@ -121,31 +122,89 @@ Dynamic: license-file
|
|
|
121
122
|
|
|
122
123
|
---
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
<details>
|
|
126
|
+
<summary><strong>What's New in V3.6 — Optimize: SKIP, SHRINK, DISCOUNT, REMEMBER</strong> (click to expand)</summary>
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
> V3.6 is the only local-first layer that SKIPS repeat LLM calls (cache: 100% saved), SHRINKS prompts 60-95% (compress: extractive + LLMLingua-2), and DISCOUNTS prefix costs (align: native KV-cache) — and remembers everything — in one install. **Your first cache hit pays for the install time. Hours of coding on repeat, minimal API cost.**
|
|
127
129
|
|
|
128
|
-
|
|
130
|
+
### The Three Levers
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
| Lever | Mechanism | Saving | Off by default? |
|
|
133
|
+
|-------|-----------|:------:|:---------------:|
|
|
134
|
+
| **Cache** | Skip repeat calls — exact-match SQLite lookup, vCache-gated semantic (opt-in) | **100% on a hit** (input + output) | Cache ON, Semantic OFF |
|
|
135
|
+
| **Compress** | Shrink prompts — extractive JSON/code (lossless) + LLMLingua-2 prose (opt-in) | **60–95% on a miss** (input only) | Safe mode ON, Aggressive OFF |
|
|
136
|
+
| **Align** | Stabilize prefix — maximize provider prefix-cache discounts | **Lossless extra** | ON when compression is ON |
|
|
131
137
|
|
|
132
|
-
|
|
133
|
-
|:-------|:-----:|:-------|:-------------------:|:-----------:|:-------|
|
|
134
|
-
| EverMemOS | 93.05% | Cloud (proprietary) | Yes | Core only | [evermind.ai](https://evermind.ai/) (Feb 2026) |
|
|
135
|
-
| Hindsight (LoComo10) | 92.0% | Cloud | Yes | No | [benchmarks.hindsight.vectorize.io](https://benchmarks.hindsight.vectorize.io) (Apr 2026) |
|
|
136
|
-
| Mem0 (token-efficient) | 91.6% | Hybrid (Cohere/OpenAI) | Yes | Partial | [mem0.ai blog](https://mem0.ai/blog/mem0-the-token-efficient-memory-algorithm) (Apr 16 2026) |
|
|
137
|
-
| **SLM V3 Mode C** | **87.7%** | Local + optional LLM | Optional (Ollama OK) | **Yes (AGPL-3.0)** | In-house, repro script in `docs/benchmarks/` |
|
|
138
|
-
| Zep v3 Cloud | 85.2% | Cloud | Yes | Community deprecated | [getzep.com](https://www.getzep.com/) |
|
|
139
|
-
| **SLM V3 Mode A** | **74.8%** | **Local, CPU-only, zero-LLM** | **No** | **Yes (AGPL-3.0)** | In-house, repro script in `docs/benchmarks/` |
|
|
140
|
-
| Mem0 (zero-retrieval-LLM) | 64.2% | Local baseline | No | Partial | Mem0 paper, zero-LLM row |
|
|
138
|
+
**Memory** (v3.5's existing engine) runs in parallel — it shapes *what is in* the prompt (relevant facts); Optimize decides *whether and how* it is sent.
|
|
141
139
|
|
|
142
|
-
|
|
140
|
+
### Quick Start
|
|
143
141
|
|
|
144
|
-
|
|
142
|
+
```bash
|
|
143
|
+
# One command to start saving
|
|
144
|
+
slm wrap claude
|
|
145
|
+
# Your first repeat prompt → CACHE HIT → $0.00
|
|
146
|
+
# Your first long prompt → COMPRESSED 70% → $0.00 per token saved
|
|
147
|
+
```
|
|
145
148
|
|
|
146
|
-
|
|
149
|
+
### New CLI Commands (6 total)
|
|
147
150
|
|
|
148
|
-
|
|
151
|
+
| Command | What It Does |
|
|
152
|
+
|:--------|:-------------|
|
|
153
|
+
| `slm optimize status\|on\|off\|savings` | Master Optimize control + savings report (USD/INR/tokens) |
|
|
154
|
+
| `slm cache status\|clear\|invalidate\|ttl\|semantic` | Cache sub-control — exact + semantic tiers |
|
|
155
|
+
| `slm compress status\|mode\|code\|prose\|ccr\|align` | Compression control — per-channel toggles |
|
|
156
|
+
| `slm proxy [--port] [--provider]` | Start the interception proxy (port 8765) |
|
|
157
|
+
| `slm wrap <agent>` | Proxy-activate an agent — one command to start saving |
|
|
158
|
+
| `slm help-optimize [topic]` | Full developer reference + per-agent setup recipes |
|
|
159
|
+
|
|
160
|
+
### Savings Dashboard
|
|
161
|
+
|
|
162
|
+
All metrics tracked and displayed live — from the dashboard (Optimize tab) or CLI:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
slm optimize savings --since 7
|
|
166
|
+
# Savings (last 7 days):
|
|
167
|
+
# Exact cache hits: 43 (127,580 input tokens saved)
|
|
168
|
+
# Tokens saved (total): 153,096
|
|
169
|
+
# Estimated savings: ~$2.30 (at $3.00/M tokens — Anthropic rates)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Enable / Disable
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
slm optimize on # Enable cache + compress
|
|
176
|
+
slm optimize off # Disable (proxy passes through)
|
|
177
|
+
slm cache semantic on # Enable semantic cache (needs embedding model)
|
|
178
|
+
slm compress mode aggressive # Enable prose compression (with safety warning)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Safety defaults:** Optimize ON. Safe mode ON (extractive only — lossless, production-safe). Semantic OFF. Aggressive OFF. No behavior change until you explicitly enable features.
|
|
182
|
+
|
|
183
|
+
### How It Works
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
Your App → Proxy/SDK/Wrap → Cache Check → HIT → Return Cached (0 tokens)
|
|
187
|
+
|
|
|
188
|
+
MISS
|
|
189
|
+
|
|
|
190
|
+
Compress → Provider → Store in Cache
|
|
191
|
+
60-95% + Align
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
- **Fail-open** — any error passes through. Your calls never break.
|
|
195
|
+
- **Separate database** — `llmcache.db` never touches `memory.db`. AES-256-GCM at rest.
|
|
196
|
+
- **Hot-reload config** — UI/CLI writes `~/.superlocalmemory/optimize.json`, daemon reloads in 2s.
|
|
197
|
+
|
|
198
|
+
### Links
|
|
199
|
+
|
|
200
|
+
Full docs:
|
|
201
|
+
- [Optimize Product Overview](docs/optimize-overview.md)
|
|
202
|
+
- [Optimize CLI Reference](docs/optimize-cli.md)
|
|
203
|
+
- [Optimize Config Reference](docs/optimize-config.md)
|
|
204
|
+
- [Wiki: V3.6 Overview](https://github.com/qualixar/superlocalmemory/wiki/V3.6-Overview)
|
|
205
|
+
- [Website: v3.6 Optimize](https://superlocalmemory.com/optimize)
|
|
206
|
+
|
|
207
|
+
</details>
|
|
149
208
|
|
|
150
209
|
---
|
|
151
210
|
|
|
@@ -240,21 +299,31 @@ slm config set v33_features.all true
|
|
|
240
299
|
|
|
241
300
|
---
|
|
242
301
|
|
|
243
|
-
|
|
244
|
-
<summary><strong>What's New in V3.2 — The Living Brain</strong> (click to expand)</summary>
|
|
302
|
+
## Why SuperLocalMemory?
|
|
245
303
|
|
|
246
|
-
|
|
304
|
+
Every **hosted** AI memory platform — Mem0 Cloud, Zep Cloud, Letta Cloud, EverMemOS Cloud — sends your data to cloud LLMs by default. Their self-hosted variants exist (Mem0 OpenMemory, Letta self-hosted, Graphiti) but require Docker + a separate graph DB or Ollama config, and most still default to OpenAI until you flip env vars. After **August 2, 2026**, any of those cloud paths becomes a compliance problem under the EU AI Act.
|
|
247
305
|
|
|
248
|
-
|
|
249
|
-
|:-------|:----:|:----:|:------:|
|
|
250
|
-
| Recall latency (10K facts) | ~500ms | <10ms | **100x faster** |
|
|
251
|
-
| Retrieval channels | 4 | 5 | +spreading activation |
|
|
252
|
-
| MCP tools | 24 | 29 | +5 new |
|
|
253
|
-
| DB tables | 9 | 18 | +9 new |
|
|
306
|
+
SuperLocalMemory V3 takes a different approach: **mathematics instead of cloud compute.** Three techniques from differential geometry, algebraic topology, and stochastic analysis replace the work that other systems need LLMs to do — similarity scoring, contradiction detection, and lifecycle management. The result is an agent memory that ships local-first out of the box — no Docker, no graph DB, no API keys — on CPU.
|
|
254
307
|
|
|
255
|
-
|
|
308
|
+
**The numbers** (evaluated on [LoCoMo](https://arxiv.org/abs/2402.09714), the standard long-conversation memory benchmark). Published numbers as of April 2026:
|
|
256
309
|
|
|
257
|
-
|
|
310
|
+
| System | Score | Config | Cloud LLM required? | Open Source | Source |
|
|
311
|
+
|:-------|:-----:|:-------|:-------------------:|:-----------:|:-------|
|
|
312
|
+
| EverMemOS | 93.05% | Cloud (proprietary) | Yes | Core only | [evermind.ai](https://evermind.ai/) (Feb 2026) |
|
|
313
|
+
| Hindsight (LoComo10) | 92.0% | Cloud | Yes | No | [benchmarks.hindsight.vectorize.io](https://benchmarks.hindsight.vectorize.io) (Apr 2026) |
|
|
314
|
+
| Mem0 (token-efficient) | 91.6% | Hybrid (Cohere/OpenAI) | Yes | Partial | [mem0.ai blog](https://mem0.ai/blog/mem0-the-token-efficient-memory-algorithm) (Apr 16 2026) |
|
|
315
|
+
| **SLM V3 Mode C** | **87.7%** | Local + optional LLM | Optional (Ollama OK) | **Yes (AGPL-3.0)** | In-house, repro script in `docs/benchmarks/` |
|
|
316
|
+
| Zep v3 Cloud | 85.2% | Cloud | Yes | Community deprecated | [getzep.com](https://www.getzep.com/) |
|
|
317
|
+
| **SLM V3 Mode A** | **74.8%** | **Local, CPU-only, zero-LLM** | **No** | **Yes (AGPL-3.0)** | In-house, repro script in `docs/benchmarks/` |
|
|
318
|
+
| Mem0 (zero-retrieval-LLM) | 64.2% | Local baseline | No | Partial | Mem0 paper, zero-LLM row |
|
|
319
|
+
|
|
320
|
+
> **How to read this table.** Scores from different papers use different LoCoMo splits, judge models, and prompt variants. We do NOT claim these numbers are apples-to-apples across rows. The rows we re-ran in-house are marked "In-house"; cited rows link to the vendor's public source and date. Mode A is the only zero-LLM configuration in the list, so the comparison that is apples-to-apples is **Mode A 74.8% vs Mem0 zero-retrieval-LLM 64.2%** (+10.6pp). Mem0's 91.6% and EverMemOS's 93.05% use cloud LLMs; Mode C uses a local LLM (Ollama). BEAM-10M, the emerging successor benchmark, will be added in a future release.
|
|
321
|
+
|
|
322
|
+
**What Mode A is**: CPU-only, SQLite-only, zero-LLM retrieval pipeline on published LoCoMo questions. To the best of our knowledge it is the only publicly-released local-first memory that clears Mem0's zero-LLM baseline on this benchmark. If another fully-local system hits similar numbers, please open an issue so we can update the table.
|
|
323
|
+
|
|
324
|
+
Mathematical layers contribute **+12.7 percentage points** on average across 6 conversations (n=832 questions), with up to **+19.9pp on the most challenging dialogues**. This isn't more compute — it's better math.
|
|
325
|
+
|
|
326
|
+
> **Upgrading from V2 (2.8.6)?** V3 is a complete architectural reinvention — new mathematical engine, new retrieval pipeline, new storage schema. Your existing data is preserved but requires migration. After installing V3, run `slm migrate` to upgrade your data. Read the [Migration Guide](https://github.com/qualixar/superlocalmemory/wiki/Migration-from-V2) before upgrading. Backup is created automatically.
|
|
258
327
|
|
|
259
328
|
---
|
|
260
329
|
|
|
@@ -275,9 +344,18 @@ slm warmup # Pre-download embedding model (~500MB, optional)
|
|
|
275
344
|
pip install superlocalmemory
|
|
276
345
|
```
|
|
277
346
|
|
|
278
|
-
###
|
|
347
|
+
### Start Saving on LLM Costs (v3.6 Optimize)
|
|
279
348
|
|
|
280
|
-
|
|
349
|
+
```bash
|
|
350
|
+
# Wrap your agent — starts proxy + sets environment + launches agent
|
|
351
|
+
slm wrap claude
|
|
352
|
+
# Your first repeat prompt → CACHE HIT → $0.00 saved
|
|
353
|
+
# See savings: slm optimize savings --since 1
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Upgrading to v3.6 "Optimize" + v3.5.0 "Scale-Ready"
|
|
357
|
+
|
|
358
|
+
**Migration is automatic.** Upgrade the package, restart the daemon — all migrations run in the background.
|
|
281
359
|
|
|
282
360
|
```bash
|
|
283
361
|
pip install -U superlocalmemory
|
|
@@ -285,7 +363,13 @@ slm restart
|
|
|
285
363
|
slm doctor
|
|
286
364
|
```
|
|
287
365
|
|
|
288
|
-
No manual commands. No data loss.
|
|
366
|
+
No manual commands. No data loss. Zero downtime.
|
|
367
|
+
|
|
368
|
+
**What you get after upgrading to v3.6.0:**
|
|
369
|
+
- **Cache** — skip repeat LLM calls entirely. Exact-match + vCache-gated semantic. **100% cost saved on hit.**
|
|
370
|
+
- **Compress** — shrink prompts 60-95% before sending. Extractive JSON/code (lossless) + LLMLingua-2 prose (opt-in). CCR reversible.
|
|
371
|
+
- **Align** — stabilize prompt prefix for native provider KV-cache discounts (Anthropic 90%, OpenAI 50%).
|
|
372
|
+
- **Savings dashboard** — live USD/INR/tokens saved displayed in the Optimize tab.
|
|
289
373
|
|
|
290
374
|
**What you get after upgrading to v3.5.0:**
|
|
291
375
|
- **CozoDB on the recall path** — entity_graph channel routes through the CozoDB backend (auto-detected, no config needed). Millions of graph edges indexed and traversed in milliseconds.
|
|
@@ -300,6 +384,7 @@ No manual commands. No data loss. Your database upgrades in-place. The daemon ap
|
|
|
300
384
|
|
|
301
385
|
| Version | Codename | Key Features |
|
|
302
386
|
|---|---|---|
|
|
387
|
+
| **v3.6.0** | Optimize | **Cache** (skip repeat calls, 100% on hit) · **Compress** (shrink prompts 60-95%) · **Align** (KV-cache stabilization) · `slm optimize\|cache\|compress\|proxy\|wrap` CLI · Live savings dashboard (USD/INR/tokens) · Hot-reload config · Safe defaults · Links: [docs/optimize-overview.md](docs/optimize-overview.md) · [V3.6 Wiki](https://github.com/qualixar/superlocalmemory/wiki/V3.6-Overview) |
|
|
303
388
|
| **v3.5.0** | Scale-Ready + Context Injection v2 | CozoDB/LanceDB migration, 6-channel recall <1s, Core Memory Block, BM25→FTS5, context injection v2, score normalization |
|
|
304
389
|
| **v3.4.5** | Scale-Ready (foundation) | Tiered storage (active/warm/cold), graph pruning, BackendOrchestrator scaffolding, CozoDB + LanceDB init + migration code (read path wired in v3.5.0) |
|
|
305
390
|
| **v3.4.51** | Recency Intelligence | Ebbinghaus decay + FSRS stability, age gate, session context time-awareness |
|
|
@@ -619,6 +704,20 @@ All 8 mesh tools work seamlessly across machines:
|
|
|
619
704
|
|
|
620
705
|
## Features
|
|
621
706
|
|
|
707
|
+
### LLM Cost Optimization (v3.6 Optimize)
|
|
708
|
+
- **Exact Cache** — byte-identical repeat calls served from local SQLite. SHA-256 key derivation, stampede shield, tag-based invalidation. **100% cost saved on hit** (input + output tokens).
|
|
709
|
+
- **Semantic Cache** (opt-in) — vCache-powered learned thresholds with SAFE-CACHE centroid defense. Near-duplicate queries served within error bound. CacheAttack 86% hijack class blocked.
|
|
710
|
+
- **Extractive Compression** — structure-preserving compression for JSON, code (AST-aware: Python/JS/Go/Rust/Java/C++), and tool outputs. **60-95% fewer input tokens**, zero accuracy regression.
|
|
711
|
+
- **LLMLingua-2 Prose** (opt-in) — extractive prose summarization for open-ended chat. Safety-warned before enable.
|
|
712
|
+
- **CCR (Compressed Context Retrieval)** — pre-compression originals stored for byte-exact reversal under UUID. Every compressed block recoverable.
|
|
713
|
+
- **CacheAligner** — detects volatile tokens (UUIDs, timestamps, JWTs) in system prompts. Maximizes native provider prefix-cache discounts (Anthropic 90%, OpenAI 50%).
|
|
714
|
+
- **Interception Proxy** — HTTP proxy on port 8765 serving Anthropic, OpenAI, and Gemini surfaces. Zero-code integration — just set `base_url`.
|
|
715
|
+
- **Agent Wrapping** — `slm wrap claude` — one command starts proxy + sets environment + launches agent. 10 supported agents.
|
|
716
|
+
- **Savings Dashboard** — live USD/INR/tokens saved, hit rate, compression ratio, cache size. CLI + UI.
|
|
717
|
+
- **Hot-Reload Config** — UI/CLI writes `optimize.json`; daemon reloads in 2 seconds. No restart.
|
|
718
|
+
- **Fail-open** — any cache/compress/proxy error passes through. Your calls never break.
|
|
719
|
+
- **Data isolation** — separate `llmcache.db` with AES-256-GCM encryption. Never touches `memory.db`.
|
|
720
|
+
|
|
622
721
|
### Retrieval
|
|
623
722
|
- 5-channel hybrid: Semantic (Fisher-Rao) + BM25 + Entity Graph + Temporal + Hopfield (associative / partial-query completion)
|
|
624
723
|
- RRF fusion + cross-encoder reranking
|
|
@@ -671,6 +770,14 @@ All 8 mesh tools work seamlessly across machines:
|
|
|
671
770
|
|
|
672
771
|
| Command | What It Does |
|
|
673
772
|
|:--------|:-------------|
|
|
773
|
+
| `slm optimize status` | Show all Optimize settings (cache, compress, proxy, config version) |
|
|
774
|
+
| `slm optimize on\|off` | Enable/disable all Optimize features (hot-reload, no restart) |
|
|
775
|
+
| `slm optimize savings [--since N] [--provider P] [--json]` | Token/cost savings report — live USD/INR |
|
|
776
|
+
| `slm cache status\|clear\|invalidate\|ttl\|semantic` | Cache sub-control — exact + semantic tiers, TTL management |
|
|
777
|
+
| `slm compress status\|mode\|code\|prose\|ccr\|align` | Compression control — per-channel toggle, safe/aggressive mode |
|
|
778
|
+
| `slm proxy [--port] [--provider] [--no-compress] [--semantic]` | Start interception proxy (port 8765) |
|
|
779
|
+
| `slm wrap <agent> [options]` | Proxy-activate an agent — one command to start saving |
|
|
780
|
+
| `slm help-optimize [topic]` | Full developer reference + per-agent setup recipes |
|
|
674
781
|
| `slm remember "..."` | Store a memory |
|
|
675
782
|
| `slm recall "..."` | Search memories |
|
|
676
783
|
| `slm forget "..."` | Delete matching memories |
|