Agent skill

Slm Cache

by qualixar in qualixar/superlocalmemory

KV cache for repeated reads — call slmcacheget(key) first; on a miss do the expensive operation then slmcacheset(key, value, ttlseconds) to store it; on a hit use the returned value directly; always…

AGPL-3.0Auto-check: notesAgent Workflows

Install Slm Cache

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

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

GitHub CLI
$ gh skill install qualixar/superlocalmemory slm-cache --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-cache .claude/skills/slm-cache && 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-cache
GitHub stars
227
Token cost
~1.5k tokens
SKILL.md length
584 words
Files
1
Skills in repo
13
Repo updated
First seen
Licence
AGPL-3.0

At a glance

KV cache for repeated reads — call slmcacheget(key) first; on a miss do the expensive operation then slmcacheset(key, value, ttlseconds) to store it; on a hit use the returned value directly; always…

  • Agent Workflows work in your project
  • SKILL.md covers Purpose, Tool: slm_cache_set, Tool: slm_cache_get and Standard Pattern: Cache-Aside, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Slm Cache is an agent skill from qualixar/superlocalmemory. KV cache for repeated reads — call slmcacheget(key) first; on a miss do the expensive operation then slmcacheset(key, value, ttlseconds) 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.

Its SKILL.md is about 1.5k 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. It works with Model Context Protocol. 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

  • Agent Workflows work in your project

Example prompts

  • “/slm-cache”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): slm_cache_set, slm_cache_get, Bash

What it can do on your machine

Read from SKILL.md and the folder at commit ce2d7a9. 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_cache_set
    • slm_cache_get
    • 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 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 Cache loads about 1.5k tokens when it runs. Until then it costs about 91 tokens; SKILL.md has 584 words of instructions outside code blocks.

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

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_cache_set, slm_cache_get, 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 ce2d7a9, republished under its AGPL-3.0 licence (© qualixar). 584 words, ~1,505 tokens.

