<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: D9292S</title>
    <description>The latest articles on DEV Community by D9292S (@d9292s).</description>
    <link>https://dev.to/d9292s</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F530460%2F0774f76b-fd5b-4cde-8a39-b48931317ebb.png</url>
      <title>DEV Community: D9292S</title>
      <link>https://dev.to/d9292s</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/d9292s"/>
    <language>en</language>
    <item>
      <title>SlothSort 🦥 — An Offline AI File Organizer That Rewards Laziness</title>
      <dc:creator>D9292S</dc:creator>
      <pubDate>Sun, 25 Oct 2026 14:15:51 +0000</pubDate>
      <link>https://dev.to/d9292s/slothsort-an-offline-ai-file-organizer-that-rewards-laziness-3266</link>
      <guid>https://dev.to/d9292s/slothsort-an-offline-ai-file-organizer-that-rewards-laziness-3266</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week3-2026-10-19"&gt;Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Most developers have a &lt;code&gt;Downloads&lt;/code&gt; folder that looks like a digital landfill: dozens of &lt;code&gt;document(1).pdf&lt;/code&gt;, &lt;code&gt;Screenshot 2026-10-21.png&lt;/code&gt;, and camera uploads like &lt;code&gt;IMG_20241019_142356.jpg&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Organizing them manually is tedious, and simple extension-moving scripts fail because they can't understand what a file actually contains.&lt;/p&gt;

&lt;p&gt;In honor of &lt;strong&gt;International Sloth Day&lt;/strong&gt; and this week's theme — &lt;strong&gt;Slow and Steady: build something with open-source AI that rewards laziness&lt;/strong&gt; — I built &lt;strong&gt;SlothSort&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SlothSort&lt;/strong&gt; is a lightweight CLI that uses a local open-weight model (&lt;code&gt;llama3.2&lt;/code&gt;) via &lt;strong&gt;Ollama&lt;/strong&gt; to scan messy folders, understand file context, clean up names into readable kebab-case, and sort everything into category folders.&lt;/p&gt;

&lt;h3&gt;
  
  
  Core Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🧠 &lt;strong&gt;Contextual Sorting:&lt;/strong&gt; Classifies files using both extensions and text header previews (peeking at the first few lines of text/CSV/code).&lt;/li&gt;
