Skip to main content

Module classify

Module classify 

Source
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 hashes down to non-video ones, for callers (like --reprocess) that build their hash list independently of pending_hashes and need the same video exclusion applied so the two paths can’t drift apart. A hash with no matching file_hashes row (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). See pending_hashes above for the equivalent single-query exclusion used when the caller list comes from embeddings directly 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 as embeddings::paths_for_hash).
pending_hashes
Hashes that have an embedding under model_id but 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.