Postgres/pgvector as the product store for ingest, search, and citations #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Postgres + pgvector is the product store:
week/ingest/searchpersist and query embeddings whenDATABASE_URLis set.PostgresStoreimplements the same store API as memory (async-adapted). Local tests run against Docker pgvector without folklore--ignored. Agents retrieve ingested sources with citations for blog grounding.Gap:
gaps/GAP_1788152435.md§4.3, §7.1.Depends on live collect / Telegram / Tavily for what is ingested; this issue is the persistence and search path.
Current codebase
docker-compose.yml:pgvector/pgvector:pg16, port 5433, dbcl8y_research.migrations/001_init.sqland duplicated DDL instore::postgres::migrate.PostgresStore:upsert_async,search_async(ORDER BY embedding <=> $1). Does not implementDocumentStore. Search scores are0.0.parse_kindmaps unknown kinds toRepo(wrong; can mark garbage onchain-authoritative).ingestandsearchalwaysMemoryStore/ ephemeral collect.weeknever upserts.migraterequires--features postgres.tests/postgres.rssingle#[tokio::test] #[ignore = "requires DATABASE_URL and pgvector"]. CI postgres job setsDATABASE_URLand runs--ignored. Makefile has notest-postgres.Why this is needed
Agents cannot search what we ingested this week across processes. Fixture memory search is a toy. Local operators cannot prove pgvector without memorizing
--ignored. Blog grounding (editor issue) needs durable cited chunks.Constraints / guardrails
DATABASE_URLstill uses MemoryStore tests (no Docker required for jobs that skip postgres).DATABASE_URLis set, CLI must use Postgres (fail if feature not compiled).source_kind, citation text). Do not treat cosine hits as volume truth.EMBEDDING_DIMrequires a migration; hashing and live embeds must match dim.body(redact/fail before upsert).(source_kind, source_id)upserts (already in schema).Relevant files
src/store.rssrc/search.rssrc/embed.rssrc/main.rssrc/pipeline.rssearch_collectionmemory-onlymigrations/001_init.sqltests/postgres.rsdocker-compose.yml.gitlab-ci.ymlpostgresjobMakefileskills/cl8y-research-search/SKILL.mdRecommended direction
include_str!orsqlx migratefrommigrations/. Add HNSW (or ivfflat) onembedding. Returnscorefrom<=>or cosine.Storeenum used by CLI (memoryvspostgres). Week ingest after collect.searchCLI: printscore,source_kind,citation, snippet; warn iftelegram/web_search.make db+make test-postgres(docker compose up -d --wait+DATABASE_URL=... cargo test --features postgres).--ignoredfolklore).Acceptance criteria
cargo run --features postgres -- ingestwithDATABASE_URLupserts rows visible tosearch.week(fixture or live) upserts collection when URL set.searchhits have non-zero ranking scores and citations.PostgresStoreused through the same ingest/search API as memory.source_kinddoes not becomeRepo.make test-postgresdocumented; CI postgres job still green.--ignoredby folklore.Test plan — functional paths
source_idwith score > 0.(kind, id)updates body/embedding.source_kind=telegramin output.Test plan — attack, hack, and abuse
source_id/ query string with quotes; parameterized.REPLICATE_API_TOKEN=...rejected or redacted before insert.Verification criteria
docker compose up -d && make test-postgres(or README equivalent) green on a clean machine with Docker.marked as related to #2
marked as related to #3
marked as related to #4
marked as related to #6
marked as related to #8
marked as related to #11