# Knowledge base and retrieval

Show what the agent knows, where it came from and how fresh it is, and let people see the passages behind an answer.

For: Knowledge owners, and anyone who wants to check an answer.

Web page: https://candor.themethodic.com/screens/knowledge-and-retrieval

## Layouts

### Sources and freshness

Pick it when: Owners add, review and retire what the agent can use.

Layout: Sources grouped by where they come from, each with a freshness stamp, and an add box.

Items:

- **Knowledge sources** (`knowledge-sources`, Pro; https://candor.themethodic.com/docs/knowledge-sources.md): Where the knowledge comes from, grouped by door.
- **Source ingest** (`source-ingest`, Pro; https://candor.themethodic.com/docs/source-ingest.md): Add knowledge: drop files, paste a link, or paste text.
- **Freshness stamp** (`freshness-stamp`, Pro; https://candor.themethodic.com/docs/freshness-stamp.md): How old a piece of knowledge is.
- **Prose diff** (`prose-diff`, Pro; https://candor.themethodic.com/docs/prose-diff.md): An agent's rewrite of a page, word by word against the original.

```bash
npx candor-ui add knowledge-sources source-ingest freshness-stamp prose-diff
```

### Retrieval inspector beside the answer

Pick it when: Someone must check an answer against its sources, such as a reviewer or an engineer tuning retrieval.

Layout: The answer with citations on the left; the ranked passages the retriever returned on the right.

Items:

- **Retrieval inspector** (`retrieval-inspector`, Pro; https://candor.themethodic.com/docs/retrieval-inspector.md): The passages behind an answer, in the order the retriever ranked them.
- **Citation** (`citation`, free; https://candor.themethodic.com/docs/citation.md): An inline [n] that opens its source.
- **Confidence mark** (`confidence-mark`, Pro; https://candor.themethodic.com/docs/confidence-mark.md): How sure the system is, with what it rests on.
- **Provenance trace** (`provenance-trace`, Pro; https://candor.themethodic.com/docs/provenance-trace.md): Where a piece of information came from.

```bash
npx candor-ui add retrieval-inspector citation confidence-mark provenance-trace
```

### What the agent remembers

Pick it when: The agent learns from the account's people and they need to see and correct it.

Layout: A list of memories, one line each, with who taught it, and a mode switch above.

Items:

- **Memory manager** (`memory-manager`, Pro; https://candor.themethodic.com/docs/memory-manager.md): What agents remember about this account, one line each, with who taught it and when.
- **Memory mode** (`memory-mode`, Pro; https://candor.themethodic.com/docs/memory-mode.md): On, paused or off, with what each does to memories already kept.
- **Memory used** (`memory-used`, Pro; https://candor.themethodic.com/docs/memory-used.md): The line under a reply saying what it remembered.

```bash
npx candor-ui add memory-manager memory-mode memory-used
```

## Rules that matter most here

- **Unknown stays unknown** (https://candor.themethodic.com/principles#unknown-stays-unknown): When no source covers the question the answer says it doesn't know; a source with no date shows no age.
- **Reasoning is believed, not verified** (https://candor.themethodic.com/principles#reasoning-is-believed): Confidence is shown with what it rests on, not as a bare percentage.
- **Say what can and can't be undone** (https://candor.themethodic.com/principles#say-what-can-be-undone): Deleting a source says which answers it will no longer back.

A full-stack block builds this with an agent route and a store: `knowledge-base` (https://candor.themethodic.com/docs/knowledge-base.md). Each block has a `-claude` twin for the Claude Agent SDK.

## Brief for a coding agent

Paste this to the agent that builds the screen.

```text
Build a knowledge screen with Candor UI. Start from the knowledge-base block (knowledge-base-claude for the Claude Agent SDK): an agent answers only from published articles, cites each article and version, and says when it doesn't know.
KnowledgeSources lists where the knowledge comes from; SourceIngest adds files, links or pasted text; FreshnessStamp shows how old each piece is.
Next to an answer, RetrievalInspector shows the passages in the order the retriever ranked them.
Cite with Citation; show ConfidenceMark with what it rests on.
When no source covers a question, the answer says so. A source with no date shows no age.
For memory use MemoryManager, MemoryMode and MemoryUsed; deleting a memory says what it was used for.

Start from the "Sources and freshness" layout: Sources grouped by where they come from, each with a freshness stamp, and an add box.
Candor items: knowledge-sources (https://candor.themethodic.com/docs/knowledge-sources.md), source-ingest (https://candor.themethodic.com/docs/source-ingest.md), freshness-stamp (https://candor.themethodic.com/docs/freshness-stamp.md), prose-diff (https://candor.themethodic.com/docs/prose-diff.md).
Install: npx candor-ui add knowledge-sources source-ingest freshness-stamp prose-diff
Read each item's docs before using it and take its props from there; don't guess them. Pro and Premium items need the person's licence key, which they add with `npx candor-ui key <key>`; don't ask for it.
```
