•
9 min read

Local Hybrid Search Across 10,000 Screenshots Without a Cloud API

By: Carlos Granier
Glimpse window searching for glimpse in:glimpse. Left, a grid of eight matching screenshots, each marked looks like with a score. Right, the selected screenshot with every occurrence of the word Glimpse outlined, 10,049 images indexed, search in 22 ms.
Table of Contents

Every week, a knowledge worker saves dozens of screenshots: error dialogs, receipts, network diagrams, chat messages, configuration screens. When you need one back three months later, you remember a fragment of text, the topic, or what the screen looked like, not the filename.

The standard pitch is to send those screenshots to a cloud vision API and put the results in a hosted vector database. For real screenshots, that is a non-starter: they hold credentials, customer records, private messages, and internal dashboards. Glimpse is my answer on Windows: an open-source, MIT-licensed desktop app that searches 10,000+ local images by exact text, meaning, and visual appearance, with zero uploads, zero telemetry, and no admin rights required.

The constraints

Before picking models or UI frameworks, the environment set six hard constraints.

ConstraintReality
Corpus size10,038 real images on my own Windows box (screenshots, note attachments, Downloads)
Privacy boundaryNothing leaves the PC; no account, no telemetry; the only optional network call is downloading pinned model weights
Deployment footprintOne 92 MB per-user zip (%LOCALAPPDATA%\Programs\Glimpse), no admin privileges, no separate .NET runtime install
Hardware baselineLaptop GPU (RTX 2080 Super Max-Q) accelerates visual indexing, but the app must still run useful search with no GPU and no downloaded models
Interactive latencyGlobal hotkey (Win+Alt+S) search must feel instant while typing (under 60 ms median) and sit quietly in the tray (~250 MB RAM)
Living filesystemUsers rename, move, delete, and download files constantly while the app is running; external drives unplug

Architecture: where deterministic code stops and models start

Most local AI tools break when they ask a neural model to do work that a database does better. Glimpse draws a clear line between deterministic retrieval and learned ranking.

  • Deterministic core (always on, zero downloads): Windows’ built-in OCR engine (Windows.Media.Ocr, run across 8 workers) extracts text and word bounding boxes into a local SQLite database. An FTS5 table with a trigram tokenizer handles substring queries so any three-letter fragment matches anywhere inside a word and outlines the exact match on the preview.
  • Optional learned rankers (pinned ONNX weights): CLIP ViT-B/16 (392 MB, ONNX vision encoder on GPU via DirectML with CPU fallback; quantized text encoder on CPU) embeds what an image looks like. EmbeddingGemma 2 (330 MB, int8 ONNX on CPU) embeds OCR text for cross-lingual and conceptual recall, so “invoice” also finds “factura” and “to-do list” finds a checklist that never uses those words.
  • Deterministic fusion and graceful fallback: Embeddings are compared in memory with SIMD and merged with SQLite results via reciprocal rank fusion. Exact text hits always lead; loose text, meaning, and visual matches interleave beneath them with visible provenance badges (looks like, ≈ related text). Without either model downloaded, Glimpse still runs as a fast local OCR search engine.
  • Process boundary for shell integration: The PowerToys Command Palette extension (Glimpse.CmdPal) is an MSIX-packaged COM server. Instead of opening index.db directly and fighting over locks or virtualized AppData paths, it queries the warm tray app over a per-user named pipe and receives 256 px thumbnails as raw bytes.
Folders (watched)
  │
  ▼
[Glimpse.Core]  Windows OCR (8 workers) ──► SQLite + FTS5 trigram index (always on)
                ├─ Optional pass 1: CLIP ViT-B/16 (DirectML GPU / CPU fallback)
                └─ Optional pass 2: EmbeddingGemma 2 int8 (CPU)
  │
  ▼
[SearchEngine]  Exact text first ──► SIMD vector scan ──► Reciprocal Rank Fusion
  │
  ├──► [Glimpse.App]     WinUI 3 tray app + global hotkey + per-user named pipe
  ├──► [Glimpse.CmdPal]  MSIX Command Palette extension (talks over named pipe)
  └──► [Glimpse.Cli]     index / embed / search / bench / eval

Four real production bugs from the commit history

Glimpse went from first commit to a public release on October 7, 2026, and to v0.6.0 with semantic search on October 13 across 26 commits. Running it live against 10,000 real images exposed four bugs that unit tests on a clean folder would never catch.

1. Concurrent SQLite writes corrupted the index (cc0a602)

  • Symptom: Running the startup folder scan alongside live folder watching corrupted index.db, leaving database pages pointing past EOF after a WAL checkpoint.
  • Root cause: Both the startup scan and the folder watcher shared a single SqliteConnection and wrote from two threads at once.
  • Fix: ImageIndex now owns every transaction (UpsertBatch, RemoveMany) and locks all public members so no connection is used concurrently. The indexer serializes OCR passes so the watcher waits for a running scan, busy_timeout protects concurrent CLI and app runs, and on startup the app runs PRAGMA quick_check: if the index is ever corrupt, Glimpse moves it aside and rebuilds cleanly instead of crashing in a loop.

