superlocalmemory 3.6.9 → 3.6.11
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 +112 -10
- package/README.md +67 -9
- package/package.json +1 -1
- package/pyproject.toml +6 -1
- package/skills/slm-optimize/README.md +55 -0
- package/skills/slm-optimize/SKILL.md +139 -0
- package/src/superlocalmemory/__init__.py +1 -1
- package/src/superlocalmemory/cli/compress_cmd.py +32 -70
- package/src/superlocalmemory/cli/optimize_cmd.py +1 -3
- package/src/superlocalmemory/cli/setup_wizard.py +49 -0
- package/src/superlocalmemory/mcp/agent_context.py +111 -0
- package/src/superlocalmemory/mcp/server.py +4 -0
- package/src/superlocalmemory/mcp/tools_active.py +7 -8
- package/src/superlocalmemory/mcp/tools_core.py +16 -0
- package/src/superlocalmemory/mcp/tools_optimize.py +304 -0
- package/src/superlocalmemory/optimize/cache/boundary_store.py +23 -9
- package/src/superlocalmemory/optimize/cache/exact.py +7 -4
- package/src/superlocalmemory/optimize/cache/key_builder.py +13 -0
- package/src/superlocalmemory/optimize/cache/manager.py +70 -8
- package/src/superlocalmemory/optimize/cache/semantic.py +10 -5
- package/src/superlocalmemory/optimize/compress/prose_llmlingua.py +1 -7
- package/src/superlocalmemory/optimize/compress/router.py +82 -87
- package/src/superlocalmemory/optimize/config/__init__.py +16 -0
- package/src/superlocalmemory/optimize/config/defaults.py +1 -6
- package/src/superlocalmemory/optimize/config/schema.py +2 -19
- package/src/superlocalmemory/optimize/config/store.py +15 -1
- package/src/superlocalmemory/optimize/metrics/counters.py +15 -7
- package/src/superlocalmemory/optimize/proxy/_helpers.py +100 -2
- package/src/superlocalmemory/optimize/proxy/anthropic_surface.py +12 -0
- package/src/superlocalmemory/optimize/proxy/capture.py +243 -0
- package/src/superlocalmemory/optimize/proxy/gemini_surface.py +31 -0
- package/src/superlocalmemory/optimize/proxy/openai_surface.py +12 -0
- package/src/superlocalmemory/optimize/proxy/server.py +29 -0
- package/src/superlocalmemory/optimize/storage/db.py +102 -11
- package/src/superlocalmemory/optimize/storage/schema.py +11 -0
- package/src/superlocalmemory/server/routes/optimize.py +6 -8
- package/src/superlocalmemory/server/unified_daemon.py +26 -5
- package/src/superlocalmemory/ui/index.html +18 -14
- package/src/superlocalmemory/ui/js/auto-settings.js +3 -1
- package/src/superlocalmemory/ui/js/ng-shell.js +3 -0
- package/src/superlocalmemory/ui/js/optimize.js +9 -9
- package/src/superlocalmemory.egg-info/PKG-INFO +69 -10
- package/src/superlocalmemory.egg-info/SOURCES.txt +3 -2
- package/src/superlocalmemory.egg-info/requires.txt +1 -0
- package/src/superlocalmemory/optimize/compress/extractive_code.py +0 -311
- package/src/superlocalmemory/optimize/compress/extractive_json.py +0 -72
|
@@ -1183,18 +1183,31 @@ def create_app() -> FastAPI:
|
|
|
1183
1183
|
# API keys (x-api-key, Authorization), NOT the SLM API key. Auth-exempt
|
|
1184
1184
|
# path prefixes are configured below in the auth_middleware block.
|
|
1185
1185
|
try:
|
|
1186
|
-
from superlocalmemory.optimize.config
|
|
1186
|
+
from superlocalmemory.optimize.config import _set_config_store, get_shared_store
|
|
1187
1187
|
from superlocalmemory.optimize.proxy.server import ProxyApp, build_proxy_router
|
|
1188
1188
|
|
|
1189
|
-
|
|
1189
|
+
# ONE shared ConfigStore for daemon + routes + watchdog + proxy reload
|
|
1190
|
+
# (fixes W-05 fresh-store-per-request; powers runtime hot-reload).
|
|
1191
|
+
_opt_store = get_shared_store()
|
|
1192
|
+
_set_config_store(_opt_store)
|
|
1193
|
+
_opt_cfg = _opt_store.get()
|
|
1194
|
+
# W-03 fix: the proxy path is gated by proxy_enabled ALONE. The master
|
|
1195
|
+
# `enabled` gates only the SDK adapter, never the proxy mount.
|
|
1190
1196
|
if _opt_cfg.proxy_enabled:
|
|
1191
1197
|
_proxy = ProxyApp(config=_opt_cfg)
|
|
1192
1198
|
application.state.optimize_proxy = _proxy
|
|
1193
1199
|
_proxy_router = build_proxy_router(_proxy)
|
|
1194
1200
|
# prefix="" — proxy claims /v1/*, /v1beta/* directly.
|
|
1195
1201
|
application.include_router(_proxy_router, prefix="")
|
|
1202
|
+
# v3.6.10: runtime hot-reload — rebuild the proxy HookChain whenever
|
|
1203
|
+
# optimize.json changes so cache_enabled / compress_enabled can be
|
|
1204
|
+
# toggled INDEPENDENTLY from the UI with no restart. UI save fires the
|
|
1205
|
+
# callback immediately; external edits are caught by the 2s watchdog.
|
|
1206
|
+
_opt_store.register_change_callback(_proxy.reload_from_config)
|
|
1207
|
+
_opt_store.start_watchdog()
|
|
1196
1208
|
logger.info(
|
|
1197
|
-
"optimize.proxy mounted on /v1/*, /v1beta/* port=8765"
|
|
1209
|
+
"optimize.proxy mounted on /v1/*, /v1beta/* port=8765 "
|
|
1210
|
+
"(runtime cache/compress hot-reload enabled)"
|
|
1198
1211
|
)
|
|
1199
1212
|
else:
|
|
1200
1213
|
application.state.optimize_proxy = None
|
|
@@ -1246,8 +1259,16 @@ def create_app() -> FastAPI:
|
|
|
1246
1259
|
logger.info("MCP transport security: allowed_hosts=%r", _mcp_allowed)
|
|
1247
1260
|
global _mcp_app
|
|
1248
1261
|
_mcp_app = _mcp_fastmcp.streamable_http_app()
|
|
1249
|
-
|
|
1250
|
-
|
|
1262
|
+
|
|
1263
|
+
# v3.6.10: per-agent-ID routing — /mcp/{agent_id} extracts the agent
|
|
1264
|
+
# identity from the URL path and places it in a ContextVar so all MCP
|
|
1265
|
+
# tools (remember, recall, etc.) automatically use the correct namespace.
|
|
1266
|
+
# AgentIDExtractorASGI lives in mcp/agent_context so it is unit-testable
|
|
1267
|
+
# (tests/test_mcp/test_agent_context.py) rather than buried inline here.
|
|
1268
|
+
from superlocalmemory.mcp.agent_context import AgentIDExtractorASGI
|
|
1269
|
+
|
|
1270
|
+
application.mount("/mcp", AgentIDExtractorASGI(_mcp_app))
|
|
1271
|
+
logger.info("MCP HTTP transport mounted at /mcp (Streamable HTTP, port 8765; per-agent routing enabled)")
|
|
1251
1272
|
except Exception as _mcp_exc: # pragma: no cover — defensive
|
|
1252
1273
|
logger.warning("MCP HTTP mount failed (non-fatal, stdio still works): %s", _mcp_exc)
|
|
1253
1274
|
|
|
@@ -1248,6 +1248,16 @@
|
|
|
1248
1248
|
<input class="form-check-input" type="checkbox" id="opt-enabled">
|
|
1249
1249
|
<label class="form-check-label" for="opt-enabled">Optimize Enabled</label>
|
|
1250
1250
|
</div>
|
|
1251
|
+
<div class="form-check form-switch mb-2">
|
|
1252
|
+
<input class="form-check-input" type="checkbox" id="opt-proxy-enabled">
|
|
1253
|
+
<label class="form-check-label" for="opt-proxy-enabled">
|
|
1254
|
+
Proxy Enabled
|
|
1255
|
+
<span class="text-muted small ms-1">(restart required)</span>
|
|
1256
|
+
</label>
|
|
1257
|
+
</div>
|
|
1258
|
+
<div id="opt-restart-notice" class="alert alert-warning py-1 px-2 small mb-2 d-none">
|
|
1259
|
+
Proxy setting changed. Run <code>slm restart</code> to apply.
|
|
1260
|
+
</div>
|
|
1251
1261
|
<div class="form-check form-switch mb-2">
|
|
1252
1262
|
<input class="form-check-input" type="checkbox" id="opt-cache-enabled">
|
|
1253
1263
|
<label class="form-check-label" for="opt-cache-enabled">Cache Enabled</label>
|
|
@@ -1263,26 +1273,14 @@
|
|
|
1263
1273
|
<div class="mb-2">
|
|
1264
1274
|
<label for="opt-compress-mode" class="form-label">Compression Mode</label>
|
|
1265
1275
|
<select class="form-select form-select-sm" id="opt-compress-mode">
|
|
1266
|
-
<option value="safe">Safe</option>
|
|
1267
|
-
<option value="aggressive">Aggressive</option>
|
|
1276
|
+
<option value="safe">Safe (lossless)</option>
|
|
1277
|
+
<option value="aggressive">Aggressive (LLMLingua-2, prose only)</option>
|
|
1268
1278
|
</select>
|
|
1269
1279
|
</div>
|
|
1270
|
-
<div class="form-check form-switch mb-2">
|
|
1271
|
-
<input class="form-check-input" type="checkbox" id="opt-compress-code">
|
|
1272
|
-
<label class="form-check-label" for="opt-compress-code">Code Compression</label>
|
|
1273
|
-
</div>
|
|
1274
1280
|
<div class="form-check form-switch mb-2">
|
|
1275
1281
|
<input class="form-check-input" type="checkbox" id="opt-compress-prose">
|
|
1276
1282
|
<label class="form-check-label" for="opt-compress-prose">Prose Compression</label>
|
|
1277
1283
|
</div>
|
|
1278
|
-
<div class="form-check form-switch mb-2">
|
|
1279
|
-
<input class="form-check-input" type="checkbox" id="opt-compress-ccr">
|
|
1280
|
-
<label class="form-check-label" for="opt-compress-ccr">CCR</label>
|
|
1281
|
-
</div>
|
|
1282
|
-
<div class="form-check form-switch mb-2">
|
|
1283
|
-
<input class="form-check-input" type="checkbox" id="opt-compress-align">
|
|
1284
|
-
<label class="form-check-label" for="opt-compress-align">Alignment Compression</label>
|
|
1285
|
-
</div>
|
|
1286
1284
|
</div>
|
|
1287
1285
|
<div class="col-md-6">
|
|
1288
1286
|
<h6>Savings</h6>
|
|
@@ -1299,6 +1297,12 @@
|
|
|
1299
1297
|
<div class="small text-muted">Config version: <span id="opt-config-version">-</span></div>
|
|
1300
1298
|
<div id="opt-stale-warning" class="text-warning small mt-1"></div>
|
|
1301
1299
|
<button class="btn btn-sm btn-outline-primary mt-2" id="opt-copy-url">Copy URL</button>
|
|
1300
|
+
<div class="mt-2 small text-muted">
|
|
1301
|
+
<strong>Point agents at the proxy:</strong><br>
|
|
1302
|
+
<code>slm wrap claude</code> — Claude Code<br>
|
|
1303
|
+
<code>--openai-api-base http://localhost:8765/v1</code> — Aider<br>
|
|
1304
|
+
<code>OPENAI_BASE_URL=http://localhost:8765/v1</code> — OpenAI SDK
|
|
1305
|
+
</div>
|
|
1302
1306
|
</div>
|
|
1303
1307
|
</div>
|
|
1304
1308
|
</div>
|
|
@@ -324,10 +324,12 @@ async function testConnection() {
|
|
|
324
324
|
if (resultEl) { resultEl.textContent = 'Testing...'; resultEl.className = 'ms-2 small text-muted'; }
|
|
325
325
|
|
|
326
326
|
try {
|
|
327
|
+
var testBody = {provider: provider, model: model};
|
|
328
|
+
if (apiKey) testBody.api_key = apiKey;
|
|
327
329
|
var resp = await fetch('/api/v3/provider/test', {
|
|
328
330
|
method: 'POST',
|
|
329
331
|
headers: {'Content-Type': 'application/json'},
|
|
330
|
-
body: JSON.stringify(
|
|
332
|
+
body: JSON.stringify(testBody)
|
|
331
333
|
});
|
|
332
334
|
var data = await resp.json();
|
|
333
335
|
if (data.success) {
|
|
@@ -338,6 +338,9 @@
|
|
|
338
338
|
// ── Lazy Load Tab Data ─────────────────────────────────────
|
|
339
339
|
function triggerTabLoad(tabId) {
|
|
340
340
|
switch(tabId) {
|
|
341
|
+
case 'brain-pane':
|
|
342
|
+
if (typeof loadBrain === 'function') loadBrain();
|
|
343
|
+
break;
|
|
341
344
|
case 'graph-pane':
|
|
342
345
|
if (typeof loadGraph === 'function') loadGraph();
|
|
343
346
|
// v3.4.4: Initialize chat panel if not already present
|
|
@@ -23,14 +23,12 @@
|
|
|
23
23
|
if (!resp.ok) return;
|
|
24
24
|
var cfg = await resp.json();
|
|
25
25
|
_setToggle('opt-enabled', cfg.enabled);
|
|
26
|
+
_setToggle('opt-proxy-enabled', cfg.proxy_enabled);
|
|
26
27
|
_setToggle('opt-cache-enabled', cfg.cache_enabled);
|
|
27
28
|
_setToggle('opt-semantic-enabled', cfg.semantic_enabled);
|
|
28
29
|
_setToggle('opt-compress-enabled', cfg.compress_enabled);
|
|
29
30
|
_setSelect('opt-compress-mode', cfg.compress_mode);
|
|
30
|
-
_setToggle('opt-compress-code', cfg.compress_code);
|
|
31
31
|
_setToggle('opt-compress-prose', cfg.compress_prose);
|
|
32
|
-
_setToggle('opt-compress-ccr', cfg.compress_ccr);
|
|
33
|
-
_setToggle('opt-compress-align', cfg.compress_align);
|
|
34
32
|
var verEl = document.getElementById('opt-config-version');
|
|
35
33
|
if (verEl) verEl.textContent = cfg.config_version || '-';
|
|
36
34
|
} catch (e) {
|
|
@@ -70,14 +68,12 @@
|
|
|
70
68
|
var val = e.target.checked;
|
|
71
69
|
|
|
72
70
|
var fieldMap = {
|
|
73
|
-
'opt-enabled':
|
|
74
|
-
'opt-
|
|
71
|
+
'opt-enabled': 'enabled',
|
|
72
|
+
'opt-proxy-enabled': 'proxy_enabled',
|
|
73
|
+
'opt-cache-enabled': 'cache_enabled',
|
|
75
74
|
'opt-semantic-enabled': 'semantic_enabled',
|
|
76
75
|
'opt-compress-enabled': 'compress_enabled',
|
|
77
|
-
'opt-compress-
|
|
78
|
-
'opt-compress-prose': 'compress_prose',
|
|
79
|
-
'opt-compress-ccr': 'compress_ccr',
|
|
80
|
-
'opt-compress-align': 'compress_align'
|
|
76
|
+
'opt-compress-prose': 'compress_prose'
|
|
81
77
|
};
|
|
82
78
|
|
|
83
79
|
if (id === 'opt-compress-mode') {
|
|
@@ -109,6 +105,10 @@
|
|
|
109
105
|
var body = {};
|
|
110
106
|
body[field] = val;
|
|
111
107
|
_putConfig(body);
|
|
108
|
+
if (id === 'opt-proxy-enabled' || id === 'opt-enabled') {
|
|
109
|
+
var notice = document.getElementById('opt-restart-notice');
|
|
110
|
+
if (notice) notice.classList.remove('d-none');
|
|
111
|
+
}
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: superlocalmemory
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.11
|
|
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
|
|
@@ -58,6 +58,7 @@ Requires-Dist: huggingface_hub==0.36.2
|
|
|
58
58
|
Requires-Dist: torch==2.11.0
|
|
59
59
|
Requires-Dist: scikit-learn==1.8.0
|
|
60
60
|
Requires-Dist: sqlite-vec==0.1.9
|
|
61
|
+
Requires-Dist: llmlingua==0.2.2
|
|
61
62
|
Provides-Extra: search
|
|
62
63
|
Requires-Dist: sentence-transformers==5.3.0; extra == "search"
|
|
63
64
|
Requires-Dist: optimum==2.1.0; extra == "search"
|
|
@@ -94,18 +95,18 @@ Dynamic: license-file
|
|
|
94
95
|
<img src="https://superlocalmemory.com/assets/logo-mark.png" alt="SuperLocalMemory" width="200"/>
|
|
95
96
|
</p>
|
|
96
97
|
|
|
97
|
-
<h1 align="center">SuperLocalMemory V3.6</h1>
|
|
98
|
-
<p align="center"><strong>
|
|
99
|
-
<p align="center"><code>v3.6.
|
|
98
|
+
<h1 align="center">SuperLocalMemory V3.6.11</h1>
|
|
99
|
+
<p align="center"><strong>Cache. Compress. Remember. Three surfaces — proxy, MCP tools, or skill. Every setup covered.</strong><br/><em>The only local-first layer that pairs persistent memory with compression + caching across every Claude plan. Full 1M window preserved in MCP and skill mode.</em></p>
|
|
100
|
+
<p align="center"><code>v3.6.11 "Optimize Everywhere"</code> — <strong>Compress + cache on any plan, three ways in.</strong><br/>Proxy (full-turn cache): <code>slm wrap claude</code> · MCP (proxy-free): add <code>slm_compress</code> to your MCP config · Skill (zero-config): <code>~/.claude/skills/slm-optimize/</code></p>
|
|
100
101
|
<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
102
|
|
|
102
103
|
<p align="center">
|
|
103
|
-
<code>
|
|
104
|
+
<code>Proxy · MCP tools · Skill — three surfaces</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
105
|
</p>
|
|
105
106
|
|
|
106
107
|
<p align="center">
|
|
107
108
|
<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="
|
|
109
|
+
<a href="#three-surfaces-proxy--mcp-tools--skill"><img src="https://img.shields.io/badge/Proxy_|_MCP_|_Skill-22c55e?style=for-the-badge" alt="Three Surfaces: Proxy, MCP Tools, Skill"/></a>
|
|
109
110
|
<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>
|
|
110
111
|
<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>
|
|
111
112
|
<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>
|
|
@@ -125,18 +126,24 @@ Dynamic: license-file
|
|
|
125
126
|
<details>
|
|
126
127
|
<summary><strong>What's New in V3.6 — Optimize: SKIP, SHRINK, DISCOUNT, REMEMBER</strong> (click to expand)</summary>
|
|
127
128
|
|
|
128
|
-
> V3.6 is the only local-first layer that SKIPS repeat LLM calls (cache: 100%
|
|
129
|
+
> V3.6 is the only local-first layer that SKIPS repeat LLM calls (cache: 100% on a hit), SHRINKS tool outputs and injected context (compress: lossless-by-default, opt-in LLMLingua-2), and DISCOUNTS prefix costs (align: native KV-cache) — and remembers everything — in one install.
|
|
130
|
+
>
|
|
131
|
+
> **v3.6.11 "Optimize Everywhere":** Three surfaces. **Proxy** (Surface A) — full-turn cache + compress on transport; needs `ANTHROPIC_BASE_URL`, shrinks the context window. **MCP tools** (Surface B) — `slm_compress`, `slm_retrieve`, `slm_cache_set`, `slm_cache_get`, `slm_optimize_stats`; no proxy, no window shrink, works on any Claude subscription. **Skill** (Surface C) — `slm-optimize` installs in `~/.claude/skills/`; zero-config auto-compress for large tool outputs and CLAUDE.md. No proxy, full 1M window. [See Three Surfaces →](#three-surfaces-proxy--mcp-tools--skill)
|
|
132
|
+
>
|
|
133
|
+
> **v3.6.10:** cache and compression are now **independent runtime switches** (cache-only, compress-only, both, or neither — toggle live from the dashboard, no restart). Compression was rebuilt to be **lossless by default** (the old string/array/code truncation is gone); aggressive mode adds LLMLingua-2 for **prose only** — never code, numbers, structured data, or the current turn.
|
|
129
134
|
|
|
130
135
|
### The Three Levers
|
|
131
136
|
|
|
132
137
|
| Lever | Mechanism | Saving | Off by default? |
|
|
133
138
|
|-------|-----------|:------:|:---------------:|
|
|
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 —
|
|
139
|
+
| **Cache** | Skip repeat calls — exact-match SQLite lookup (zero false hits), vCache-gated semantic (opt-in) | **100% on a hit** (input + output) | Cache ON, Semantic OFF |
|
|
140
|
+
| **Compress** | Shrink prompts — **safe = lossless** normalization; **aggressive = LLMLingua-2 prose only** (opt-in) | Safe: small + lossless · Aggressive: large on prose | Safe mode, Aggressive OFF |
|
|
136
141
|
| **Align** | Stabilize prefix — maximize provider prefix-cache discounts | **Lossless extra** | ON when compression is ON |
|
|
137
142
|
|
|
138
143
|
**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.
|
|
139
144
|
|
|
145
|
+
> **Independent at runtime:** enable caching only, compression only, both, or neither — from the dashboard Optimize tab, applied live (no restart). Each AI client can also get its own memory identity over HTTP MCP via `http://127.0.0.1:8765/mcp/{agent_id}`.
|
|
146
|
+
|
|
140
147
|
### Quick Start
|
|
141
148
|
|
|
142
149
|
```bash
|
|
@@ -152,7 +159,7 @@ slm wrap claude
|
|
|
152
159
|
|:--------|:-------------|
|
|
153
160
|
| `slm optimize status\|on\|off\|savings` | Master Optimize control + savings report (USD/INR/tokens) |
|
|
154
161
|
| `slm cache status\|clear\|invalidate\|ttl\|semantic` | Cache sub-control — exact + semantic tiers |
|
|
155
|
-
| `slm compress status\|mode\|
|
|
162
|
+
| `slm compress status\|mode\|prose` | Compression control — safe (lossless) / aggressive (LLMLingua-2 prose) |
|
|
156
163
|
| `slm proxy [--port] [--provider]` | Start the interception proxy (port 8765) |
|
|
157
164
|
| `slm wrap <agent>` | Proxy-activate an agent — one command to start saving |
|
|
158
165
|
| `slm help-optimize [topic]` | Full developer reference + per-agent setup recipes |
|
|
@@ -208,6 +215,57 @@ Full docs:
|
|
|
208
215
|
|
|
209
216
|
---
|
|
210
217
|
|
|
218
|
+
## Three Surfaces: Proxy · MCP Tools · Skill
|
|
219
|
+
|
|
220
|
+
v3.6.11 delivers one engine across **three ways in** — choose the surface that fits your setup:
|
|
221
|
+
|
|
222
|
+
| Surface | How you use it | Requires proxy? | Window effect | Cache scope |
|
|
223
|
+
|---------|---------------|:---------------:|:-------------:|-------------|
|
|
224
|
+
| **A — Proxy** | `slm wrap claude` or `ANTHROPIC_BASE_URL=http://127.0.0.1:8765` | **Yes** | Shrinks (proxy intercepts full context) | Full-turn cache — every Claude call |
|
|
225
|
+
| **B — MCP tools** | Add 5 tools to MCP config; call `slm_compress`, `slm_cache_set/get` | **No** | **Preserved** (full 1M) | Results you explicitly route through SLM |
|
|
226
|
+
| **C — Skill** | Copy `skills/slm-optimize/SKILL.md` → `~/.claude/skills/` | **No** | **Preserved** (full 1M) | Auto-applied by the agent per skill rules |
|
|
227
|
+
|
|
228
|
+
**How to choose:**
|
|
229
|
+
- On a **metered API** (pay-per-token) and want to cache every call → **Proxy (A)**
|
|
230
|
+
- On a **Pro/Max/Team subscription** or any plan where you can't or won't run a proxy → **MCP tools (B)** or **Skill (C)**
|
|
231
|
+
- Want zero configuration → **Skill (C)**: install once, auto-compresses CLAUDE.md and large outputs
|
|
232
|
+
- Want agent-controlled caching of repeated file reads and tool outputs → **MCP tools (B)**
|
|
233
|
+
|
|
234
|
+
**The hard constraint:** The primary Claude conversation turn cannot be cached without a proxy — the MCP/skill path caches results you explicitly route through SLM (tool outputs, file reads, sub-model calls).
|
|
235
|
+
|
|
236
|
+
### MCP Tools Setup (Surface B)
|
|
237
|
+
|
|
238
|
+
Add to your `claude_desktop_config.json` or IDE MCP config alongside your existing SLM entry:
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"mcpServers": {
|
|
243
|
+
"superlocalmemory": {
|
|
244
|
+
"command": "slm",
|
|
245
|
+
"args": ["mcp"]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
The 5 optimize tools (`slm_compress`, `slm_retrieve`, `slm_cache_set`, `slm_cache_get`, `slm_optimize_stats`) are included automatically from v3.6.11+. Verify with `slm_optimize_stats()`.
|
|
252
|
+
|
|
253
|
+
### Skill Setup (Surface C)
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
mkdir -p ~/.claude/skills/slm-optimize
|
|
257
|
+
cp $(pip show superlocalmemory | grep Location | awk '{print $2}')/superlocalmemory/skills/slm-optimize/SKILL.md \
|
|
258
|
+
~/.claude/skills/slm-optimize/SKILL.md
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Then reference in your `CLAUDE.md`:
|
|
262
|
+
```markdown
|
|
263
|
+
## Context Management
|
|
264
|
+
Use the `slm-optimize` skill to compress large outputs and cache repeated reads.
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
211
269
|
<details>
|
|
212
270
|
<summary><strong>What's New in V3.3 — The Living Brain Evolves</strong> (click to expand)</summary>
|
|
213
271
|
|
|
@@ -384,6 +442,7 @@ No manual commands. No data loss. Zero downtime.
|
|
|
384
442
|
|
|
385
443
|
| Version | Codename | Key Features |
|
|
386
444
|
|---|---|---|
|
|
445
|
+
| **v3.6.11** | Optimize Everywhere | **Three surfaces** — Proxy (A: full-turn cache), MCP tools (B: `slm_compress`/`slm_retrieve`/`slm_cache_set`/`slm_cache_get`/`slm_optimize_stats` — proxy-free, 1M window), Skill (C: `slm-optimize` zero-config). `CacheDB.get_value()` (pure KV lookup). 23 new tests. Links: [Three Surfaces →](#three-surfaces-proxy--mcp-tools--skill) · [docs/optimize-overview.md](docs/optimize-overview.md) |
|
|
387
446
|
| **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) |
|
|
388
447
|
| **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 |
|
|
389
448
|
| **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) |
|
|
@@ -271,6 +271,7 @@ src/superlocalmemory/mcp/__init__.py
|
|
|
271
271
|
src/superlocalmemory/mcp/_daemon_proxy.py
|
|
272
272
|
src/superlocalmemory/mcp/_pool_adapter.py
|
|
273
273
|
src/superlocalmemory/mcp/_stdin_guard.py
|
|
274
|
+
src/superlocalmemory/mcp/agent_context.py
|
|
274
275
|
src/superlocalmemory/mcp/resources.py
|
|
275
276
|
src/superlocalmemory/mcp/server.py
|
|
276
277
|
src/superlocalmemory/mcp/shared.py
|
|
@@ -282,6 +283,7 @@ src/superlocalmemory/mcp/tools_core.py
|
|
|
282
283
|
src/superlocalmemory/mcp/tools_evolution.py
|
|
283
284
|
src/superlocalmemory/mcp/tools_learning.py
|
|
284
285
|
src/superlocalmemory/mcp/tools_mesh.py
|
|
286
|
+
src/superlocalmemory/mcp/tools_optimize.py
|
|
285
287
|
src/superlocalmemory/mcp/tools_v28.py
|
|
286
288
|
src/superlocalmemory/mcp/tools_v3.py
|
|
287
289
|
src/superlocalmemory/mcp/tools_v33.py
|
|
@@ -309,8 +311,6 @@ src/superlocalmemory/optimize/cache/stampede.py
|
|
|
309
311
|
src/superlocalmemory/optimize/compress/__init__.py
|
|
310
312
|
src/superlocalmemory/optimize/compress/align.py
|
|
311
313
|
src/superlocalmemory/optimize/compress/ccr.py
|
|
312
|
-
src/superlocalmemory/optimize/compress/extractive_code.py
|
|
313
|
-
src/superlocalmemory/optimize/compress/extractive_json.py
|
|
314
314
|
src/superlocalmemory/optimize/compress/prose_llmlingua.py
|
|
315
315
|
src/superlocalmemory/optimize/compress/router.py
|
|
316
316
|
src/superlocalmemory/optimize/config/__init__.py
|
|
@@ -325,6 +325,7 @@ src/superlocalmemory/optimize/metrics/persistence.py
|
|
|
325
325
|
src/superlocalmemory/optimize/proxy/__init__.py
|
|
326
326
|
src/superlocalmemory/optimize/proxy/_helpers.py
|
|
327
327
|
src/superlocalmemory/optimize/proxy/anthropic_surface.py
|
|
328
|
+
src/superlocalmemory/optimize/proxy/capture.py
|
|
328
329
|
src/superlocalmemory/optimize/proxy/gemini_surface.py
|
|
329
330
|
src/superlocalmemory/optimize/proxy/lifecycle.py
|
|
330
331
|
src/superlocalmemory/optimize/proxy/openai_surface.py
|