Retrieved Context Chunks
The RAG debugging surface: ranked passages with similarity as a meter, matched spans in real mark elements, and filter chips wired as a radiogroup so arrows move between them.
A green tick means the connector works, not that the answers are current. Freshness as an age in words per source, the headline taken from the stalest one, and a failed sync that still says what age it is answering from.
components/retrieval-index-status.tsxnpx hoverlab add retrieval-index-status
Or over MCP, from your editor's agent — no account needed.
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Start a page with this section — add more, order them, and leave with the page source.
Answers can only be as current as the source they come from. The oldest connected source was last read 6 weeks ago, so anything changed since then may not be reflected yet.
Website · 4 domains
Up to date · last read 11 minutes ago
486 docs
Notion workspace
Partly indexed · last read 2 hours ago
812 of 1,340 documents searchable — the remaining 528 cannot be cited yet.
1,340 docs
Zendesk · resolved only
Behind · last read 9 days ago
22,190 docs
Google Drive folder
Not syncing · last read 6 weeks ago
The connected account lost access to the folder on 3 August. The 74 documents already indexed are still being answered from, at the age above.
74 docs
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
'use client'
/**
* <RetrievalIndexStatus> — how old the assistant's knowledge is.
*
* Retrieval & Context had the chunk cards, the citations, the source
* picker, the honest empty state and the context budget. All five describe
* a single question being answered. None of them describes the thing that
* decides whether the answer is *right*: when each source was last read.
*
* THE ONE THING THIS GETS RIGHT THAT MOST DO NOT
*
* A green tick beside a connector means "the connection works", and
* everybody reads it as "the answers are current". Those are different
* claims and the gap between them is where a support agent confidently
* quotes a refund policy that changed on Tuesday. So freshness is stated
* as an age in words next to every source, and the panel's headline is
* the *oldest* source rather than an average — an index is only as
* current as its stalest corner.
*
* A FAILING SYNC IS NOT A FAILING ANSWER
*
* When a crawl breaks, the old documents are still there and still being
* answered from. Saying "sync failed" alone implies the assistant has
* gone quiet; it has not, it is answering from data of a known age. Both
* facts go on the row, in that order.
*
* PARTIAL IS ITS OWN STATE
*
* A source that indexed 812 of 1,340 documents is neither ready nor
* broken, and collapsing it into either is a lie in one direction or the
* other. It gets a progress figure and a sentence about what is missing.
*
* ACCESSIBILITY: a real list with one heading per source; every status is
* text before it is a colour, so nothing here depends on distinguishing
* amber from green; the refresh confirmation is `aria-live="polite"`.
*/
import * as React from 'react'
import { AlertTriangle, CheckCircle2, Clock, RefreshCw, XCircle } from 'lucide-react'
export type IndexState = 'fresh' | 'stale' | 'partial' | 'failed'
export interface IndexedSource {
id: string
name: string
kind: string
state: IndexState
/** Age of the newest content, in words. Never a bare timestamp. */
age: string
documents: number
/** Set on `partial`: how many of `documents` are actually searchable. */
indexed?: number
/** Set on `failed`: what broke, in a sentence a customer can act on. */
problem?: string
}
export interface RetrievalIndexStatusProps {
sources?: IndexedSource[]
className?: string
}
const DEFAULT_SOURCES: IndexedSource[] = [
{
id: 'help',
name: 'Help centre',
kind: 'Website · 4 domains',
state: 'fresh',
age: '11 minutes ago',
documents: 486,
},
{
id: 'notion',
name: 'Internal handbook',
kind: 'Notion workspace',
state: 'partial',
age: '2 hours ago',
documents: 1340,
indexed: 812,
},
{
id: 'zendesk',
name: 'Past tickets',
kind: 'Zendesk · resolved only',
state: 'stale',
age: '9 days ago',
documents: 22190,
},
{
id: 'drive',
name: 'Policy documents',
kind: 'Google Drive folder',
state: 'failed',
age: '6 weeks ago',
documents: 74,
problem: 'The connected account lost access to the folder on 3 August.',
},
]
const STATE_TEXT: Record<IndexState, string> = {
fresh: 'Up to date',
stale: 'Behind',
partial: 'Partly indexed',
failed: 'Not syncing',
}
const STATE_ICON: Record<IndexState, React.ComponentType<{ className?: string }>> = {
fresh: CheckCircle2,
stale: Clock,
partial: AlertTriangle,
failed: XCircle,
}
/* Colour is the second signal, never the first — every state is spelled
out in STATE_TEXT above. */
const STATE_TONE: Record<IndexState, string> = {
fresh: 'text-primary',
stale: 'text-amber-700 dark:text-amber-400',
partial: 'text-amber-700 dark:text-amber-400',
failed: 'text-destructive',
}
export function RetrievalIndexStatus({
sources = DEFAULT_SOURCES,
className = '',
}: RetrievalIndexStatusProps) {
const [refreshing, setRefreshing] = React.useState(false)
const [message, setMessage] = React.useState('')
/* The headline is the worst row, not the average. */
const worst =
sources.find((s) => s.state === 'failed') ??
sources.find((s) => s.state === 'stale') ??
sources.find((s) => s.state === 'partial') ??
sources[0]
function refresh() {
setRefreshing(true)
window.setTimeout(() => {
setRefreshing(false)
setMessage(
'Re-crawl queued for every source. Answers keep using the current index until it finishes.',
)
}, 900)
}
if (!worst) return null
return (
<section className={`mx-auto w-full max-w-3xl px-4 py-16 sm:px-6 ${className}`}>
<div className="rounded-2xl border border-border bg-card">
<header className="flex flex-wrap items-start gap-3 border-b border-border px-5 py-4">
<div className="min-w-0 flex-1">
<h2 className="text-base font-semibold text-foreground">Knowledge freshness</h2>
{/* The sentence the green ticks were being read as. */}
<p className="mt-1 text-xs leading-relaxed text-muted-foreground">
Answers can only be as current as the source they come from. The oldest
connected source was last read{' '}
<strong className="font-semibold text-foreground">{worst.age}</strong>, so
anything changed since then may not be reflected yet.
</p>
</div>
<button
type="button"
onClick={refresh}
disabled={refreshing}
className="inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
>
<RefreshCw
aria-hidden
className={`h-3.5 w-3.5 ${refreshing ? 'motion-safe:animate-spin' : ''}`}
/>
{refreshing ? 'Queuing' : 'Re-crawl all'}
</button>
</header>
<ul className="divide-y divide-border">
{sources.map((source) => {
const Icon = STATE_ICON[source.state]
const share =
source.indexed === undefined
? null
: Math.round((source.indexed / source.documents) * 100)
return (
<li key={source.id} className="flex flex-wrap items-start gap-3 px-5 py-4">
<Icon
aria-hidden
className={`mt-0.5 h-4.5 w-4.5 shrink-0 ${STATE_TONE[source.state]}`}
/>
<div className="min-w-0 flex-1">
<h3 data-stress-ignore className="text-sm font-medium text-foreground">{source.name}</h3>
<p className="mt-0.5 text-xs text-muted-foreground">{source.kind}</p>
<p className="mt-1.5 text-xs">
<span className={`font-medium ${STATE_TONE[source.state]}`}>
{STATE_TEXT[source.state]}
</span>
<span className="text-muted-foreground"> · last read {source.age}</span>
</p>
{/* Partial gets a number and a consequence. */}
{source.state === 'partial' && source.indexed !== undefined ? (
<>
<div
aria-hidden
className="mt-1.5 h-1.5 w-full max-w-xs overflow-hidden rounded-full border border-transparent bg-muted"
>
<div
className="h-full rounded-full bg-primary border border-transparent"
style={{ width: `${share}%` }}
/>
</div>
<p className="mt-1 text-xs text-muted-foreground">
{source.indexed.toLocaleString('en-US')} of{' '}
{source.documents.toLocaleString('en-US')} documents searchable —
the remaining {(source.documents - source.indexed).toLocaleString('en-US')}{' '}
cannot be cited yet.
</p>
</>
) : null}
{/* Failed: what broke, and that answers continue. */}
{source.state === 'failed' && source.problem ? (
<p className="mt-1.5 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive">
{source.problem} The {source.documents} documents already indexed are
still being answered from, at the age above.
</p>
) : null}
</div>
<p className="shrink-0 text-xs tabular-nums text-muted-foreground">
{source.documents.toLocaleString('en-US')} docs
</p>
</li>
)
})}
</ul>
<p aria-live="polite" className="border-t border-border px-5 py-3 text-xs text-muted-foreground">
{message}
</p>
</div>
</section>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/retrieval-index-status.tsx and import it where you need the section:
import { RetrievalIndexStatus } from '@/components/retrieval-index-status'Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.
| Prop | Type | Default |
|---|---|---|
sources | IndexedSource[] | DEFAULT_SOURCES |
className | string | '' |
The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.
This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.
<!--
Index Freshness Panel — markup from the Hoverlab catalog.
This is the block rendered once to HTML and wrapped as a component
file. It is not a port of the React source: the Tailwind classes carry
the design, which is the part that took the work, and they are the same
in every framework.
This block is interactive in React and the handlers are NOT here.
Buttons, toggles and menus render in their initial state and do
nothing until you wire them up.
-->
<section class="mx-auto w-full max-w-3xl px-4 py-16 sm:px-6 ">
<div class="rounded-2xl border border-border bg-card">
<header class="flex flex-wrap items-start gap-3 border-b border-border px-5 py-4">
<div class="min-w-0 flex-1">
<h2 class="text-base font-semibold text-foreground">Knowledge freshness</h2>
<p class="mt-1 text-xs leading-relaxed text-muted-foreground">Answers can only be as current as the source they come from. The oldest connected source was last read <strong class="font-semibold text-foreground">6 weeks ago</strong>, so anything changed since then may not be reflected yet.</p>
</div>
<button type="button" class="inline-flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-cw h-3.5 w-3.5" aria-hidden="true"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"></path><path d="M8 16H3v5"></path></svg>Re-crawl all</button>
</header>
<ul class="divide-y divide-border">
<li class="flex flex-wrap items-start gap-3 px-5 py-4">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-check mt-0.5 h-4.5 w-4.5 shrink-0 text-primary" aria-hidden="true">
<circle cx="12" cy="12" r="10"></circle>
<path d="m9 12 2 2 4-4"></path>
</svg>
<div class="min-w-0 flex-1">
<h3 data-stress-ignore="true" class="text-sm font-medium text-foreground">Help centre</h3>
<p class="mt-0.5 text-xs text-muted-foreground">Website · 4 domains</p>
<p class="mt-1.5 text-xs">
<span class="font-medium text-primary">Up to date</span>
<span class="text-muted-foreground">· last read 11 minutes ago</span>
</p>
</div>
<p class="shrink-0 text-xs tabular-nums text-muted-foreground">486 docs</p>
</li>
<li class="flex flex-wrap items-start gap-3 px-5 py-4">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-triangle-alert mt-0.5 h-4.5 w-4.5 shrink-0 text-amber-700 dark:text-amber-400" aria-hidden="true">
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"></path>
<path d="M12 9v4"></path>
<path d="M12 17h.01"></path>
</svg>
<div class="min-w-0 flex-1">
<h3 data-stress-ignore="true" class="text-sm font-medium text-foreground">Internal handbook</h3>
<p class="mt-0.5 text-xs text-muted-foreground">Notion workspace</p>
<p class="mt-1.5 text-xs">
<span class="font-medium text-amber-700 dark:text-amber-400">Partly indexed</span>
<span class="text-muted-foreground">· last read 2 hours ago</span>
</p>
<div aria-hidden="true" class="mt-1.5 h-1.5 w-full max-w-xs overflow-hidden rounded-full border border-transparent bg-muted">
<div class="h-full rounded-full bg-primary border border-transparent" style="width:61%"></div>
</div>
<p class="mt-1 text-xs text-muted-foreground">812 of 1,340 documents searchable — the remaining 528 cannot be cited yet.</p>
</div>
<p class="shrink-0 text-xs tabular-nums text-muted-foreground">1,340 docs</p>
</li>
<li class="flex flex-wrap items-start gap-3 px-5 py-4">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clock mt-0.5 h-4.5 w-4.5 shrink-0 text-amber-700 dark:text-amber-400" aria-hidden="true">
<path d="M12 6v6l4 2"></path>
<circle cx="12" cy="12" r="10"></circle>
</svg>
<div class="min-w-0 flex-1">
<h3 data-stress-ignore="true" class="text-sm font-medium text-foreground">Past tickets</h3>
<p class="mt-0.5 text-xs text-muted-foreground">Zendesk · resolved only</p>
<p class="mt-1.5 text-xs">
<span class="font-medium text-amber-700 dark:text-amber-400">Behind</span>
<span class="text-muted-foreground">· last read 9 days ago</span>
</p>
</div>
<p class="shrink-0 text-xs tabular-nums text-muted-foreground">22,190 docs</p>
</li>
<li class="flex flex-wrap items-start gap-3 px-5 py-4">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-x mt-0.5 h-4.5 w-4.5 shrink-0 text-destructive" aria-hidden="true">
<circle cx="12" cy="12" r="10"></circle>
<path d="m15 9-6 6"></path>
<path d="m9 9 6 6"></path>
</svg>
<div class="min-w-0 flex-1">
<h3 data-stress-ignore="true" class="text-sm font-medium text-foreground">Policy documents</h3>
<p class="mt-0.5 text-xs text-muted-foreground">Google Drive folder</p>
<p class="mt-1.5 text-xs">
<span class="font-medium text-destructive">Not syncing</span>
<span class="text-muted-foreground">· last read 6 weeks ago</span>
</p>
<p class="mt-1.5 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive">The connected account lost access to the folder on 3 August. The 74 documents already indexed are still being answered from, at the age above.</p>
</div>
<p class="shrink-0 text-xs tabular-nums text-muted-foreground">74 docs</p>
</li>
</ul>
<p aria-live="polite" class="border-t border-border px-5 py-3 text-xs text-muted-foreground"></p>
</div>
</section>
What each framework gets across the whole catalog — effects convert properly; this rung is markup.
The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.
Want the whole screen instead of this one section? Open a page and copy it entire.
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse Retrieval & ContextCopying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
The RAG debugging surface: ranked passages with similarity as a meter, matched spans in real mark elements, and filter chips wired as a radiogroup so arrows move between them.
The published footnotes under an answer — ordered list, real cite and time elements, the claim each source supports, and a staleness warning written in words rather than shown as an amber dot.
Choosing what the assistant may read, with indexing state told honestly — a half-indexed source says so rather than showing a green tick — and the footer stating the effect of the selection, not its cardinality.
The refusal screen: says plainly that nothing was found, shows where it looked and the near-misses below threshold, and offers the two real ways out instead of inventing an answer.
What is in the context and what fell out of it — a stacked budget with the reply reserve drawn as a segment, and the dropped chunks named with the reason, which is the part nobody ships.
Retrieved sources ranked by how stale they are, because a confident answer from a two-year-old document is the failure people do not catch.
Which sources this answer may draw on, shown as a scope the user can read before asking rather than a citation list after.
How an answer is tied to its sources, and what the system does when it cannot find any.