DEV Community

GS
GS

Posted on

A Lazy File Tidier That Never Deletes Anything

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

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

What I Built

SlothNest is a lazy file tidier. You point it at a messy folder, and a small open-weight model reads each file's name and a peek at its contents, then sorts it into a category folder with a cleaner name. I got tired of my Downloads folder looking like a junk drawer, so this does the sorting for me.

It's built to be careful, not clever. It never deletes anything, it only moves files into a SlothNest folder, and it keeps an undo ledger so one command puts everything back. It also works through a small batch at a time, because sloths don't rush.

Demo

Before: five messy files in a folder. Then python sloth.py apply sorts them, find shows where they ended up, and python sloth.py undo puts everything back exactly as it was.

Before and after run

The folder before

Code

SlothNest repo

How I Built It

  • Model: Gemma 3 (1B), an open-weight model from Google, served locally by Ollama.
  • Glue: about 100 lines of Python using the ollama library, with SQLite for the undo ledger.
  • How it works: for each file, the model returns JSON with a category, a short new name, and a one-line reason. The script validates the answer before moving anything.

The 1B model isn't perfect. Sometimes it returns a category that isn't in my list, or a filename with a stray space. One of those showed up in my first test, where untitled3.py got a leading space in its name. I fixed it with one line of code, and I added a fallback that sorts by file extension if the model's answer is unusable. A tiny model plus a few guardrails turned out to be enough.

I built and tested this in Google Cloud Shell with a fake messy folder. The tool is designed to run on a laptop against a real Downloads folder, and the settings (SLOTH_WATCH, SLOTH_MODEL) are environment variables, so no code changes are needed.

Why Does Open Innovation Matter?

A file tidier needs to read your files, and I don't want to send my receipts and homework to someone else's server just to rename them.

  • Privacy: with an open-weight model running through Ollama, the files stay on the machine doing the sorting.
  • Cost: no API key and no per-file bill. It's free to run on every download, forever.
  • Swappable: changing models is one setting (SLOTH_MODEL=...), so I can trade speed for accuracy without touching the code.

My Agent Session

N/A

The Lazy Payoff

I only tested this on five fake files, so I won't pretend I have a time-saved number yet. The plan is to schedule it (cron or Task Scheduler) to sort a few files every half hour, so the folder stays tidy without me doing anything.

Prize Categories

  • Best Use of Gemma

Top comments (0)