Guide

How to make AI agents cite sources in your knowledge base

To make AI agents cite sources, list each source in the document's frontmatter with a stable id, require a footnote such as [^billing-export] after every factual claim, and have a second agent check that each footnote says what the claim says. When there's no source, the claim stays out. Knowtarium, a desktop app that's in pre-order and not released yet, then lets you click any citation to see its source.

By Fadel Kaadan · Updated

Why uncited claims break AI knowledge bases

An agent can write a sentence that is fluent, specific and wrong, and it looks exactly like one it copied from a source. Once it's saved in your notes, nothing tells the two apart.

In a knowledge base that agents write, that one sentence doesn't stay put. The next session reads it as context and repeats it. A summary picks it up. A month later it appears in four notes and looks settled. Nobody invented it on purpose, and nobody can find where it came from.

A citation fixes this at the moment it's cheapest. When the agent writes the claim, it knows which file or page it read. Recording that takes one line. Reconstructing it later means reading every source again. And a rule that every claim needs a source changes what the agent writes: when there's no source, it has to say so instead of filling the gap.

This guide sets up citations by hand, in plain frontmatter any agent can write. After each step, a short note covers the same step in Knowtarium, a desktop app we make for knowledge bases written by people and agents together.

Cite per claim or per document

You can require sources at two levels. Most knowledge bases need both.

LevelHowUse it for
Per documentA list of sources in the frontmatterSummaries, overviews, notes built from one meeting or one report
Per claimA footnote after the sentence, pointing at one of those sourcesNumbers, dates, names, quotes and decisions: anything someone might act on

A good default: every document lists its sources, and every sentence with a number, date, name or quote cites one of them. Opinions and your own reasoning don't need a footnote, but they should read as opinions.

In Knowtarium

Both levels show up in Knowtarium. The document's sources appear in its properties, next to who wrote it and who checked it, and each footnote in the text is a citation you can click.

How OKF records sources in frontmatter

You could invent your own citation format, but a published one means every tool and agent reads it the same way. The Open Knowledge Format (OKF), an open specification published by Google Cloud, records provenance in a sources field and ties claims to it with footnotes:

metrics/churn.md
---
type: Metric
title: Churn
generated: { by: claude-code/2.1, at: 2026-09-26T08:10:00Z }
stale_after: 2026-12-31T00:00:00Z
sources:
- id: billing-export
resource: /references/billing-2026-09.csv
title: Billing export, September 2026
author: process:billing-sync
last_modified: 2026-09-25T23:00:00Z
- id: pricing-decision
resource: /decisions/2026-07-01-annual-plans.md
title: Switch billing to annual plans
---
Monthly churn fell to 2.4% in September.[^billing-export]
The drop followed the move to annual plans.[^pricing-decision]
[^billing-export]: Billing export, September 2026
[^pricing-decision]: Switch billing to annual plans

Each entry in sources needs a resource: a URL, a path inside the knowledge base, or a file in a references/ folder. The other fields are optional:

  • id: a stable key. The spec says it should be present whenever the body cites the source.
  • title: a readable label.
  • author: who or what produced the source, as an actor like human:maya or process:billing-sync.
  • last_modified: when the source itself last changed.
  • usage_count: how often the source was used over a period given in a sibling usage_window field.

The footnote label is the join key. The spec explains why it's an id and not a position like "source 2": agents rewrite these documents constantly, and a numbered reference points at the wrong source the moment someone reorders the list. A named id survives.

When a resource points at another document in the knowledge base, that link is the lineage: a reader can follow it to that document's own sources. OKF records these signals, not a trust score. Read the full rules in the OKF specification.

Rules that make agents cite

Agents follow the instructions file they read at the start of a session: AGENTS.md for most tools, CLAUDE.md for Claude Code. Add a sources section:

AGENTS.md (excerpt)
## Sources
- Every number, date, name, quote and decision needs a source.
- Add each source to `sources` with a short, stable `id` and a `resource`.
- Cite it right after the claim with a footnote: [^the-id].
- Only cite a source you opened in this session. Never invent a URL
or a title.
- Quote numbers exactly as the source gives them. Don't round.
- Save a copy of web pages and exports you cite in references/.
- If you can't find a source, don't state the claim. Put it under
"## Open questions" with what you'd need to confirm it.
- Never change a source's `id` once a document cites it.

Two of these do most of the work. "Only cite a source you opened" stops the agent from citing what it remembers a page saying. "If you can't find a source, don't state the claim" gives it somewhere to put a guess that isn't your notes. The full template is in our guide to AGENTS.md for a knowledge base.

Keep copies of what you cite. Web pages change and exports get overwritten. A saved copy in references/ means a citation can still be checked next year.

