# Freshness stamp

How old a piece of knowledge is (Candor's FreshnessStamp). "Read 3 hours ago" when known; "Never read" when not; overdue when older than its schedule allows. A timestamp in the future is clamped and called out rather than shown as "in 2 hours".

- Registry name: `freshness-stamp` (`@candor/freshness-stamp`)
- Tier: Pro. Installing it needs a Pro, Premium or Team licence key: the person runs `npx candor-ui key <key>` themselves; never ask for the key in chat or write it to a file.
- Docs: https://candor.themethodic.com/docs/freshness-stamp

## Install

```bash
npx candor-ui add freshness-stamp
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/freshness-stamp`.
It brings in: locale, relative-time, utils.
npm packages: lucide-react@^1.67.0.

## Example

```tsx
"use client"

import { FreshnessStamp } from "@/components/freshness-stamp"

const hoursAgo = (h: number) => new Date(Date.now() - h * 3_600_000).toISOString()

export default function Example() {
  return (
    <div className="flex flex-col gap-2">
      <FreshnessStamp readAt={hoursAgo(2)} everyHours={24} />
      <FreshnessStamp readAt={hoursAgo(52)} everyHours={24} verb="Synced" />
      <FreshnessStamp readAt={null} />
    </div>
  )
}
```

## <FreshnessStamp>

Props:

- `readAt: string | null`: When it was last read (ISO date). null means it never was, shown as "Never read".
- `everyHours?: number | undefined`: Expected re-read interval; overdue past 1.5× this.
- `verb?: string | undefined`: The word before the time, e.g. "Synced" or "Checked".
- `className?: string | undefined`

## Strings (`freshnessStamp`)

The fixed words, English by default. Override any of them under `freshnessStamp` in `<LocaleProvider strings={{ freshnessStamp: { … } }}>`; the table is exported as `freshnessStampStrings`.

- `read`: Read
- `never`: Never {verb}
- `onDate`: on {date}
- `stamp`: {verb} {when}
- `stampOverdue`: {verb} {when} · overdue
- `timeUnknown`: {verb} time unknown
- `future`: This timestamp is ahead of the clock; treat it as unknown.

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider` (fixed strings) and `TermsProvider` (nouns); entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
