SlothSort 🦥: The Zero-Effort, Local AI File Organizer A developer built SlothSort, a lightweight Python agent that watches a folder and waits 24 hours before acting on new files, then uses a local open-weight model via Ollama (llama3.1) to generate descriptive filenames and sort them into categorized directories. The script runs entirely offline, detects aged files on startup, and avoids overwriting existing files by appending counters to name collisions. I built SlothSort , a background digital butler that rewards peak laziness. Like most developers, my Downloads folder is a chaotic graveyard of files named Screenshot 10222026.png, invoice final v2 FINAL.pdf, and asdfasdf.jpg. I am simply too lazy to rename and organize them manually. SlothSort is a lightweight Python agent that monitors your messy folders. Channeling true International Sloth Day energy, it waits exactly 24 hours before acting on any new file. Once a file hits the "sloth threshold," the script wakes up, analyzes the file using a local open-weight model to determine context, generates a clean, descriptive file name, and moves it to a neatly categorized directory like /Invoices, /Work Docs, or /Images . You do absolutely nothing while your computer does the housekeeping. Note: I am running this entirely offline via my terminal. The script detects old files on startup, processes them silently through the local LLM, and prints the new mapped destinations. SlothSort started. Watching /Users/harsh/Downloads for files older than 24 hours... SlothSort awakening to process: IMG 9921 rec.jpg Moved: IMG 9921 rec.jpg - /Users/dev/Documents/SlothSorted/Images/receipt scan.jpg SlothSort awakening to process: Q3 tax est.pdf Moved: Q3 tax est.pdf - /Users/dev/Documents/SlothSorted/Financials/Q3 tax estimate.pdf python import os import time import shutil import json from pathlib import Path from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import ollama WATCH DIR = os.path.expanduser "~/Downloads" BASE SORT DIR = os.path.expanduser "~/Documents/SlothSorted" SLOTH THRESHOLD SECONDS = 86400 24 hours class SlothHandler FileSystemEventHandler : def process file self, file path : file name = os.path.basename file path Skip hidden files or already processing files if file name.startswith '.' : return Get file age file stat = os.stat file path file age = time.time - file stat.st mtime if file age SLOTH THRESHOLD SECONDS: print f"SlothSort awakening to process: {file name}" new name, category = self.ask local llm file name if new name and category: self.move and rename file path, new name, category def ask local llm self, filename : prompt = f""" You are a highly efficient file organizer. I have a file named '{filename}'. Based ONLY on this file name, provide a clean, descriptive file name keeping the original extension and a broad folder category for it e.g., Invoices, Images, Documents, Installers, Code . Respond ONLY in strict JSON format like this: {{"new name": "clean name.ext", "category": "CategoryName"}} """ try: response = ollama.chat model='llama3.1', messages= {'role': 'user', 'content': prompt} result = json.loads response 'message' 'content' return result.get 'new name' , result.get 'category' except Exception as e: print f"Failed to process {filename} via Ollama: {e}" return None, None def move and rename self, old path, new name, category : target dir = os.path.join BASE SORT DIR, category os.makedirs target dir, exist ok=True new path = os.path.join target dir, new name Avoid overwriting existing files counter = 1 while os.path.exists new path : name, ext = os.path.splitext new name new path = os.path.join target dir, f"{name} {counter}{ext}" counter += 1 shutil.move old path, new path print f"Moved: {os.path.basename old path } - {new path}" def on modified self, event : if not event.is directory: self.process file event.src path if name == " main ": print f"SlothSort started. Watching {WATCH DIR} for files older than 24 hours..." os.makedirs BASE SORT DIR, exist ok=True event handler = SlothHandler observer = Observer observer.schedule event handler, WATCH DIR, recursive=False observer.start Run an initial scan on startup for file in os.listdir WATCH DIR : event handler.process file os.path.join WATCH DIR, file try: while True: time.sleep 3600 Sleep for an hour, peak sloth behavior except KeyboardInterrupt: observer.stop observer.join SlothSort is built entirely on open-source AI and local inference: The Brain: Llama-3.1 open-weight model running completely locally via Ollama. I configured the prompt to force strict JSON outputs containing new name and category keys. The Harness: Python utilizing the watchdog library to monitor the file system for changes and track file age os.stat .st mtime . The Workflow: When a file crosses the 24-hour threshold, the script sends the file context to the local Ollama API. Upon receiving the parsed JSON response, shutil safely moves and renames the file into the new structured directory tree, automatically handling any name collisions. For a personal file-sorting tool, open innovation is non-negotiable due to privacy and cost. A closed API approach would require me to upload my personal bank statements, medical PDFs, and private photos to a third-party server just to generate a file name. That is an unacceptable privacy risk for basic desktop utility. By utilizing an open-weight model via Ollama, my data physically never leaves my machine. Additionally, running this locally means I set it up once and never pay a subscription fee or worry about API token limits. Whether I download 10 files or 10,000, open-source AI makes this background automation completely free, private, and capable of running without a Wi-Fi connection. The payoff is zero-maintenance organization. I ran the initial startup script today and SlothSort processed over 200 neglected files from my Downloads folder. For the first time in years, my Downloads directory is completely empty, and everything is neatly filed into /Financials, /Project Assets, and /Random Junk. It saved me hours of manual renaming and dragging-and-dropping, allowing me to fully embrace the sloth lifestyle this week. Open-Weight Champion Best Local Automation