What I Built
My Downloads folder is a mess. It is full of names like Airtel_bill_oct(3).pdf, DS_unit3_notes_final.pdf and resume_v7_updated_final.docx, and sorting them by hand is a job I keep putting off.
SlothSort is a command-line tool that does it for me. You point it at a folder and it shows a plan: where each file should go and what it should be called. Nothing is moved until you add --apply. If you change your mind, one undo command puts every file back.
Examples of what it does:
Messy file to Where it goes
Airtel_bill_oct(3).pdf to Bills/2026-10 Airtel Broadband Bill.pdf
DS_unit3_notes_final.pdf to Study/Data Structures Unit 3 Notes.pdf
IMG_2231.jpg to Photos/IMG_2231.jpg
vscode_setup_x64.exe to Installers/vscode_setup_x64.exe
The effort it saves: I run one command, look at the preview once, approve it, and I'm done. I don't have to open files to see what they are, think of names, or drag anything.
I know local AI file organizers already exist. I focused on making this one safe to trust (preview first, undo, never delete) and on measuring how well it actually works.
Demo -
1: messy folder and empty terminal

2: running the command (“Scanning and analyzing files...”)

3: The plan table

4: --apply and the success message

5:Undo and Successfully restored files to their original locations!

You can also try it yourself without touching your real files. The repo has a script that builds a fake messy folder:
powershell
python scripts/make_test_folder.py
python -m slothsort test_downloads --ignore-recent # preview only
python -m slothsort test_downloads --ignore-recent --apply # do it
python -m slothsort undo test_downloads # put everything back
Code -
https://github.com/Sanasaifi786/SlothSort
How I Built It
Stack: Python, Ollama running Gemma 3 4B locally, pypdf and python-docx to read the start of documents, rich for the terminal tables, and pytest for tests.
The pipeline:
Scan the folder (top level only). Skip temporary files like .crdownload and anything modified in the last 10 minutes.
Rules first: extensions like .jpg, .exe and .zip are sorted instantly with plain rules. No AI needed.
AI only for unclear files: for PDFs, Word files and text files, I read the first ~500 characters and ask Gemma for a category and a clean name as JSON.
Validate the answer, build a plan, and show it as a table.
With --apply, move the files and write slothsort_undo.json so everything can be reversed.
Why hybrid: asking a 4B model what photo.jpg is wastes time. Rules handle the obvious files and the model handles the ones where the content matters.
I don't trust the model's output. The category must be in my allowed list, otherwise it becomes "Other". Broken JSON falls back safely. File names are cleaned of Windows-illegal characters, and name clashes become file (2).pdf. SlothSort never deletes or overwrites anything.
There are 33 automated tests covering file-name cleaning, name clashes, scanning rules, PDF and DOCX reading, AI output parsing, moving files and undo. They all pass.
Why Does Open Innovation Matter?
Files in a Downloads folder are often the most private things on a computer: bills, bank statements, tax forms, resumes, ID scans. Sending those to a cloud API just to get a file renamed felt wrong to me.
Running an open-weight model locally gave me:
Privacy: the file contents never leave my laptop.
Offline use: it needs no internet once the model is downloaded.
No ongoing cost: no API key, no per-file charge.
Swappable models: --model gemma3:4b or another model, with no code change.
Control: the categories live in a plain categories.json file that I can edit.
Where a closed model would be better: it would almost certainly be faster and more accurate. A small local model on a laptop CPU is slow and makes mistakes (see below). For this particular task I accepted that trade for privacy.
The Lazy Payoff
I built a small benchmark (scripts/benchmark.py) on a test folder of 35 files with known correct categories.
Mode Correct Accuracy Time
Rules only (--no-ai) 19 / 35 54.3% 0.00 s
Rules + Gemma 3 4B 32 / 35 91.4% 155.89 s
By hand 35 / 35 100% about 120 s (my estimate, not a stopwatch run)
What I take from this, honestly:
The AI added 13 correct files on top of the rules (19 → 32). Documents with unhelpful names are exactly where rules fail.
It is not faster than doing it myself. On my laptop the hybrid run took about 2.5 minutes, slightly longer than my rough manual estimate. The saving is attention, not clock time: I can start it and walk away.
The test folder is small and I created it myself, so 91.4% is an indication, not a general accuracy claim. Real folders will be messier.
Limitations: scanned PDFs without a text layer have no text to read, so SlothSort falls back to the file name. It only processes the top level of a folder. CPU speed depends on your laptop (mine is a Windows laptop with 16 GB RAM).
Next steps: a watch mode that tidies files as they finish downloading, OCR for scanned documents, and remembering my corrections.
Best Use of Gemma: I ran Gemma 3 4B locally through Ollama as the classifier for every ambiguous file.
Top comments (0)