This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady
What I Built
sloth-sorter is a lazy, fully local tidier for your Downloads folder.
When a new file lands, a small open-weight model reads the filename and the first bit of the content. It renames the file to something meaningful and files it into the right folder. scan0042 (3).pdf becomes Invoices/Invoice_Airtel_Oct2026.pdf. Every move is logged with a one-line summary, so a single command gives you a morning digest of what got sorted.
It is built for people who know their Downloads folder is a disaster and keep putting off fixing it. You set it up once and never think about it again.
Safety features, because nobody should trust an AI with their files on day one:
Dry run by default. It prints what it would do and moves nothing until you pass --apply.
Undo log. Every move is recorded, and undo --last N reverses the most recent moves.
It never overwrites. Name collisions get _2, _3, and so on.
It skips unfinished downloads (.crdownload, .part) and files that are still growing.
If the model fails, the file is left alone.
Demo
Code
bash
ollama pull qwen2.5:3b
python sloth.py once --folder ~/Downloads # dry run, moves nothing
python sloth.py watch --folder ~/Downloads --apply # lazy mode: runs forever
python sloth.py digest # what got sorted overnight
python sloth.py undo --last 5 # changed your mind
How I Built It
Model: a small open-weight model (default qwen2.5:3b) served locally by Ollama. The model is a command-line flag, so swapping in Gemma, Llama, or Phi is one flag.
Structured output: the Ollama request uses a JSON schema, so the model must return {category, new_name, summary}, and category can only be one of a fixed list of folders. That keeps a small model from inventing folders or returning free-form text.
Content reading: the standard library handles text, CSV, JSON, and .docx. pypdf is optional, for PDFs. Scanned PDFs and images fall back to the filename.
Dependencies: there are none beyond Ollama. The folder watcher is a simple polling loop with a “has the file stopped growing?” check, so there is nothing to install or break.
Cleanup layer: the model’s suggested name is sanitized in code (safe characters only, 60-character cap, original extension kept), so a bad model answer can’t produce an invalid filename.
Why Does Open Innovation Matter?
Downloads folders hold invoices, bank statements, ID scans, and medical reports. Sending those to a cloud API just to rename them is a bad trade.
Privacy: the contents never leave the machine. With a closed API, the tool would have to upload your most sensitive documents.
Cost: it costs nothing to run. Sorting thousands of old files would be a per-token bill on a hosted API. Here it only uses electricity.
Offline: it works with no internet at all.
Swappable models: I can pick the model that handles my own files best instead of whatever one vendor offers.
Control: the categories, the naming style, and the prompt are all editable, so the behavior is yours to change.
My Agent Session
The Lazy Payoff
Prize Categories
Top comments (0)