slm-compress

Solid

Compress large text, tool output, or transcripts to reduce context-window usage while keeping the full 1M window intact — call slm_compress(content, mode, reversible, ttl_seconds) to shrink content; if the result is lossy a ccr_id is returned so you can call slm_retrieve(ccr_id) later to recover the exact original; always fail-open (ok:false → continue with the original).

AI & Automation 199 stars 34 forks Updated today AGPL-3.0

Install

View on GitHub

Quality Score: 88/100

Stars 20%
77
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# slm-compress — Reversible Context Compression (Surface B) ## Purpose 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. ## Primary MCP Tool: slm_compress ``` 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 ``` ### Return dict (all keys always present) | 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`...

Details

Author
qualixar
Repository
qualixar/superlocalmemory
Created
5 months ago
Last Updated
today
Language
Python
License
AGPL-3.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

slm-status

Health and optimization stats for SuperLocalMemory — call slm_optimize_stats() for live compression and cache counters (compress_runs, tokens_saved_compress, cache_proxy_hits, cache_proxy_misses, cache_kv_hits, cache_kv_misses); run slm status [--json] for system state (mode, profile, DB size, fact/entity/edge counts) and slm doctor [--json] for preflight including the "Optimize (Surface B)" health line; use together to confirm optimization is actually saving tokens.

199 Updated today
qualixar
AI & Automation Solid

semantic-compress

Make an LLM-directed document smaller while preserving what it does. Two modes: a local span-level core->pointer pass, and an A/B-validated distill loop that produces the smallest document that behaves the same as the original. Point at core knowledge the model already holds (a concept name activates it); keep project-specific detail explicit and verbatim. TRIGGER when asked to compress, tighten, shorten, or strip a prompt / instruction / system message meant for an LLM; to distill a skill; to compress a whole document; to make this smaller while preserving behaviour; to A/B test a compression or produce a behaviourally-equivalent compression; when an instruction set explains concepts the model already knows from training; or when reducing token cost of an LLM-directed prompt without losing meaning. Not for human-facing prose - that is /deslop.

30 Updated 4 days ago
bjcoombs
AI & Automation Listed

context-graph-compressor

Compress any conversation into a portable JSON context graph for handoff to a new chat or LLM. Trigger on: "compress this chat", "save context", "new chat", "hand off", "transfer context", "too many tokens", "start fresh", "export conversation", "context graph", "continue in new session". Also trigger proactively when the user mentions starting over in a long session.

0 Updated yesterday
Highlydeveloped-trowel635