Download SKILL.mdSave it as .claude/skills/slm-cache/SKILL.md (or your agent's skills folder).
name
slm-cache
description
KV 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.
allowed-tools
slm_cache_set, slm_cache_get, Bash
when_to_use
cache file, avoid re-reading, repeated read, cache result, cache tool output, save re-read, reuse across session, cache check, cache hit, cache miss

slm-cache — KV Cache for Repeated Reads (Surface B)

Purpose

When the same file, query result, or expensive tool output is needed more than once in a session, fetching it again wastes tokens and time. slm_cache_set stores a result under a stable key; slm_cache_get retrieves it on subsequent calls. The cache is agent-scoped (automatically namespaced by tenant/agent ID), TTL-bounded, and fail-open.

This is an agent-routed cache — it caches results the agent explicitly routes through SLM. It cannot cache Claude conversation turns.

Tool: slm_cache_set

slm_cache_set(
    key:          str,          # required — cache key (max 512 chars)
    value:        str,          # required — value to store (max 1 MB)
    ttl_seconds:  int = 86400,  # time-to-live in seconds (default 24 h)
) -> dict
Return dict
KeyTypeMeaning
okboolTrue on success; False on validation error or internal error
storedboolTrue when the value was written to the cache
notestr | NoneError detail or None on success

Keys are SHA-256-hashed internally per agent so they do not collide across agents. The raw key string you supply is the only handle you need.

Tool: slm_cache_get

slm_cache_get(
    key: str,   # required — same key used in slm_cache_set
) -> dict
Return dict
KeyTypeMeaning
okboolTrue on clean execution (including miss); False on internal error
hitboolTrue when the key exists and has not expired
valuestr | NoneThe stored value on a hit; None on miss
notestr | NoneError detail or None

A miss returns {"ok": true, "hit": false, "value": null, "note": null}. ok: false means something went wrong internally but the miss behaviour is the same — treat both as a cache miss and proceed with the real fetch.

Standard Pattern: Cache-Aside

Always check the cache first, then fill on miss:

python
# 1. Check cache
cached = await slm_cache_get(key="file:/absolute/path/to/config.json")

if cached["hit"]:
    content = cached["value"]
else:
    # 2. Expensive operation (file read, search, API call)
    content = read_file("/absolute/path/to/config.json")

    # 3. Store for the rest of the session
    await slm_cache_set(
        key="file:/absolute/path/to/config.json",
        value=content,
        ttl_seconds=3600,   # 1 h — adjust to data volatility
    )

# 4. Use content

Key Naming Convention

Use a stable, human-readable prefix so keys are recognisable in stats and won't collide accidentally:

Content typeSuggested prefixExample
File readfile:file:/repo/src/config.py
Search resultsearch:search:recall:session_init_context
Tool outputtool:tool:build_code_graph:/repo
External fetchurl:url:https://api.example.com/v1/data

Key length cap: 512 characters. Keys longer than that are rejected (ok: false).

When Caching Pays Off

Cache when:

  • You will read the same file more than once in a session.
  • A search or recall result is reused across multiple reasoning steps.
  • An expensive MCP tool call (graph build, semantic search) produces output that is stable for the session duration.

Do NOT cache:

  • Volatile data (live API responses that change minute-to-minute, current timestamps, streaming output).
  • Secrets, credentials, tokens, or ccr_id values (CCR already handles its own storage).
  • Data that must be fresh for correctness — a stale cache is worse than a cache miss.
  • Intermediate scratchpad text you will discard.
Show full SKILL.md (194 more words)Show less

Fail-Open Guarantee

Neither tool raises an exception. On any internal error:

  • slm_cache_get returns {"ok": false, "hit": false, "value": null, ...} — treat as a miss and proceed with the real fetch.
  • slm_cache_set returns {"ok": false, "stored": false, ...} — log the note if useful, but continue; the value is still available in memory this step.

Never block a task on a cache failure.

TTL Guidance

Data typeSuggested TTL
Static config / generated file86400 s (24 h — the default)
Session-specific tool output3600 s (1 h)
Rapidly changing API dataDo not cache, or 60–300 s

Set ttl_seconds to match how long the data remains valid. After expiry slm_cache_get returns a miss automatically.

Secondary CLI (fallback when MCP is unavailable)

The slm cache subcommand exists but has known pre-existing parse-test failures. Prefer the MCP tools above. If you must use CLI:

bash
slm cache status [--json] [--tenant default]
slm cache clear [--json] [--tenant default]
slm cache invalidate --tag <tag> [--json] [--tenant default]
slm cache ttl --set <seconds> [--semantic <seconds>] [--json] [--tenant default]
slm cache semantic on|off [--json] [--tenant default]

These subcommands control daemon-level cache settings. They do not read or write individual cache entries — use the MCP tools for that.


  • slm-compress — for large content reduction; cache and compress work together
  • slm-status — view cache_kv_hits/cache_kv_misses counters from slm_optimize_stats
  • slm-profile — cache entries are namespaced per profile; switching profiles gives a fresh cache namespace

SuperLocalMemory v4.1.21 · 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-cache of qualixar/superlocalmemory.

Open the folder on GitHubat commit ce2d7a9

Compare with similar skills

Slm Cache 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 Cache compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Slm Cache this skillqualixar/superlocalmemory227—~1.5kAutomated safety check: NotesAGPL-3.0
MCP Server Builderanthropics/skills180k64 repos~2.3kAutomated safety check: PassApache-2.0
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT
MCP Integration for Pluginsanthropics/claude-plugins-official38k11 repos~3.1kAutomated safety check: PassApache-2.0
Fastmcp Client CLIPrefectHQ/fastmcp28k1 repos~823Automated safety check: PassApache-2.0
MemPalace Memory SearchMemPalace/mempalace59k—~1.4kAutomated safety check: PassMIT

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 64 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • MCP Integration for Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to bundle Model Context Protocol servers in a Claude Code plugin, covering config files, stdio, SSE, HTTP and WebSocket server types, and authentication.

    38k GitHub starsUsed in 11 repos~3.1k tokens
    Agent WorkflowsAuto-check passed
  • Fastmcp Client CLI

    PrefectHQ/fastmcp

    Query and invoke tools on MCP servers using fastmcp list and fastmcp call.

    28k GitHub starsUsed in 1 repo~823 tokens
    Agent WorkflowsAuto-check passed
  • MemPalace Memory Search

    MemPalace/mempalace

    Mines project files and conversation exports into a local, searchable memory palace and recalls past work by semantic search through the mempalace CLI.

    59k GitHub stars~1.4k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Crush Configuration

    charmbracelet/crush

    Explains how to configure the Crush coding agent with crushrc or crush.json, covering providers, models, LSPs, MCP servers, hooks, permissions and config precedence.

    29k GitHub stars~3.7k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed

More from qualixar/superlocalmemory

All 13 skills in this repo
  • Superlocalmemory

    qualixar/superlocalmemory

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

    227 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…

    227 GitHub stars~2.7k tokensUpdated today
    Auto-check: notes
  • Slm Loop

    qualixar/superlocalmemory

    Run gate-verified bounded loops with SuperLocalMemory as the durable ledger.

    227 GitHub stars~1.2k tokensUpdated today
    Auto-check: notes
  • Slm Recall

    qualixar/superlocalmemory

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

    227 GitHub stars~3.3k tokensUpdated today
    Auto-check: notes
  • Slm Remember

    qualixar/superlocalmemory

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

    227 GitHub stars~2.3k 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).

    227 GitHub stars~1.4k tokensUpdated today
    Auto-check: notes

Categories

Questions about Slm Cache

What does Slm Cache do?

KV cache for repeated reads — call slmcacheget(key) first; on a miss do the expensive operation then slmcacheset(key, value, ttlseconds) to store it; on a hit use the returned value directly; always…. Slm Cache is an agent skill from qualixar/superlocalmemory. KV cache for repeated reads — call slmcacheget(key) first; on a miss do the expensive operation then slmcacheset(key, value, ttlseconds) 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.

When should I use Slm Cache?

Slm Cache fits situations like: agent Workflows work in your project.

How do I install Slm Cache in Claude Code?

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

How do I install Slm Cache in Codex?

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

Can I use Slm Cache 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-cache -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-cache, .gemini/skills/slm-cache, .github/skills/slm-cache and .opencode/skills/slm-cache in your project.

What does Slm Cache need to run?

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

Does Slm Cache 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 Cache 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 Cache use?

Slm Cache 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 Cache use?

About 1.5k tokens (SKILL.md is roughly 6k 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 Cache?

Skills that share tags, products or a category with Slm Cache: MCP Server Builder (anthropics/skills, 180k stars), MCP Server Builder (shareAI-lab/learn-claude-code, 78k stars), MCP Integration for Plugins (anthropics/claude-plugins-official, 38k stars) and Fastmcp Client CLI (PrefectHQ/fastmcp, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Slm Cache?

qualixar (a GitHub organization) maintains it in qualixar/superlocalmemory, which has 227 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on October 8, 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.