The web edition — The Counsel
The browser face of AI Legal UK is The Counsel — a legal assistant rendered as an editorial broadsheet rather than a SaaS dashboard. No command line needed. Open it in your browser, drop in a document, and watch the panel work clause by clause via SSE streaming. It looks like a premium legal title; it is completely free and open source.
What you'll see
- A warm-cream broadsheet — masthead, marginalia, drop-caps and Roman-numeral cells
- Six primary navigation entries: Chambers · Review · Generate · Caselaw · Library · Docs
- Drop a PDF, DOCX or paste text on
/review; SSE streaming as the panel reasons - A score gauge with the Contract Safety Score (0–100) and per-clause risk pills
- Marginalia from the Senior Counsel persona suggesting replacement language
- One-click PDF export of any completed review for your records
Under the hood
The Counsel is a Next.js 14 App Router application. The editorial design system lives in dashboard/components/counsel/ and is shared by every page. It runs locally on your machine and supports two operating modes.
Design language
| Token | Value | Notes |
|---|---|---|
| Paper | #f5f0e6 | Warm cream — the page itself |
| Ink | #1a1410 | Headlines and body type |
| Accent | #8b1f1f | Oxblood — used for italic display, drop-caps, risk underlines |
| Display / serif | Source Serif 4 | Italic for titles, drop-caps and the wordmark |
| Mono | IBM Plex Mono | Editorial kickers and masthead vol. lines |
| Sans | IBM Plex Sans | Buttons and small UI chrome |
Two Modes
| Mode | API Key Required | Data Source | Cost |
|---|---|---|---|
| Demo | No | Pre-loaded fixture data | Free |
| Live | Yes (Anthropic or OpenAI for review analysis) | Real provider-backed analysis via SSE streaming | Per-token |
Switch between modes using the toggle in the page header.
Pages
The editorial nav is six entries; everything else is auxiliary.
| Section | Path | Purpose |
|---|---|---|
| Chambers | /chambers | Home of active matters — recent activity, draft reviews, queued instruments |
| Review | /review | Drop a PDF / DOCX / paste text. SSE streaming as the panel works clause by clause |
| Generate | /generate | Draft NDAs, terms, privacy policies, agreements, board packs from facts |
| Caselaw | /caselaw | Judgment search via the Lex Graph; opens at /judgment |
| Library | /skills | Full register of 38 skills across 10 editorial categories |
| Docs | /docs | Quickstarts, concepts, reference, architecture, and contribution guides |
| Matter detail | /matter/[id] | Per-matter workspace — playbooks, document set, panel verdicts |
| Compare | /compare | Side-by-side contract diff with change highlighting |
| Legislation | /legislation | Browse and search statute via legislation.gov.uk |
| History | /history | Local-storage review history with per-filter empty states |
| Pricing | /pricing | Plans, what's included, and the always-free open-source build |
| Onboarding | /onboarding | First-run walk-through for demo vs. live |
| Settings | /settings | API key, mode, self-host link |
| The Panel | /counsel/agents | All twelve agents and their orchestration weights |
Key features
- SSE streaming for real-time analysis progress in live mode
- PDF export from review detail and compare pages via the browser print dialog
- Client-side persistence — reviews and settings stored in browser localStorage
- Statute linking — citations are auto-linked to legislation.gov.uk inline
- Demo / live mode indicator in the masthead so a sample is never confused with a live opinion
API Key Handling
Your Key Never Leaves Your Browser Unnecessarily
The dashboard server does not hold or persist any API key. The browser stores your provider key in localStorage under the key ai-legal-uk-api-key. Each request sends the key in the request body to the dashboard's own API route, which passes it directly to the selected provider adapter. The server never logs, stores, or forwards the key anywhere else.
Quick Start — hosted
The hosted edition is at the-counsel.co.uk. Sign up with email or Google, complete the brief onboarding, and you land in your Chambers with a personalised welcome and quick-instrument tiles.
Quick Start — local
cd dashboard
npm install
npm run devOpen http://localhost:3000. The dashboard starts in Demo mode by default — no API key needed to explore every feature. Authenticated routes (/chambers, /matter/*, /history, /settings, /onboarding) require Clerk env vars; without them the auth-gated pages will simply redirect to /sign-in.
For a fresh production deployment to your own domain (Vercel + Clerk + Neon + R2 + Resend), see the deployment guide.
Tech stack
- Framework: Next.js 14 (App Router)
- Design system:
components/counsel/— editorial broadsheet primitives (masthead, nav, marginalia, score gauges, risk pills) - Typography: Source Serif 4 + IBM Plex Mono + IBM Plex Sans
- AI: provider adapters in
lib/model-providers/(Anthropic, OpenAI, OpenAI Codex CLI) - Document parsing: TXT, DOCX, PDF text extraction with optional OCR fallback (OpenAI / Firecrawl)
- Auth: Clerk (
@clerk/nextjs) for sign-up, sign-in, and the production session token. Email/password + Google OAuth. - Database: Neon Postgres via Drizzle ORM. Tables:
users,matters,reviews,documents. Schema inlib/db/schema.ts. - Storage: Cloudflare R2 for document uploads and cached audio briefings via presigned URLs.
- Email: Resend for the welcome dispatch (triggered by Clerk's
user.createdwebhook at/api/webhooks/clerk). - Local-only state: the original demo flow still uses browser localStorage for unauthenticated users — review history, API keys, and mode toggle. Authenticated users see a server-backed view.