Source code

1.3.0GPL-3.0

citation mechanism

Citations that resolve to a passage

An answer is only checkable if you can get back to the text behind it. KnowNote records where every passage began and ended in the extracted text of the document it was cut from, so a citation resolves to that passage rather than to the file.

A citation, from the reader's side

try it

Below is one real string standing in for a document of yours — the application's own description of itself — and the citations an answer would carry for it. Its offsets are computed when this page is built, which is exactly what the app computes on import. Choose a citation.

example source · package.json description ·179 characters · one chunk

A local-first knowledge note-taking tool that transforms your PDFs, documents, and web pages into a queryable, citable, and traceable personal knowledge base using RAG technology.

citations the answer would carry

Choose a citation to see the span it resolves to.

Where the offsets come from

Traceability is not a feature bolted onto the answer step. It is decided one step earlier, when a document is cut up.

Passage size
~500 charactersSmall enough that a quotation means one thing, large enough that it carries its own context. Paragraph and sentence boundaries are preferred over a hard cut where the format gives them.
Overlap
50 charactersConsecutive passages share a tail and a head, so a sentence that straddles a boundary is still whole in one of them.
Offsets
start + end, in charactersRecorded against the extracted text of the document, not against the rendered page. This is what a citation resolves to.
Provenance kept
document, passage index, offsetsEnough to point at the place, quote it, and show it beside the answer when you ask for the source.

Why passages overlap

A fixed-size cut eventually lands in the middle of a sentence, and a passage that starts mid-sentence is a bad thing to quote and a worse thing to retrieve. Overlap means each boundary is covered twice: the sentence that straddles one passage is whole in its neighbour. It costs a few duplicated characters and buys retrieval that does not depend on where the split happened to fall.

What a citation is not

These are the limits of the mechanism as it exists, not as it might be described.

It cites what it retrieved
not what the model assertedA citation points at the passages that were put in front of the model. If the model writes something those passages do not support, the citation is still to them — the honest reading of a citation is “this is what the answer was built from”, not “this sentence is proven”.
Offsets are into extracted text
page-level, not pixel-levelKnowNote records where a passage sits in the text it extracted from your document, which is page-aware for PDFs but is not a coordinate on the rendered page.
No citation for a paraphrase
by designWhen the model restates an idea across several passages, the answer carries all of them rather than inventing a single span that does not exist.