Agent skill

Slm Compress

by qualixar in qualixar/superlocalmemory

Compress large text, tool output, or transcripts to reduce context-window usage while keeping the full 1M window intact — call slmcompress(content, mode, reversible, ttlseconds) to shrink content…

AGPL-3.0Auto-check: notesAgent Workflows

Install Slm Compress

skills CLI
$ npx skills add qualixar/superlocalmemory --skill slm-compress -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install qualixar/superlocalmemory slm-compress --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/qualixar/superlocalmemory.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugin/skills/slm-compress .claude/skills/slm-compress && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
slm-compress
GitHub stars
231
Token cost
~1.6k tokens
SKILL.md length
574 words
Files
1
Skills in repo
17
Repo updated
First seen
Licence
AGPL-3.0

At a glance

Compress large text, tool output, or transcripts to reduce context-window usage while keeping the full 1M window intact — call slmcompress(content, mode, reversible, ttlseconds) to shrink content…

  • Tasks that involve Context engineering
  • SKILL.md covers Purpose, Primary MCP Tool: slm_compress, Recovery Tool: slm_retrieve and Decision: When to Compress, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Slm Compress is an agent skill from qualixar/superlocalmemory. Compress large text, tool output, or transcripts to reduce context-window usage while keeping the full 1M window intact — call slmcompress(content, mode, reversible, ttlseconds) to shrink content; if the result is lossy a ccrid is returned so you can call slmretrieve(ccrid) later to recover the exact original; always fail-open (ok:false → continue with the original).

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Agent Workflows, covering Context engineering. The repository describes itself as: Open-source governed, local-first memory control plane for AI agents and teams. arXiv:2608.08253. The licence is AGPL-3.0.

When your agent uses it

  • Tasks that involve Context engineering

Example prompts

  • “/slm-compress”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): slm_compress, slm_retrieve, Bash

What it can do on your machine

Read from SKILL.md and the folder at commit 26f8c68. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • slm_compress
    • slm_retrieve
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are json, python and bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Slm Compress loads about 1.6k tokens when it runs. Until then it costs about 97 tokens; SKILL.md has 574 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: slm_compress, slm_retrieve, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from qualixar/superlocalmemory at commit 26f8c68, republished under its AGPL-3.0 licence (© qualixar). 574 words, ~1,562 tokens.

Download SKILL.mdSave it as .claude/skills/slm-compress/SKILL.md (or your agent's skills folder).
name
slm-compress
description
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).
allowed-tools
slm_compress, slm_retrieve, Bash
when_to_use
compress context, shrink output, save tokens, context window full, long transcript, compress tool result, reduce tokens, large output, compress text

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)
KeyTypeMeaning
okboolTrue on success; False on internal error or empty input
compressedstrCompressed text (or original on failure)
strategystrWhich strategy was applied (e.g. "normalize", "none")
tokens_beforeintWord-count estimate of the input
tokens_afterintWord-count estimate of the output
ratiofloattokens_after / tokens_before (lower = more compact)
lossyboolWhether information was removed
ccr_idstr | NoneUUID4 session token; present only when lossy=True and reversible=True
notestr | NoneHuman-readable note (e.g. warnings, recovery hint)
Mode semantics (verified from source)
  • "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.

Recovery Tool: slm_retrieve

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
KeyTypeMeaning
okboolTrue when content was found
contentstr | NoneOriginal text, decoded from UTF-8 (or Latin-1 fallback)
size_bytesintByte length of the stored original
errorstr | NoneError message on failure; None on success

ccr_id must be a valid UUID4. Non-UUID4 strings return ok: false immediately.

CCR security rule

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:

  • Never log them.
  • Never share them across agents.
  • Never pass them as tool arguments to any tool other than slm_retrieve.
  • Never compress a ccr_id string itself.
  • They expire after ttl_seconds (default 24 h); slm_retrieve returns ok: false after expiry.
Show full SKILL.md (217 more words)Show less

Decision: When to Compress

Compress when:

  • A single tool output or transcript exceeds approximately 2 000 characters.
  • You are accumulating repeated context (e.g. full file reads across multiple steps).
  • Context is nearing the point where recall quality or response quality degrades.

Do NOT compress:

  • Code you are about to read, edit, or diff — you need every character.
  • JSON you will parse programmatically — compression may alter structure.
  • Secrets, credentials, or ccr_id strings.
  • Anything under ~500 characters — overhead exceeds benefit.
  • The compressed form of content already compressed this session.

Fail-Open Guarantee

slm_compress never raises an exception. On any internal error it returns:

