The appointment brief your doctor didn't give you.
Five specialist AI agents + 52 clinical sources + your patient profile → one cited appointment brief, verified against the corpus, designed to be handed to your OB-GYN.
- Live demo: https://second-opinion-eta.vercel.app
- Sample brief (no signup, no API call, static render): https://second-opinion-eta.vercel.app/sample
- Built for: Cerebral Valley's "Built with Opus 4.7" hackathon, April 2026
- Built by: James Olusoga · DareDev256 · Toronto
Adenomyosis affects 1 in 3 women. The average diagnostic delay is 11 years. Zero drugs have ever been developed exclusively for it. Every time my fiancée walked out of an appointment, her specialist had offered two options: hormonal contraceptives now, or a hysterectomy later.
The April 2026 Kho Clinical Expert Series (10.1097/AOG.0000000000006276) explicitly lays out at least four evidence-based pathways in between — pelvic MRI for staging, GnRH antagonists, LNG-IUS specifically, dienogest, MR-guided focused ultrasound, RFA, adenomyomectomy. Her specialist had not mentioned any of them. The literature is moving faster than clinical practice.
This is what an informed friend with a medical library would write for you the night before your appointment.
patient profile
+ uploaded PDFs (whole-chart, 1M-context read)
│
▼
┌────────┼────────┐ ← 3 specialists in parallel
│ │ │
▼ ▼ ▼
Dr. O'Reilly Dr. Laurent Dr. Amari
OB-GYN Repro Endo Chronic Pain
│ │ │
└────────┼────────┘
│
▼
SYNTHESIZER ← de-dupes, ranks by patient fit,
│ integrates all three lenses
▼
VERIFIER ← fact-checks every claim
│ against the 52-source corpus
▼
AppointmentBrief JSON
+ verification badge (green / yellow / red)
All five calls share the same cached system prompt (~32.5K tokens of clinical corpus + role + output rules). First call creates the cache, the other four within the cache TTL get ~90% input-cost reduction via prompt caching.
Unit economics (list prices):
- Cold brief — cache TTL expired or first call after deploy. Pays cache-write tax (~$3.29) on top of fresh input + output. Total: ~$5–6 per brief.
- Warm brief — within cache TTL, all five agents share the populated prefix. Total: ~$0.34 per brief.
The live cost panel on every generated brief shows the actual breakdown — cached input vs fresh input vs cache-write vs output — so the architecture is transparent end-to-end. At scale with steady traffic, warm cost dominates and the corpus tax amortizes across briefs.
Every clinical claim in the brief cites a corpus source by filename. The verifier flags any claim that doesn't. A green verdict means the brief is safe to hand to a doctor. A yellow or red verdict tells you and your clinician exactly what to re-check.
| Agent | Role | Mission |
|---|---|---|
| Dr. O'Reilly | OB-GYN | Medical + interventional + diagnostic options. Flags missing MRI staging, untrialed drug classes. |
| Dr. Laurent | Reproductive Endocrinologist | Fertility-preserving pathways. Miscarriage-risk data. IVF pretreatment protocols. |
| Dr. Amari | Chronic Pelvic Pain Specialist | Multidisciplinary pain plan. TENS, pelvic floor PT, central sensitization. Non-hormonal options. |
| Synthesizer | (no role-play; the composer) | Reads all three consult notes, de-duplicates, ranks by patient fit, surfaces disagreement as tradeoffs. |
| Verifier | (no role-play; the auditor) | Reads the composed brief + the corpus. Confirms every clinical claim has a citation AND the cited source supports it. Returns green/yellow/red. |
Each specialist writes a compact consult-note JSON (~1–2K tokens). The synthesizer composes the full AppointmentBrief schema (up to 32K tokens). The verifier writes a structured report that surfaces on every final brief as a visible badge.
Three capabilities from Opus 4.7 are load-bearing for this product:
- 1M context window. Drop an entire MyChart export (years of records, 200+ pages) and the model reads it in one pass. Sub-1M models can't do this in a single call. See
src/components/DocumentUpload.tsx— multi-file, 32 MB per file, 80 MB total cap. - Vision. MyChart PDFs, imaging reports, phone photos of paper notes, screenshots in any language — Opus parses them directly with no EHR-specific adapter.
- Prompt caching with ephemeral TTL. The 32.5K-token corpus is cached once per cold session; four subsequent agents all hit the same cache. 90%+ input-cost reduction on every warm call. See the
cache_control: { type: "ephemeral" }blocks insrc/app/api/generate-brief/route.ts.
- Three-case demo picker — Sandra (32 Toronto OHIP, fertility-preserving), Maya (28 Vancouver, suspected undiagnosed), Helena (41 London NHS, done with childbearing). Three different countries, three different life stages, one engine.
- Whole-chart upload — drag-drop any combination of PDFs/images. Opus reads them as a longitudinal record, noting treatment evolution and finding progression.
- Live multi-agent panel — three specialist streams light up in parallel in the browser, then the synthesizer composes, then the verifier audits. Judges watch the architecture work.
- Clickable citations — every claim's source pill links to the real PubMed paper, DOI, FDA label, ClinicalTrials.gov page, or program website.
- Quality-of-life adjuncts — the "what your doctor didn't mention" section: diet, supplements, movement, pain management, mental health, cycle-aware living. Evidence-graded honestly (uses "anecdotal" when that's what the evidence is).
- Printable doctor handoff page — the brief flips into a one-page markdown-rendered clinical document, written in first-person by the patient, that a doctor can read in under a minute.
- Email-this-brief — one-click mailto with a plain-text serialization, so the brief doesn't disappear when the tab closes.
- Editorial design — warm cream + aubergine + rose palette, Fraunces serif, asymmetric layouts, scrollytelling timeline of the 11-year diagnostic delay. Chosen against the AI-startup-dark-mode default so the site reads as a serious women's-health publication, not a chatbot wrapper.
- Next.js 16.2 (App Router, Turbopack) with React 19
- Anthropic SDK (
@anthropic-ai/sdk) —messages.stream()with content blocks for multi-doc vision + prompt caching - Streaming via NDJSON — each agent emits tagged events (
{"t":"agent_delta","a":"obgyn","d":"..."}) so the client can route chunks to the right panel pane - Tailwind v4 with a custom editorial palette (see
src/app/globals.css) - TypeScript strict, zero
any - Vercel hosting;
edgeruntime on the OG image,nodejsruntime on the generate-brief route for the large-payload vision support
src/
app/
api/generate-brief/route.ts ← orchestrates 5 Opus calls over NDJSON stream
page.tsx ← landing + state machine (intro/form/generating/result)
sample/page.tsx ← static /sample brief, renders SAMPLE_BRIEF
about/page.tsx ← founder narrative
privacy/page.tsx ← plain-English privacy page
opengraph-image.tsx ← edge-rendered OG image
globals.css ← editorial palette + paper grain + animations
components/
IntroScene.tsx ← hero + stats + before/after + how-it-works
DiagnosticDelayScroll.tsx ← scrollytelling — 5 doctor visits → "Adenomyosis."
AutoDemoLoop.tsx ← landing-page autoplay demo of the panel
ProfileForm.tsx ← patient-profile form + 3-case picker
DocumentUpload.tsx ← whole-chart multi-file drag-drop
PanelTheatre.tsx ← live view of 3 specialists + synth + verifier
BriefView.tsx ← renders AppointmentBrief + VerificationBadge
CitationPill.tsx ← hover-popover citation with real PubMed link
BeforeAfterSplit.tsx ← handwritten clinic note vs composed brief
lib/
anthropic.ts ← SDK client, model ID, max tokens
types.ts ← PatientProfile, AppointmentBrief, VerifierReport
stream-parser.ts ← NDJSON chunk parser + PanelEvent union
prompts/
system.ts ← shared system prompt (corpus + rules)
specialists.ts ← 3 specialist role primers
synthesizer.ts ← synthesis primer
verifier.ts ← verifier primer (fact-check against corpus)
corpus-metadata.ts ← 52 sources with clickable URLs
corpus/
compiled.ts ← ~32.5K tokens of clinical literature
01-clinical-guidelines/ ← Kho 2026, meta-analyses, drug data
02-care-pathways/ ← treatment centres with real contacts
03-trials-and-orgs/ ← ClinicalTrials.gov entries + advocacy orgs
data/
sample-brief.ts ← hand-authored static sample brief
demo-cases.ts ← Sandra / Maya / Helena demo profiles
# Prereq: Node 20+, an Anthropic API key
cp .env.local.example .env.local
# edit .env.local and set ANTHROPIC_API_KEY=sk-ant-...
npm install
npm run dev # localhost:3000
# build + run
npm run build
npm start
# type-check
npx tsc --noEmitSecond Opinion is a research-helper tool, not a medical device. It does not diagnose, treat, or provide medical advice. The output is a structured aid for a patient–clinician conversation, not a prescription. Every prose field is rendered with the explicit framing "discuss with your clinician."
Privacy: patient data is sent to Anthropic's commercial API for generation only. Anthropic's commercial terms prohibit using API prompts to train models. Second Opinion itself does not persist, log, or store patient data anywhere on disk or database. See /privacy for the full data-flow.
The verifier agent is our clinical-safety guard rail. It reads the composed brief and fact-checks every claim against the corpus before the patient sees the result. A yellow or red verdict means don't hand the brief to a doctor without re-reading the flagged claims first.
- Fiancée — for every walk-out-of-the-appointment moment that made this necessary, and for letting me tell her story.
- Dr. Mara Sobel (Mount Sinai Toronto), Adenomyosis Advice Association, Femade Canada — cold-emailed during the build. Any reply would be cited here.
- Anthropic — for Opus 4.7 and the 1M context window without which this product isn't possible.
- Cerebral Valley — for running the hackathon and processing $500 in API credits through the Org-ID saga.
Built in five days. Submitted April 26, 2026.