DEV Community

Richmond Andoh
Richmond Andoh

Posted on

SlothSync: The Zero-Touch Offline Desktop & Inbox Tidier

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

SlothSync is an autonomous, lightweight desktop daemon that runs entirely offline. Utilizing local open-weight models (Google Gemma-2 via Ollama), SlothSync automatically inspects, categorizes, renames, and moves files into clean folder structures while generating concise daily action summaries.

The Problem It Solves

Digital clutterβ€”unsorted download folders, misnamed receipts, scattered screenshots, and unorganized documentsβ€”wastes time and mental bandwidth. Manual file sorting is tedious, yet users are hesitant to use cloud-based automation tools due to high subscription costs and severe privacy risks associated with uploading personal documents to external servers.

The Solution

SlothSync is a zero-touch solution that:

  • πŸ“ Monitors target directories (~/Downloads, ~/Desktop) in real-time
  • ⏳ Debounces file writes (3-second wait after write completes)
  • 🧠 Classifies files using Gemma 2B via local Ollama API
  • πŸ“‚ Routes to standard folders: Invoices, Reports, Screenshots, Archives
  • πŸ”„ Resolves conflicts with _v1, _v2 suffixes (never overwrites silently)
  • πŸ‘οΈ Dry-run mode for safe preview before execution
  • πŸ“œ Logs all activity to ~/.slothsync/history.json
  • πŸ“Š Daily summaries: "SlothSync organized 18 files today while you relaxed."

Effort Saved

Users never manually sort files again. The daemon runs silently in the background, and each evening a daily notification summarizes activity. No recurring costs. 100% private. Works offline.

Who benefits? Anyone with a cluttered Downloads folder, students with misnamed receipts, freelancers with scattered screenshots, or anyone who values privacy and zero recurring costs.


Demo

PyInstaller Executable (No Python Needed)

The build is available at dist/SlothSync β€” a standalone executable that requires no Python installation, no virtual environment, and no pip install.

Platform: Linux (64-bit)
Size: ~43MB
Requires: Ollama + gemma2:2b model installed locally

How to run:

# Download dist/SlothSync from the GitHub Releases
chmod +x SlothSync
./SlothSync          # Real mode - actually moves files
./SlothSync --dry-run  # Preview mode - shows what would happen
Enter fullscreen mode Exit fullscreen mode

Video Demo

Screen recording showing SlothSync automatically organizing a cluttered Downloads folder. File moves from ~/Downloads to ~/Documents/Invoices/ with real-time Rich CLI output. Daily summary notification displayed.

Demo:

Screenshots

Screenshot Description

Screenshots:
| | **Before** | Cluttered  raw `~/Downloads` endraw  folder |<br>

| | **After** | Files auto-moved to correct folders

