Expand description
Classifications table: one row per unique content hash (photo/screenshot/
document/meme/unknown), keyed to embeddings.hash. Zero-shot classification
reuses embeddings videre embed already computed. See
docs/superpowers/specs/2026-07-29-screenshot-document-classification-design.md.
Functions§
- ensure_
classifications_ table - Create
classifications, keyed by(model_id, hash). - exclude_
video_ hashes - Filters
hashesdown to non-video ones, for callers (like--reprocess) that build their hash list independently ofpending_hashesand need the same video exclusion applied so the two paths can’t drift apart. A hash with no matchingfile_hashesrow (nothing known about its extension) is kept, not excluded, only a confirmed video extension is filtered out. Loads the full hash->ext mapping in one query rather than one query per hash, since callers can pass every embedded hash in the library (tens of thousands). Seepending_hashesabove for the equivalent single-query exclusion used when the caller list comes fromembeddingsdirectly rather than being pre-built like it is here. - insert_
classifications - Upsert a batch of (hash, category, confidence) rows inside one transaction.
- paths_
for_ category - (path, hash) pairs for every file classified as
category, one entry per on-disk path of a matched hash (same duplicate-path convention asembeddings::paths_for_hash). - pending_
hashes - Hashes that have an embedding under
model_idbut no classification yet. Excludes video hashes (.mov/.mp4), none of the four zero-shot categories (photo/screenshot/document/meme) fit a video frame well, so videos are never classified, per the video-embedding design’s decision.