slm-cache
仓库创建 2026年2月5日最近提交 1 天前SkillHot 收录 8 小时前
▸ 精选理由
简单接口即可显著节省 token 与延迟,适合会话内重复查询场景。
这个 Skill 做什么
面向代理会话的键值缓存接口,减少重复读取与昂贵操作的消耗。
提供给代理会话用的键值缓存:先 slm_cache_get(key),空就做昂贵操作再 slm_cache_set(key,value,ttl) 存起来,下次命中直接用结果。遇到同一文件、查询或工具输出会被多次读取时能省耗费的时间和 token。实现上是按代理/租户自动命名空间、带 TTL,并且遇错时“开放失败”(返回 miss),不会抛异常或中断流程。
▸ 展开 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.
199
Stars
34
Forks
37
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/qualixar/superlocalmemory/main/codex-plugin/skills/slm-cache/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/qualixar/superlocalmemory/main/codex-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, # requirvia SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有