2. UI-thread database reads caused Windows “Application Hang” (7e75a5c)

  • Symptom: Right after rename and deletion handling shipped, Windows began reporting Glimpse as hung during heavy file activity.
  • Root cause: Four small blockers stacked together. Preview word outlines and Copy text read SQLite on the UI thread; self-healing search tried to delete stale rows through the search connection while waiting up to 10 seconds behind the indexer’s write lock; every rename or delete triggered an immediate UI refresh; and the folder watcher reacted to non-image noise like browser .crdownload temp files.
  • Fix: Moved preview outlines and stale-row cleanup onto background workers (ignoring stale completions), coalesced burst filesystem events into one refresh, and filtered out non-image temp files. Verified with a stress test: 300 indexed images deleted one by one, 150 download-style renames, and concurrent searches ran without a single UI stall and left the index clean.

3. Live screenshots silently skipped visual embeddings (cc076a7)

  • Symptom: Screenshots captured while Glimpse was already running became text-searchable, yet never received CLIP visual embeddings or updated the status bar until the next app restart. Startup scans worked fine, which masked the bug.
  • Root cause: Snapshotting the live process with dotnet-dump traced the stall to a single C# expression: the indexer incremented its processed-image counter inside progress?.Report(...). Startup scans pass a progress reporter; the folder watcher passes null. Because ?. skips evaluating its arguments when the receiver is null, the counter stayed at 0, the watcher assumed zero images were indexed, and the visual embedding pass never fired.
  • Fix: Pulled the counter out of the conditional call so live batches always announce new images to the visual pass, and wired previously swallowed watcher exceptions into Diagnostics.Report so failures land in the app log instead of vanishing.

4. EmbeddingGemma 2 ran 10x too slow on CPU (d1253ad)

  • Symptom: Adding EmbeddingGemma 2 (int8 ONNX) for search by meaning took about 350 ms per query on CPU, breaking interactive search latency.
  • Root cause: The exported ONNX graph left MatMulNBits nodes configured for float32 compute, which dequantized every weight on every single inference call.
  • Fix: On first model load, Glimpse rewrites accuracy_level=4 directly into the small ONNX graph file. Query encoding dropped from ~350 ms to ~35 ms (a 10x speedup) while holding 0.999 cosine similarity against the reference output. A separate runaway bug in the Command Palette extension (5262842), where constructing each result’s “More like this” page triggered eager like: searches in its constructor, was fixed by switching pages to lazy search on open.

Operational guardrails and observability

A local tool that runs in the background every day has to fail quietly when the environment changes without hiding real errors.

  • Self-healing without data loss (0ea71c0): Renaming an image or folder updates its index path in place while preserving OCR text and embeddings. If a search hits a deleted file, Glimpse drops the stale entry on the fly, unless the entire drive is missing, so unplugging an external drive or disconnecting a share never wipes its index.
  • Lock-free interactive search: Searches no longer queue behind background embedding passes; only model loading takes a lock, and toggling a model off stops the background pass immediately.
  • Built-in measurement (glimpse-cli bench and eval): Latency and retrieval accuracy are measured directly against the live 10,000-image library rather than guessed from synthetic fixtures, and GLIMPSE_DATA_DIR lets test runs target an isolated folder without touching production data.

Measured results

Measured on a laptop (Core i9-10980HK, RTX 2080 Super Max-Q) with 10,038 real images indexed:

MetricMeasured value
Text search (SQLite FTS5)1.8 ms median
Visual search (CLIP ViT-B/16)21 ms median
Text + visual together (default)27 ms median
Text + visual + meaning (EmbeddingGemma 2)54 ms median
”More like this” similarity search1.9 ms median
EmbeddingGemma query speedup (accuracy_level=4)~350 ms → ~35 ms (0.999 cosine vs. reference)
OCR throughput (8 workers)~64 images/s (9,284 images in 2 min 25 s)
Visual indexing throughput (GPU)~95 images/s (9,246 images in 1 min 37 s)
Index size on disk~10 KB / image (99 MB for 10k images)
Resident memory in tray~250 MB with visual search loaded
Retrieval eval (27 test queries, meaning off → on)hit@1: 5 → 9 · hit@5: 12 → 17 · MRR: 0.292 → 0.471
Cloud API cost / data uploaded$0 / 0 bytes

Where this pattern transfers

Replace personal screenshots with compliance records, field-service photos, engineering schematics, legal exhibits, or medical intake scans, and the architecture stays the same. Teams in regulated environments often sit on tens of thousands of unsearchable local images and PDFs that policy forbids sending to external APIs. Pairing deterministic OS/database indexing with small, optional local ONNX rankers, hard process isolation, and graceful text-only fallback delivers sub-60 ms hybrid search on hardware those teams already own.

The full source code and releases are public on GitHub, and the project overview lives on the Glimpse project page.

New posts by email

New posts and case studies, sent when they're published. Unsubscribe anytime.

About the Author

Carlos Granier is a Tech Founder, CTO, and AI Strategist with 25 years of experience building at the intersection of technology and business. He co-founded Pongalo, one of the first US Hispanic OTT platforms, and built a YouTube MCN to 200M+ monthly views. He now helps founders and executives implement AI as practical infrastructure. Based in Miami, Florida.

Connect on LinkedIn • Book a call

Let's Connect