Skip to content

[stack] Add structured court case briefs - #210

Draft
ThatXliner wants to merge 19 commits into
mainfrom
codex/court-case-briefs
Draft

[stack] Add structured court case briefs#210
ThatXliner wants to merge 19 commits into
mainfrom
codex/court-case-briefs

Conversation

@ThatXliner

Copy link
Copy Markdown
Collaborator

What changed

  • adds a court-case-specific structured brief schema and rendering path
  • generates and caches briefs during court-case scraping, with exact-source quote verification
  • extends the retroactive brief job to backfill existing court cases
  • returns court briefs through the content API and removes the bill-only legislative timeline from case detail views
  • seeds all three local court cases with representative briefs so the interface is testable without an LLM key

Why

PR #198 intentionally scopes the article revamp to bills. This stacked follow-up applies the same rich, scannable reading model to court cases without forcing judicial records into bill-specific concepts such as provisions, funding, or legislative status.

Validation

  • validators, database, API, scraper, and Expo TypeScript checks
  • Expo and database lint
  • 31 scraper tests, including grounded-quote verification
  • local database seed refreshed 3 court-case briefs
  • git diff --check

ThatXliner and others added 19 commits July 26, 2026 15:35
The article pipeline emitted one ~900-word markdown blob per item. The prose
was careful — nonpartisan framing, sponsor claims treated as intent, removed
oversight named rather than called "streamlining" — but structurally it gave
the reader one decision: read all of it, or none of it. Nothing was scannable,
everything rendered at equal weight, and quotes were just italic text that
nothing verified.

A brief is the same analysis stored as typed pieces instead of prose: a hook,
stat tiles, before/after changes, affected groups, unknowns, a glossary, and
optional long-form sections. The reader can stop at any depth and still have
learned something true.

Editorial guarantees move into the types rather than being trusted to a prompt:

- `kind` on a change is mechanical (creates/repeals/waives/funds), never
  evaluative — a brief can say what a provision does, not whether it's good.
- `before`/`after` forces current law to be stated separately from the change.
- `direction` on an affected group tops out at mixed/unclear, so the model can
  decline to score a group instead of manufacturing symmetry.
- `unknowns` is non-empty: no brief can claim to have settled everything.
- Legal status is derived from the scraped bill status, so "would" vs "does"
  comes from a string match rather than an inference.

Generation is three steps, one of which costs a token. The LLM structures the
brief (grounded in the official text plus the existing vetted article), then
two deterministic passes run: every quote is checked verbatim against the whole
source document and stripped if it doesn't match — the claim survives, the
citation doesn't — and loaded political vocabulary in the model's own voice
triggers one regeneration. Quotes are exempt from the lint: a sponsor may call
their bill "common sense", and quoting that is reporting.

Argument-level framing deliberately stays in the existing cited dual-lens.
Briefs describe mechanism; the lens carries the debate.

Bills only. The schema is written around legislative mechanics, and executive
actions and court cases each need their own design pass — `content_brief`
already carries a contentType, so adding one is a generator, not a migration.
Content without a brief keeps rendering the markdown article.

Two adjacent fixes found while verifying this:
- `pnpm db:seed` had been failing outright: the fixture bill descriptions
  exceed the table's 100-char check constraint. Clamped with the same helper
  the scraper and API use.
- `pnpm test` in the scraper globbed `src/**/*.test.ts` unquoted, so the shell
  expanded it one level deep and silently ran 2 of 5 test files. Quoted, so
  Node's runner does the globbing: 23 tests now discovered instead of 7.

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
billion-nextjs Ready Ready Preview, Comment Jul 27, 2026 5:25pm

@ThatXliner ThatXliner changed the title Add structured court case briefs [stack] Add structured court case briefs Jul 27, 2026
@ThatXliner
ThatXliner changed the base branch from worktree-bill-brief-articles to main July 27, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant