This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady
What I Built
SlothSort is a lazy file tidier that runs entirely on your own machine. Point it at the folder you keep ignoring (mine is Downloads) and a local open-weight model reads each file's name and a snippet of its contents, decides where it belongs, and can even give it a clean name. Files older than 90 days get archived by year.
We all have a folder full of final_v2_REAL.pdf and IMG_2231.jpg, and we all keep promising to sort it "this weekend." SlothSort does that chore so you never have to.
It's built to be safe enough to trust with a messy folder:
-
Dry run by default. Nothing moves until you pass
--apply. -
One-command undo. Every run is logged, so
--undoputs everything back. -
Sloth mode.
--watchchecks the folder every few minutes and otherwise does nothing. - Graceful fallback. If the model isn't running, it falls back to simple extension rules instead of crashing.
It's one Python file with zero dependencies. No pip install, no web app, no accounts.
Demo
Here's what a run looks like:
SlothSort looking at /home/me/Downloads [model: llama3.2:3b]
IMG_2231.jpg -> Images/IMG_2231.jpg
notes_final_v2.txt -> Documents/meeting-notes-q3-planning.txt
setup.exe -> Installers/setup.exe
taxes.pdf -> Archive/2024/Documents/taxes.pdf
Dry run: 4 file(s) would move. Add --apply to do it.
Code
SlothSort
A lazy, fully local file tidier powered by an open-weight model.
Your Downloads folder is a mess. You know it, and you keep putting it off. SlothSort does it for you: a local LLM reads each file's name and a snippet of its contents, decides where it belongs, and (optionally) gives it a clean name. Old files get archived by year.
Everything runs on your machine. No cloud, no API keys, no internet required. It's a single Python file that uses only the standard library, so there is nothing to pip install.
Built for the DEV Hacktoberfest Week 3 challenge: Slow and Steady.
Features
-
Local AI sorting: uses any open-weight model served by Ollama (default:
llama3.2:3b). -
Dry run by default: nothing moves until you pass
--apply. -
One-command undo: every run is logged, so
--undoputs files back. -
Smart renaming:
--renamelets the model suggest clean…
How I Built It
Open pieces:
-
Ollama for local inference, serving an open-weight model on
localhost. -
Llama 3.2 3B as the default model. It's small enough to run on a laptop, and
--modelswaps in any other open-weight model (Gemma, Qwen, Mistral) without code changes.
How it's wired together:
- SlothSort scans the target folder (non-recursive) and skips hidden files, half-downloaded files (
.crdownload,.part), and anything modified in the last two minutes. - For each file, it sends the model the filename, an extension hint, and the first ~600 characters of text-like files.
- The model replies with JSON,
{"category": "...", "new_name": "..."}, using Ollama's JSON mode at temperature 0 so results are consistent. - If the model returns an invalid category or errors on a file, that file falls back to a simple extension rule. A flaky model never breaks the run.
- Files move (or are just listed in a dry run), name collisions get a numeric suffix so nothing is overwritten, and a log is saved so
--undoworks.
It talks to Ollama over its plain HTTP API using only Python's standard library, so the whole tool stays one file you can read in five minutes.
Why Does Open Innovation Matter?
Downloads folders are full of invoices, ID scans, tax documents, and private notes. A closed API would mean uploading all of that to someone else's servers just to decide which folder it goes in. That's a bad trade for a chore this small.
Running an open-weight model locally changed what was possible:
- Privacy: your files never leave your machine. There is no "trust us" step.
- Offline: it works on a plane, on bad Wi-Fi, or with no internet at all.
- No bill: a tidier that checks every few minutes would rack up API calls forever. Locally, after the one-time download, it costs only electricity.
-
No lock-in: the model is one flag. If a better open model comes out, you switch with
--model. Nobody can deprecate it, reprice it, or change its behavior under you. - Hybrid by design: the open model adds the smarts, but the tool still works without it. That kind of fallback is hard to build when your core logic lives behind someone else's API.
Top comments (0)