DEV Community

Nikhil Pradhan
Nikhil Pradhan

Posted on

LazyDesk AI: The Sloth-Approved, 100% Local Desktop Organizer & PDF Synthesizer Powered by Gemma 3

What I Built
The Philosophy of the Sloth: Conserving Energy by Automating Dreaded Chores

The Hacktoberfest Week 3 challenge arrived with an inspiring observation: Sloths have life figured out. They move at their own pace, conserve energy, and refuse to waste effort on tasks that don't serve them.

When the challenge organizers brainstormed ideas for this theme, one suggestion stood out immediately:

"A file and inbox tidier that automatically sorts, renames, and archives the clutter you keep putting off."

We all have that folder. The Downloads or Desktop directory overflowing with hundreds of unfiled items: invoices named Invoice_Final_v2(1).pdf, spreadsheets from three quarters ago, code snippets, compressed archives, and 30-page documents we promised ourselves we’d read later. Cleaning it takes mental energy we'd rather conserve. Yet, uploading these files to cloud-based AI tools presents a massive privacy breach: our desktops harbor tax forms, medical PDFs, confidential contracts, and personal photos.

LazyDesk AI was built to solve this dilemma. It is a 100% local-first, privacy-guaranteed desktop productivity assistant that sorts chaotic files, uncovers duplicate documents, and extracts structured insights from multi-page PDFsβ€”all running directly on your computer using Google's open-weight Gemma 3 4B via Ollama.

What Effort Does It Save?

LazyDesk AI turns hours of tedious computer chores into effortless, single-click operations:

Automated, Non-Destructive File Sorting: Categorizes files into 8 clean directories (Documents, Spreadsheets, Images, Videos, Audio, Code, Archives, and Other). It generates an interactive Move Preview, handles filename collisions automatically (report_1.pdf) so nothing is ever overwritten, supports a Dry-Run mode, and provides 1-click undo history if you ever change your mind.
Cryptographic Duplicate Discovery (Report-Only): Employs a two-stage filter (exact byte-size grouping + streaming 64 KB chunked SHA-256 hashes) to find duplicate files with different names. It shows reclaimable disk space and never deletes your files automatically.
Instant 5-Part Executive Summaries with Gemma 3 4B: Instead of wading through dense 20-page PDFs, PyMuPDF extracts the text in milliseconds and local Gemma 3 4B synthesizes:
Executive Overview: High-level context and objectives.
Key Points & Insights: Crucial arguments and takeaways.
Important Dates, Deadlines & Entities: Concrete milestones and organizations.
Action Items & Next Steps: Immediate tasks extracted from the text.
Document Notes & Uncertainties: Transparent flags for ambiguities or gaps.
Strictly Grounded Document Q&A: Query your document in natural language. Gemma 3 4B answers based strictly on the document's verified text, cites page numbers, and explicitly declines to answer if information is absentβ€”eliminating hallucination.
Who Gets to Be a Little Lazier Because of It?
Developers & Tech Workers who let daily installers, scripts, and logs turn their folders into digital junkyards.
Students & Researchers juggling stacks of academic papers who need instant takeaways, deadlines, and citations without reading 40 pages per document.
Freelancers & Business Owners handling private client invoices, contracts, and receipts who demand complete privacy without cloud subscription fees.
Demo

LazyDesk AI features a dark, muted-neutral dashboard built in Streamlit with slate and indigo styling. It includes a built-in, completely isolated demo sandbox so you can explore all features safely without touching your real files.

