Sloth-ninja gives statutory citations a live reality check

A new paste-in checker lets solicitors test whether UK legislation cited in a draft actually exists before relying on it.

searchcompliance

Paste in a draft and the checker pulls out UK Acts, sections, regulations and statutory instruments, then checks them against legislation.gov.uk. Results separate provisions that are confirmed, missing or outside the tool's reach, with links back to the official source.

  • Verified legislation: confirms the cited provision exists and links to it.
  • Missing references: flags citations the live service cannot find.
  • Case citations: clearly marked as unverified because no permitted case-law source has been adopted.

The checker has sensible guardrails for long drafts and limits how many references it will test in one go. Its disclaimer matters: a provision's existence says nothing about whether it supports the argument around it.

So what Litigators and legal-ops teams reviewing draft-heavy work get a quick factual check before a bad citation travels any further.

View this fork on GitHub →

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

Commits in this thread

2 commits from Sloth-ninja/JessicaOSS, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
a84f0465 WS7: Citation Checker - live legislation.gov.uk verification sloth-ninja 2026-07-19 ↗ GitHub
commit body
Backend: new POST /citations/check (requireAuth, own rate limiter
RATE_LIMIT_CITATIONS_MAX default 20/15min, 100k-char cap with 413,
50-citation cap, whole-handler try/catch with fixed generic 500 detail).
Extraction regexes ported from evals/src/citations.ts into
backend/src/lib/citationExtraction.ts (provenance headers both ends; the
evals resolver is NOT ported - verification uses lib/legislation.ts's
verifyCitation, sequential to respect its ~1 req/s politeness bucket).
Neutral-case citations always return "unverifiable" with the fixed
Find Case Law / BAILII copy.

Frontend: /citation-checker page per the approved WS7 mock-up (paste-in
textarea, Check citations action, skeleton checking state, results table
with green Verified rows linking to canonical legislation.gov.uk URLs,
red Not found + reason, amber case-law rows, summary count line, footer
disclaimer), checkCitations in mikeApi.ts, and a "Research" sidebar group
with Citation Checker (ClipboardCheck).

Tests: 25 new vitest cases (extraction fixtures + route tests with mocked
verifyCitation); backend suite 122/122. Docs: env registry + module maps
in CLAUDE.md, .env.example, BUILD_LOG entry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1d0b2513 WS7 review fixes: 20k text cap (ReDoS mitigation) + politeness-bucket note sloth-ninja 2026-07-19 ↗ GitHub
commit body
Independent review of PR #24 (approve-with-fixes):

1. Availability: the ported ACT_TITLE regex is O(n^2) and extraction runs
   synchronously before the first await - a pathological 100k paste blocked
   the Node event loop ~6.7s (reviewer-benchmarked), stalling all requests
   including SSE chat. Minimal mitigation: MAX_TEXT_LENGTH lowered from
   100_000 to 20_000 (worst case well under ~0.5s). 413 copy, boundary
   tests (20_000 / 20_001), .env.example and BUILD_LOG updated. The regex
   itself stays byte-identical to evals per the sync mandate; a future
   synced regex fix in both suites remains recommended.

2. Documented the conscious trade-off that verification shares the global
   legislation.gov.uk politeness bucket with the chat tools (one
   50-citation check can queue chat legislation lookups for tens of
   seconds - by design, a single bucket is what politeness to the
   upstream host requires).

Co-Authored-By: Claude Fable 5 <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-1171.md from inside the repo you want the changes in.

⬇ Download capture-thread-1171.md