cache-identity
Skill1 starsChanged 23 days agoMITView on GitHub
Use when caching model results, latency, or artifacts: build a versioned key, bound the store, publish atomically, and never trust an unvalidated cache path.
In this repository46 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- .gemini/AGENTS.mdAGENTS.md
- .cursor/rules/agent-foundry-orchestrator.mdcCursor rule
- .cursor/rules/agent-foundry-skills.mdcCursor rule
- web/llms.txtllms.txt
- anti-slopSkill
- api-designSkill
- automation-pickSkill
- bottleneck-gatingSkill
- budget-guardSkill
- constraint-then-solveSkill
- context-optimizationSkill
- cron-troubleshootSkill
- e2e-test-strategySkill
- engram-routingSkill
- execution-observabilitySkill
- fallback-model-routingSkill
- feedback-loopSkill
- judge-integritySkill
- knowledge-extractSkill
- landscape-firstSkill
- measure-firstSkill
- plan-before-codeSkill
- plan-then-actSkill
- prompt-disciplineSkill
- pushback-when-wrongSkill
- quality-protocolSkill
- read-before-buildSkill
- re-verify-findingsSkill
- session-closeoutSkill
- session-distillSkill
- show-your-workSkill
- structured-output-contractSkill
- verify-firstSkill
- workflow-decomposeSkill
- agent-memory-vaultSkill
- agent-team-standardsSkill
- autonomous-briefingSkill
- book-to-skillSkill
- chrome-devtools-mcp-bridgeSkill
- design-languageSkill
- funnel-pr-guardSkill
- persistent-memorySkill
- sql-migration-trioSkill
- token-compressionSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Look up; return a miss when the row is absent, expired, malformed, or version-mismatched.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
cache-identity
A cache is a claim about identity. If the key is wrong, every hit is a bug.
Contract
- Key fields: runtime version, git SHA (dirty marker), model revision, effective parameters, prompt or skill hash, load bucket.
- Length-prefix each field before hashing so concatenation cannot collide.
- Store numbers and references only. Never deserialize executable content from a cache path.
- Enforce a TTL and a row or byte cap; evict oldest first.
- Publish atomically: temp file, flush, fsync, rename, marker. A losing concurrent publish is success.
- A cache read failure returns a miss, never an exception to the caller.
- Success and failure latency are separate fields.
Procedure
- Compute the key from resolved values, not raw user input.
- Look up; return a miss when the row is absent, expired, malformed, or version-mismatched.
- On write, update running means and the timestamp in one statement.
- Prune on a schedule or at write time; never let the store grow unbounded.
- On release, record the format version so a shape change cannot mix generations.
Worked example
A key built from resolved values, with a version-mismatch miss.
key = f"summary:v3:{tenant_id}:{doc_id}:{content_hash}"
hit -> {"key": key, "value": "...", "version": 3}
miss -> {"key": key, "value": null, "reason": "version_mismatch"}Anti-patterns
- Keying on model name alone while parameters change.
- A cache directory trusted as a code or binary source.
- Unbounded grammar or prompt caches; they are denial-of-service vectors.
- Deleting a file a reader may still have open; expire first, delete after a slack window.
References
- key
Verification Checklist
- Changing any key field produces a miss. (step 1)
- Expired rows are invisible. (step 2)
- Concurrent publish loses safely. (step 3)
- Corrupt entries are ignored. (step 2)
- The store stays under its cap. (step 4)
- Success and failure latencies stay separate. (step 5)
Composes With
measure-first— benchmark baselines are a separate artifactexecution-observability— cache identity appears in request metadatacontext-optimization— artifact spill uses the same publish rules
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