Have a second agent verify citations

Rules reduce bad citations; they don't remove them. An agent can cite a real source for a claim the source doesn't make. So check citations separately, in two passes.

1. The mechanical pass

Every footnote must match a sources id, and every id should be cited somewhere. You can see both lists from the terminal:

terminal
# footnote labels cited in the body
grep -o "\[\^[a-z0-9-]*\]" metrics/churn.md | sort -u
# ids declared in the frontmatter
grep -E "^ - id:" metrics/churn.md

2. The reading pass

Then have a different agent session read each claim against its source. Start it fresh, without the writing session's context, so it reads the document the way a stranger would. A different agent altogether, such as Codex checking Claude Code's work, is even better.

prompt for the checking agent
Check the citations in metrics/churn.md. Don't change the document.
1. For every footnote, find the sources entry with the same id.
Report footnotes with no entry, and entries nobody cites.
2. Open each resource. Report any that don't exist.
3. For each cited claim, quote the passage in the source that
supports it, or say that you can't find one.
4. Report claims with numbers, dates or names that cite nothing.
If every claim checks out, add yourself to `verified` with the
current UTC time. If not, list the problems and stop.

The last step records the check. In OKF, a verified entry from an agent makes the document machine-confirmed. When you read it yourself and add your own human: entry, it becomes human-reviewed:

frontmatter
verified:
- { by: second-agent/1.0, at: 2026-09-26T09:02:00Z } # the checking agent
- { by: human:maya, at: 2026-09-26T10:30:00Z } # you, after reading it

Don't let an agent sign for you

Tell agents never to add a human: entry. The human: prefix is what makes a verification count as a person's review, so it has to come from a person.

In Knowtarium

In Knowtarium, the two entries above are the two sides of verification: the agent's check makes the document machine-confirmed, your approval adds the human: entry, and both after the last change make it fully verified. Agents can't mark anything as checked by a person, so the rule in the callout holds even if an agent ignores it.

Sources change, so citations expire

A citation is true as of when someone checked it. Give documents with numbers a stale_after date, and record last_modified on sources you know change. When the September export is replaced by October's, the churn note should be rechecked, not quietly trusted. A document is stale once the current time is past its stale_after, whoever verified it.

In Knowtarium

Documents past stale_after turn stale in Knowtarium and join the review queue, which also shows what expires in the next 30 days. A refresh is a new change, so it gets its own review.

Traced citations in Knowtarium

Knowtarium reads the sources field and the footnotes that point at it, and puts them in front of you while you read. Nothing about the format changes: the citations are the same plain OKF your agents already write.

  • Every claim, traced. Click a citation to see the source behind it, who made it and how often it's used.
  • Properties, not raw YAML. The frontmatter shows as a readable list: who wrote the document, who checked it, when it expires and where it came from.
  • A graph coloured by trust. Every document takes the colour of its tier, so unverified notes stand out. Links to documents nobody has written yet show as dashed ghosts.
  • Full-text search. Find every document that mentions a number or a source as you type, with the matching line shown.

When a source or a number changes

Citations matter most when something changes. If an agent rewrites the churn note, the change waits in the review queue as a diff until you approve it. If you correct a number yourself, the edit waits for an agent check: when you ask, your agent reads the diff, follows links and documents that share a source, and proposes fixes wherever the old value still appears. Those fixes wait for your review too.

Knowtarium doesn't call an AI itself; the agents you already use do the writing and the checking. See all the features.

Questions

How do I make an AI agent cite its sources?

Write the rule into the instructions file it reads, such as AGENTS.md or CLAUDE.md: every number, date, name and quote needs a footnote pointing at a source listed in the frontmatter. Then have a second agent check each citation against its source.

Can citations stop AI hallucinations in my notes?

They don't stop an agent from making things up, but they make it visible. A claim with no source, or a source that doesn't say what the claim says, is easy to catch in review. Without citations, a wrong claim looks the same as a right one.

What is provenance frontmatter?

Fields at the top of a markdown file that record where the content came from and who handled it. In the Open Knowledge Format, sources lists the materials a document derives from, generated records who wrote it, and verified records who checked it.

Why use footnote ids instead of numbered citations?

Agents rewrite documents often. A numbered reference points at the wrong source as soon as the list is reordered, while a named id like [^billing-export] stays attached to the right source.

Should the same agent that wrote a note verify it?

Preferably not. Use a fresh session or a different agent, so the check doesn't inherit the writer's assumptions. For anything important, read it yourself too and add your own verified entry.

How do I see the source behind a citation?

In the markdown file, find the sources entry whose id matches the footnote label and open its resource. In Knowtarium, you click the citation and it shows the source behind it, who made it and how often it's used.