Source code

1.3.0GPL-3.0

20 September 2026

How an answer finds its way back to its page

Citations are decided when a document is cut up, not when the answer is written. Here is where the offsets come from and what they do and do not prove.

Every retrieval tool ends up making the same claim: “answers with sources”. It is worth being precise about what that means, because the interesting engineering happens a long way from the answer.

In KnowNote, a citation is not attached to the answer. It is attached to the passage, and the passage acquired it at import time, before any model was involved at all.

Splitting is where traceability is decided

When a document is imported, its text is extracted and then cut into passages of roughly 500 characters with about 50 characters of overlap. Each passage records two numbers: where it starts and where it ends in the extracted text.

That is the whole mechanism. Everything downstream — retrieval, the prompt, the answer’s citation marks — is just carrying those two integers forward.

Two details matter more than they look:

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

Boundaries follow the document. The splitter prefers paragraph and sentence separators over a hard character cut, and the separator priority list includes full-width CJK punctuation rather than only ASCII, because a full stop is not always ..

What a citation resolves to

Each retrieved passage keeps its document, its passage index and its offsets. When the model answers, the passages that were put in front of it come back with the answer, so the interface can show them beside it and point back at the text they were cut from.

That is deliberately a weaker promise than “click the citation and land on the sentence”. The application today shows you the retrieved passage and where it came from in the extracted text. It does not yet open the source PDF at that page and highlight the span in place. Saying otherwise would make this post describe a product that does not exist yet.

So a citation resolves to a place in the extracted text, which is a stronger thing than a filename and a weaker thing than a pixel coordinate on a page. Both halves of that sentence matter.

What a citation does not prove

This is the part that citation features usually leave out, and it is the part worth stating.

A citation points at the passages the answer was built from. It does not certify that the sentence above it follows from them. If a model writes something the retrieved passages do not support, the citation still points at those passages, because that is honestly what happened.

The correct reading is therefore:

this is the material the answer had in front of it

and not:

this sentence is proven by this paragraph.

That distinction is not a flaw to fix; it is what a citation is. A tool that claims the second reading is overselling, and a reader who assumes it will be misled by a confident paragraph and four plausible-looking sources.

Where the model restates an idea that spans several passages, the answer carries all of them rather than manufacturing a single span that does not exist in the document.

Why offsets rather than page numbers

Page numbers feel more useful and are less reliable. They depend on the PDF reader, on text reflow, and on whether the page is a scan. Character offsets are boring and exact: they survive extraction, they can be compared, and they can be re-checked against the stored text without rendering anything.

KnowNote records page information for formats that have it, which is what lets a citation say “p. 14” as well as “chars 8,120–8,247”. The offsets are the mechanism; the page number is a courtesy.