Interactive Workflow:
Launch App: Run python -m streamlit run app.py (opens on http://localhost:8501).
One-Click Demo Sandbox: In the sidebar, click "πŸ“‚ Load Demo Sandbox Path" to populate realistic sample data (invoices, spreadsheets, code, duplicate files, and a multi-page PDF spec).
Inspect the Dashboard: View volume metrics, category breakdowns, and searchable file tables.
Preview & Organize: Test Dry Run Mode, review proposed moves, and watch conflict renaming in action.
Detect Duplicates: Identify identical invoice copies and inspect exact reclaimable bytes.
Synthesize PDFs: Upload LazyDesk_Product_Specification.pdf and watch Gemma 3 4B deliver an executive summary with action items in seconds.
One-Click Rollback: Test the Operation History & Undo tab to restore all files to their original directories.
+--------------------------------------------------------------------------+
| [DEMO PREVIEW] πŸ“Š File Dashboard |
| Scans direct files, calculates byte sizes, and charts category breakdowns|
+--------------------------------------------------------------------------+
| [DEMO PREVIEW] πŸ—‚οΈ Smart File Organizer |
| Interactive proposed move plan, conflict check, dry-run & 1-click undo |
+--------------------------------------------------------------------------+
| [DEMO PREVIEW] πŸ” Duplicate Detector |
| Streaming SHA-256 checksums, identical content grouping, report-only |
+--------------------------------------------------------------------------+
| [DEMO PREVIEW] πŸ“‘ Local AI PDF Summarizer & Grounded Q&A |
| Sub-second PyMuPDF extraction + Gemma 3 4B structured executive summary |
+--------------------------------------------------------------------------+

(Walkthrough repository and screenshots: https://github.com/your-username/lazydesk-ai
)

Code

LazyDesk AI is open-source, modular, and built on Python 3.13+:

text
lazydesk-ai/
β”œβ”€β”€ app.py # Streamlit productivity dashboard & navigation
β”œβ”€β”€ .streamlit/config.toml # Dark muted-neutral theme configuration
β”œβ”€β”€ modules/
β”‚ β”œβ”€β”€ config.py # Category mappings, exclusions, AI defaults
β”‚ β”œβ”€β”€ file_scanner.py # Direct-file scanner & metric aggregation
β”‚ β”œβ”€β”€ organizer.py # Conflict resolution, preview, move & rollback
β”‚ β”œβ”€β”€ duplicate_detector.py # Size pre-filter + SHA-256 chunked hashing
β”‚ β”œβ”€β”€ pdf_processor.py # PyMuPDF text engine & scanned PDF detector
β”‚ β”œβ”€β”€ local_ai.py # Ollama REST API client (Gemma 3 4B)
β”‚ └── operation_history.py # JSON audit history logger for undo support
β”œβ”€β”€ sample_data/ # Isolated test files (never touches real data)
β”‚ β”œβ”€β”€ create_demo_data.py # Demo sandbox generator
β”‚ └── demo_sandbox/ # Sample PDFs, CSVs, scripts, and duplicates
β”œβ”€β”€ tests/ # 30 automated unit tests (100% green)
β”‚ β”œβ”€β”€ test_file_scanner.py # Categorization, paths, edge cases
β”‚ β”œβ”€β”€ test_organizer.py # Previews, dry runs, safe moves, undo
β”‚ β”œβ”€β”€ test_duplicate_detector.py # Content hashing, size pre-filtering
β”‚ β”œβ”€β”€ test_pdf_processor.py # PyMuPDF extraction, scanned detection
β”‚ β”œβ”€β”€ test_local_ai.py # Mocked Ollama endpoints, timeouts, errors
β”‚ └── test_operation_history.py # Audit logging & persistence
β”œβ”€β”€ requirements.txt # Dependencies (PyMuPDF, Streamlit, Ollama client)
β”œβ”€β”€ ARCHITECTURE.md # System architecture documentation
└── README.md # Complete Windows/Linux setup instructions
GitHub Repository

πŸ”— https://github.com/your-username/lazydesk-ai

Key Code Highlight: Local AI Generation with Zero Cloud Calls
python

modules/local_ai.py

def generate_document_summary(
document_text: str,
filename: str = "document.pdf",
model: str = "gemma3:4b",
base_url: str = "http://localhost:11434",
timeout: int = 90,
) -> AISummaryResult:
"""Send extracted document text strictly to the local Ollama instance."""
clean_text = document_text.strip()
if not clean_text:
return AISummaryResult(
success=False,
summary_markdown="",
model_used=model,
error_message="Document text is empty.",
)
prompt = build_summarization_prompt(clean_text, filename)
endpoint = f"{base_url.rstrip('/')}/api/generate"
payload = {
"model": model,
"prompt": prompt,
"stream": False,
"options": {
"temperature": 0.2, # Low temperature for strict factual fidelity
"top_p": 0.9,
},
}
# Pure localhost communication: Zero bytes leave your machine
response = requests.post(endpoint, json=payload, timeout=timeout)
response.raise_for_status()
return AISummaryResult(
success=True,
summary_markdown=response.json().get("response", "").strip(),
model_used=model,
)
How I Built It

LazyDesk AI was built around a guiding engineering principle: Use deterministic algorithms where they shine, and open-weight AI where qualitative intelligence is needed.

  1. Local Open-Weight AI: Google's Gemma 3 4B via Ollama

Rather than an external chatbot wrapper, Gemma 3 4B powers real document intelligence:

Parameter Efficiency: Gemma 3 4B delivers crisp logical synthesis and structured extraction within a compact memory footprint that runs smoothly on standard laptops (CPU or modest GPU).
Zero Cloud Egress: Communicates exclusively with http://localhost:11434/api/generate. No remote tokens, tracking, or telemetry.
Robust Error Handling: The UI detects whether Ollama is online, checks if gemma3:4b is installed, and provides copy-pasteable terminal commands if setup is needed.

  1. High-Performance PDF Extraction: PyMuPDF (fitz)

Text is parsed using PyMuPDF, providing sub-second text extraction and page indexing.

Scanned PDF Guard: If a user uploads an image-only scanned document without an OCR layer, LazyDesk AI detects the lack of digital characters and explicitly warns the user that OCR is requiredβ€”preventing the AI from hallucinating or claiming it read an unreadable file.
Context Protection: Caps extraction to prevent context window blowout on resource-constrained hardware.

  1. Defensive File Operations & Reversibility Preview & Dry Run: Users inspect a full table of proposed moves before touching disk. Conflict Avoidance: If invoice.pdf exists at the destination, the organizer renames the new file to invoice_1.pdf. Overwriting is physically impossible. Transaction History: Every batch operation is saved with original paths, destination paths, and timestamps to ~/.lazydesk/operations_history.json. Clicking "Undo Operation" restores everything and prunes newly emptied folders.
  2. Rigorous Quality Assurance (30 Passing Tests)

To guarantee stability, a complete pytest suite covers all modules:

text
============================= test session starts =============================
platform win32 -- Python 3.14.6, pytest-9.1.1
collected 30 items
tests/test_duplicate_detector.py::test_calculate_sha256 PASSED [ 3%]
tests/test_duplicate_detector.py::test_detect_duplicates_with_identical_content PASSED [ 6%]
tests/test_duplicate_detector.py::test_no_duplicates_when_files_differ_in_content PASSED [ 10%]
tests/test_file_scanner.py::test_categorize_extension PASSED [ 13%]
tests/test_file_scanner.py::test_format_bytes PASSED [ 16%]
tests/test_file_scanner.py::test_scan_nonexistent_directory PASSED [ 20%]
tests/test_file_scanner.py::test_scan_file_instead_of_directory PASSED [ 23%]
tests/test_file_scanner.py::test_scan_empty_directory PASSED [ 26%]
tests/test_file_scanner.py::test_scan_populated_directory PASSED [ 30%]
tests/test_local_ai.py::test_build_summarization_prompt PASSED [ 33%]
tests/test_local_ai.py::test_check_ollama_status_connected_with_model PASSED [ 36%]
tests/test_local_ai.py::test_check_ollama_status_connected_without_model PASSED [ 40%]
tests/test_local_ai.py::test_check_ollama_status_connection_error PASSED [ 43%]
tests/test_local_ai.py::test_check_ollama_status_timeout PASSED [ 46%]
tests/test_local_ai.py::test_generate_summary_empty_text PASSED [ 50%]
tests/test_local_ai.py::test_generate_summary_success PASSED [ 53%]
tests/test_local_ai.py::test_generate_summary_timeout PASSED [ 56%]
tests/test_local_ai.py::test_answer_document_question_success PASSED [ 60%]
tests/test_local_ai.py::test_answer_document_question_empty_query PASSED [ 63%]
tests/test_operation_history.py::test_create_new_batch_id PASSED [ 66%]
tests/test_operation_history.py::test_save_and_retrieve_history PASSED [ 70%]
tests/test_organizer.py::test_resolve_filename_conflict PASSED [ 73%]
tests/test_organizer.py::test_preview_organization PASSED [ 76%]
tests/test_organizer.py::test_execute_organization_dry_run PASSED [ 80%]
tests/test_organizer.py::test_execute_and_undo_organization PASSED [ 83%]
tests/test_pdf_processor.py::test_extract_valid_pdf_bytes PASSED [ 86%]
tests/test_pdf_processor.py::test_extract_pdf_file_path PASSED [ 90%]
tests/test_pdf_processor.py::test_detect_empty_or_scanned_pdf PASSED [ 93%]
tests/test_pdf_processor.py::test_pdf_character_truncation PASSED [ 96%]
tests/test_pdf_processor.py::test_invalid_pdf_data PASSED [100%]
============================= 30 passed in 0.67s ==============================
Why Does Open Innovation Matter?

When an AI tool interacts with your personal computer, open innovation isn't just an ideological preferenceβ€”it is the only architecture that makes technical sense.

  1. Absolute Data Sovereignty

Your Downloads folder holds bank statements, proprietary source code, tax filings, and personal medical receipts. Feeding this directory into a closed cloud API requires transmitting your files to third-party servers where they risk inclusion in model training logs. With open weights like Gemma 3 running locally, your private data never leaves your RAM and SSD.

  1. Predictable, Zero-Cost Operation

Closed APIs charge per thousand tokens. When sorting through folders or summarizing dozens of documents a week, metered API bills create hesitation. With open-weight AI, running inference is as free as running a calculator. You can be as lazy as you want without worrying about monthly subscriptions or token limits.

  1. Offline Resilience

Whether you are on an airplane, commuting on a train, or experiencing an internet outage, LazyDesk AI works identically. Cloud APIs fail the moment Wi-Fi drops; local open-weight AI remains completely functional.

  1. True User Agency & Model Swapping

Closed ecosystems trap you in vendor lock-in. Because LazyDesk AI connects to standard Ollama endpoints, users can effortlessly swap between models (gemma3:4b, llama3.2, mistral, phi3) with a single click in the Settings tab.

My Agent Session

This project was developed through pair-programming with the Antigravity autonomous AI coding agent.

The agent served as architect, QA engineer, and implementation partner:

Modular Scaffolding: Structured the system into 6 decoupled modules adhering to single-responsibility principles.
Defensive Engineering: Caught real-world edge cases early (e.g., Python dataclass default argument ordering, multi-line PyMuPDF bounding-box text placement, and Streamlit CSRF configuration).
Automated Sandbox Generation: Wrote create_demo_data.py to ensure all tests and interactive walkthroughs run in an isolated environment without ever touching personal files.
Verification: Executed the test suite autonomously and ensured the live Streamlit server returned healthy HTTP 200 responses before declaring completion.

The full development session transcript, tool calls, and test execution logs are preserved in the project's repository under the .system_generated audit logs, showcasing the complete agentic development journey from architecture design to passing unit tests.

The Lazy Payoff

Here is how LazyDesk AI lets users embrace their inner sloth:

Task The Hard Way (Manual / Cloud API) The LazyDesk AI Way Time & Effort Saved
Cleaning a 200-file Downloads folder 45 minutes of dragging files, creating folders, and checking extensions. 3 seconds: Click Preview, Click Confirm. Files are categorized. 45 minutes saved
Hunting down duplicate files Manually opening files, comparing file dates, checking byte sizes. Instant: Automated SHA-256 scan shows duplicate groups and reclaimable bytes. Zero mental fatigue
Extracting action items from a 30-page PDF 30 minutes of skimming for dates, deliverables, and names. 15 seconds: Gemma 3 4B extracts exact deadlines, named entities, and action items. 29 minutes saved
Regretting a move operation Frantically digging through folders trying to remember where files used to be. 1 click: Click "Undo Operation" in History to restore original file locations. Zero panic
Prize Categories
🌟 Featured Partner Category: Best Use of Gemma ($200 USD)

"Use Gemma, Google's open-weight model, in building your project: run it locally, fine-tune it, or serve it through Google Cloud or another provider."

Why LazyDesk AI Qualifies: LazyDesk AI places Google's open-weight Gemma 3 4B at the very center of its application architecture. Gemma 3 4B runs 100% locally on the user's computer via Ollama, performing real, high-value document synthesis and grounded Q&A tasks. The application is specifically tuned with prompts that leverage Gemma's instruction-following strengths to extract executive summaries, action items, and temporal entities without hallucination.

πŸ† Main Challenge Category: Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

"Build something with open-weight models or open-source AI that rewards laziness."

Why LazyDesk AI Qualifies: Directly inspired by the challenge theme and International Sloth Day, LazyDesk AI automates the dreaded chore of desktop decluttering, duplicate finding, and document reading. It is fully open-source, local-first, rigorously tested, and lets you be lazy without compromising your privacy.

Built with ❀️ for Hacktoberfest 2026. Keep your desktop clean, your AI open, and your data local.

Top comments (0)