{"slug": "building-sortsense-a-local-ai-file-organizer-built-in-a-single-hack-day", "title": "Building SortSense: A Local AI File Organizer Built in a Single Hack Day", "summary": "Team Brute Force built SortSense, a privacy-first file organizer that runs Gemma 4 locally through Ollama to semantically classify and rename downloaded documents instead of relying on extension-based rules. The Python 3.13 desktop app uses watchdog to detect new files, pypdf for text extraction, and a deterministic Pydantic validation layer that checks Gemma's structured JSON output before any filesystem operation, routing low-confidence results to a human review queue. No document bytes leave the user's machine.", "body_md": "Building SortSense: A Local AI File Organizer Built in a Single Hack Day\n\nHacktoberfest: Contribution Chronicles\n\nWe, Team Brute Force, built SortSense during the Hacktoberfest Hack Day Coimbatore x (INIT Club & IDEA Club). We wanted to tackle a problem almost everyone with a laptop faces: the Downloads folder slowly turns into a mess of files with meaningless names, making it difficult to find what you actually need.\n\nFiles received through WhatsApp, browsers, and other platforms often arrive as:\n\nIMG-20261008-WA0004.pdf\n\nDOC-WA0012.pdf\n\na8f31c92.pdf\n\nTraditional file organizers usually rely on rigid extension-based rules like .pdf → Documents or .jpg → Pictures. But a PDF could be an electricity bill, university notes, an assignment, or something completely different.\n\nCloud AI can understand documents semantically, but uploading sensitive files such as bills, identity documents, or personal records to external servers isn't always acceptable.\n\nSo we built SortSense — a privacy-first file organizer that understands files locally.\n\nHow it works\n\nOur stack is Python 3.13, CustomTkinter, Pydantic, watchdog, pypdf, Ollama, and Gemma 4.\n\nDetection: SortSense monitors download directories using watchdog and detects new files as they arrive. It can detect Chrome, Firefox, and OS-default download paths on Windows and Linux.\n\nExtraction: For supported documents, the ingestion pipeline extracts the content using pypdf or plain-text extraction.\n\nUnderstanding: The extracted content is sent to a locally running Gemma 4 model through Ollama. Gemma determines what the document actually means instead of relying only on its file extension.\n\nValidation: Gemma returns structured JSON containing information such as the category, suggested filename, document type, summary, confidence, and suggested action. A deterministic Pydantic-based validation layer checks the response before any filesystem operation happens.\n\nOrganization: SortSense safely renames and moves the file into the appropriate category. It also searches for existing matching folders instead of unnecessarily creating duplicates.\n\nReview: If Gemma's confidence is below our configurable threshold, the file is sent to a Review Queue instead of being silently misplaced.\n\nDashboard: The CustomTkinter desktop application shows live counters, Activity Log entries, Review Queue items, and settings.\n\nThe important part: the files never leave the user's machine.\n\nThe Gemma 4 Partner Challenge\n\nWe built SortSense around local Gemma 4 inference using gemma4:e4b through Ollama.\n\nGemma receives the extracted document content and returns a structured analysis containing the document category, filename suggestion, document type, summary, confidence, and suggested action.\n\nFor example:\n\nElectricity bill PDF\n\n        ↓\n\n     Gemma 4\n\n        ↓\n\nUtilities/Electricity_Bill_September_2026.pdf\n\nOr:\n\nSignals & Systems notes\n\n        ↓\n\n     Gemma 4\n\n        ↓\n\nStudy_Notes/Signals_Systems_Semester_Notes.pdf\n\nA key architectural decision was to keep Gemma responsible for understanding and recommendation, while deterministic Python code remains responsible for validation and filesystem operations.\n\nThis gives us the flexibility of AI without giving an LLM unrestricted control over the user's files.\n\nWhat makes SortSense different\n\nThe main difference is simple:\n\nTraditional organizers ask what a file is. SortSense tries to understand what the file means.\n\nOur key differentiators are:\n\nLocal edge inference: Gemma 4 runs directly on the user's machine.\n\nPrivacy-first: No document bytes are uploaded to a cloud AI service.\n\nSemantic organization: Files are classified based on their content rather than just their extension.\n\nConfidence guardrails: Low-confidence results go to a human review queue.\n\nStructured output: Gemma is prompted for strict JSON and the result is validated before filesystem operations.\n\nSmart folder reuse: Existing matching folders are reused to avoid unnecessary fragmentation.\n\nIntelligent renaming: Meaningless filenames can be converted into useful descriptive filenames.\n\nMulti-browser monitoring: Chrome, Firefox, and OS-default download paths can be monitored.\n\nStuff that broke (and what we learned)\n\nBuilding the complete system during a single hack day forced us to make a lot of architectural decisions quickly.\n\nAI vs filesystem control: We decided early that the model should never directly manipulate files. Gemma recommends; deterministic Python validates and executes.\n\nModel confidence: AI classification isn't always certain, so we introduced a configurable 0.85 confidence threshold. Anything below it goes to the Review Queue.\n\nUnsafe model output: We added validation for path traversal, invalid extensions, null bytes, empty responses, and other unsafe values before allowing a file operation.\n\nFile collisions: We made the routing system collision-safe. Existing files are never overwritten; suffixes such as _1, _2, etc. are added automatically.\n\nBackground processing: The filesystem watcher and file-processing pipeline run in background threads, while GUI updates are safely marshalled back to the Tkinter main thread.\n\nKeeping the architecture small: Instead of adding FastAPI, a separate database, or unnecessary cloud services, we kept the system as a lightweight local Python application with Ollama and CustomTkinter.\n\nWhat we built during the hackathon\n\nStarting from zero, we completed:\n\n-Full watchdog filesystem watcher\n\n-Multi-browser download path detection\n\n-PDF and plain-text ingestion\n\n-Local Gemma 4 integration through Ollama\n\n-Structured JSON prompting\n\n-Deterministic validation layer\n\n-Atomic file routing\n\n-Smart existing-folder search\n\n-Automatic file renaming\n\n-CustomTkinter desktop dashboard\n\n-Live counters\n\n-Activity Log\n\n-Review Queue\n\n-Settings page\n\n-Automated Windows and Linux setup scripts\n\n-89-test pytest suite\n\nTeam Brute Force:\n\nDev Madhav — File watcher daemon, browser path detection, OS directory routing, atomic file move/rename engine\n\nAadi UR — Document extraction pipeline, metadata sanitisation, GUI pipeline integration and live counter wiring\n\nJeevan T — Local Gemma 4 integration via Ollama, structured JSON prompt engineering and confidence validation\n\nRohith Singothu — CustomTkinter desktop dashboard, setup scripts, documentation and MLH submission\n\nLinks\n\nGitHub Repo: [https://github.com/Minnolter12/bruteforceManager](https://github.com/Minnolter12/bruteforceManager)\n\nDemo Video: [https://drive.google.com/drive/folders/1ml5yyOWsXLudp3xN56YhwqRokNHoMXOi?usp=drive_link](https://drive.google.com/drive/folders/1ml5yyOWsXLudp3xN56YhwqRokNHoMXOi?usp=drive_link)\n\nLive Application: SortSense is a local desktop application and runs directly on the user's machine.\n\nHuge thanks to the team for surviving the sprint!\n\nDev Madhav\n\nAadi UR\n\nJeevan T\n\nRohith Singothu\n\n(Built for Hacktoberfest Hack Day Coimbatore x (INIT Club & IDEA Club) 2026)", "url": "https://wpnews.pro/news/building-sortsense-a-local-ai-file-organizer-built-in-a-single-hack-day", "canonical_source": "https://dev.to/rohith_singothu_3fbb71141/building-sortsense-a-local-ai-file-organizer-built-in-a-single-hack-day-353b", "published_at": "2026-10-08 11:13:18+00:00", "updated_at": "2026-10-08 11:19:21.778279+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-products", "developer-tools"], "entities": ["Team Brute Force", "SortSense", "Ollama", "Gemma 4", "Hacktoberfest", "CustomTkinter", "Pydantic", "pypdf"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/building-sortsense-a-local-ai-file-organizer-built-in-a-single-hack-day", "markdown": "https://wpnews.pro/news/building-sortsense-a-local-ai-file-organizer-built-in-a-single-hack-day.md", "text": "https://wpnews.pro/news/building-sortsense-a-local-ai-file-organizer-built-in-a-single-hack-day.txt", "jsonld": "https://wpnews.pro/news/building-sortsense-a-local-ai-file-organizer-built-in-a-single-hack-day.jsonld"}}