From 94f1290aae6b4e0873f6475b00d9f69b0b6599aa Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 11 Sep 2026 14:37:47 +0200 Subject: [PATCH] fix: references at the end, never in the body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A slide carrying [1] markers is unreadable from the back of a room, and an article that cites inline reads as a paper rather than as teaching material. The model is now told explicitly not to cite in the body — no bracketed numbers, no parenthetical "(Nelson, p. 2604)" inside sentences — and to put everything it drew on in a References section at the end, which in a presentation is the final slide. Checked rather than assumed: a six-slide deck generated through the grounded path contains zero in-text citation markers, and ends with a References slide. The prose keeps the specificity that grounding is for — bilirubin produced at two to three times the adult rate, conjugation immature until about two weeks, thresholds in mg/dL — without a single marker interrupting it. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU --- src/routes/learningAI.js | 9 ++++++--- test/learning-retrieval.test.js | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/routes/learningAI.js b/src/routes/learningAI.js index 28c40f2f..6184eb62 100644 --- a/src/routes/learningAI.js +++ b/src/routes/learningAI.js @@ -152,9 +152,12 @@ function buildGeneratePrompt(opts) { source += '\nThe following excerpts come from this institution\'s indexed clinical library. ' + 'Prefer them over your own recall wherever they disagree, and do not contradict them. ' + 'They are reference material, not a template: write the resource in your own words.\n\n' + - 'End the resource with a short References section listing only the excerpts you actually ' + - 'drew on, by title and page. In a presentation this is the final slide, titled References. ' + - 'Do not invent references, and do not list an excerpt you did not use.\n\n' + + 'Do NOT cite in the body: no [1] markers, no bracketed numbers, no parenthetical ' + + '"(Nelson, p. 2604)" inside sentences. Teaching material reads as prose, and a slide ' + + 'carrying citation markers is unreadable from the back of a room.\n\n' + + 'Instead, end the resource with a short References section listing only the excerpts you ' + + 'actually drew on, by title and page. In a presentation this is the final slide, titled ' + + 'References. Do not invent references, and do not list an excerpt you did not use.\n\n' + 'LIBRARY EXCERPTS:\n"""\n' + corpusContext + '\n"""\n'; } diff --git a/test/learning-retrieval.test.js b/test/learning-retrieval.test.js index abb6ae2a..451493a5 100644 --- a/test/learning-retrieval.test.js +++ b/test/learning-retrieval.test.js @@ -113,7 +113,12 @@ test('the corpus block tells the model to prefer it over recall', () => { assert.match(route, /reference material, not a template/, 'so it writes rather than copies'); // Provenance a clinician can check, on the deck itself rather than only in a // log. Restricted to excerpts actually used, and explicitly not invented. - assert.match(route, /In a presentation this is the final slide, titled References/); + // References belong at the end, never in the body: a slide carrying [1] + // markers is unreadable from the back of a room, and an article reads as + // prose, not as a paper. + assert.match(route, /Do NOT cite in the body: no \[1\] markers, no bracketed numbers/); + assert.match(route, /In a presentation this is the final slide, titled/); + assert.match(route, /'References\. Do not invent references/); assert.match(route, /Do not invent references, and do not list an excerpt you did not use/); // Opt in: a resource on something the library does not cover is better // written without it than padded with the nearest unrelated excerpts.