Reading and surfaces
Reading: Markdown twins
This page is the behaviour reference for the features.llms setting. It makes the build write, beside each page, a plain Markdown file of that page's text, and one llms.txt at the site root that lists them. A reader that does not run a browser (a program fetching the page, a model given the page as text) can read the twin and not the HTML.
The setting
// culm.json
{ "features": { "llms": true } }It is a boolean. Any other value is refused with a problem at features.llms.
New projects have it on. culm init writes "features": { "llms": true } into culm.json (owner ruling 20).
Existing projects stay off. A culm.json without the key is the same as false.
With it off, the build output is byte-equal to a build before the setting existed.
packages/tools/__tests__/build/bundle.spec.tschecks every file of the site-basic build against a recorded set of hashes, for no features, { "llms": false } and { "llms": false, "gpu": false }.
With it on, the build adds files and changes none: culm-manifest.json and every other file are byte-equal to the off build (same test file, "llms on").
culm dev and culm measure do not write them (measure/run.ts compiles the site without them). This is a known gap.
The files
For each page that builds, the twin has the page's html path with .md added:
html file
twin
html file
index.html
twin
index.html.md
html file
about/index.html
twin
about/index.html.md
llms.txt is at the site root. It is an H1 with the site's name, a ## Pages heading, and one list item per page, in page order, each a link to the page's twin by a root-relative path:
# Basic
## Pages
- [Home](/index.html.md)
- [About](/about/index.html.md)Links are root-relative because no setting names the site's address. Characters that would end a link target (whitespace, parentheses, <, >, backslash) are percent-encoded. There is no summary line. A page that fails to compile has no twin and no line in llms.txt.
The twin path rule is Culm's choice. The llms.txt convention (llmstxt.org, read on 2026-12-05 through a web-fetch summary, not as raw text; the commit of the convention's repository was not confirmed) says a page's Markdown version is its address with .md added, or its extension replaced by .md. For an address with no file name it was not confirmed what the rule gives: the fetched text was garbled. Culm therefore does not claim to follow the convention there. It appends .md to the html path, so a twin is a file the build writes at a path nobody has to guess. The owner is to confirm this rule.
What a twin leaves out
A twin is the page's text and structure: headings, paragraphs, lists, tables, links and the text of buttons and labels. It leaves out:
Live content. A node that reads a live source (a list or a table; a live form is written the same way in the code, but no test covers it) is written as a line Live content: <source>, naming the source and not showing any row. A published live page holds no rows anyway; they come from the backend when the page runs.
Nodes hidden on every layout. The page does not draw them, so the twin does not hold them. A node hidden on the phone only is still in the twin.
Styling. No colour, size, spacing or layout.
Mail addresses. A plain mailto: link on a live page is already written without its address in the page; the twin does not write it either. A hidden mailto: whose text is the address itself is still written as user [at] domain, the same as the page.
Images, as their alt text. An image is written as Image: <alt>, and nothing if it has no alt text.
Inputs, selects, text areas, scripts, styles, SVG and anything marked aria-hidden.
A value from the site's own data (data-v-text) is written as Site value: <text>.
Text stays text: the escape rule
The twin has its own Markdown writer and its own escape. The HTML escape is not reused, because it does not protect Markdown. Author text reaches the file only through escapeMarkdown, which:
puts a backslash before every ASCII punctuation character;
writes : and @ as the character references : and @, so no https:// or a@b.co is left in the source to be read as an autolink;
makes each run of whitespace, line breaks included, one space, with none at either end.
So [x](javascript:alert(1)) in a page's text is written as \[x\]\(javascript:alert\(1\)\), and a line that starts # in the text is not a heading in the twin. Link destinations from the page are written inside <...> with <, >, whitespace, backslash and | percent-encoded.
What checked it, and what did not. No CommonMark or GFM parser could be installed (the registry was unreachable), so the committed escape tests run in fallback mode: they assert the exact written text, that no line starts with a block marker, and that no punctuation is left unescaped. They do not parse. Outside the repository, and not committed, the written text of about 35 hostile inputs, and a twin built from hostile page text, were read by markdown-it 14.3.3 and marked 18.0.11; neither gave a link, image, heading, list, quote, code, table or HTML that the input did not make itself. A parse-based test with micromark and remark is still owed, and one risk is unverified: a parser that finds autolinks after it decodes character references (remark-gfm may) could link a@b\.co.
Sizes
What a reader gets without running JavaScript, counted with o200k_base (js-tiktoken 1.0.21): see Stage 10a. In short, the seven sample pages are 21,787 tokens as HTML and 404 as twins (0.019). The sample application's live pages hold almost no text in the file, so that ratio describes a reader that does not run JavaScript, not a person's page.
Whether a model answers questions as well from a twin as from the HTML was not run; see the stage 10a exit record.
Previous
Next