Automated summary
Provides an agent-scoped, TTL-bounded key-value cache via slm_cache_get and slm_cache_set so repeated file reads, search results, or tool outputs can be reused within a session.
Strengths
- Fail-open behavior: any cache error or miss returns a miss-like result, so the caller can always fall back to the real operation.
- Agent-scoped namespacing with hashed keys prevents cross-agent collisions and keeps keys portable for the caller.
- Clear cache-aside workflow with configurable TTLs and suggested key prefixes for files, searches, tool outputs, and URLs.
- Explicit size and key-length limits (1 MB values, 512-character keys) make storage constraints predictable.
Limitations
- Only caches values the agent explicitly routes through SLM; it cannot cache Claude conversation turns or other un-routed context.
- The SKILL.md excerpt ends mid-section at “Cache when:”, so the guidance on when caching pays off is incomplete.
- Requires the SLM cache tools/MCP server to be available; without it, every lookup behaves as a miss.
Use when the same file, query result, or expensive tool output will be read more than once during an agent session and token/time savings matter.
Do not use for frequently changing data, one-off reads, or conversation context that cannot be addressed by a stable key.
Security analysis
SafeThe skill only documents two KV cache MCP tools plus a narrowly scoped `slm: *` CLI fallback; there is no exfiltration, network callout, obfuscated payload, or safety-disabling behavior, and it explicitly tells the agent not to cache secrets or block on cache failures. The only mild concern is the tenant-wide `slm cache clear` fallback command, which is destructive to cache state but not to user data and is not presented as an automatic action.
- •The documented CLI fallback includes `slm cache clear`, which deletes every cache entry for the tenant; the skill presents it as a manual administrative command rather than an automatic step, but an agent could run it casually and drop all cached state. Low severity since only cache data is lost.
- •The skill encourages persisting file contents and tool output via `slm_cache_set`; it explicitly warns against caching secrets/credentials/tokens, which mitigates the main data-retention concern, but cache entries are still a second copy of whatever is cached for up to the TTL.
Examples
Read /repo/src/config.py, store it in the cache with key file:/repo/src/config.py for one hour, and whenever I ask about that config for the rest of the session, check the cache first instead of re-reading the file.Run the build_code_graph tool for /repo once, cache the result under tool:build_code_graph:/repo for the session, and reuse the cached value on later questions rather than regenerating the graph.Before searching the repo again for session_init_context, call slm_cache_get with key search:recall:session_init_context; if it is a miss, run the search and store the result with slm_cache_set.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. 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" allowed-tools: slm_cache_set, slm_cache_get, Bash(slm:*)
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
| Key | Type | Meaning |
|-----|------|---------|
| ok | bool | True on success; False on validation error or internal error |
| stored | bool | True when the value was written to the cache |
| note | str | None | Error 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. The namespace is the calling agent (SLM_AGENT_ID, or the /mcp/<agent> path), not the memory profile, so switching profiles does not give you a fresh cache. A caller on another computer gets its own namespace, keyed by its access key, and can never see a local agent's entries.
Tool: slm_cache_get
slm_cache_get(
key: str, # required — same key used in slm_cache_set
) -> dict
Return dict
| Key | Type | Meaning |
|-----|------|---------|
| ok | bool | True on clean execution (including miss); False on internal error |
| hit | bool | True when the key exists and has not expired |
| value | str | None | The stored value on a hit; None on miss |
| note | str | None | Error detail or None |
value is the string you stored. 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:
# 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 type | Suggested prefix | Example |
|---|---|---|
| File read | file: | file:/repo/src/config.py |
| Search result | search: | search:recall:session_init_context |
| Tool output | tool: | tool:build_code_graph:/repo |
| External fetch | url: | 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_idvalues (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.
Fail-Open Guarantee
Neither tool raises an exception. On any internal error:
slm_cache_getreturns{"ok": false, "hit": false, "value": null, ...}— treat as a miss and proceed with the real fetch.slm_cache_setreturns{"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 type | Suggested TTL | |---|---| | Static config / generated file | 86400 s (24 h — the default) | | Session-specific tool output | 3600 s (1 h) | | Rapidly changing API data | Do 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)
Prefer the MCP tools above. If you must use the command line:
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 and bulk removal. They do not read or write individual entries — use the MCP tools for that. Entries written by slm_cache_set carry the tag mcp-kv, so slm cache invalidate --tag mcp-kv removes them, and slm cache clear deletes every entry for the tenant.
Related skills
slm-compress— for large content reduction; cache and compress work togetherslm-status— viewcache_kv_hits/cache_kv_missescounters (daemon-persisted totals) fromslm_optimize_stats
SuperLocalMemory v4.2.10 · Qualixar · AGPL-3.0-or-later
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/kv-cache-for-repeated-reads-mvda87mc/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/kv-cache-for-repeated-reads-mvda87mc' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/kv-cache-for-repeated-reads-mvda87mc/download' --output '.skill-downloads/kv-cache-for-repeated-reads-mvda87mc/SKILL.md.part' && mv '.skill-downloads/kv-cache-for-repeated-reads-mvda87mc/SKILL.md.part' '.skill-downloads/kv-cache-for-repeated-reads-mvda87mc/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): slm_cache_set, slm_cache_get, Bash(slm:*)
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/kv-cache-for-repeated-reads-mvda87mc/SKILL.md' && test -s '.skill-downloads/kv-cache-for-repeated-reads-mvda87mc/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/slm-cache' && cp -R '.skill-downloads/kv-cache-for-repeated-reads-mvda87mc' '.claude/skills/slm-cache'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/kv-cache-for-repeated-reads-mvda87mc'openskills read 'kv-cache-for-repeated-reads-mvda87mc'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/kv-cache-for-repeated-reads-mvda87mc/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
PDF Reader
Productivity
Read and extract text from PDF files, including documents, reports, contracts, and spreadsheets. Works with local files, URLs, and WhatsApp attachments. Use whenever PDF content is needed, even if not explicitly requested.
Discord Messaging Workflows
Productivity
Use the message tool to send, edit, and moderate Discord messages with interactive components.
Interactive Verdict Preview
Productivity
Generate an interactive HTML preview of keep/drop verdicts for maintainer review, then process the pasted feedback JSON.