Sloth-ninja makes UK legislation research easier to interrogate

A dedicated research page turns citation lookups and title searches into a clearer route from statutory text to legal analysis.

searchworkflow

Sloth-ninja has added a legislation research surface for finding UK Acts and statutory instruments either from a natural-language citation or by title. Searches are submitted deliberately rather than firing on every keystroke, a sensible choice where broader title searches can take time.

  • Citation lookup finds a specific provision and shows its text, scope and relevant effects.
  • Title search lets users browse matching legislation, then open a selected provision in detail.
  • Amendment warnings remain visible when published legislation may lag outstanding changes, rather than presenting an apparently settled text.
  • Continue in Assistant carries the selected provision into the chat for follow-up analysis.

This will matter to legal teams that need a quick route into primary legislation without losing sight of whether the text may still be catching up with amendments.

View this fork on GitHub →

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

Commits in this thread

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

SHA Subject Author Date
0892e306 WS7: Legislation panel (legislation.gov.uk) sloth-ninja 2026-07-20 ↗ GitHub
commit body
Research › Legislation page + /legislation backend routes, per the approved
WS7 mock-up. One prominent input with two modes (look up a natural UK
citation, or search by Act/SI title), example chips teaching the citation
grammar, master-detail split for title search, and a provision view reusing
assistant/LegislationPanel with the amber outstanding-amendments band and a
per-effect list beneath it.

Backend: new src/routes/legislation.ts (both requireAuth, per-handler
try/catch), thin wrappers over the tested lib/legislation.ts - GET
/legislation/search?title= → {matches}; GET /legislation/lookup?citation= →
lookupCitation. No key gating (open OGL API). A failed lookup is a domain
result: HTTP 200 {resolved:false, citation, reason}; only unexpected throws
yield a fixed generic 502 (raw errors logged server-side only). Success
payload uses the same snake_case field names the chat tool emits so
LegislationPanel props align. Mounted behind the existing researchLimiter.

Frontend: new (pages)/legislation/page.tsx (submit-on-enter only - no
search-as-you-type, title search can take 3-6s). mikeApi searchLegislation /
lookupLegislation. Sidebar "Legislation" (Landmark) added to the Research
group between Company Search and Citation Checker.

Tests: 7 route-mapping tests (vi.mock("../lib/legislation")). Backend tsc +
vitest 140/140 green; frontend tsc clean; lint at the main baseline (34/78);
evals:smoke 4/4 from the main checkout. CLAUDE.md module map + BUILD_LOG
entry updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
f863815f WS7: fix SI search results dead-ending on lookup sloth-ninja 2026-07-20 ↗ GitHub
commit body
selectMatch resolved every chosen search result by its bare title.
Acts parse from a bare title but a whole statutory instrument has no
title-only parse branch, so SI results dead-ended on the "could not
parse" card. Resolve SI-typed matches by their parseable
"SI {year}/{number}" citation instead; Acts still resolve by title,
and the title stays the human label for the Assistant prefill.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
00869878 Merge remote-tracking branch 'origin/main' into ws7-legislation-panel sloth-ninja 2026-07-20 ↗ GitHub
# Conflicts:
#	docs/BUILD_LOG.md

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-1166.md from inside the repo you want the changes in.

⬇ Download capture-thread-1166.md