DEV Community

Jainil Chavda
Jainil Chavda

Posted on

Sloth Sorter: an offline, low-RAM file tidier with undo

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission πŸ¦₯

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

Sloth Sorter is a command-line tool that tidies a messy Downloads folder so you don't have to. It sorts files into folders, optionally reads their contents to guess a better category, and can rename them. Everything runs offline on a low-end laptop.

It is built to be safe:

  • Dry-run by default. It shows a preview and moves nothing until you pass --apply.
  • It never deletes. It only moves and renames.
  • Undo with SHA-256 checks. Every move is logged in SQLite and can be reverted, and files that changed since the move are skipped.

Code

GitHub logo Jainil26 / sloth-sorter

Offline, low-resource AI file organizer. Sorts, renames and archives your messy Downloads folder with dry-run and undo. Open-source, no LLM or GPU needed.

πŸ¦₯ sloth-sorter

An offline, low-resource file organizer CLI in Python 3.14. Sorts, cleans, and categorizes messy folders (like Downloads or Desktop) with collision safety, dry-run by default, intelligent embedding-based document classification, smart keyword renaming, and cryptographically verified undos.

Designed specifically for low-end laptops with limited CPU, memory, and disk space:

  • Zero Heavy ML Bloat: No PyTorch, no sentence-transformers, no LLMs. Uses Model2Vec static embeddings (minishlab/potion-base-8M, ~30MB).
  • Tiny Install Footprint: Total virtual environment disk space is only ~303MB.
  • Lazy Loaded: Runs without --smart never import or load Model2Vec.
  • Never Deletes User Files: Moves and renames only.
  • Dry-Run by Default: Nothing moves without explicit --apply.
  • Safe Undo with SHA-256: SQLite-backed batch log tracks moves and renames, verifies hashes before reverting, and prevents overwriting conflicts.

πŸ—οΈ How It Works: 3 Tiers

Sloth Sorter uses a fast, hierarchical, multi-tiered approach:

                      [ Incoming File ]
…

How I Built It

My laptop can't run even a small LLM, so I used a three-tier pipeline that only reaches for AI when needed:

  1. Rules: extension and filename patterns, free and instant.
  2. Open-source embeddings (--smart): Model2Vec potion-base-8M (about 30 MB, CPU-only, no PyTorch) embeds the first ~2000 characters of a file. NumPy cosine similarity against category prototypes picks the category.
  3. Keyword renaming (--rename): a small built-in TF-IDF extractor builds names like 2026-03_electricity_invoice.pdf.

Stack: Python 3.14, Model2Vec, NumPy, PyMuPDF, python-docx, Rich, SQLite, pytest (44 tests passing). I built it over three days with Antigravity.

Benchmark on 30 synthetic documents: about 18 files/s, 191 MB peak RAM, 5 s model load (it includes the first-time download), 100% accuracy.

Why Does Open Innovation Matter?

  • Privacy: it reads your personal documents (ID cards, certificates, fee receipts) and none of it leaves the machine.
  • Runs on weak hardware: an open static-embedding model needs no GPU and no large download, which a closed API-based approach would not give me.
  • Zero cost: no API key or per-file billing, and it works offline after the first model download.
  • Swappable: categories and prototypes are plain config, so anyone can retrain them for their own files.

The Lazy Payoff

On my real Downloads folder (503 files), a single dry-run produced a full plan and a CSV report in seconds. 431 files were sorted by rules alone, and the embedding tier handled the other 72.

Honest limitations

  • The 100% score is on synthetic files written to match the prototypes. On my real, messy Downloads, the embedding tier was much weaker. For example, lecture PDFs landed in "Resumes", and a software license landed in "Invoices". I only reviewed these by filename, so treat this as a rough observation, not a measured accuracy.
  • Keyword renaming on real files was often unhelpful, so --rename is experimental.
  • The venv is about 303 MB, mostly PyMuPDF (172 MB). Swapping it for pypdf would shrink it.
  • Planned next: a stricter confidence threshold, keyword gates for risky categories, and a watchdog auto-sort mode.

Top comments (0)