By Sagar Shankaran, Founder of CallSphere
Code-level patterns for grounding Claude answers: a provenance type, titled document blocks, no-answer contracts, and separated verification calls.
Key takeaways
The first cited-answer feature you build is a one-off. The fifth one teaches you that grounding is a set of reusable patterns, not a special case. Once you have shipped a few, the same shapes keep recurring: how you frame context, how you structure the tools that fetch evidence, how you separate generation from verification, and how you represent a claim-with-provenance everywhere in your stack. This post is a pattern catalog — the abstractions worth lifting into shared code so every new feature is grounded by default rather than by heroics.
These are opinionated. They reflect what survives contact with real corpora, messy chunks, and product managers who want both speed and trust. Treat them as defaults you deviate from deliberately.
The most important abstraction is also the simplest. Define one structure that pairs a generated claim with its supporting spans and a verification verdict, and use it everywhere — in the model response parser, the verifier, the renderer, the logs. When provenance is a type rather than an ad-hoc tuple passed around, you stop losing it at integration boundaries.
type Span = { docId: string; title: string;
text: string; start: number; end: number };
type GroundedClaim = {
sentence: string;
spans: Span[];
verdict: "supported" | "partial" | "unsupported" | "uncited";
};
Every stage either produces or consumes GroundedClaim. The renderer reads verdict to style confidence; analytics aggregates verdicts to track grounding health; export serializes the whole structure. One type, many consumers — that is the leverage.
Resist the urge to flatten retrieved chunks into a single string. Claude's Citations feature reasons over discrete document blocks, and discreteness is what lets it attribute a claim to source #3 rather than "somewhere in the blob." Give each block a meaningful title — refund-policy-v3, not doc1 — because that title becomes the user-facing source label and the key you trace by in logs.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
A small helper that turns a retrieval result into document blocks pays for itself immediately:
def to_blocks(chunks):
return [{
"type": "document",
"source": {"type": "text", "media_type": "text/plain",
"data": ch.text},
"title": ch.source_title,
"citations": {"enabled": True},
} for ch in chunks]
This keeps block construction in one place, so enabling citations or attaching metadata is a single edit, not a search-and-replace across features.
The behavior that distinguishes a trustworthy grounded system is what it does when the answer is not in the sources. Without instruction, models reach for plausible-sounding filler. The pattern is a short, firm contract in the user turn: answer only from the provided documents, cite every claim, and if the documents do not contain the answer, say exactly that and cite nothing.
Answer the question using ONLY the documents above.
Cite the supporting sentence for every factual claim.
If the documents do not contain the answer, reply:
"The provided sources don't cover this." Do not guess.
This single paragraph removes a whole class of confident-but-ungrounded answers. Keep it stable across features so behavior is predictable, and resist piling on more rules — terse contracts are followed more reliably than verbose ones.
flowchart TD
A["Question"] --> B["retrieve() tool"]
B --> C["to_blocks(): titled documents"]
C --> D["generate() with no-answer contract"]
D --> E["parse -> GroundedClaim[]"]
E --> F["verify() per claim, parallel"]
F --> G["render() reads verdict"]
E --> H["log GroundedClaim for audit"]
Each labeled node is a reusable unit with a clean input and output. Because they all speak the GroundedClaim type, you can swap the retriever, change models, or add a second verifier without rewriting the rest.
Do not ask one prompt to both answer and judge its own grounding — the incentives conflict and the output gets muddy. Split them. generate() produces the cited answer; verify() takes one claim and one span and returns a verdict. Keeping verification in its own narrow call means you can run it on a cheaper model, parallelize it across claims, cache verdicts by claim-span hash, and reason about its cost independently.
The hash-cache is an underrated trick: identical claim-span pairs recur across sessions, so memoizing verdicts on a hash of (sentence, span.text) cuts repeat verification cost without weakening guarantees. Provenance is deterministic enough that caching it is safe.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
If your logs store only the final answer string, you cannot later answer "why did the system say this?" Store the full GroundedClaim[] for every response. When a customer disputes an answer, you replay the exact spans the model relied on. This also feeds an evaluation loop: aggregate verdict distributions over time, and a rising share of uncited or unsupported is an early warning that retrieval quality has regressed before users complain.
GroundedClaim type and route every stage through it.to_blocks() helper with titles and citations on.verify() as a separate, cheap, parallel, hash-cached call.GroundedClaim[] and chart verdict distributions as a grounding-health metric.| Need | Pattern to reach for |
|---|---|
| Provenance keeps getting dropped | First-class GroundedClaim type |
| Vague "source: file" citations | Titled document blocks |
| Confident answers with no source | Strict no-answer contract |
| Verification too slow or costly | Separate, cached verify() call |
The claim-with-provenance type. Making provenance a first-class object that every stage produces or consumes is what stops citations from leaking away at integration boundaries.
Self-grading prompts tend toward optimistic verdicts and tangled output. A separate, narrowly scoped verification call is cheaper, parallelizable, cacheable, and more honest.
The title you assign each block becomes the source label users see, so a descriptive title turns an opaque citation into a recognizable, trustworthy reference.
Yes. Hash the claim and span text and memoize the verdict. Because the entailment check over identical inputs is deterministic enough, this cuts repeat cost without weakening grounding.
CallSphere bakes these grounding patterns into voice and chat agents so every answer they give a caller is tied to your real source content — auditable, consistent, and available 24/7. See it in action at callsphere.ai.
Source & attribution: This is an independent, original explainer inspired by Anthropic's coverage on the Claude blog. Claude, Claude Code, Claude Cowork, Claude Opus, and the Model Context Protocol are products and trademarks of Anthropic. CallSphere is not affiliated with or endorsed by Anthropic.

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
Anthropic's Claude Fable 5 and Mythos 5 explained: pricing, availability, frontier benchmarks, the dual-model safeguard architecture, and what they mean for AI agents.
Where Claude Code, MCP, and multi-agent systems are taking GTM engineering next, and how to prepare your team now for standing and multi-agent workflows.
Where Claude Cowork and the Claude agent ecosystem are heading next — standing agents, MCP, skills as a moat — and the concrete moves to prepare your team now.
The metrics, leading signals, and anti-metrics that prove Claude Cowork is working — acceptance rate, time-to-outcome, and why usage counts mislead.
Shipping an agentic GTM workflow is easy; proving it works is hard. The metrics, signals, and eval loops that show a Claude Code rebuild is paying off.
A realistic end-to-end Claude Cowork use case: a quarterly vendor-spend review from vague ask to shipped deliverable, with every agentic step shown.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI