How It Works
How it works
The three-layer architecture
Every piece of text in Gearbox Relay moves through three stages: Capture, Enrichment, and Structure.
Layer 1: Capture
Text enters Gearbox Relay through multiple pathways:
Clipboard watcher — On desktop, a background process monitors your system clipboard. When you copy text anywhere — in a browser, a PDF, a document — it is captured automatically. The watcher runs with minimal resource usage and can be paused from the system tray.
Browser extension — The Chrome extension captures selected text via right-click → "Capture to Gearbox" or the keyboard shortcut Alt+Shift+R. This sends the capture directly to your local Gearbox Relay instance via a local HTTP endpoint, bypassing the clipboard entirely.
Mobile share — On iOS and Android, you can share text to Gearbox Relay from any app that supports the system share menu. This is the primary capture method on mobile since there is no clipboard watcher.
Manual paste — You can also paste text directly into the Gearbox Relay window. This is useful for capturing from apps that clear the clipboard or when you want to preview a capture before saving it.
Layer 2: Enrichment
Once captured, text enters the enrichment pipeline. This runs entirely on your device using local AI models.
Text AI — The default model is Qwen 3.5 0.8B (Q4_K_M quantization), downloaded automatically on first launch (~500 MB). It runs via llama-cpp-2 on desktop, MLX Swift on iOS, and MediaPipe on Android. The enrichment pipeline:
- Generates a one-paragraph summary of the capture
- Assigns relevant tags based on content
- Identifies semantic connections to other captures
Embeddings — A separate embedding model (all-MiniLM-L6-v2, 384 dimensions) runs via ONNX Runtime. This produces a dense vector representation of each capture that enables semantic search — finding captures by meaning, not just keywords.
Model agnostic — Gearbox Relay is not locked to Qwen. The model manifest at src-tauri/models/manifest.json defines available models. You can add any GGUF model that fits your hardware and preferences.
Layer 3: Structure
Your captures accumulate into a personal knowledge base with two complementary search systems.
Full-text search — SQLite FTS5 provides fast keyword search across all capture text, summaries, and tags. This handles exact matches, phrase search, and prefix matching.
Semantic search — LanceDB stores embedding vectors and enables similarity search. When you search for "things related to sustainable architecture," it finds captures about green building, environmental design, and eco-friendly materials — even if those exact words don't appear in your query.
Hybrid retrieval — Both search systems can be combined. Gearbox Relay returns results that match both keyword and semantic criteria, ranked by combined relevance.
Technology stack
| Layer | Desktop | Mobile |
|---|---|---|
| Framework | Tauri 2.0 (Rust + React) | Flutter 3.48 |
| Text AI | llama-cpp-2 (Qwen 3.5 0.8B GGUF) | iOS: MLX Swift, Android: MediaPipe |
| Embeddings | ONNX Runtime + all-MiniLM-L6-v2 (384-dim) | ONNX Runtime Mobile |
| Vector DB | LanceDB | LanceDB (via relay-core) |
| Search | SQLite FTS5 + hybrid LanceDB | SQLite FTS5 |
| Database | SQLite (r2d2 connection pool) | SQLite via relay-core |
| Sync | LWW object sync, OpaqueBlob v2 (AES-256-GCM) | Same protocol via relay-core |
Sync protocol
Gearbox Relay sync uses LWW (last-writer-wins) conflict resolution. This is a single-user, multi-device protocol — designed for syncing your own data across your own devices.
When the same capture is modified on two devices, the version with the higher last_modified timestamp wins. This is deterministic and simple, appropriate for personal use cases where conflicts are rare.
All sync data is encrypted client-side using OpaqueBlob v2 before transmission. The server stores only ciphertext. Keys are derived from your account password via Argon2id. This means:
- The server cannot read your data
- The server cannot give anyone else access to your data
- You need your password to decrypt sync data on a new device
Data flow
When you copy text, Gearbox Relay processes it through several stages:
- The clipboard watcher, browser extension, or mobile share detects the capture
- Text is sent to the enrichment pipeline
- Qwen generates a summary and tags; all-MiniLM generates an embedding vector
- The capture is stored in SQLite (metadata and full-text index) and LanceDB (vector)
- If sync is enabled, data is encrypted with OpaqueBlob v2 and transmitted to other devices
Performance characteristics
First capture — After installing Gearbox Relay and downloading the AI model (~500 MB), the first capture takes 2-5 seconds for enrichment. Subsequent captures are faster due to model caching.
Search latency — Full-text search responds in under 50ms for typical libraries (10,000+ captures). Semantic search adds 10-30ms depending on library size.
Memory usage — The AI model and embedding service load into memory on first use and stay resident. Typical memory footprint: 1-2 GB RAM.
Offline behavior — All features work offline. Sync resumes automatically when connectivity returns.
