slm-cache

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

提升会话效率,显著节省重复查询的时间与 token 成本。

▸ 风险提示

缓存可能保留敏感结果,需合理设置过期与访问限制。

这个 Skill 做什么

为重复读取提供键值缓存,避免重复昂贵计算或请求。

提供简单的键值缓存,避免在会话中重复做昂贵的计算或请求,从而省时间和 tokens。使用时先 slm_cache_get 查询,未命中再执行操作并 slm_cache_set 存入,支持 TTL 且按 agent 自动命名空间。任何错误都会宽松失败(hit:false),不会抛异常,方便在不可靠环境下稳健运行。

▸ 展开 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缓存提速节省token通用
199
Stars
34
Forks
37
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/qualixar/superlocalmemory/main/plugin/skills/slm-cache/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/qualixar/superlocalmemory/main/plugin/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 公开信息 · 原文版权归作者所有