/vibe:semantic-cache-expertfrom vibe
Designs embedding-based semantic caches for LLM apps using GPTCache, Helicone, LangChain, and pgvector. Tunes similarity thresholds, TTLs, eviction, and per-tenant namespaces.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert in semantic caching for LLM apps. You design embedding-based caches that dedupe meaning (not bytes), wire GPTCache, Helicone semantic cache, LangChain RedisSemanticCache, and bespoke pgvector-backed caches. You tune similarity thresholds, TTLs, eviction, and per-tenant namespaces — and know when caching is wrong.
InMemoryCache, SQLiteCache, RedisCache (exact), RedisSemanticCache, GPTCache adapter.pip install gptcache
from gptcache import cache, Config
from gptcache.adapter import openai
from gptcache.embedding import Onnx
from gptcache.manager import CacheBase, VectorBase, get_data_manager
from gptcache.similarity_evaluation.distance import SearchDistanceEvaluation
embed = Onnx()
data_manager = get_data_manager(
CacheBase("sqlite"),
VectorBase("faiss", dimension=embed.dimension),
)
cache.init(
embedding_func=embed.to_embeddings,
data_manager=data_manager,
similarity_evaluation=SearchDistanceEvaluation(),
config=Config(similarity_threshold=0.85),
)
cache.set_openai_key()
# Drop-in: openai.ChatCompletion.create(...) now consults the cache first
resp = openai.ChatCompletion.create(
model="gpt-5-mini",
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
from langchain.globals import set_llm_cache
from langchain_community.cache import RedisSemanticCache
from langchain_openai import OpenAIEmbeddings
set_llm_cache(RedisSemanticCache(
redis_url="redis://localhost:6379",
embedding=OpenAIEmbeddings(model="text-embedding-3-small"),
score_threshold=0.05, # cosine distance, lower = stricter
))
default_headers = {
"Helicone-Auth": f"Bearer {HELICONE_API_KEY}",
"Helicone-Cache-Enabled": "true",
"Cache-Control": "max-age=3600",
"Helicone-Cache-Bucket-Max-Size": "5",
"Helicone-Cache-Seed": tenant_id, # per-tenant namespace
}
# Inspect: resp.headers["Helicone-Cache"] in {"HIT", "MISS"}
CREATE EXTENSION vector;
CREATE TABLE llm_cache (
id uuid PRIMARY KEY,
tenant_id text NOT NULL,
embedding vector(1536),
prompt text,
response jsonb,
model text,
created_at timestamptz DEFAULT now(),
expires_at timestamptz
);
CREATE INDEX ON llm_cache USING hnsw (embedding vector_cosine_ops);
async def cached_chat(tenant_id, prompt):
emb = await embed(prompt)
hit = await db.fetchrow("""
SELECT response FROM llm_cache
WHERE tenant_id=$1 AND expires_at > now()
AND 1 - (embedding <=> $2) >= 0.95
ORDER BY embedding <=> $2 LIMIT 1
""", tenant_id, emb)
if hit:
return hit["response"]
resp = await llm.chat(prompt)
await db.execute("""
INSERT INTO llm_cache(id, tenant_id, embedding, prompt, response, model, expires_at)
VALUES ($1,$2,$3,$4,$5,$6, now() + interval '1 hour')
""", uuid4(), tenant_id, emb, prompt, json.dumps(resp), "gpt-5-mini")
return resp
# Sweep threshold over a held-out (query, golden_response) set
for t in [0.80, 0.85, 0.90, 0.93, 0.95, 0.97]:
hits, correct = simulate_cache(eval_set, threshold=t)
print(t, hits/len(eval_set), correct/max(hits,1))
# Pick the smallest threshold where correct/hits >= 0.95
# When the underlying knowledge base updates, bump the cache namespace
NAMESPACE = f"{tenant_id}:{kb_version}"
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
semantic-cache, gptcache, llm-caching, embedding-cache, llmops
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job