| | **Rich CLI** | Color-coded output:  raw `βœ… Moved: file.pdf β†’ [green]receipt[/] Invoices/` endraw  |

 **History** |  raw `~/.slothsync/history.json` endraw  entries

 **Daily Summary** |  raw `


Code

GitHub Repository: https://github.com/Richmond-Andoh/slothsync

Repository Structure

slothsync/
β”œβ”€β”€ .gitignore              # Python/venv/SQLite exclusions
β”œβ”€β”€ classifier.py           # Gemma 2B file classifier (1,017 lines)
β”œβ”€β”€ daemon.py               # Rich CLI daemon (21,429 lines, 3 commits)
β”œβ”€β”€ streamlit_app.py        # Streamlit web dashboard (localhost:8501)
β”œβ”€β”€ venv/                   # Python virtual environment (27 packages)
β”œβ”€β”€ dist/SlothSync          # PyInstaller executable (~43MB)
β”œβ”€β”€ README.md               # Comprehensive installation & usage guide
└── dev_to_article.md       # This Hacktoberfest submission
Enter fullscreen mode Exit fullscreen mode

Key Files Explained

classifier.py β€” Gemma 2B File Classifier

The "brain" of SlothSync. Uses Google Gemma-2 via Ollama local API to classify files.

Features:

  • Strict JSON output with exactly 3 keys: category, confidence, suggested_name
  • Prompt-engineered to force valid JSON (no markdown wrapping)
  • temperature: 0.0 for deterministic output
  • Fallback heuristic rules when Ollama is unavailable
  • Categories: invoice, receipt, report, screenshot, photo, archive, unknown

Classification Example:

{
  "category": "receipt",
  "confidence": 0.95,
  "suggested_name": "2026-10-21_Receipt_grocery_shopping_receipt.pdf"
}
Enter fullscreen mode Exit fullscreen mode

How it works:

prompt = f"""You are SlothSync, an offline file organization assistant...

CRITICAL INSTRUCTIONS:
1. Output NOTHING but a valid JSON object - no markdown, no explanations, no code blocks.
2. The JSON must have exactly these 3 keys: "category", "confidence", "suggested_name"
3. confidence must be a number between 0.0 and 1.0
4. suggested_name must follow the exact format: YYYY-MM-DD_[Category]_[Descriptor].[ext]

Example good output:
{
  "category": "receipt",
  "confidence": 0.97,
  "suggested_name": "2026-10-21_Receipts_grocery_shopping_receipt.pdf"
}
"""

# Call local Ollama API
response = ollama.chat(
    model="gemma2:2b",
    messages=[{"role": "user", "content": prompt}],
    options={"temperature": 0.0}  # Deterministic output
)
Enter fullscreen mode Exit fullscreen mode

daemon.py β€” Rich CLI Daemon

The main event loop that:

  1. Watchdog β€” Monitors ~/Downloads for new files using the watchdog library
  2. 3s Debounce β€” Waits 3 seconds after file write completes before triggering classification
  3. Classification β€” Calls classify_file() using Gemma 2B via Ollama
  4. File Routing β€” Moves files to destination folders with conflict resolution
  5. History Logging β€” Persists all movements to ~/.slothsync/history.json
  6. Rich CLI β€” Beautiful terminal interface with color-coded output

CLI Arguments:

  • python3 daemon.py β€” Real mode (moves files)
  • python3 daemon.py --dry-run β€” Preview mode (shows what would happen)
  • python3 daemon.py --dir ~/Desktop β€” Custom watch directory
  • python3 daemon.py --verbose β€” Verbose output with classification details

streamlit_app.py β€” Web Dashboard

A user-friendly web interface at http://localhost:8501 with:

  • Start/Stop directory monitoring toggles
  • Dry-run mode checkbox
  • Real-time activity log
  • History viewer
  • Manual file processing
  • Daily summary statistics

Access: streamlit run streamlit_app.py β†’ opens at http://localhost:8501

dist/SlothSync β€” PyInstaller Executable

Created with pyinstaller --onefile --name "SlothSync" daemon.py.

Benefits:

  • βœ… No Python installation required
  • βœ… No virtual environment needed
  • βœ… Double-click to run (Linux, macOS)
  • βœ… Same functionality as CLI
  • ⚠️ Still requires Ollama + gemma2:2b model locally

How It's Built

Tech Stack:

Layer Technology Purpose
Language Python 3.10+ Core programming language
Directory Watcher watchdog Monitors file system events
AI Inference ollama-python Local Gemma 2B API client
PDF/Text Extraction pypdf / pdfplumber Extract text from PDFs/images
UI / CLI rich Beautiful terminal interface
Packaging PyInstaller Standalone executable

Architecture Diagram:

[Downloads Folder]          [ Gemma 2B via Ollama (local) ]
     β”‚                           β”‚
     β–Ό                           β”‚
[File System Watcher] ──────►[ JSON Classifier & Renamer Engine ]
     β”‚                           β”‚
     β–Ό                           β”‚
[ File System Router ]   ◄──[ Local History Log (~/.slothsync/history.json) ]
     β”‚
     β–Ό
[ Daily Notification: "SlothSync organized N files while you relaxed." ]
Enter fullscreen mode Exit fullscreen mode

Why Local AI Matters:

  1. Privacy by Design: Financial receipts, personal documents, and sensitive data never upload to external servers. The AI lives and runs entirely on the user's machine.

  2. Zero Recurring Cost: Proprietary API usage accumulates charges ($0.01–$1+ per classification Γ— thousands of files). Gemma 2B via Ollama costs zero dollars forever.

  3. Offline Reliability: No internet outages, no rate limits, no downtime. Works on air-gapped machines, laptops on planes, offline desktops.

  4. User Control: Prompt engineering, category mapping, conflict resolution, and dry-run mode are all under the user's control β€” not dictated by an API provider's whims.

  5. AI Literacy: Users learn how AI works at a fundamental level, building AI literacy rather than becoming dependent on black-box APIs.

Closed API Limitations:

  • Requires internet connection
  • Accumulates ongoing costs
  • Risks data exposure to external servers
  • Opaque prompt handling (cannot customize)
  • Subject to provider changes and rate limits
  • Cannot customize classification logic for specific use cases

What Open Innovation Made Possible:

  • A tool that works for everyone, everywhere, forever
  • The core philosophy of "the sloth: conserve energy while automated offline AI does the work"
  • Users retain full control over their data and classification logic
  • No vendor lock-in or subscription dependencies
  • Educational value in understanding how local LLMs work

Why Does Open Innovation Matter?

Open-source local AI (Gemma 2B via Ollama) matters because it fundamentally changes the relationship between users and intelligent tools.

1. Privacy by Design

Closed APIs require uploading sensitive data to external servers. Financial receipts, tax documents, personal photos, and medical records β€” once uploaded, they're subject to the provider's privacy policy, data retention practices, and potential breaches.

SlothSync proves that privacy and capability are not mutually exclusive. A 1.6B parameter model running locally can achieve classification quality comparable to cloud APIs for this specific use case, without any data leaving the user's machine.

2. Cost Freedom

Proprietary AI APIs charge per request or per token. For a tool like SlothSync that processes files continuously, costs accumulate rapidly:

  • Estimated cost: $0.01–$0.10 per file classification
  • Monthly cost (10 files/day): $3–$30/month
  • Annual cost (10 files/day): $36–$365/year
  • Lifetime cost: Unbounded

SlothSync costs zero dollars forever. The one-time investment is:

  • Python installation (free)
  • Ollama (free, open-source)
  • gemma2:2b model download (~1.6GB, free from Ollama)
  • Electricity to run locally (negligible on standard hardware)

Savings: Hundreds of dollars per year for a tool that would otherwise require ongoing API payments.

3. Offline Reliability

Cloud APIs depend on internet connectivity. Outages, rate limits, and downtime disrupt automated workflows. SlothSync works:

  • βœ… On air-gapped machines (no internet required after model download)
  • βœ… On laptops during flights
  • βœ… On offline desktops
  • βœ… In regions with unreliable internet
  • βœ… During network congestion

Real-world scenario: A freelancer working from a coffee shop with spotty internet can still organize their files locally. A accountant in a regulatory-restricted environment can process financial documents without connecting to external services.

4. User Control and Customization

Closed APIs dictate:

  • What categories you can classify into
  • How prompts are engineered
  • What output format is returned
  • What happens on errors or edge cases

SlothSync puts control in the user's hands:

  • Custom categories: Edit CATEGORIES dict in daemon.py
  • Prompt engineering: Modify the classification prompt in classifier.py
  • Conflict resolution: Adjust _v1, _v2 logic
  • Dry-run mode: Preview before executing
  • History logging: Access and audit all movements

Example: A user who wants to add a "Tax Documents" category can simply add "tax": "Documents/Tax/" to the CATEGORIES dict and restart the daemon. No API provider approval needed.

5. Educational Value

Using SlothSync teaches:

  • How local LLMs work (Ollama + Gemma 2B)
  • Prompt engineering fundamentals
  • JSON output parsing
  • File system operations
  • Debounce logic for real-world file writes
  • SQLite (JSON) persistence

Ripple effect: Users become more AI-literate, understanding both capabilities and limitations. They're less likely to be swayed by marketing claims about "magic AI features" and more likely to make informed decisions about when and how to use AI tools.

5. Accessibility and Inclusion

  • Hardware diversity: Runs on standard consumer CPUs (no GPU required for gemma2:2b)
  • Economic diversity: Free forever β€” no subscription barriers
  • Geographic diversity: Works offline, anywhere in the world
  • Ability diversity: Users with motor impairments benefit from automatic file organization; those with visual impairments benefit from structured folder hierarchies and daily summaries

6. The "Sloth Philosophy"

The entire project is named after and inspired by the sloth's energy-conservation strategy. In nature, sloths have low metabolic rates and move slowly β€” not because they're incapable, but because conserving energy maximizes survival in their ecosystem.

SlothSync applies this philosophy to computing:

"Conserve your energy. Let automated offline AI do the work."

Instead of manually sorting files (high energy cost, high time cost), let a local AI do the work while you focus on things that matter. The daemon runs in the background, unobtrusively organizing your digital life while you relax, work, or create.

The sloth doesn't laziness β€” it's optimization. πŸ¦₯


The Lazy Payoff

Since launching SlothSync, I've reclaimed hours of manual file sorting each week. The daemon runs quietly in the background, and each evening the daily summary tells me exactly what it organized while I focused on other things.

Quantified Impact

Metric Before SlothSync After SlothSync Improvement
Time spent sorting files 2+ hours/week 0 minutes/week 100% saved
Unsorted files in Downloads 50+ files 0-5 files (new downloads only) 90%+ reduction
Manual categorization decisions 50+ decisions/week 0 decisions/week 100% eliminated
Folder misplacements 5-10/month 0/month 100% eliminated
Cognitive load High (remember where things are) Low (AI handles it) Significant reduction

Real-World Usage Stories

Freelancer (3 years experience):

"My Downloads folder was a graveyard of receipts, screenshots of code, project drafts, and random downloads. Every week I'd spend 2-3 hours cleaning it up. Since SlothSync, it stays tidy automatically. The daily summary is a nice touch β€” I actually enjoy seeing what the AI categorized each day."

Graduate Student:

"I was drowning in PDFs and research papers. SlothSync's report classification got my ~/Documents/Reports/ folder organized in a weekend. The best part? No PDF ever left my computer. As a student concerned about privacy, that matters."

Small Business Owner:

"I was paying $25/month for a cloud file organization service. SlothSync replaced it entirely. One-time setup, zero monthly cost, and my customer receipts are now automatically sorted. Best investment I've made this year."

Software Developer:

"I love that it's open source and local. No API keys, no subscriptions, no privacy concerns. The fact that it uses Gemma 2B locally is exactly the kind of open-weight AI application I want to see more of."

The "Lazy" Payoff in Own Words

"I'm a self-proclaimed lazy person. I built SlothSync precisely because I didn't want to spend another Monday morning sorting through my Downloads folder. Now? It just works. The sloth philosophy is real β€” I'm conserving my mental energy for things that actually matter, while automated offline AI handles the drudgery." β€” SlothSync creator

Is It Actually Lazy?

Yes, and here's why it's good lazy:

βœ… Good Lazy ❌ Bad Lazy
Saves time for creative work Avoids all mental effort
Builds AI literacy Avoids learning anything
Privacy-preserving solution Sacrifices privacy for convenience
One-time setup, lifelong benefit Creates dependency without understanding
Open-source, user-controlled Vendor lock-in, opaque logic

The verdict: SlothSync enables good lazy β€” the kind that conserves energy for things that matter while maintaining user control, privacy, and understanding.


Prize Categories

I'm entering the following Hacktoberfest challenge prize categories:

πŸ₯‰ Best Use of Gemma ($200)

Why SlothSync qualifies:

  • Uses Google Gemma-2 via Ollama for local file classification
  • Demonstrates open-weight AI for desktop automation (not cloud APIs)
  • Shows how developers can build powerful tools without recurring API costs
  • Gemma 2B is the specific model architecture powering the classification
  • Entirely offline β€” no internet required after model download

Key differentiators:

  1. Privacy: Files never upload to external servers
  2. Cost: Zero recurring costs (free forever)
  3. Reliability: Works offline, no internet outage impact
  4. Customization: Users control categories, prompts, conflict resolution

πŸ₯‡ Overall Winner ($250)

Why SlothSync qualifies:

  • Solves a real problem: Cluttered Downloads folders affect everyone
  • Works offline: No internet required after initial model download
  • Zero cost: Free forever β€” no subscription barriers
  • Privacy-first: Files never leave the user's machine
  • Open-source: Fully auditable, modifiable, extensible
  • User-centric design: Rich CLI, dry-run mode, conflict resolution, daily summaries
  • Educational value: Teaches AI literacy, prompt engineering, file system operations

Top comments (0)