Your RAG Cache Can Resurrect a Deleted Document A developer published a TypeScript reference implementation, tiny-rag-revocation-gate, that demonstrates how retrieval caches in RAG pipelines can serve deleted or permission-revoked documents into a model's context. The gate caches only document IDs and revisions, then re-validates each candidate against an authoritative snapshot of tenant, deletion state, reader list and revision before any text enters the prompt, capping requests at 100 candidates and rejecting duplicate or conflicting entries. The writeup notes that index freshness mechanisms such as Pinecone's log sequence numbers do not invalidate a separate application-level cache. You delete a document. The search index catches up. The source URL returns 404. The admin screen says it is gone. Then someone asks your assistant a question, and the assistant quotes it. The model did not break into your database. Your application handed it an old copy. That is the uncomfortable thing about adding a cache to a retrieval pipeline: you have created another place where yesterday's permission can survive today's decision. Let's build a small TypeScript gate that makes that failure visible. No model, no vector database, no API key. Just cached references, current document state, and a test that proves deleted content stays out of the context we build. Code: tiny-rag-revocation-gate https://github.com/bobbyhalljr/tiny-rag-revocation-gate Imagine an internal handbook at revision 7. Alex can read it, so a retrieval cache stores a result for a question about travel expenses. Later, the handbook is deleted. The cache entry still has another twenty minutes to live. A cache hit tells you that a previous retrieval produced a result. It does not tell you that the document still exists, that its content is current, or that Alex can still read it. Those are different questions with different owners. This becomes especially easy to miss when your vector index and your application database update independently. Pinecone documents eventual consistency https://docs.pinecone.io/guides/index-data/check-data-freshness : writes can take time to appear in query results. Its serverless API exposes log sequence numbers to check whether a query reflects a particular write. That helps you reason about the index. It does not invalidate a separate application cache. Even a perfectly fresh index cannot help a request that skips the index entirely. For this example, the cache stores only this: export type Candidate = { documentId: string; revision: number; }; No document text. No cached claim that a user is allowed to read it. The current record lives behind a trusted adapter: export type Document = { tenantId: string; documentId: string; revision: number; deleted: boolean; readers: readonly string ; text: string; }; export type ReadSnapshot = tenantId: string, documentIds: readonly string = Promise