Every component runs on your machine. No cloud dependency in the data path. Five independently replaceable layers — memory, cache, compression, retrieval, and the MCP interface — all composable.
Data flows top-down on ingress, bottom-up on retrieval. Each layer has a clean interface — swap any one without touching the others.
The MCP server exposes all SLM capabilities to Claude Code, Cursor, Windsurf, and every other tool that speaks the Model Context Protocol. No wrappers, no polling — structured tool calls with typed responses.
The 26 CLI commands all accept --json, returning a consistent envelope: { success, command, version, data, next_actions }. No text scraping required in agent pipelines.
Exact-match caching uses a SHA-256 hash of the full prompt. A hit returns the cached response immediately — no LLM call, no token cost, no latency. This is the default mode because it has no false positives.
Semantic cache is explicitly opt-in. Unlike naive implementations that apply a global threshold (e.g., 0.95 cosine similarity for all prompts), SLM learns per-prompt similarity thresholds. A threshold tuned on code questions doesn't get applied to factual recall. LRU eviction with configurable TTL keeps the cache bounded.
On a cache miss, prompts compress before being forwarded to the LLM. For code and JSON payloads, SLM uses an extractive path — it preserves keys and function signatures while compressing values. The result is byte-exact reversible: decompress the response and you get the original byte-for-byte.
Proper prefix ordering aligns compressed prompts with Anthropic's KV-cache prefix boundary. This stacks the provider's native 90% cache discount on top of SLM's own compression savings — two cost-reduction mechanisms working together without configuration.
The memory store is tiered across three databases, each optimized for a different access pattern. Hot memories live in CozoDB — a property graph database that excels at relationship-rich, frequently-accessed facts and can traverse connections between memories in a single query.
Warm memories move to LanceDB, a columnar vector index designed for semantic retrieval. Cold memories compress to SQLite with zstd — 32× compression on rarely-accessed archival facts. Tiering is automatic, driven by statistical access patterns, not manually configured TTLs.
Cosine similarity treats memory retrieval as a dot product in flat vector space. SLM treats it as a distance problem on a Riemannian manifold — the statistical manifold of probability distributions over memory content.
The Fisher-Rao metric defines geodesic distances on this manifold. Confidence scores weight the distance: high-certainty memories rank higher regardless of recency. The geometry improves with use — the manifold structure captures relationships that cosine similarity misses entirely. Three peer-reviewed arXiv papers prove the approach.
slm recall.A single recall command traverses all five layers in under 10ms on a cold cache. Here is every step, in order.
slm recall "JWT token lifetime". If --json is present, the response envelope is prepared. Input is normalized and validated before passing to the cache layer.
Three engines. Each one purpose-built for its access pattern. Automatic promotion and demotion — you never configure tier boundaries manually.
| Hot | Warm | Cold | |
|---|---|---|---|
| Engine | CozoDB | LanceDB | SQLite + zstd |
| Format | Property graph | Columnar vectors | Compressed rows |
| Access time | < 5ms | < 20ms | < 100ms |
| Compression | None | None | 32× (zstd) |
| Use for | Recent, related facts — graph traversal across memory connections | Semantic search — approximate nearest-neighbor over vector embeddings | Rarely accessed facts, archival storage, long-term memory at minimal cost |
Read the code, fork it, audit it. Every layer — MCP interface, cache engine, compression engine, memory store, and mathematical retrieval — is published under AGPL v3. No closed dependencies in the data path.