Back to projects

AI / MLPrototype2026

Plainsight

A legal and medical information assistant that answers in plain language and cites an official source for every claim: hybrid retrieval over 127 government documents, Claude Haiku answers measured at $0.0007 each, and a hands-free voice mode on Gemini Live.

127
Official documents indexed
3,738
Searchable passages
$0.0007
Measured cost per answer

Timeline

Oct 2026

Role

Design, retrieval pipeline and front end

Team

Solo

Domain

Legal information · Consumer rights · Voice interfaces

Status

Prototype

Stack

Next.js 16TypeScriptClaude Haiku 5.5Gemini embeddingsGemini LiveTailwind CSS 4

Source

Section 01

Overview

Plainsight answers everyday legal and medical-legal questions: rent increases, eviction notices, traffic tickets, consent to care. It covers four regions (British Columbia, Ontario, California, New York), and every answer is drawn from statutes, government guides and regulators, with a numbered citation on each claim.

The rule that shapes the whole app: the model is never allowed to answer from its own memory. Retrieval finds official passages first, Claude Haiku explains only what those passages say, and every answer carries a triage level that points to the right professional. It presents itself as general information, not legal or medical advice.

Home: four topics, one region, grounded in 37 BC sources
Plainsight home page with the headline 'Know where you stand, in plain language', four topic filters and suggested questions

Section 02

The Honesty Test

The question 'How much can my landlord raise the rent this year?' is the trap every legal chatbot falls into: the yearly percentage changes, and a language model will happily invent one. Plainsight's corpus intentionally holds the rules but not the current figure, and the answer says exactly that: the sources do not give this year's percentage, here is how the limit works, here is the official calculator.

Everything else in the answer is cited: the no-rounding rule, the 12-month wait, the 3 months' written notice on the approved form. The sources rail shows which passages were retrieved, each with its cosine score and keyword rank, so the grounding is inspectable rather than claimed.

A cited answer that refuses to invent the one number it does not have
Plainsight answer about rent increases with a triage chip, British Columbia badge, numbered citations and a sources rail showing 5 cited of 8 retrieved

Section 03

Retrieval

The library holds 127 documents from governments, tribunals, regulators, Crown insurers and legal-aid organisations, plus statute text. Heading-aware chunking turns them into 3,738 passages; Gemini embeddings (768-d, L2-normalised) live in an 11.5 MB binary file, so there is no vector database service to run.

Search is hybrid: BM25 rewards exact legal terms like 'security deposit', semantic search catches 'kicked out' meaning eviction. The two rankings merge with reciprocal-rank fusion, the chosen topic gets a gentle boost, each document contributes at most 2 passages, and the top 8 go to the model. The app's own How It Works page traces a real query live: for BC that is 1,195 candidate passages, 376 ms to embed, 3 ms to search.

The pipeline explaining itself on a real query
How Plainsight answers page showing corpus stats and a live trace with BM25 and cosine top hits for the rent question
Source library: every document the answers can draw from
Source library page showing 37 BC documents and 1,195 searchable passages with filters by type and topic

Section 04

Answering

Claude Haiku 5.5 writes the answer behind a byte-stable cached system prompt, with three rules: cite every claim, never invent figures or deadlines, and say so when the library does not cover something. Answers stream as NDJSON with a fixed structure: what the rules say, your options, next steps, when to get professional help.

Measured on repeated runs: 0.9 to 1.0 s to the first word, under 4.2 s for the full answer, about 3,900 tokens, $0.0007 per answer. Failure modes are designed in: if Claude is unavailable the app shows the top official passages instead, and if embeddings fail, search falls back to keywords and says so.

Options, next steps, and the measured footer: 3.8 s and $0.0007
Lower half of a Plainsight answer with next steps, professional help section and a footer reading haiku-5-5, 0.9s first word, 3.8s, 3,878 tokens, $0.0007

Section 05

Voice and Safety

A voice mode runs on the Gemini Live API: you talk naturally, Gemini transcribes and calls the same retrieval pipeline through a lookup_answer tool, and the cited answer appears on screen while it speaks. The grounding rules do not change because the modality did.

Safety is handled before search, not after: emergency phrases surface a call-911 / 9-8-8 banner immediately, every answer carries a triage level, and the disclaimer that Plainsight is not a lawyer or a doctor sits on every screen.

Plainsight home page on a phone
Home on a phone
Plainsight rent increase answer on a phone with triage chip and citations
A cited answer on a phone

Section 06

Results

Plainsight is the answer-engine pattern I now reach for when correctness matters more than fluency: retrieve first, cite everything, measure the cost, and make refusing to guess a feature.

  • 127 official documents, 3,738 passages, 4 regions, one 11.5 MB embedding file, no vector database service
  • Hybrid BM25 + semantic retrieval fused by reciprocal rank, at most 2 passages per document, top 8 to the model
  • Measured answers: first word in about 1 s, $0.0007 each, with citations on every claim
  • Asked for this year's rent cap, it says the number is not in its sources instead of inventing one