Most retrieval pipelines that care about freshness do it as an instruction in the system prompt: "prefer recent documents" or "if unsure, say you don't know." That is a policy with no return value. Nothing upstream can branch on it, nothing is logged, and nothing is testable. The gate described here is the opposite: a small deterministic function that sits between retrieval and prompt assembly and returns a structured decision.
The underlying problem is well documented. Retrieval-augmented generation exists because a model's knowledge freezes at training time, and pulling external documents into the context is what makes answers current and grounded (GitHub's RAG overview). But grounding only helps if the retrieved document is itself current. A stale document in the context window is worse than no document, because the model will cite it with confidence.
The function signature is deliberately boring. It takes a retrieval result plus a clock, and returns an object. No model call, no network call, no randomness. That means it runs in microseconds, it is trivial to unit test, and its decisions are reproducible in an incident review.
The placement matters. Run the gate after retrieval and re-ranking, before the context is assembled. Running it earlier means you discard candidates that a better query would have replaced. Running it later means you have already spent prompt tokens on documents you are about to reject, which is exactly the kind of waste that prompt caching literature keeps circling: cached prefixes save money only when the prefix is worth sending at all (the caching chapter from the Language AI Handbook).



