# I built a sloth that cleans my Downloads folder — meet slothsort 🦥

> Source: <https://dev.to/utkarshsonawane67/i-built-a-sloth-that-cleans-my-downloads-folder-meet-slothsort-4nik>
> Published: 2026-10-19 22:10:01+00:00

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

**slothsort** is a small Python CLI that tidies a messy folder for you. Point it at your Downloads directory — you know the one, with `Q3-budget-final-FINAL.xlsx` living next to `screenshot 2026-10-19.png` and an installer from 2024 — and it sorts everything into tidy category folders: Documents, Images, Videos, Audio, Archives, Installers, Code, and friends.

The twist: the sorting decisions are made by **Gemma, running locally through Ollama**. No accounts, no API keys, no filenames leaving your machine. And because sloths plan for every contingency, there's an honest offline fallback — when no model is reachable, deterministic extension rules do the sorting instead of an error message.

Repo: [https://github.com/sonawaneutkarsh/slothsort](https://github.com/sonawaneutkarsh/slothsort)

Here's a real run — offline mode, on a folder of 12 genuinely messy files:

``` bash
$ python3 -m slothsort /tmp/messy-desk --offline
slothsort would move 12 file(s):

  [Archives]
    backup-2024.zip
    font-pack.zip
  [Audio]
    podcast-ep12.mp3
  [Documents]
    meeting-notes.txt
    todo.md
  [Images]
    grandma-recipe-scan.jpg
    screenshot 2026-10-19.png
  [Installers]
    installer-v2.4.1.exe
  [Other]
    app-debug.log
  [Presentations]
    slides-pitch-deck.pptx
  [Spreadsheets]
    Q3-budget-final-FINAL.xlsx
  [Videos]
    vacation-clip.mov

Nothing moved (dry run). Re-run with --yes to apply, or --undo to revert the last run.
```

That's the whole pitch: **one command, zero decisions, twelve files filed.** The dry run is the default — slothsort shows you the plan and moves nothing until you say `--yes`. Changed your mind afterward? `--undo` puts every file back exactly where it was.

With Ollama running (`ollama pull gemma3`, then drop the `--offline` flag), filenames the rules don't recognize get classified by the model instead — `app-debug.log` stops landing in `Other` and gets filed where it actually belongs.

The architecture is deliberately boring, in the good way:

`--recursive` descends but never re-sorts folders it already created).`localhost:11434` — Ollama, plain HTTP, stdlib only. Default model is `gemma3`. The model must reply with `--yes`. Laziness, but make it safe.` a.pdf` becomes `a (2).pdf`, never overwritten), and every run writes a `.slothsort-manifest.json` so `--undo` reverses the whole thing.
The full test suite (19 tests, `python -m unittest discover -s tests`) covers the extension bands, model-reply validation, fallback behavior, plan building, collision handling, the apply/undo round-trip, the CLI, and the Ollama HTTP layer with mocks — no server needed to verify.

The challenge asked for the lazy payoff, so here are the numbers from the demo above: **12 files → 9 folders, 1 command, 0 decisions made, 0 files deleted, and a one-command undo** if I don't like where anything landed. The dreaded "I'll organize Downloads this weekend" task now takes eleven seconds, most of which is reading the preview.

This project only makes sense *because* the AI is open:

`--model llama3.2` and you're done — no code changes, no renegotiating with a vendor. The deterministic core (extension rules, preview, collision handling, undo) stays identical no matter which weights you plug in.
A closed model could file your PDFs. It couldn't do any of the three things above. That's the whole argument.

A `--watch` mode that tidies new downloads as they land, content sniffing (so `app-debug.log` is classified by what's inside it, not its name), and per-folder rules you can teach it once ("always put screenshots in Images/Screenshots"). All doable without touching the core.

*Built October 19, 2026 for the Hacktoberfest Week 3 DEV Challenge ("Slow and Steady"). Tags: #devchallenge #hf26challenge*
