docs.tiesa.tech · en-GB

Architecture & structure

Detailed Mermaid and sequence live here so Search and Home stay light. Mobile-friendly law search tooling is rare — this site is the blueprint for Karolis and for serious readers (including potential competitors) who want the exact structure.

1. Host → project → repo map

  1. tiesa.tech / www.tiesa.tech → Vercel radau → git Kuglys/radau (private) — apex home with three product doors (Dora, Radau, MCP). Middleware rewrites / → /apex.
  2. radau.tiesa.tech → radau / Kuglys/radau · Production (main) — since 2026-09-28 the Claude-lane build: DORA, NIS2 and animals-in-science packs (EN/LT) with Pack v2 tables from the originals, reader /read, BM25 with LT/EN stemming, question-type intents, 1-hop cite expand, Jev final stage (server key).
  3. beta.radau.tiesa.tech → same project/repo · Preview / branch beta/mcdm-topsis — Prod search plus Beta-only AHP–TOPSIS ranking lane (not merged into main).
  4. claude.radau.tiesa.tech → same project/repo · Preview / branch claude/radau (branched from Beta) — next experiments (its 2026-09-28 build was promoted to main). See CLAUDE-LANE.md.
  5. dora.tiesa.tech → Vercel dora → git Kuglys/dora-graph-rag-prototypes (private) — frozen research PoC (Graph RAG vs Jev). Product routes unchanged.
  6. mcp.tiesa.tech → Vercel radau-mcp / git Kuglys/radau-mcp. Not on dora.
  7. docs.tiesa.tech → radau / Production — this page. Middleware rewrites / → /docs. Preview on any deploy: ?docs=1.

All three GitHub repos are private. Profile: github.com/Kuglys.

2. Where things sit in the Radau repo

  1. src/app/ — routes: / (home), /search, /read (whole act with hit column, two-act compare), /api/jev/advisor (Jev, server-side key), /apex (tiesa.tech), /docs (this site).
  2. src/middleware.ts — host rewrites for apex + docs; preview flags ?apex=1 / ?docs=1.
  3. src/lib/search.ts + stem.ts — MiniSearch index; terms are stemmed (Snowball LT/EN, nlp.js) and diacritic-folded, function words dropped.
  4. src/lib/text-norm.ts, intent.ts, smart-search.ts — Unicode-safe word matching, the 10 question types and the re-rank (Purpose, Tables, Body, intent boosts, intent-aware candidates).
  5. src/lib/graph-expand.ts — 1-hop cite expand; keeps the 8 most query-relevant neighbours.
  6. src/lib/mcdm/ — AHP–TOPSIS (Beta: only on the beta / claude lanes, hidden and forced off on radau.tiesa.tech), Jev client (jev-openrouter.ts: intent, rank, excerpt), lane detection (beta.ts).
  7. src/lib/segments.ts, sketch.ts, tables.ts, originals.ts — semantic parts for Jev’s best part, answer sketch, table detection, links to the official and archived originals.
  8. src/components/workspace/ — result cards, BlocksView (real tables), graph drawer, pipeline strip.
  9. scripts/enrich-packs.mjs — build step (Pack v2); scripts/eval/ — ranking evaluation; scripts/acceptance-tables.cjs, regress-*.cjs — live checks.
  10. governance/OUP/ — Karolis’s prompts, verbatim; MAINTAINING.md, CLAUDE-LANE.md — how to run and hand over the site.

3. Pack layout (Pack v2)

  1. Packs: dora-en/lt, nis2-en/lt, dir2010-63-en/lt (EU Directive 2010/63 + LT B1-866).
  2. A doc = article, recital, annex or table. IDs are packId:localId; the same localId in EN and LT lets the reader line up both languages.
  3. blocks: ordered paragraphs and tables (caption, header[][], rows[][], spans expanded). Every table is also its own doc (type: table, parentId = its annex), so “Tables only” is exact and a table can be found by its content.
  4. source: official URL + anchor; the build also archives a copy under /originals/.
  5. graph.json: cites and covers (annex → table) edges, one graph per pack.
  6. Tables per pack today: dir2010-63-lt 44, dir2010-63-en 36, NIS2 3 + 3, DORA 0 (its original has no annex tables).

4. From document to screen

  1. Offline: split the act; dir2010-63 packs are checked by Jev (title ↔ body) before publishing.
  2. Every build: enrich-packs.mjs re-reads the originals and writes Pack v2 (never fails the build).
  3. Question type: keyword cues (instant) + one Jev yes/no call per type (≈0.4 s, ≈$0.00003).
  4. BM25 (stemmed, stopwords dropped) + candidates that fit the question type.
  5. Re-rank: Purpose, Tables, Body, question-type boosts.
  6. Graph: 8 most relevant 1-hop citations. (AHP–TOPSIS re-rank: Beta lanes only — not ready for production.)
  7. Jev final stage: re-rank the top 12 on the full passage, pick the best part of the top 5; it is told the question type.
  8. Screen: cards (tables as tables), answer sketch, “Read in document”, “Original ↗”, Jev usage meter.

5. Quality & tests

  1. Ranking evaluation (scripts/eval/, 60 EN/LT gold questions): right article first 47 → 52, in top 3 56 → 60, MRR 0.863 → 0.928 (v01.1 vs the code before it).
  2. Table acceptance (acceptance-tables.cjs): 8 real tables from the originals must show as tables, survive “Tables only” and open in the reader — 8/8 on production.
  3. Live regressions: focus mode, Tables-only exits, graph click scrolling, answer-sketch deadlines, question types and Jev usage.

6. Releases & lanes

  1. v01.1 (2026-09-28): the Claude-lane build promoted to production — Pack v2 tables, reader, question types, stemming, Jev final stage.
  2. v01.2 (in progress on claude/radau): more documents (GDPR, AI Act, CRA, CER, ISO standards) and a quick selector for groups of documents.
  3. Work happens on a lane (claude.radau.tiesa.tech, beta.radau.tiesa.tech), is tested there, then main is fast-forwarded. Rollback = promote the previous deployment in Vercel.