Unlisted · noindex · design plan

Roxy — Smarter Retrieval Plan

Hybrid search & chunking · plan only, not a build commitment · August 13, 2026

This page details the "Smarter retrieval" tentative card on Roxy's status page. It explains why plain word search will eventually fail Bob quietly, and the three small upgrades — all inside Bob's existing Supabase — that fix it.

Status: plan only. Nothing on this page is built or scheduled. It becomes a build decision only after cited answers from the live library prove useful to Bob. It requires no new database, no new service, and no new monthly cost beyond pennies of embedding usage.

The problem, in plain English

Today, when Bob asks Roxy a question, Roxy finds documents by matching the words in the question against the words in the library (full-text search). This works well when the words line up — a ticker, a company name, an author's phrase.

It fails silently when they don't. If Bob asks about "datacenter power constraints" and the newsletter said "grid interconnect queues," word search finds nothing. Roxy then honestly reports a miss — on material the library actually contains. The answer looks trustworthy and is wrong about coverage. That is the most dangerous failure a research librarian can have, because nobody notices it happening.

Two smaller problems ride along: a search hit today returns a whole newsletter (thousands of words) instead of the paragraph that matters, and there is no clean way to ask time-and-author questions like "what was this writer saying in June versus now?"

The fix: three small parts

1. Search by meaning (hybrid search)

Alongside the existing word search, store an embedding for each passage — a numeric "fingerprint" of what the passage is about. Two passages about the same idea get similar fingerprints even when they use different words. At question time, Roxy runs both searches:

Supabase supports this natively via the pgvector extension — one column and one index on the existing tables. No second database, no external search service.

2. Split documents into passages (chunking)

Store each document's text as ordered passages (roughly paragraph-sized) that point back to their parent document. Benefits:

The schema already anticipates this (documentsdocument_chunks); this fills that layer in for the Substack corpus. Chunks carry an ordinal and parent-document reference so full context is always one join away.

3. Author and date as first-class filters

Investment research is dated claims by named people. Publisher, author, published date, title, and source URL should be queryable columns (most already arrive free in the mail headers), so that questions like these are real database queries, not text-matching luck:

What each part costs

PartChangeCost
Author/date metadataEnsure existing columns are populated and used as retrieval filtersMostly free — data already arrives in mail headers
ChunkingSmall migration filling the existing document_chunks layer; re-chunk current corpusOne-time script; cheapest now while the corpus is small
Hybrid searchpgvector column + index; embed passages at ingest; merge FTS + vector results at query timePennies to embed the current corpus; negligible ongoing

What this deliberately does not include

Acceptance proof (when built)

When to do it

Not now. At 28 documents, word search plus a capable model is genuinely good enough, and the current priority is proving cited answers Bob relies on. The right trigger is either of:

Chunking is cheapest done early (fewer documents to migrate), so if a build decision comes, chunking and metadata go first, embeddings second.