feat(uk): UK legal adaptation - NVIDIA provider, FCL API, UK workflows, auth hardening

↗ view on GitHub · CD · 2026-08-05 · c39a9175

UK SYSTEM PROMPT
- Rewrote assistant persona for England & Wales (SRA, OSCOLA, CPR)
- Added UK_RESEARCH_SYSTEM_PROMPT and buildSystemPromptWithUKResearch() for
  National Archives Find Case Law tools instead of CourtListener

UK WORKFLOWS (9 templates)
- 7 Litigation: LBA, Response to LBA, Witness Statement, Without Prejudice
  Settlement, N1 Claim Form, Chronology Builder, Disclosure List
- 2 Employment: Grievance Letter, Settlement Agreement Checklist
- Merged into ALL_SYSTEM_WORKFLOWS alongside existing US workflows

NATIONAL ARCHIVES FIND CASE LAW API
- findCaseLaw.ts: searchFCL(), readFCLCase(), verifyFCLCitation()
- findCaseLawTools.ts: 3 tool schemas + FindCaseLawToolEvent discriminated union
- streaming.ts: FINDCASELAW_TOOLS wired in when includeResearchTools=true
  (default changed from true→false; UK research replaces CourtListener)
- contextBuilders.ts: buildSystemPromptWithUKResearch() called when enabled

NVIDIA PROVIDER
- nvidia.ts: full Chat Completions SSE streaming with multi-turn tool-call loop
- Models: meta/llama-3.3-70b-instruct (main), meta/llama-3.1-8b-instruct (title)
- Provider routing via model.includes("/") heuristic
- NVIDIA_API_KEY env var wired through userApiKeys

AUTH HARDENING
- auth.ts: fresh createServerSupabase() for DB ops - fixes JWT contamination
  when auth.getUser() is called on the same client (→ "JWT issued at future")
- userLookup.ts: INSERT → UPSERT with onConflict="user_id" - eliminates race
  condition on concurrent profile sync
- index.ts: global Express error handler + unhandledRejection guard (Node.js 25)

INFRA
- Frontend port 3002, backend port 4000 (avoids Protect & Serve conflicts)
- Supabase cloud project ueutbrecfctltyletmsv as DB
- all_migrations_combined.sql: 42 migration files merged for Supabase SQL Editor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Repository chattydogmagazine/mike
Author CD <39174241+chattydogmagazine@users.noreply.github.com>
Authored
Parents e32daad5
Stats 24 files changed , +3658 , -30
Part of UK legal adaptation

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-c39a9175.md from inside the repo you want the change in.

⬇ Download capture-commit-c39a9175.md