json
{ "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.

Worked Example

python
# 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"]

Secondary CLI (fallback when MCP is unavailable)

Prefer the MCP tools above. If you must use the command line:

bash
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.

Size Cap

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 result
  • slm-status — check tokens_saved_compress and compress_runs from slm_optimize_stats

SuperLocalMemory v4.1.24 · Qualixar · AGPL-3.0-or-later

© qualixar, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugin/skills/slm-compress of qualixar/superlocalmemory.

Open the folder on GitHubat commit 26f8c68

Compare with similar skills

Slm Compress next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Slm Compress compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Slm Compress this skillqualixar/superlocalmemory231—~1.6kAutomated safety check: NotesAGPL-3.0
Context Mode Output Sandboxmksglu/context-mode26k—~4.1kAutomated safety check: PassCustom licence
Memori Long-Term MemoryMemoriLabs/Memori17k—~2kAutomated safety check: NotesCustom licence
Picoclaw Skill Creatorsipeed/picoclaw30k—~4.4kAutomated safety check: PassMIT
ccc Semantic Code Searchcocoindex-io/cocoindex-code2.8k—~938Automated safety check: PassApache-2.0
Context Mode for Antigravity CLImksglu/context-mode26k—~850Automated safety check: PassCustom licence

Similar skills

  • Context Mode Output Sandbox

    mksglu/context-mode

    Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.

    26k GitHub stars~4.1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Memori Long-Term Memory

    MemoriLabs/Memori

    Connects Claude Code to Memori Cloud for long-term memory, recalling stored context before substantive replies and saving new context afterward.

    17k GitHub stars~2k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check: notes
  • Picoclaw Skill Creator

    sipeed/picoclaw

    Guidance for creating, updating and reviewing Picoclaw skills, from the SKILL.md structure to organizing bundled scripts, references and assets.

    30k GitHub stars~4.4k tokensUpdated 14 days ago
    Agent WorkflowsAuto-check passed
  • ccc Semantic Code Search

    cocoindex-io/cocoindex-code

    Semantic code search and index management with the ccc CLI: the agent initializes, indexes and queries the project by concept, filtering by language or path.

    2.8k GitHub stars~938 tokensUpdated 2 days ago
    Agent WorkflowsAuto-check passed
  • Routing rules for using context-mode MCP tools in Antigravity CLI: sandboxed code runs, file analysis, indexed search and web fetches that keep large output out of the conversation.

    26k GitHub stars~850 tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Token Optimizer

    alexgreensh/token-optimizer

    Audit a Claude Code or Codex setup for context-window waste, then fix it and measure the savings.

    2.5k GitHub stars~3.6k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed

More from qualixar/superlocalmemory

All 17 skills in this repo
  • Superlocalmemory

    qualixar/superlocalmemory

    AI agent memory with mathematical foundations. An agent skill from qualixar/superlocalmemory.

    231 GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Slm Graph

    qualixar/superlocalmemory

    Index and query a codebase as a structural graph — build the code graph, trace blast radius of a change, find callers/callees/inheritors, semantic code search by meaning, assemble PR review context…

    231 GitHub stars~3k tokensUpdated today
    Auto-check: notes
  • Slm Loop

    qualixar/superlocalmemory

    Gate-verified bounded loops with SuperLocalMemory as the durable ledger.

    231 GitHub stars~2k tokensUpdated today
    Auto-check: notes
  • Slm Recall

    qualixar/superlocalmemory

    Search and retrieve facts, decisions, and past context from SuperLocalMemory.

    231 GitHub stars~5.1k tokensUpdated today
    Auto-check: notes
  • Slm Remember

    qualixar/superlocalmemory

    Capture durable facts, decisions, constraints, and gotchas into SuperLocalMemory.

    231 GitHub stars~3.8k tokensUpdated today
    Auto-check: notes
  • Slm Scope

    qualixar/superlocalmemory

    Controls memory visibility across profiles — personal (private, default), shared (selected profiles), or global (all profiles on this machine).

    231 GitHub stars~1.6k tokensUpdated today
    Auto-check: notes

Categories

Questions about Slm Compress

What does Slm Compress do?

Compress large text, tool output, or transcripts to reduce context-window usage while keeping the full 1M window intact — call slmcompress(content, mode, reversible, ttlseconds) to shrink content…. Slm Compress is an agent skill from qualixar/superlocalmemory. Compress large text, tool output, or transcripts to reduce context-window usage while keeping the full 1M window intact — call slmcompress(content, mode, reversible, ttlseconds) to shrink content; if the result is lossy a ccrid is returned so you can call slmretrieve(ccrid) later to recover the exact original; always fail-open (ok:false → continue with the original).

When should I use Slm Compress?

Slm Compress fits situations like: tasks that involve Context engineering.

How do I install Slm Compress in Claude Code?

Run `npx skills add qualixar/superlocalmemory --skill slm-compress -a claude-code`. Or copy the skill folder (plugin/skills/slm-compress in qualixar/superlocalmemory) into .claude/skills/slm-compress in your project. Claude Code loads it when a task matches its description.

How do I install Slm Compress in Codex?

Run `npx skills add qualixar/superlocalmemory --skill slm-compress -a codex`. Or copy the skill folder (plugin/skills/slm-compress in qualixar/superlocalmemory) into .agents/skills/slm-compress in your project. Codex loads it when a task matches its description.

Can I use Slm Compress in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add qualixar/superlocalmemory --skill slm-compress -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/slm-compress, .gemini/skills/slm-compress, .github/skills/slm-compress and .opencode/skills/slm-compress in your project.

What does Slm Compress need to run?

SKILL.md names no scripts, command-line tools or credentials: Slm Compress is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: slm_compress, slm_retrieve, Bash.

Does Slm Compress access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Slm Compress safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Slm Compress use?

Slm Compress is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Slm Compress use?

About 1.6k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Slm Compress?

Skills that share tags, products or a category with Slm Compress: Context Mode Output Sandbox (mksglu/context-mode, 26k stars), Memori Long-Term Memory (MemoriLabs/Memori, 17k stars), Picoclaw Skill Creator (sipeed/picoclaw, 30k stars) and ccc Semantic Code Search (cocoindex-io/cocoindex-code, 2.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Slm Compress?

qualixar (a GitHub organization) maintains it in qualixar/superlocalmemory, which has 231 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 9, 2026.

Source: qualixar/superlocalmemory on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.