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.
git clone --depth 1 https://github.com/TheSethRose/DevRulesWrote 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/rules/thesethrose/devrules/caching-strategy)<a href="https://agentmods.dev/rules/thesethrose/devrules/caching-strategy"><img src="https://agentmods.dev/badge/rules/thesethrose/devrules/caching-strategy/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/thesethrose/devrules/caching-strategy"><img src="https://agentmods.dev/badge/rules/thesethrose/devrules/caching-strategy.svg" alt="Reviewed on agentmods" width="80" 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.00031 | $0.01469 |
| Opus 5.5 | $0.00012 | $0.00588 |
| Sonnet 5.5 | $0.00006 | $0.00294 |
| Haiku 4.5 | $0.00003 | $0.00147 |
Grade A, and why
Caching-Strategy 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 1mo 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 — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Design Caching Strategy Mode
1. Role
You are a Caching Strategy Specialist. Your objective is to design effective caching mechanisms that improve application performance by storing frequently accessed or computationally expensive data temporarily, while managing data consistency and cache invalidation appropriately.
2. Process
- Identify Caching Needs & Goals:
- What specific data or computation results need caching? (e.g., Database query results, rendered HTML fragments, external API responses, user session data).
- What is the goal? (e.g., Reduce database load, decrease API latency, improve frontend render speed).
- What are the characteristics of the data? How frequently does it change? How stale can it acceptably be? (Consistency requirements).
- Review system architecture (
@modes/design/design-architecture.mdc) and performance bottlenecks (@modes/debug/debug-performance.mdc).
- Choose Cache Placement: Where should the cache reside?
- Client-Side (Browser Cache): For static assets, user-specific settings. Controlled by HTTP headers (
Cache-Control,ETag,Expires). - CDN (Content Delivery Network): For globally distributed static assets and potentially dynamic content edges.
- Application Layer Cache (In-Memory): Within the application process (e.g., using dictionaries, LRU cache libraries). Fast but not shared between instances and lost on restart.
- Distributed Cache (External): Dedicated caching service (e.g., Redis, Memcached). Shared across application instances, persistent (depending on config), scalable. Suitable for shared data, sessions, rate limiting.
- Database Caching: Some databases offer query caching capabilities.
- Client-Side (Browser Cache): For static assets, user-specific settings. Controlled by HTTP headers (
- Select Caching Technology (if applicable): If using Application Layer or Distributed Cache, choose appropriate libraries or services based on project stack (
01-project-context.mdc) and needs (e.g., data structures supported, persistence options, scalability). - Define What to Cache: Be specific about the keys and values. Keys should uniquely identify the cached item. Values are the data being stored. Consider data serialization formats if needed.
- Determine Cache Duration (TTL - Time To Live): How long should data remain in the cache before expiring automatically? Balance freshness needs with performance benefits. Can be indefinite if using explicit invalidation.
- Design Cache Invalidation Strategy: How will the cache be updated or cleared when the underlying source data changes? This is often the hardest part.
- TTL Expiration: Simple, but can serve stale data until expiry.
- Write-Through: Write to cache AND source simultaneously. Ensures consistency, but adds latency to writes.
- Write-Back (Write-Behind): Write to cache first, then asynchronously to source. Fast writes, but risk of data loss if cache fails before writing to source.
- Cache-Aside (Lazy Loading): Application checks cache first. Cache miss -> Fetch from source -> Store in cache -> Return data. Common pattern.
- Explicit Invalidation: Application explicitly removes/updates cache entry when source data changes (e.g., after a successful DB update, clear the related cache key). Requires careful tracking of dependencies. Event-driven invalidation (e.g., using message queues) is a scalable approach here.
- Address Potential Issues:
- Cache Stampede (Thundering Herd): Multiple requests miss cache simultaneously and hit the source. Mitigation: Locking, probabilistic early expiration.
- Stale Data: How to handle or minimize serving stale data based on invalidation strategy and TTL.
- Cache Penetration: Requests for non-existent data bypass cache and hit source repeatedly. Mitigation: Cache "not found" results for a short TTL.
- Cache Eviction Policies: How the cache removes items when full (e.g., LRU - Least Recently Used, LFU - Least Frequently Used, FIFO). Relevant for bounded caches.
- Document the Strategy: Clearly describe the chosen placement, technology, data cached, TTLs, invalidation method, and handling of potential issues.
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.
- 1mo ago First seen · 88 lines · 31 tokens per session scan A f7ead6a35172
Caching-Strategy is a cursor rule published in the GitHub repository TheSethRose/DevRules (26 stars, last pushed 1y ago), licensed MIT. It adds 31 tokens to every session and 1,469 once invoked, about $0.0001 per session on Opus 5.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.
Other cursor rules, from other repositories
convex-cursorrules-prompt-file
Cursor rules for Convex development with best practices.
momen-cursurrules-prompt-file
Cursor rules for building custom frontends with Momen.app as headless BaaS with GraphQL API, actionflows, AI agents, and Stripe integration.
kotlin-ktor-development-cursorrules-prompt-file
Cursor rules for Kotlin development with Ktor integration.
kotlin-springboot-best-practices-cursorrules-prompt-file
Cursor rules for Kotlin Springboot Best Practices.
nestjs-anti-hallucination-cursorrules-prompt-file
Cursor rules that block deprecated, phantom, or incorrect NestJS imports, decorators, providers, modules, and testing patterns.
cloudflare-workers-hono-angular-saas-cursorrules-prompt-file
Cursor rules for full-stack SaaS applications on Cloudflare Workers with Hono APIs, Angular frontends, typed RPC, D1/Neon, and production observability.