&lt;li&gt;🏷️ &lt;strong&gt;Clean Renaming:&lt;/strong&gt; Standardizes messy timestamps and downloads (&lt;code&gt;Screenshot 2026-10-21 000814.png&lt;/code&gt; → &lt;code&gt;screenshot-2026-10-21-000814.png&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;🦥 &lt;strong&gt;True Sloth Mode (&lt;code&gt;--watch&lt;/code&gt;):&lt;/strong&gt; Runs quietly in the background, tidying up new downloads automatically while you take a nap.&lt;/li&gt;
&lt;li&gt;📑 &lt;strong&gt;Deduplication (&lt;code&gt;--dedupe&lt;/code&gt;):&lt;/strong&gt; Uses fast SHA-256 matching to isolate duplicate downloads (&lt;code&gt;invoice (1).pdf&lt;/code&gt;) into a &lt;code&gt;Duplicates/&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;🛡️ &lt;strong&gt;Defensive by Default:&lt;/strong&gt; Safe dry-run previews by default, collision protection (&lt;code&gt;-1&lt;/code&gt;, &lt;code&gt;-2&lt;/code&gt;), and instant 1-command rollback (&lt;code&gt;slothsort undo&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Here is a live terminal session running against a messy directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ slothsort ~/Downloads --dedupe

┌──────────────── 🦥 slothsort v1.0.0 ────────────────┐
│  📂 /Users/deepa/Downloads                          │
│  ⚙️   DRY-RUN  Model: llama3.2 • Offline Inference  │
└─────────────────────────────────────────────────────┘

Taxonomy Breakdown                                                          
┌────────────────────┬──────────┬────────────┬────────────┬────────────────┐
│ Category           │    Files │       Size │    Renamed │      Inference │
├────────────────────┼──────────┼────────────┼────────────┼────────────────┤
│ 📦 Archives        │        3 │    45.0 MB │          1 │      1/3 local │
│ 🎵 Audio           │        2 │    18.5 MB │          2 │          rules │
│ 💻 Code            │        5 │     0.2 MB │          2 │          rules │
│ 📊 Data            │        3 │     1.1 MB │          3 │          rules │
│ 🎨 Design          │        2 │    24.0 MB │          2 │          rules │
│ 📄 Documents       │        7 │     2.8 MB │          6 │      1/7 local │
│ 📑 Duplicates      │        2 │     1.4 MB │          0 │         dedupe │
│ 🖼️  Images         │        4 │     6.9 MB │          4 │          rules │
│ ⚙️  Installers     │        2 │   157.9 MB │          2 │          rules │
│ 🎬 Videos          │        1 │   240.0 MB │          1 │      1/1 local │
├────────────────────┼──────────┼────────────┼────────────┼────────────────┤
│ Total              │       31 │   497.8 MB │         23 │              — │
└────────────────────┴──────────┴────────────┴────────────┴────────────────┘

┌─ Proposed Directory Hierarchy ──────────────────────────────────────────────┐
│ 📁 Downloads/                                                               │
│ ├── 📄 Documents/ (7 files)                                                 │
│ │   ├── analytics_october_metrics.csv → analytics-october-metrics.csv •     │
│ │   │   Financial data report                                               │
│ │   ├── budget_forecast_q4.xlsx → budget-forecast-q4.xlsx • standardized    │
│ │   │   kebab-case                                                          │
│ │   ├── final_report_FINAL_v3_USETHISONE.docx →                             │
│ │   │   final-report-final-v3-usethisone.docx • standardized kebab-case     │
│ │   └── meeting_notes_oct.txt → meeting-notes-oct.txt • standardized        │
│ │       kebab-case                                                          │
│ ├── 📑 Duplicates/ (2 files)                                                │
│ │   ├── document(2).pdf → Duplicates/document(2).pdf • duplicate of         │
│ │   │   document(1).pdf                                                     │
│ │   └── IMG_20241020_083211.jpg → Duplicates/IMG_20241020_083211.jpg •      │
│ │       duplicate of IMG_20241019_142356.jpg                                │
│ ├── 🖼️  Images/ (4 files)                                                   │
│ │   ├── Screenshot 2026-10-21 000814.png →                                  │
│ │   │   screenshot-2026-10-21-000814.png • standardized kebab-case          │
│ │   └── wallpaper_4k_mountain.jpg → wallpaper-4k-mountain.jpg •             │
│ │       standardized kebab-case                                             │
│ └── ⚙️  Installers/ (2 files)                                               │
│     ├── ABDownloadManager_1.11.1_windows_x64.exe →                          │
│     │   abdownloadmanager-1.11.1-windows-x64.exe • standardized kebab-case  │
│     └── VSCodeUserSetup-x64-1.92.0.exe → vscodeusersetup-x64-1.92.0.exe •   │
│         standardized kebab-case                                             │
└─────────────────────────────────────────────────────────────────────────────┘

┌─ Next Step ─────────────────────────────────────────────────────────────────┐
│  Dry-run preview complete. No files were modified on disk.                  │
│                                                                             │
│  To apply these changes, run:                                               │
│    slothsort "~/Downloads" --execute --dedupe                               │
└─────────────────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you pass &lt;code&gt;--execute&lt;/code&gt;, the moves happen atomically. If you ever change your mind:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ slothsort undo ~/Downloads

┌─ Rollback Complete ─────────────────────────────────────────────────────────┐
│  ✓ Successfully restored 31 file(s) to original locations.                  │
└─────────────────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The complete codebase, documentation, and automated test suite are open-sourced on GitHub:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/D9292S/slothsort" rel="noopener noreferrer"&gt;GitHub Repository: D9292S/slothsort&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;slothsort/
├── pyproject.toml              # Modern Hatchling package configuration
├── README.md                   # Full documentation and command reference
├── LICENSE                     # MIT License
├── .slothsort.toml.example     # Configuration template for user overrides
├── slothsort/
│   ├── __init__.py             # Version metadata
│   ├── config.py               # Taxonomy mapping, model configurations, defaults
│   ├── scanner.py              # Filtering, snippet extraction, SHA-256 duplicate hashing
│   ├── categorizer.py          # Ollama JSON inference + Algorithmic Hallucination Guard
│   ├── organizer.py            # Collision resolution (-1, -2), moves, atomic undo manifest
│   └── cli.py                  # Rich terminal UI, diff tree, watch mode, commands
├── demo/
│   └── simulate_mess.py        # Demo script to generate 31 realistic messy files
└── tests/
    ├── test_scanner.py         # Filtering, snippets, duplicate detection tests
    ├── test_safety.py          # Hallucination guard &amp;amp; name preservation tests
    ├── test_parser.py          # Resilient JSON parsing tests (lists, dicts, markdown)
    └── test_organizer.py       # Collision resolution &amp;amp; end-to-end rollback tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;SlothSort is built with &lt;strong&gt;Python 3.10+&lt;/strong&gt;, &lt;strong&gt;Ollama&lt;/strong&gt;, &lt;strong&gt;Meta Llama 3.2 (3B)&lt;/strong&gt;, &lt;strong&gt;Click&lt;/strong&gt;, &lt;strong&gt;Rich&lt;/strong&gt;, and &lt;strong&gt;Pydantic&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Technical Highlights
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Local Inference:&lt;/strong&gt; Files are batched and sent to Ollama with strict JSON schemas enforced by Pydantic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content Sniffing:&lt;/strong&gt; For ambiguous text/code/data files under 2 MB, the scanner peeks at the first 300 characters to provide the model with grounding context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Hallucination Guard (&lt;code&gt;is_safe_rename&lt;/code&gt;):&lt;/strong&gt; During testing, I caught a 3B model edge case: when given a batch containing multiple installers, Llama 3.2 occasionally cross-pollinated names (trying to rename &lt;code&gt;ABDownloadManager.exe&lt;/code&gt; to &lt;code&gt;bitdefender.exe&lt;/code&gt;). I wrote an algorithmic safety guard that verifies suggested names never borrow tokens from other files in the batch, falling back to safe formatting if cross-contamination is detected.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safety &amp;amp; Testing:&lt;/strong&gt; Includes an atomic rollback log (&lt;code&gt;.slothsort-undo.json&lt;/code&gt;) and &lt;strong&gt;12 unit tests&lt;/strong&gt; in &lt;code&gt;pytest&lt;/code&gt; verifying parsing, collision handling, and hallucination rejection.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;For personal file management, local open-source AI is fundamentally superior to closed cloud APIs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🔒 &lt;strong&gt;Absolute Privacy:&lt;/strong&gt; Your Downloads folder contains tax drafts, bank statements, and personal records. With local models, &lt;strong&gt;zero bytes leave your machine&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;💸 &lt;strong&gt;Zero Recurring Cost:&lt;/strong&gt; Organizing thousands of files costs \$0.00 in API tokens.&lt;/li&gt;
&lt;li&gt;✈️ &lt;strong&gt;100% Offline:&lt;/strong&gt; Operates in airplane mode, on trains, or without internet.&lt;/li&gt;
&lt;li&gt;🎛️ &lt;strong&gt;Model Portability:&lt;/strong&gt; Swap models freely based on your hardware (&lt;code&gt;--model llama3.2&lt;/code&gt;, &lt;code&gt;--model phi3&lt;/code&gt;, or &lt;code&gt;--model mistral&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;🛡️ &lt;strong&gt;Resilient Fallback:&lt;/strong&gt; If Ollama is offline or files exceed 500 MB, SlothSort gracefully falls back to deterministic rules. It never crashes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;p&gt;I built SlothSort through an iterative agent pair-programming session with an AI coding assistant. The agent helped scaffold the initial Click/Rich CLI architecture, iterate on small-model prompt engineering with Ollama, and write the 12-test &lt;code&gt;pytest&lt;/code&gt; suite that verified the algorithmic hallucination guard.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Lazy Payoff
&lt;/h2&gt;

&lt;p&gt;Manually sorting an 800-file Downloads folder usually takes 45 minutes of tedious drag-and-drop. &lt;/p&gt;

&lt;p&gt;With SlothSort, it takes &lt;strong&gt;5 seconds&lt;/strong&gt; with one command — or zero effort if you leave &lt;code&gt;--watch&lt;/code&gt; running in the background.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
  </channel>
</rss>
