DEV Community

Pushpraj Patel
Pushpraj Patel

Posted on

Sloth Sorter

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

What I Built

Sloth Sorter is a lazy file tidier. Point it at a messy folder (my Downloads folder was the victim) and it reads each file, decides where it belongs, gives it a clean descriptive name, and files it away. You review a plan and approve it with one flag.

It saves the chore everyone puts off: dragging Screenshot (47).png, invoice_final_v2.pdf and download(3).zip into folders and renaming them. Anyone with a cluttered Downloads folder gets to be a little lazier.

Demo

[Add your video or GIF link here. A 20-second terminal recording of the dry run followed by --apply works well.]

Example of the dry-run output:

Screenshot 2026-10-12 at 9.41.03.png  ->  Images/dashboard-error-message.png
invoice_final_v2.pdf                  ->  Receipts/invoice-final-v2.pdf
notes.txt                             ->  Documents/meeting-notes-q4-planning.txt

Dry run: 3 files. Re-run with --apply to do it.
Enter fullscreen mode Exit fullscreen mode

Code

GitHub repo link here https://github.com/vikasfine17/sloth-sorter

It's a single Python file using only the standard library, plus a README.

How I Built It

  • Model: an open-weight model served locally through Ollama. The default is llama3.2:3b, and --model accepts anything Ollama can run.
  • How it works: for each file, the script sends the name, size and a short text preview to the local model. The model returns JSON with a category and a short kebab-case name. The script validates the category against a fixed list, sanitizes the name, and plans the move.
  • No dependencies: it talks to Ollama's local HTTP API with urllib, so there's nothing to install beyond Ollama itself.
  • Built to be trusted with your files:
    • Dry run by default, and nothing moves without --apply.
    • Every move is logged to .sloth-undo.json, so --undo restores it.
    • It never overwrites files; name collisions get a numeric suffix.
    • It skips files modified in the last 10 minutes, so it won't touch a half-finished download.
    • If the model is unreachable, it falls back to sorting by file extension.

Why Does Open Innovation Matter?

A Downloads folder is full of sensitive things: tax forms, IDs, receipts, contracts. Sending file names and previews to a hosted API just to tidy them would defeat the purpose.

Running an open-weight model locally gave me:

  • Privacy: file contents never leave the machine.
  • Offline use and zero cost: no API key, no per-file charges, and it works without internet.
  • Control: I can swap models with one flag, or edit the categories and system prompt to match my own filing system. A closed API wouldn't let me do both of those while keeping the data local.

Top comments (0)