Spaces:
Running
References, out of three general primitives
From the design update: the References section.
maybe to not reinvent everything, we could just have models create a
"References" doc … generally, i dont want to much custom stuff, if possible
things that can generalize.
So there is no references data model here, no seeded page and no cite button.
An agent writes an ordinary page with one heading per source, and three
primitives — each useful on any page — turn that into a citation system.
1. Collapsible headings
A section folds to its heading, which is what makes a long references page
navigable. The arrow sits in the sheet's left margin (it never moves the text)
and a shut section is marked ···.
Folding is view state: it lives in the client, never in the Yjs document, so
collapsing a section on your screen does not collapse it on your collaborator's,
and nothing is persisted or synced. Sections are keyed by heading slug, so a
fold survives edits elsewhere on the page.
2. Section anchors
Links can address a heading: /d/<doc>/references#attention-is-all-you-need.
Following one opens the page, unfolds the section if it is collapsed — a
jump to something hidden is no jump — and scrolls to it with a brief wash.
Typing [[references#att offers that page's headings in the existing
autocomplete, and pasted URLs with a hash work too (hashchange, popstate and
first load all route through the same reveal).
The slug rule is one function shared by all three uses: lowercase, every run of
non-alphanumerics becomes a hyphen, repeats take -2, -3.
3. Link previews
Hovering an internal link shows what is on the other end: the section's heading,
its source URL and the start of its summary, with the page it lives on. Page
markdown is fetched once per 30s and parsed into sections — the parser is
fence-aware and skips a leading bare URL when picking the summary, because a
reference usually leads with its link.
The prompt
One short paragraph, as asked: keep a references page (create it when you
first cite something), one ### Source title section per source with the URL on
its own line and a 1–3 sentence summary, cite into it with the anchor form, and
never paste bare URLs into the prose.
Verification
A new browser test builds the references page exactly as an agent would (a
new-page suggestion, accepted), then cites it via the autocomplete and checks
the anchor, the preview's four fields, the jump, folding one section without
touching its neighbour, and that following an anchor into a folded section
opens it. A/B checked: without the client change the run fails at the heading
autocomplete. Full smoke and browser suites pass.