DEV Community

Anurag T
Anurag T

Posted on

Slothsort

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

My Downloads folder had 500+ files. Half of them were named things like scan0042.txt, doc1.txt, thing.md. I had no idea what was inside without opening each one.

So I built Slothsort โ€” a tool that runs a local AI model on your laptop, reads your files, and sorts them into clean folders like Finance/, Career/, Code/, Study/. It also renames them so they actually make sense.

You open the dashboard, see what it figured out, and click Approve. It never touches anything without your permission. If you change your mind โ€” one click undoes it.

Demo

๐ŸŒ Live demo: https://slothsort.onrender.com/

Here is how it works:

Drop files into the watched folder
Click Scan Directory
Slothsort reads each file and proposes where to move it
You review, approve, or skip โ€” nothing happens without your say
Every move is logged, every move is undoable
Code-

Anurag-tech22 (Anurag Nitin Thopate) ยท GitHub

Anurag-tech22 has 27 repositories available. Follow their code on GitHub.

favicon github.com

Built with Python + FastAPI for the backend, SQLite for storing all move history, and vanilla HTML/CSS/JS for the frontend. No heavy frameworks, no bloat.

How I Built It

The main idea: instead of sorting by file extension (which tells you nothing), read the actual content and let the AI decide what it is.

The model I used is Google Gemma 2 (2B) running locally through Ollama. It talks over a standard OpenAI-compatible API, so it also works with LM Studio or anything similar.

File โ†’ Read first 1KB โ†’ Gemma 2B on localhost โ†’ Category + clean name โ†’ Dashboard โ†’ You approve โ†’ File moved + logged to SQLite
A few things I had to figure out along the way:

Small models don't always return clean JSON. Sometimes they wrap the answer in a paragraph. I wrote a parser that strips all that noise and pulls out just the structured data I need.

Path safety. I added a check so the model can never propose moving a file outside your watched folder โ€” even if it hallucinates a weird path like ../../Windows/System32.

Offline fallback. If Ollama is not running, it automatically falls back to keyword + extension rules. No crash, no broken screen.

Does the AI actually help? I tested on 21 files with tricky names:

Method Correct Accuracy
Extension + keyword rules 14 / 21 67%
Gemma 2B running locally 17 / 21 81%
For scan0042.txt โ€” rules guessed Documents. Gemma read it, saw a GST tax ledger, and sorted it to Finance. That is the whole point.

Why Does Open Innovation Matter?

This tool reads your personal files. Tax records, resumes, medical stuff, private notes.

No way I am sending that to a third-party API. With Gemma running locally on my machine, everything stays on 127.0.0.1. No logs, no telemetry, nothing leaves my laptop.

It also works completely offline. No internet needed.

And if you want to switch models โ€” mistral, llama3.2, qwen2.5, whatever โ€” it is one environment variable change. No code changes at all.

A closed API would make all of this impossible or expensive. Local open weights made it free and private.

My Agent Session

I used an AI coding assistant while building this. A few things we worked through:

Tests were failing on Windows because symlinks need Developer Mode. Fixed the test suite to handle that gracefully.
Hardened the JSON parser against weird outputs from small models.
Built a proper benchmark script so I had real numbers, not guesses.
36 tests passing, 0 failing.

The Lazy Payoff

I genuinely have not manually sorted my Downloads folder all week.

Before: 45 minutes of clicking and drag-dropping once a month.
Now: open dashboard, click Approve, done in under a minute.

Every move is logged. Undo is always one click away. Nothing gets overwritten.

That is the sloth lifestyle. Let the model do the work. ๐Ÿฆฅ

Prize Categories

1)-Best Use of Gemma(Slow and Steady) โ€” Built around Google Gemma 2 (2B) running locally on device. Zero cloud. Celebrates doing less, the smart way.
2)Best use of Render

Top comments (0)