DEV Community

utkarsh sonawane
utkarsh sonawane

Posted on

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

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission 🦥

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

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

What I built

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

Demo

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

$ 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.
Enter fullscreen mode Exit fullscreen mode

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.

How it works

The architecture is deliberately boring, in the good way:

  1. Scan. Lists the files in your folder (top level by default; --recursive descends but never re-sorts folders it already created).
  2. Classify. Each filename goes to localhost:11434 — Ollama, plain HTTP, stdlib only. Default model is gemma3. The model must reply with exactly one category name; anything else — a sentence, an invented category, an empty reply — is rejected and the extension rules take over. The model never gets to invent folders.
  3. Preview. Dry-run prints the full plan grouped by folder. Nothing moves until --yes. Laziness, but make it safe.
  4. Apply + undo. Moves are collision-safe (a second 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 lazy payoff

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.

Why open innovation matters for this build

This project only makes sense because the AI is open:

  • Your filenames are personal data. A cloud API sorting your Downloads folder would see every bank statement, medical form, and half-written novel title you own. With local inference, none of it leaves your machine — there is no trust decision to make, which is exactly the point of automating something this personal.
  • Free forever. Sorting files is precisely the kind of tiny automation a per-token API would make silly to pay for. Open weights make the lazy option the free option: set it up once, nap forever. No accounts, no keys, no subscriptions to babysit — very on-brand for Sloth Day.
  • Models are swappable, not load-bearing. Don't like Gemma's filing instincts? --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.

What I'd do next

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.

Prize categories

  • Overall
  • Best Use of Gemma — Gemma (via Ollama) is the default classifier; the prompt design, strict reply validation, and model-swap architecture are built around it.

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

Top comments (0)