Skip to content

codingstark-dev/ogai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dlr (Downloads Local Retriever)

Local-first semantic indexing and search for your downloads folder.

It scans files, extracts searchable snippets, generates embeddings with Gemini, and lets you query from CLI or a local HTTP API.

Requirements

  • Zig 0.15.1 (or compatible with this project setup)
  • A Gemini API key
  • Optional external tools for richer extraction:
    • pdftotext (PDF text extraction)
    • exiftool (image metadata)
    • zipinfo (archive listing)

Configure Gemini API Key

Set your key in environment variable GEMINI_API_KEY.

Current shell session:

export GEMINI_API_KEY="your_key_here"

Persistent for zsh:

echo 'export GEMINI_API_KEY="your_key_here"' >> ~/.zshrc
source ~/.zshrc

You can also provide it inline for one command:

GEMINI_API_KEY="your_key_here" zig build run -- search "invoice pdf"

Build

zig build

Run

Run the binary through build runner:

zig build run -- <command> [options]

Available commands:

  • scan
  • scan [--all]
  • embed [--all] [--batch N] [--concurrency N] (defaults: --batch 256, --concurrency 16)
  • search <query> [--top N]
  • classify [--model]
  • backup [--apply] (default is dry-run)
  • serve [--port N]
  • stats
  • dupes

Quick Start

zig build run -- scan
zig build run -- embed --all --batch 256 --concurrency 16
zig build run -- search "find receipts" --top 10
zig build run -- stats

To build embeddings quickly in one go, use:

zig build run -- embed --all --batch 256 --concurrency 16

By default, scan runs in a strict generic-files mode (docs/media/archives) and skips source-code style files. If you really want broad scanning, pass --all:

zig build run -- scan --all

Dry-run backup plan:

zig build run -- backup

Apply backup actions:

zig build run -- backup --apply

Local HTTP API

Start server:

zig build run -- serve --port 7842

Endpoints:

  • GET /search?q=<query>&top=<n>
  • GET /file/:id
  • POST /label with JSON body:
    • { "file_id": 123, "label": "important" }
  • GET /stats

Environment Variables

  • GEMINI_API_KEY (required for embed, search, serve, classify --model)
  • DLR_DB_PATH (default: ~/.downloader/index.db)
  • DLR_ROOT (default: ~/Downloads)
  • DLR_DIMS (default: 768)
  • DLR_SERVER_PORT (default: 7842)
  • DLR_BACKUP_DIR (default: ~/Archive)

Tests

zig build test

About

Local-first semantic indexing and search for your downloads folder. It scans files, extracts searchable snippets, generates embeddings with Gemini, and lets you query from CLI or a local HTTP API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages