marklok teaches Mike to cite Danish and EU law

This fork now recognises formal legal references and pulls the exact provision back as a clickable citation.

searchchat-ui

marklok has wired Danish statute law and EU regulation into the assistant. When it spots a formal legal reference in a question - a specific statute section, an article of an EU regulation - it now fetches that exact provision and the passages most similar to it, then surfaces them in the answer as clickable citations. A slide-in panel shows the underlying source. The material is pulled from Retsinformation, Denmark's official legal database, and EUR-Lex, the EU's law portal.

Two of the smaller fixes here travel well beyond Danish law: citations no longer silently vanish when they lack a page number, and the stop button stops tempting users to cancel an answer mid-stream and lose their references. Both are worth lifting even if Danish statute isn't your problem.

So what Anyone building legal AI for a civil-law jurisdiction - where citations follow a strict, predictable format - should study how this fork resolves them.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

4 commits from marklok/danishmike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
130ce0ae Add Danish law & EUR-Lex retrieval pipeline Markus 2026-05-08 ↗ GitHub
commit body
- Add lawRetrieval.ts: vector search + metadata-based fallback for specific
  § and Artikel references, merges results and dedupes
- Add ingestion scripts for Retsinformation and EUR-Lex (DORA, PRIIPs)
- Add document_chunks table migration and IVFFlat index (lists=20)
- Wire law context into chat and project-chat routes
- Add RETSINFORMATION_LAWS and EURLEX_REGULATIONS env vars to .env.example
- Ignore backend/data/ (local EUR-Lex HTML files) in .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20f4a079 Add inline law citation panel Markus 2026-05-08 ↗ GitHub
commit body
Law citations (Retsinformation / EUR-Lex) now open in a slide-in panel
on the same page instead of navigating to an external URL. Shows source
badge, full excerpt text, and a link to the original source.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
90a57483 Fix law citations not rendering as clickable pills Markus 2026-05-08 ↗ GitHub
commit body
- normalizeCitation: treat page:null as page=0 instead of dropping the
  citation (law chunks have no page number)
- Emit loading_citations SSE event when <CITATIONS> block starts so the
  frontend can track citation generation state
- Strengthen formatLawContext prompt to reliably produce <CITATIONS> blocks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3f95ec9d Fix streaming UX: hide stop button during citation generation Markus 2026-05-08 ↗ GitHub
commit body
When visible text finishes but the invisible <CITATIONS> block is still
generating, the stop button now switches to the send arrow so the user
can't accidentally cancel and lose citations. The streaming indicator on
the last message also stops during this phase.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-206.md from inside the repo you want the changes in.

⬇ Download capture-thread-206.md