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.
npx agentmods add skills/ariegoldkin/claude-forge/semantic-cachingnpx skills add ArieGoldkin/claude-forge --skill semantic-cachinggit clone --depth 1 https://github.com/ArieGoldkin/claude-forgeWrote 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.
[](https://agentmods.dev/skills/ariegoldkin/claude-forge/semantic-caching)<a href="https://agentmods.dev/skills/ariegoldkin/claude-forge/semantic-caching"><img src="https://agentmods.dev/badge/skills/ariegoldkin/claude-forge/semantic-caching.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00025 | $0.00864 |
| Opus 5 | $0.00013 | $0.00432 |
| Sonnet 5 | $0.00005 | $0.00173 |
| Haiku 4.5 | $0.00003 | $0.00086 |
Grade A, and why
semantic-caching 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 6d 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.
How it starts
The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Semantic Caching
Cache LLM responses by semantic similarity.
Cache Hierarchy
Request → L1 (Exact) → L2 (Semantic) → L3 (Prompt) → L4 (LLM)
~1ms ~10ms ~2s ~3s
100% save 100% save 90% save Full cost
Redis Semantic Cache
from redisvl.index import SearchIndex
from redisvl.query import VectorQuery
class SemanticCacheService:
def __init__(self, redis_url: str, threshold: float = 0.92):
self.client = Redis.from_url(redis_url)
self.threshold = threshold
async def get(self, content: str, agent_type: str) -> dict | None:
embedding = await embed_text(content[:2000])
query = VectorQuery(
vector=embedding,
vector_field_name="embedding",
filter_expression=f"@agent_type:{{{agent_type}}}",
num_results=1
)
results = self.index.query(query)
if results:
distance = float(results[0].get("vector_distance", 1.0))
if distance <= (1 - self.threshold):
return json.loads(results[0]["response"])
return None
async def set(self, content: str, response: dict, agent_type: str):
embedding = await embed_text(content[:2000])
key = f"cache:{agent_type}:{hash_content(content)}"
self.client.hset(key, mapping={
"agent_type": agent_type,
"embedding": embedding,
"response": json.dumps(response),
"created_at": time.time(),
})
self.client.expire(key, 86400) # 24h TTL
Similarity Thresholds
| Threshold | Distance | Use Case |
|---|---|---|
| 0.98-1.00 | 0.00-0.02 | Nearly identical |
| 0.95-0.98 | 0.02-0.05 | Very similar |
| 0.92-0.95 | 0.05-0.08 | Similar (default) |
| 0.85-0.92 | 0.08-0.15 | Moderately similar |
Multi-Level Lookup
async def get_llm_response(query: str, agent_type: str) -> dict:
# L1: Exact match (in-memory LRU)
cache_key = hash_content(query)
if cache_key in lru_cache:
return lru_cache[cache_key]
# L2: Semantic similarity (Redis)
similar = await semantic_cache.get(query, agent_type)
if similar:
lru_cache[cache_key] = similar # Promote to L1
return similar
# L3/L4: LLM call with prompt caching
response = await llm.generate(query)
# Store in caches
await semantic_cache.set(query, response, agent_type)
lru_cache[cache_key] = response
return response
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.
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.
- 6d ago First seen · 121 lines · 25 tokens per session scan A cdcd64968a10
semantic-caching is a skill published in the GitHub repository ArieGoldkin/claude-forge (6 stars, last pushed 28d ago), licensed MIT. It adds 25 tokens to every session and 864 once invoked, about $0.0001 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-31.
Other skills, from other repositories
cis-aws-database-5.1
Ensure Secure Access to ElastiCache.
cis-aws-database-5.11
Ensure ElastiCache has Cluster Mode Enabled.
cis-aws-database-5.12
Ensure ElastiCache is deployed across multiple Availability Zones (AZs).
cis-aws-database-5.13
Ensure ElastiCache has automatic backups enabled.
build-feature-store
Build a feature store using Feast for centralized feature management, configure offline and online stores for batch and real-time serving, define feature views with transformations, and implement point-in-time correct joins for ML pipelines. Use when managing features for multiple ML models, ensuring training-serving…
llm-caching
Implement multi-layer LLM caching with exact match, semantic similarity, and provider-side prompt caching. Reduce API costs by 30–70%, cut latency, and improve throughput using Redis, GPTCache, and provider caching APIs.