CLAUDE LABJP
COWORK — Claude Cowork expands to web and mobile with remote sessions, synced files, and a shared Chat and Cowork home across devicesM365 — Claude Cowork adds Microsoft 365 write tools to draft and send email, manage calendars, and update OneDrive and SharePoint filesMCP — Admins can provision MCP connectors org-wide through their identity provider, starting with Okta, with access granted on first loginCODE — Claude Code fixes SessionStart hook streaming in headless sessions so remote workers are not idle-reaped mid-hookGOV — Claude Code and Claude Cowork are in public beta in Claude for Government Desktop on a FedRAMP High authorized environmentLIMITS — Claude Code weekly usage limits are increased by 50% through July 13COWORK — Claude Cowork expands to web and mobile with remote sessions, synced files, and a shared Chat and Cowork home across devicesM365 — Claude Cowork adds Microsoft 365 write tools to draft and send email, manage calendars, and update OneDrive and SharePoint filesMCP — Admins can provision MCP connectors org-wide through their identity provider, starting with Okta, with access granted on first loginCODE — Claude Code fixes SessionStart hook streaming in headless sessions so remote workers are not idle-reaped mid-hookGOV — Claude Code and Claude Cowork are in public beta in Claude for Government Desktop on a FedRAMP High authorized environmentLIMITS — Claude Code weekly usage limits are increased by 50% through July 13
Articles/API & SDK
API & SDK/2026-07-09Advanced

When the RAG Started Being Confidently Wrong — Field Notes on Measuring Retrieval Misses With Groundedness

In a Claude API RAG, the answers stay fluent while the facts drift. Often the cause is a silent recall decay on the retrieval side, missing the document that holds the answer. Field notes on measuring groundedness and retrieval hit rate and walking the system back, with working code and real numbers.

Claude API108RAG4vector search2retrieval augmented generationgroundednessevaluation3TypeScript23

Premium Article

I asked our support RAG, "How many days is the refund window?" Claude answered smoothly: "Within 14 days." The actual policy was 30. The answer was fluent, cited its sources, and radiated confidence — which is exactly what made my stomach drop.

The model wasn't broken. Retrieval was. It had failed to fetch the document holding the answer, yet generation carried on, and Claude assembled a plausible falsehood from the unrelated fragments it happened to have.

These are field notes on a silent recall decay — a retrieval miss — in a Claude API RAG I ran in production: how I surfaced it with a groundedness number and walked it back in stages. This is not about building a RAG. It is about how to notice, and fix, when retrieval quietly degrades after you've built it. I'll leave the build steps to pieces like prompt caching design for the Claude API and focus here on measurement.

Generation never stops, so decay stays invisible

The awkward thing about RAG is that generation continues even when retrieval fails. With zero relevant documents, or a few unrelated fragments hovering near the threshold, Claude still returns something that reads well. The API throws nothing. The logs are a wall of 200s.

The decay I hit didn't arrive one morning — it crept. I added documents to the knowledge base, tweaked chunking, swapped the embedding model for a newer version. Every change was well-intentioned. And each time, the document containing the answer got quietly pushed out of the top-K.

The trouble is that none of this shows up in how the answer looks. The prose stays fluent — the confidence, if anything, grows. Only a vague "it's felt off lately" from users arrives, and late. So I needed to measure whether retrieval was actually grabbing the answer, separately from generation.

Doubt it as two numbers

Treating "the RAG is drifting" as one lump makes the cause impossible to isolate. I split the problem in two and gave each its own number.

MetricWhat it measuresWhat a low value means
Retrieval hit rateShare of queries where the answer-bearing doc lands in the top KRetrieval (embeddings, chunks, threshold) is broken
GroundednessShare of answers actually supported by the retrieved docsRetrieval works but generation ignores the docs

If retrieval hit rate is low, the cause is the retrieval pipeline. If hit rate is high but groundedness is low, the cause is the generation prompt or how the context is packed. Just being able to make that cut ended the blind trial-and-error.

The first time I measured, retrieval hit rate was 68% and groundedness 61%. One in three times, the document with the answer never even reached Claude. Seeing the numbers is what finally made the problem's location click.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
How to split a fluent-but-wrong RAG into two numbers — groundedness and retrieval hit rate — to tell a retrieval failure from a generation failure
A working implementation that puts Claude in the grader's seat to score whether an answer is actually grounded in the retrieved docs, run daily
The staged fixes — chunk bloat, embedding-model swaps, threshold drift — that walked groundedness from 61% back to 94%
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API & SDK2026-04-06
Building a Persistent Memory Agent with Claude API, pgvector, and Redis: A Complete
A complete guide to building production-ready persistent memory for Claude API agents using PostgreSQL + pgvector + Redis. Learn vector search, layered memory architecture, session management, and GDPR-compliant data handling.
API & SDK2026-07-08
Contract-Test Every Tool Before You Submit or Automate an MCP Connector
A connector that works once in a chat can still break silently in an unattended job through misread response shapes or double-fired writes. Here is a small harness that machine-checks tool descriptions, response contracts, idempotency, and latency, with measured numbers.
API & SDK2026-07-03
A 40% Lower Price Doesn't Mean a 40% Lower Bill — Measuring the Opus 4.8 to Sonnet 5 Migration by Cost per Completed Task
Sonnet 5's intro pricing looks ~40% cheaper than Opus 4.8, yet extra tool turns can flip the math. Working TypeScript for consumption vectors, a paired-run harness, and break-even turn counts.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →