DEV Community

Tushar Singla
Tushar Singla

Posted on

SlothSort

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

What I Built

I have a Downloads folder I'm not proud of: IMG_2043.png, scan0012.pdf, final_v3_REAL.docx. Every few months I promise to clean it up, and every few months I don't.

So I built SlothSort 🦥, a lazy, fully local file tidier. It watches a folder, reads each file with an open-weight model running on my own machine, renames it to something sensible, and files it into a category folder (Documents, Receipts, Screenshots, Images, and so on).

It's named after the sloth because it's deliberately slow. In sloth mode, it waits until the folder has been quiet for 10 minutes, then tidies everything in one calm batch. Anyone with a chaotic Downloads or Desktop folder gets to be a little lazier.

Before:

IMG_2043.png
scan0012.pdf
final_v3_REAL.docx
Screenshot 2026-10-19.png
Enter fullscreen mode Exit fullscreen mode

After:

Receipts/2026-09-14-electricity-bill.pdf
Documents/project-proposal-draft.docx
Screenshots/2026-10-19-dashboard-error.png
Images/[beach-sunset-goa].png
``

Enter fullscreen mode Exit fullscreen mode


bash
ollama pull [qwen2.5:7b]
pip install -e .
python demo/make_messy_folder.py
slothsort once # dry run (default): shows what it would do
slothsort once --apply # actually does it
slothsort undo # changed your mind? reverse the last batch


## Code

{% embed https://github.com/YOUR-USERNAME/slothsort %}

## How I Built It

- **Model:** [Qwen2.5 7B], an open-weight model, served locally through **Ollama**. [Add a vision model if you used one for images.]
- **Pipeline:** `watchdog` detects files, then text is extracted (`pypdf` for the first ~2 PDF pages, plain reads for docs and code). The model returns strict JSON: `{"new_name": "...", "category": "..."}`.
- **Validation:** filenames are sanitized, original extensions are kept, and malformed JSON gets one retry before the file is simply left alone.
- **Safety first:** dry-run is the default and `--apply` is required to move anything. It never overwrites (collisions get a counter), never deletes, and never touches anything outside the watched folder. Every move is written to `~/.slothsort/log.jsonl`, and `slothsort undo` reverses it.
- **Sloth mode:** files are queued and processed only after the folder has been quiet for N minutes, so it doesn't fight with files that are still downloading.
- **Stack:** Python, Ollama, watchdog, pypdf, Typer, pytest (model calls mocked, so tests run without Ollama).

[Add one real "this surprised me" moment, e.g. a model returning filenames with slashes, or the 3B model being faster but weaker on receipts.]

## Why Does Open Innovation Matter?

**Your files never leave your machine.** SlothSort reads tax PDFs, ID scans, bank statements, and screenshots of private chats. A closed-API version would mean uploading all of that to a server I don't control just to rename a file. Here, the only network call is to `localhost`.

**It works offline.** [I tested it with Wi-Fi off and it worked. Confirm this before posting.]

**It costs $0 per file.** A tidier runs constantly on lots of small files, exactly the usage pattern that makes API bills creep up. After the one-time model download, mine is free.

**Swapping models is one line.** In `config.yaml`:

Enter fullscreen mode Exit fullscreen mode


yaml
model: qwen2.5:7b # try a Gemma, Llama, or a smaller 3B model




I tried [model A] and [model B]: [what you observed]. With a closed API, the model can be changed or deprecated underneath you. Here, I choose, and my setup keeps working.

## My Agent Session

[Optional. If you built this with Claude Code, save the session with DevRelay and embed it with the `agent_session` tag as described on the challenge page. Otherwise delete this section.]

## The Lazy Payoff

[Optional. Use real numbers only. For example: "My Downloads folder had 214 files. SlothSort sorted them in about X minutes, and I'd put that off for months." If you haven't run it on a real folder yet, do that first, or delete this section.]

## Prize Categories

[Check the challenge page and list only the partner categories that genuinely apply. If none fit, delete this section.]
Enter fullscreen mode Exit fullscreen mode

Top comments (0)