/superlocalmemory:slm-compressfrom SuperLocalMemory
Compresses large text, tool output, or transcripts to reduce context-window usage while preserving the full 1M window. Supports lossless normalization and lossy compression with reversible recovery via slm_retrieve.
Ships in SuperLocalMemory. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When a tool output, transcript, or accumulated context grows large enough to crowd out working space, slm_compress reduces it in-place. The compressed form is used for the remainder of the session; the exact original is recoverable on demand via slm_retrieve. This works without a proxy and without touching ANTHROPIC_BASE_URL, so the full 1M context window is never sacrificed.
slm_compress(
content: str, # required — text to compress (max 1 MB)
mode: str = "auto", # "normalize" | "auto" | "aggressive"
reversible: bool = True, # store original in CCR for later retrieval
ttl_seconds: int = 86400, # CCR lifetime in seconds (default 24 h)
) -> dict
| Key | Type | Meaning |
|---|---|---|
ok | bool | True on success; False on internal error or empty input |
compressed | str | Compressed text (or original on failure) |
strategy | str | Which strategy was applied (e.g. "normalize", "none") |
tokens_before | int | Word-count estimate of the input |
tokens_after | int | Word-count estimate of the output |
ratio | float | tokens_after / tokens_before (lower = more compact) |
lossy | bool | Whether information was removed |
ccr_id | str | None | UUID4 session token; present only when lossy=True and reversible=True |
note | str | None | Human-readable note (e.g. warnings, recovery hint) |
"normalize" — lossless whitespace collapse; no daemon dependency; lossy: false, ccr_id: null."auto" — delegates to CompressRouter; may be lossy depending on daemon config; default."aggressive" — requests aggressive compression from the daemon; daemon must have compress_mode=aggressive set in config; note field will warn if daemon config does not match.When slm_compress returns lossy: true, the original is stored under the ccr_id. Use slm_retrieve to get it back:
slm_retrieve(ccr_id: str) -> dict
| Key | Type | Meaning |
|---|---|---|
ok | bool | True when content was found |
content | str | None | Original text, decoded from UTF-8 (or Latin-1 fallback) |
size_bytes | int | Byte length of the stored original |
error | str | None | Error message on failure; None on success |
ccr_id must be a valid UUID4. Non-UUID4 strings return ok: false immediately.
ccr_id values are unguessable session tokens, and the stored original can be read back only by the same agent (or, for a remote caller, the same access key) that compressed it. Treat them like short-lived credentials:
slm_retrieve.ccr_id string itself.ttl_seconds (default 24 h); slm_retrieve returns ok: false after expiry.Compress when:
Do NOT compress:
ccr_id strings.slm_compress never raises an exception. On any internal error it returns:
{ "ok": false, "compressed": "<original input>", "ratio": 1.0, ... }
When ok is false, continue with the original content. Never block a task waiting for compression to succeed.
# Step 1: compress a large tool output
result = await slm_compress(
content=long_log_text,
mode="auto",
reversible=True,
ttl_seconds=3600,
)
if result["ok"]:
working_text = result["compressed"]
ccr_id = result["ccr_id"] # None if lossless
else:
working_text = long_log_text # fail-open
ccr_id = None
# ... work with working_text ...
# Step 2: restore original when needed (e.g. before final summary)
if ccr_id:
restore = await slm_retrieve(ccr_id=ccr_id)
if restore["ok"]:
original_text = restore["content"]
Prefer the MCP tools above. If you must use the command line:
slm compress status [--json]
slm compress mode safe|aggressive [--json]
slm compress code on|off [--json]
slm compress prose on|off [--json]
slm compress ccr on|off [--json]
slm compress align on|off [--json]
These subcommands control daemon-level compression settings — they do not compress content inline. For inline compression, use slm_compress via MCP.
Content over 1 MB (1 000 000 bytes UTF-8) is processed but reversible is forced to False and ccr_id will be None. The note field will state "content over 1MB: ccr skipped".
slm-cache — for repeated reads; use cache-aside before compressing a frequently re-read resultslm-status — check tokens_saved_compress and compress_runs from slm_optimize_statsSuperLocalMemory v4.2.34 · Qualixar · AGPL-3.0-or-later
Some hosts block local MCP servers by policy, and many agents, bots and agent frameworks never had them. SuperLocalMemory works the same from any shell, so this skill still applies:
slm status --json first. Never report "SLM unavailable" only because an MCP tool is missing.slm tool <name> --json '{...}', with the same arguments, checks and results: a successful call prints exactly what the MCP tool returns, and a failed one prints "success": false with error.code and error.message. slm tool describe <name> shows one tool's arguments; slm tool list lists the tools available right now (pictures and documents appear once they are turned on, slm media status).slm command answers in one JSON document on stdout: add --json after it, put slm --json before it, or set SLM_JSON=1 in the environment. slm mcp, slm session and slm session-context ignore SLM_JSON so servers and hooks keep working; give them --json directly. Read success first; a failure carries error.code and error.message. Exit code 0 means success, 1 that the command ran and failed (error.exit_code keeps a more specific code), 2 that it could not run, 130 that it was interrupted. Under JSON a command never asks a question: one that needs a confirmation answers confirmation_required and names the flag. slm gdpr export streams its document over several lines.slm recall "<question>" --json and slm remember "<text>" --json. slm help --json lists every command with its options.The slm-cli skill has the full command reference.
What SKILL.md sets; muted values are Claude Code's defaults
compress context, shrink output, save tokens, context window full, long transcript, compress tool result, reduce tokens, large output, compress text
2 plugins in one repository ship this exact skill · first indexed Nov 23, 2026
17 skills in this plugin
/slm-bot-memoryCross-bot memory on a shared computer (Grok Bot, Cursor plugin, any host where several agents share one machine). Explains agent_id attribution vs. profile/scope access, how to namespace by agent_id + profile + scope, and what must never be written to memory. Read this before the first remember/recall on a new Grok-Bot-style host./slm-cacheKV cache for repeated reads — call slm_cache_get(key) first; on a miss do the expensive operation then slm_cache_set(key, value, ttl_seconds) to store it; on a hit use the returned value directly; always fail-open (hit:false on any error, never raises); saves tokens when the same file, query result, or tool output is read more than once in a session./slm-clinpx claudepluginhub qualixar/superlocalmemory --plugin superlocalmemoryOther plugins' skills for the same job