DEV Community

Anirban Acharya
Anirban Acharya

Posted on

sloth-tidy

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

sloth-tidy is a tiny command-line tool that cleans up a messy folder so you don't have to. It reads each file's name (and the start of its text, if it's a text file), asks a local AI model what it is, then sorts it into a folder like Documents or Archives and gives it a readable name. Scan 001.txt becomes Documents/invoice-march-electricity.txt.

It's built for the "I'll sort my Downloads folder this weekend" crowd, which is to say, me.

Code

https://github.com/Anirban846/sloth-tidy

How I Built It

  • Model: any open-weight model served locally by Ollama. I defaulted to llama3.2:3b because it's small enough for a laptop.
  • Approach: one file per request, with the model forced to return JSON (format: json). I validate the reply: unknown categories become Other and names are slugified, so a bad answer can't produce a bad path.
  • Safety, because lazy people don't check: dry run by default, a collision-proof renamer that never overwrites, and an undo log so --undo puts everything back.
  • Dependencies: none. Python's standard library talks to Ollama's local HTTP API.
  • Fallback: if the model isn't running, it sorts by file extension instead of crashing.

Why Does Open Innovation Matter?

A file tidier reads your files. Receipts, scans, half-finished documents. Sending those to a closed API just to rename them felt wrong, so with an open-weight model the whole thing runs on my own machine with no account, no key, and no per-call cost. Set it up once and it's free forever.

It also means I can swap models with one flag (--model) as better small ones appear, and fix the behavior with a prompt edit instead of waiting on a vendor.

Top comments (0)