DEV Community

Dinuka Ekanayake
Dinuka Ekanayake

Posted on

I Built a Sloth That Organizes My Files While I Do Nothing 🦥 (With Local Open-Source AI)

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

Every few weeks, my Downloads folder tells the same story: an invoice named document-final-2.pdf, meeting notes named notes.txt, an appointment reminder saved among work files, and a hundred small decisions I keep postponing.

I didn't need a smarter to-do list. I needed something that quietly finished one of those chores.

Meet SlothSort, a local-first AI file organizer. Drop supported files into an inbox and let a small open-weight model read what they're about. It suggests folders such as Finance, Work, Health, Learning and Personal—even when the filename gives away almost nothing.

But the interesting part isn't deciding which folder sounds right. It's knowing when not to decide.

SlothSort compares the similarity of each file against descriptions of my folders. If the best match is sufficiently strong and clearly better than the next-best match, it's eligible for sorting. If it's ambiguous, it waits for me. In the Streamlit interface, I can approve or edit suggestions in a table, then move files as one batch. Each move is recorded, and I can undo the last batch if I change my mind.

There's also an opt-in CLI watcher. With the model cached, it can sit on my laptop offline, wait for files to finish copying into the inbox, and file high-confidence documents as they arrive. It leaves uncertain files alone instead of guessing.

The result isn't an agent that makes grand promises. It's a tiny, deliberately boring assistant that helps future-me avoid the same chore again.

Demo

Video: https://drive.google.com/file/d/1W0rryGEoDbMFSZlAUHhUX4KzWopTyPSZ/view?usp=sharing

In the video I:

  1. Create 11 synthetic files with unhelpful names like note_005.txt.
  2. Run semantic matching with the local model and inspect suggestions and top-two gaps.
  3. Show a low-confidence file that remains unchecked for review.
  4. Approve a batch, show the created category folders, then undo it safely.
  5. Restart in offline mode and show that the cached model still performs inference disconnected from the internet.

The exact outcome and evaluation numbers will be added after running the model on my PC.

Code

GitHub: https://github.com/DinukaEk/slothsort-week3

The project is MIT-licensed and includes the local UI, Python CLI, semantic engine, document readers, safe file-moving journal, synthetic dataset, an evaluation script, deterministic tests, and a GitHub Actions workflow.

How I Built It

AI core: sentence-transformers/all-MiniLM-L6-v2, an Apache-2.0 open-weight sentence embedding model, run locally through the open-source Sentence Transformers library.

The model does not generate prose. It maps the file text and each folder's natural-language description into a shared vector space. SlothSort measures cosine similarity and ranks candidate folders. The top score and its margin over second place determine whether to mark a suggestion as ready or needing review.

# Simplified from slothsort/engine.py
vectors = encoder.encode(category_prompts + document_texts)
ranked = sorted(
    ((folder, cosine(doc_vector, category_vector))
     for folder, category_vector in category_vectors),
    key=lambda pair: pair[1],
    reverse=True,
)
ready = ranked[0][1] >= min_similarity and (
    ranked[0][1] - ranked[1][1]
) >= min_margin
Enter fullscreen mode Exit fullscreen mode

It is easy to confuse these similarities with confidence percentages. They aren't calibrated probabilities. That's why manual review and undo are essential to the design.

The files are handled by a deliberately narrow pipeline: extract limited plain text, embed locally, preview suggestions, move only selected files, write a SHA-256-backed audit entry, and provide a verified undo. File collisions get numbered names instead of overwriting other data. Watch mode checks stability between scans so it doesn't immediately move half-written files.

Test evidence: 32 deterministic unit tests passed in the initial build environment. These exercise the scoring logic, supported/unsafe file types, path validation, no-overwrite behavior, tamper detection, and undo. The unit tests mock embedding vectors; they do not prove production AI classification quality.

Real-model evaluation: [PASTE ACTUAL python scripts/evaluate.py --offline RESULT HERE]. The evaluator uses a small synthetic dataset, including one intentionally vague note. It also reports a transparent keyword baseline. It is a toy comparison, not a scientific or production benchmark.

Why Does Open Innovation Matter?

I didn't want to build an automatic organizer that demands a subscription to decide where notes.txt belongs.

With an open-weight model, the user controls the entire inference loop:

  • Privacy: the content is processed on the user's own machine. Local file contents aren't sent to a third-party AI endpoint.
  • Offline usefulness: after downloading the model once, sorting still works without Wi-Fi. I can demonstrate that by disconnecting my laptop during a scan.
  • Custom behavior: the five default folders are plain-text descriptions, not categories baked into an inaccessible hosted model. I can replace descriptions, adjust thresholds, or swap the model.
  • Predictable economics: there are no per-document or per-token API charges; running the model still has local CPU, memory, and electricity costs.

I haven't proved this small model is more accurate than every closed API. A larger hosted LLM might interpret unusual documents better. For this specific low-stakes, repetitive chore, however, keeping private content local and making every decision reversible matter more than buying maximum model intelligence.

Open innovation makes the shape of the product possible: an assistant I can inspect, modify, run without a provider account, and keep using when a service's pricing changes.

The Lazy Payoff

The payoff isn't “AI productivity” measured in vibes. It is fewer manual moves.

The project includes 11 synthetic demo files. [AFTER RUNNING: ADD NUMBER OF FILES AUTO-ELIGIBLE, NUMBER ACTUALLY MOVED, NUMBER SENT TO REVIEW, AND ANY REAL TIMING YOU RECORDED.]

For a transparent illustrative estimate, if a manual file decision takes 20 seconds, organizing 50 eligible files avoids up to 16 minutes 40 seconds of repetitive decisions before review time. That's a scenario, not a measured user study. A more honest success metric is the number of correct moves requiring no correction, which I'll track with the audit journal.

My favorite design choice is the boring one: uncertain files aren't silently moved. The sloth can work slowly, but it mustn't break anything while I'm not looking.


Thanks for participating in Hacktoberfest! 🦥

Top comments (0)