What it does

scoreUrl(url) maps a result URL’s domain to a credibility tier and a 0–100 numeric score. Used by serperSearch() in the server to badge each web search result before returning it to the model and to the UI.

Source: KB/src/lib/credibility.ts (~108 lines).

Tiers

Defined as CredibilityTier = "authoritative" | "official" | "practitioner" | "uncertain" in KB/src/lib/types.ts:2.

TierScoreExamples
authoritative95imy.se, datainspektionen.se, bolagsverket.se, scb.se, edpb.europa.eu, eur-lex.europa.eu, riksdagen.se, government.se, ec.europa.eu, cnil.fr, ico.org.uk, datatilsynet.no/.dk, dpc.ie, pts.se
official78europa.eu, uodo.gov.pl, gpdp.it, aepd.es, cppa.ca, privacycommission.be, garante-privacy.it, coe.int, echr.coe.int
practitioner62iusmentis.com, gdpr.eu, gdprhub.eu, law.cornell.edu, scholar.google.com, ssrn.com — plus heuristic matches: any .law TLD, or .se containing legal or law
uncertain (news)42reuters.com, ft.com, bbc.com, svt.se, dn.se, aftonbladet.se, computerweekly.com, theregister.com, wired.com, techcrunch.com
uncertain (other)15anything not in the lists above

Sets are defined at module load (KB/src/lib/credibility.ts:4–54).

Domain extraction

extractDomain(url) (KB/src/lib/credibility.ts:56–68) uses new URL() parsing with a https:// prefix fallback for bare domains, then strips leading www.. If URL throws, falls back to manual replace/split.

Practitioner heuristic

isPractitionerDomain(domain) (KB/src/lib/credibility.ts:70–82) extends the explicit set with two pattern checks:

  • Domain ends in .law (the new gTLD)
  • Domain ends in .se AND contains legal or law (e.g. legalfirm.se)

UI rendering

<SourceBadge> (KB/src/components/SourceBadge.tsx) maps the tier to a colour + glyph:

TierGlyphColour family
authoritativegreen
officialblue
practitioneramber
uncertain?red

Used in <ChatMessage> source list (KB/src/components/ChatMessage.tsx:107) and in <ArticleViewer> citation list (KB/src/components/ArticleViewer.tsx:358).

Gotchas

  • Scores are coarse and binary per domain. There is no per-page authority signal — every page on imy.se scores 95, regardless of whether it is a regulator decision or a press release.
  • News tier is labelled uncertain despite having a higher score (42) than the catch-all (15). The label collision means <SourceBadge> cannot visually distinguish “respectable news outlet” from “random blog”.
  • The set lists are EU-DPA centric. A US authority like ftc.gov would fall to score 15.

See also

KB Architecture, KB Chat Flow, KB UI Components.

See also