content-hash-cache-pattern

content-hash-cache-pattern is a skill for Claude Code, Codex from jxoesneon/Ciel. It costs 22 tokens per session (534 once invoked), scanned A, original, Apache-2.0.

A caching pattern that stores the result of expensive file processing under a fingerprint of the file's contents. A fingerprint changes when the file changes, even if the file is renamed or moved.

In plain words
What is it for?
Use it for tasks such as PDF parsing, OCR, or indexing large files where processing the same unchanged content is costly.
Why use it?
It avoids repeating work for files that have already been processed while still detecting changed files automatically.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for tasks such as PDF parsing, OCR, or indexing large files where processing the same unchanged content is costly.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jxoesneon/ciel/content-hash-cache-pattern
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 jxoesneon/Ciel --skill content-hash-cache-pattern
Clone the repo
git clone --depth 1 https://github.com/jxoesneon/Ciel

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 content-hash-cache-pattern

README.md
[![agentmods](https://agentmods.dev/badge/skills/jxoesneon/ciel/content-hash-cache-pattern/github.svg)](https://agentmods.dev/skills/jxoesneon/ciel/content-hash-cache-pattern)
Your own site
<a href="https://agentmods.dev/skills/jxoesneon/ciel/content-hash-cache-pattern"><img src="https://agentmods.dev/badge/skills/jxoesneon/ciel/content-hash-cache-pattern/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.

agentmods 80×15 button for content-hash-cache-pattern

Your own site · 80×15
<a href="https://agentmods.dev/skills/jxoesneon/ciel/content-hash-cache-pattern"><img src="https://agentmods.dev/badge/skills/jxoesneon/ciel/content-hash-cache-pattern.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 22 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 534 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.00022 $0.00534
Opus 5 $0.00011 $0.00267
Sonnet 5 $0.00004 $0.00107
Haiku 4.5 $0.00002 $0.00053

Measured 5d ago against content hash 90e298e49707, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

content-hash-cache-pattern 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 5d 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.

skills/content-hash-cache-pattern/SKILL.md · 53 lines

What it actually says

CIEL ADAPTATION: Content-Hash Cache (I/O Optimization)

This skill provides a standard architectural pattern for caching the results of expensive, deterministic file processing operations (e.g., PDF parsing, OCR, large-file indexing).

Core Pattern: Content over Path

Unlike traditional path-based caching, this pattern uses the SHA-256 hash of the file content as the cache key.

  • Rename/Move Resilience: Moving a file results in a cache hit.
  • Automatic Invalidation: Changing a single byte in a file triggers a cache miss.
  • No Index File: Cache files are named {hash}.json, allowing O(1) lookup without a central registry.

Implementation Standard

  1. Compute Hash: Use chunked reads (64KB) for large files to avoid memory exhaustion.
  2. Read/Check: Check if .cache/{hash}.json exists before processing.
  3. Process (Pure): The processing logic itself should be a pure function with no knowledge of the cache.
  4. Write: Store the result alongside the source_path and file_hash in a structured JSON file.

Design Decisions

  • Fail Gracefully: Treat corrupted or malformed JSON in the cache as a miss; never crash.
  • Service Layer: Implement caching as a wrapper/service layer around the core processing logic.
  • Chunked I/O: Mandatory for files >10MB to maintain efficiency.

Anti-Patterns

  • Path-Based Caching: Caching by filename, which leads to stale data after edits or renames.
  • In-Memory Only: Using simple dictionaries for cache that disappear after a session restart.
  • Impure Cache Hooks: Mixing caching logic directly into business logic/parsers.
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. 5d ago First seen · 53 lines · 22 tokens per session scan A 90e298e49707

Subscribe to this mod's changes

content-hash-cache-pattern is a skill published in the GitHub repository jxoesneon/Ciel (1 stars, last pushed yesterday), licensed Apache-2.0. It adds 22 tokens to every session and 534 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-09-03.

Related

Other skills, from other repositories

doc-crafter

Especialista em documentação de código e APIs. Gera e atualiza especificações (OpenAPI/Swagger), diagramas Mermaid, README e JSDoc/Docstrings. Use para "documentar este endpoint", "atualizar swagger" ou "gerar documentação da função".

rcelebrone/DotAgents · 62 tokens

backend-patterns

Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.

Kacper0199/Opencode-Ultrathinker · 31 tokens

api-debugging

Systematic approach to debugging REST APIs, HTTP errors, authentication issues, and network problems. Use when the user has API errors, status code issues, timeout problems, or needs help troubleshooting HTTP requests.

ownpilot/OwnPilot · 44 tokens

service-app-creator

Create or update the Service component of a NextClaw Mini App, choosing between Portable Rust/WASI Components and native-process MCP services. Use after nextclaw-app-creator selects a Service-backed app, or when the user explicitly asks for Service Actions, portable components, local files, external APIs, commands…

Peiiii/nextclaw · 74 tokens

tg-bot-ops

A guide for operating and troubleshooting Telegram bots and systems that connect Telegram to an AI agent. It covers how messages arrive, get processed, and produce replies.

serejaris/personal-corp-os · 146 tokens

neo4j-getting-started-skill

Orchestrates zero-to-running-app in 8 stages — prerequisites → context → provision → model → load → explore → query → build. Each stage reads its own reference file. Supports HITL and fully autonomous operation. Use when starting a new Neo4j project from scratch, provisioning Aura, generating synthetic data, building…

neo4j-contrib/neo4j-skills · 157 tokens