V3.6 Optimize · June 2026

60–95% fewer tokens.
$0 on a cache hit.

v3.6 Optimize ships three compounding improvements: intelligent semantic caching with learned thresholds, extractive prompt compression that preserves code structure, and prefix-aligned KV-cache maximization.

Feature 01 · Semantic Cache

Semantic caching with learned thresholds.

Unlike global-threshold semantic caches that get hijacked (a 0.95 similarity score that works for code fails catastrophically for names), v3.6 learns per-prompt similarity thresholds from your actual usage. After 10 uses of a prompt pattern, the cache knows the safe similarity floor for that specific prompt type.

71% Hit rate after 7 days
340K+ Tokens saved per week
slm cache — semantic mode
# First use — learns the threshold $ slm cache --semantic "summarize the auth module" ↳ Miss · LLM call · storing with learned threshold: 0.87 (code/architecture) # Similar query — hits the semantic cache $ slm cache --semantic "give me a summary of the authentication code" ✓ Semantic hit (sim: 0.91 > threshold: 0.87) · $0.00 · 2ms
Feature 02 · Extractive Compression

Code-aware compression that preserves structure.

Extractive compression for code and JSON preserves function signatures, class names, and keys — the structural skeleton — while compressing verbose implementations. The result is byte-exact reversible: decompress and you get the original, bit for bit.

90% Reduction on Python modules
100% Byte-exact reversible
slm compress
$ slm compress codebase-context.json ↳ Input: 18,420 tokens (Python module + tests) ↳ Extracted: function signatures, class defs, imports ↳ Output: 1,842 tokens (90.0% reduction) ↳ Reversible: ✓ byte-exact
Feature 03 · KV-Cache Prefix Alignment

Stack your provider's native discount on top.

Anthropic's KV-cache gives a 90% cost discount on repeated prompt prefixes. v3.6 automatically reorders your context to maximize prefix stability — frequently-used system prompts and memory summaries go first, variable content last. The provider charges full price for the first call; subsequent calls with the same prefix cost 10%.

90% KV-cache hit rate on Anthropic
8.1× Effective cost reduction combined
slm prefix-align
$ slm prefix-align --analyze session.json ↳ System prompt: 2,104 tokens (stable — pinned to prefix) ↳ Memory summary: 840 tokens (stable — pinned to prefix) ↳ Variable context: 3,200 tokens (appended after) $ slm cache --status ✓ KV prefix hit rate: 91% · Effective cost: 0.09× baseline
Changelog

What shipped in v3.6.

Zero-migration upgrade from any v3.5.x release. pip install -U superlocalmemory

v3.6.0 Semantic cache with learned per-prompt similarity thresholds
v3.6.0 KV-cache prefix optimizer — automatic context reordering for maximum prefix stability
v3.6.0 Extractive compression for Python, TypeScript, and JSON — byte-exact reversible
v3.5.x → v3.6.x Zero-migration upgrade — no data format changes, no configuration required
$ pip install -U superlocalmemory

Ready to stop paying for repeat calls?

One upgrade. Three compounding improvements. $0 on every cache hit starting tonight.