mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 13:22:14 +00:00
The reference-grounding builder (buildSystemPromptWithReferences) and its SOURCES list shipped to no one: both live paths called the plain system prompt, so the model was asked to cite referenceId values it was never shown — and the parser rejects invented ids, so the citation machinery the schema and UI footnote already support stayed dark. Wire the builder into both consumers, passing the metric sections the snapshot actually carries (a weight-only run never lists BP guidance). Apply the fenced-JSON parse fallback here too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>