Prima Get an API key

The stone repository

Heading-anchored citations

A citation points at a section a person can open, not at a range of characters.

Live Built and working today on the surface this card describes.

What it does

A citation reads file § heading, with the line number beside it. That is a thing you can open.

It works because the repository is chunked by heading rather than by a fixed window. The chunk boundary and the citation target are the same object by construction. A window-based splitter makes them two objects that drift apart, and the citation stops landing where the text is.

Every chunk keeps its full heading trail, so a section nested three deep still knows what it sits under.

Text before the first heading in a file cites as the file alone. It is not given a heading it does not have.

Inputs and outputs

Label path § heading, or the path alone when there is no heading above the text.
Line The one-based line of the heading, or of the first line for text before any heading.
Trail The full heading path, outermost first.
What the model is told To cite the sections it used, in that format, and that what is not in the repository it does not know.

Configuration

Nothing to configure The format is fixed. It is the same string in the chat's interface, in what the model is handed, and in what an engraved note records as its sources.

Limits

  • A file with no headings cites as a file. That is accurate, not a degradation.
  • A long section is split into several chunks that all carry the same heading, so two citations can point at the same section with different line numbers.
  • A citation is a location, not a proof. It says where the sentence came from, not that the sentence is right.

Example

a citation, as it renders

handbook/holidays.md § Carry-over  (Line 42)

Source of truth

  • prima-chat/server/wiki.ts (`chunkMarkdown`, the heading trail, `citationLabel`, and the reasoning in the file header)
  • prima-chat/server/routes/tools.ts (the citation instruction handed to the model, outside the untrusted fence)