loom-caching

loom-caching is a skill for Claude Code, Codex from cosmix/loom. It costs 31 tokens per session (3,286 once invoked), scanned A, original, MIT.

A guide to caching, which stores frequently used or expensive-to-create data closer to the code that needs it. It covers Redis, Memcached, content delivery networks, database queries, and machine-learning models.

In plain words
What is it for?
Use it to choose cache read and write patterns, set expiration and removal rules, handle cache invalidation, and prevent overloaded systems during mass cache misses.
Why use it?
It helps reduce repeated work and waiting time while addressing the difficult parts of caching: outdated data, deciding when entries expire, and many requests missing the same entry at once.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/cosmix/loom/loom-caching
Any agent
npx skills add cosmix/loom --skill loom-caching
Clone the repo
git clone --depth 1 https://github.com/cosmix/loom

Made for: Claude Code, Codex.

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 loom-caching

README.md
[![agentmods](https://agentmods.dev/badge/skills/cosmix/loom/loom-caching.svg)](https://agentmods.dev/skills/cosmix/loom/loom-caching)
Your own site
<a href="https://agentmods.dev/skills/cosmix/loom/loom-caching"><img src="https://agentmods.dev/badge/skills/cosmix/loom/loom-caching.svg" alt="Measured on agentmods" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,286 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00031 $0.03286
Opus 5 $0.00015 $0.01643
Sonnet 5 $0.00006 $0.00657
Haiku 4.5 $0.00003 $0.00329

Measured yesterday against content hash ef1f4f177e06, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

loom-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 yesterday.

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.

skills/loom-caching/SKILL.md · 196 lines

How it starts

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

Caching

Overview

Store expensive-to-compute or frequently-read data closer to the consumer. The easy part is the read path; the hard parts are invalidation (keeping it correct) and stampede (surviving a mass miss). This skill is organized around those failure modes, not around toy get/set wrappers.

Strategy Selection

Strategy Read path Write path Consistency Failure mode to watch
Cache-aside (lazy) App checks cache → loads on miss → populates App writes DB, then invalidates (don't update) cache Eventual; brief staleness window Stampede on hot-key miss; race between load and invalidate
Read-through Cache library loads on miss (paired with write-through) Eventual Same as aside; hides loader in the cache layer
Write-through Read from cache Write DB and cache synchronously Strong-ish; cache always fresh after write Write latency = DB + cache; cache churn for rarely-read keys
Write-behind (write-back) Read from cache Write cache now, flush DB async in batches Weak; data loss if node dies before flush Lost writes on crash; ordering; DB divergence

Default to cache-aside. It's simple, resilient (cache down ≠ writes fail), and puts invalidation in your control. Reach for write-through only when you can't tolerate a post-write stale read; write-behind only for write-heavy, loss-tolerant data (metrics, counters, activity feeds).

On write, invalidate — do not update — the cache (cache-aside). Two concurrent writers updating the cache can commit their DB writes in one order and their cache writes in the opposite order, leaving the cache permanently wrong. Deleting the entry forces the next reader to reload the DB's truth. (This is the [Facebook "leases"] class of bug.)

Write-behind loses data. A crash between "wrote cache" and "flushed DB" silently drops the write. Never use it as the system of record for anything you can't recompute or afford to lose.

Read the full file on GitHub · 196 lines

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. yesterday Changed · -23 tokens per session ef1f4f177e06
  2. 5d ago First seen · 196 lines · 54 tokens per session scan A 2e0635220491

Subscribe to this mod's changes

loom-caching is a skill published in the GitHub repository cosmix/loom (54 stars, last pushed today), licensed MIT. It adds 31 tokens to every session and 3,286 once invoked, about $0.0002 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.

Related

Other skills, from other repositories

aws-cloudformation-elasticache

Provides AWS CloudFormation patterns for ElastiCache Redis or Memcached infrastructure, including subnet groups, parameter groups, security controls, and cross-stack outputs. Use when designing cache tiers, high-availability replication groups, encryption settings, or reusable CloudFormation templates for application…

giuseppe-trisciuoglio/developer-kit · 61 tokens

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…

pjt222/agent-almanac · 86 tokens

google-cloud-storage-fuse

Mounts Cloud Storage buckets as a POSIX file system with Cloud Storage FUSE (gcsfuse). Use when interacting with gcsfuse: decide whether FUSE, native gs:// reads, or Filestore/Managed Lustre fits a workload, deploy tuned mounts on GKE, Compute Engine, or Cloud Run, enable and size file, stat, and list caches, tune…

google/skills · 214 tokens

azure-resource-manager-redis-dotnet

Azure Resource Manager SDK for Redis in .NET. Use for MANAGEMENT PLANE operations: creating/managing Azure Cache for Redis instances, firewall rules, access keys, patch schedules, linked servers (geo-replication), and private endpoints via Azure Resource Manager. NOT for data plane operations (get/set keys, pub/sub) …

microsoft/skills · 114 tokens

coverage-tracker

Run a Google Alerts-style keyword coverage tracker. Uses news-search for recent keyword queries, lets the LLM dedupe and classify real features versus junk, stores decisions in SQLite, and alerts only on new real coverage.

elvisun/newsjack · 47 tokens

warehouse-init

Initialize warehouse schema discovery. Generates .astro/warehouse.md with all table metadata for instant lookups. Run once per project, refresh when schema changes. Use when user says "/astronomer-data:warehouse-init" or asks to set up data discovery.

astronomer/agents · 54 tokens