redis-semantic-cache

redis-semantic-cache is a skill for Claude Code from redis/agent-skills. It costs 102 tokens per session (942 once invoked), scanned A, original, MIT.

Guidance for Redis LangCache, a Redis Cloud service that caches AI responses based on the meaning of a prompt rather than only its exact text. Similar prompts can reuse a stored response instead of calling the language model again.

In plain words
What is it for?
Use it to cache language-model answers, retrieval-augmented generation responses, or classification results, and to configure separate caches, similarity thresholds, and custom filters for different tasks.
Why use it?
It can reduce repeated model calls, which helps lower response time and API usage for suitable workloads. It also explains how to balance matching more prompts against returning a response that is not similar enough.

Skill for Claude Code ✓ vendor

Written for Claude Code: shipped in a Claude Code plugin.

Part of the redis-development plugin — 8 skills shipped together

Good fit Use it to cache language-model answers, retrieval-augmented generation responses, or classification results…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/redis/agent-skills/redis-semantic-cache
About the project

Redis Agent Skills is Redis's collection of packaged instructions and resources that teach AI coding agents how to work with Redis data structures, connections, search, caching, clustering, security, observability, and agent memory. It is for developers using coding agents to build or troubleshoot Redis-backed applications. The catalogue entries are the project's own agent skills, instructions, and plugin packaging.

redis/agent-skills · 140 stars · on GitHub · redis.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add redis/agent-skills --skill redis-semantic-cache
Clone the repo
git clone --depth 1 https://github.com/redis/agent-skills

Made for: Claude Code.

Or install redis-development, the plugin that ships this one along with the rest of its 8 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for redis-semantic-cache

README.md
[![agentmods](https://agentmods.dev/badge/skills/redis/agent-skills/redis-semantic-cache.svg)](https://agentmods.dev/skills/redis/agent-skills/redis-semantic-cache)
Your own site
<a href="https://agentmods.dev/skills/redis/agent-skills/redis-semantic-cache"><img src="https://agentmods.dev/badge/skills/redis/agent-skills/redis-semantic-cache.svg" alt="Measured on agentmods" height="20"></a>
Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 942 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00102 $0.00942
Opus 5 $0.00051 $0.00471
Sonnet 5 $0.00020 $0.00188
Haiku 4.5 $0.00010 $0.00094

Measured 7d ago against content hash 139a4520d595, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

redis-semantic-cache scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/redis-development/skills/redis-semantic-cache/SKILL.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Redis Semantic Cache

Semantic caching for LLM responses with Redis Cloud's LangCache service. Stores prompts as embeddings; subsequent semantically-similar prompts return the cached response without re-calling the model.

LangCache is currently in preview on Redis Cloud. Features and behavior may change.

When to apply

  • Wrapping an LLM call (OpenAI, Anthropic, etc.) with a cache layer to cut cost and latency.
  • Caching RAG answers, classification outputs, or any deterministic LLM workload.
  • Tuning the precision/hit-rate trade-off for a semantic cache.
  • Splitting one application's LLM workloads across multiple cache instances.

1. The cache-aside flow

LangCache fits in front of any LLM call as a standard cache-aside pattern:

  1. Send the user's prompt to LangCache's search.
  2. Cache hit — return the stored response directly.
  3. Cache miss — call the LLM, then set the response so future similar prompts hit.
from langcache import LangCache
import os

lang_cache = LangCache(
    server_url=f"https://{os.getenv('HOST')}",
    cache_id=os.getenv("CACHE_ID"),
    api_key=os.getenv("API_KEY"),
)

result = lang_cache.search(prompt="What is Redis?", similarity_threshold=0.9)
if result:
    response = result[0]["response"]
else:
    response = llm.generate("What is Redis?")
    lang_cache.set(prompt="What is Redis?", response=response)

The same operations are available via REST (POST /v1/caches/{cacheId}/entries/search and POST /v1/caches/{cacheId}/entries) when an SDK isn't an option.

See references/langcache-usage.md for full SDK + REST samples and attribute-based storage.

2. Tune the similarity threshold

The threshold controls how close (in embedding cosine distance) a new prompt must be to a cached one to count as a hit. Higher = stricter match, fewer false positives. Lower = more hits, more risk of returning an off-topic answer.

Threshold Behavior Use when
0.95+ Near-exact match required Customer-facing answers where wrong responses are costly
0.9 Balanced default Most workloads — start here
0.8 Loose semantic match Internal tools, exploratory queries, FAQ deduplication

Read the full file on GitHub · 89 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 89 lines · 102 tokens per session scan A 139a4520d595

Subscribe to this mod's changes

redis-semantic-cache is a skill published in the GitHub repository redis/agent-skills (140 stars, last pushed 5d ago), licensed MIT. It adds 102 tokens to every session and 942 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.