slm-cache

仓库创建 2026年2月5日最近提交 1 天前SkillHot 收录 6 小时前
▸ 精选理由

减少重复计算与 token 消耗,适合高频查询场景。

这个 Skill 做什么

为重复读取场景提供键值缓存,命中可直接复用结果以节省开销。

提供键值缓存来避免重复做昂贵的读取操作,先用 slm_cache_get(key) 查缓存,未命中再执行耗时请求并用 slm_cache_set 存入带 TTL 的结果。遇到错误回退为未命中(fail-open),不会抛异常,能在同一会话里节省 token 和时间。适合重复读取同一文件、查询或工具输出的场景。

▸ 展开 SKILL.md 英文原文

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.

开发编程KV 缓存性能优化失败保守通用
199
Stars
34
Forks
37
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/qualixar/superlocalmemory/main/plugin-src/skills/slm-cache/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/qualixar/superlocalmemory/main/plugin-src/skills/slm-cache/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# 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,          # requir
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有