Skip to content

Retrieval feeds the Enrichment prompt (#125) - #137

Merged
wschenk merged 1 commit into
mainfrom
claude/desktop-feature-deploy-loop-sqwp25
Aug 4, 2026
Merged

Retrieval feeds the Enrichment prompt (#125)#137
wschenk merged 1 commit into
mainfrom
claude/desktop-feature-deploy-loop-sqwp25

Conversation

@wschenk

@wschenk wschenk commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Research stops starting cold. Before a report is written, what this walk already worked out about the same things is retrieved into the prompt — Threads that named the same nouns first, then ones that merely read alike — each with the reason it is there, and a plain instruction to build on them and say which one.

The chicken-and-egg this had to solve. The Thread being enriched has neither mentions nor an embedding of its own: it earns both from the report about to be written. So both retrieval paths start from the Capture itself.

  • The embedding fallback embeds the walker's words at query time and asks the index with that vector, rather than looking the Thread up and finding nothing.
  • Mention-first — which would otherwise never fire on a first Capture, the common case — matches nouns the corpus already knows against the words the walker just used. A known noun appearing whole in what they said is the same exact link a stored mention would have been. Names under four characters are skipped: a short noun matches everything and means nothing.

Best-effort by construction. A Capture with no history is prompted exactly as it was before any of this existed. A retrieval that throws — a broken index, a gateway that will not embed — writes the cold-start report rather than failing the job. Every failure path is caught and returns an empty list.

Closes #125

Test plan

  • tests/enrichment-retrieval.spec.ts — a Capture whose past shares a noun gets that Thread in its prompt, with the walk date and the shared noun named; a Capture with no history produces a prompt containing no retrieval section at all; a repository whose index throws still completes with the cold-start report; a Thread linked only by resemblance is retrieved and labelled "reads alike"; the renderer's exact output; and the text matcher (whole words only, short names skipped, case-insensitive)
  • pnpm typecheck clean; pnpm test — 337 passed, 1 failed (trash-repository.spec.ts, Neon-backed, fails identically on a clean checkout of main here), 10 skipped
  • pnpm lint — 6 errors, all pre-existing

Two tests hardened. desk-priors-desktop failed once under full-suite load and passed on re-run. The cause is real and mine: rows paint from the local store before their Enrichments land, so asserting a mention-derived chip without first waiting for a mention-derived element is a race that only shows when both browser projects run at once. Both assertions now gate on the Mentions rail row, which cannot exist until Enrichments have loaded. I ran the full suite twice after the change.

Note for production

The retrieval quality depends on embeddings existing. Until mise run embeddings:backfill is run (after checking the model against the gateway's live /v1/models table), only Threads enriched since #124 have vectors — so the fallback half is thin and mention matching carries it. That is the intended degradation, not a defect.


Generated by Claude Code

Research stops starting cold. Before a report is written, what this walk
already worked out about the same things is retrieved into the prompt —
Threads that named the same nouns first, then ones that merely read
alike — with the reason each is there and a plain instruction to build
on them and say which one.

The Thread being enriched has neither mentions nor an embedding of its
own yet: it earns both from the report about to be written. So both
paths start from the Capture itself. The embedding fallback embeds the
walker's words at query time rather than looking the Thread up and
finding nothing. And mention-first — which would otherwise never fire on
a first Capture, the common case — matches nouns the corpus already
knows against the words the walker just used: a known noun appearing
whole in what they said is the same exact link a stored mention would
have been. Names under four characters are skipped; a short noun matches
everything and means nothing.

All of it is best-effort by construction. A Capture with no history is
prompted exactly as it was before retrieval existed, and a retrieval
that throws — a broken index, a gateway that will not embed — writes the
cold-start report rather than failing the job.

Also hardens two tests that read enrichment-derived UI: rows paint from
the store before their Enrichments land, so asserting a mention chip
without waiting for a mention-derived element was a race that only
showed under both browser projects at once.

Closes #125
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
walking-thoughts Ready Ready Preview Aug 4, 2026 1:37pm

Request Review

@wschenk
wschenk merged commit d178e7c into main Aug 4, 2026
3 checks passed
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.

Retrieval feeds the Enrichment prompt

2 participants