跳到正文
DEV Community· Kunal·· 3 小時前AI 評分60

slothdesk 用本機 Gemma 4 整理下載資料夾,找出被遺忘的秘密

slothdesk: a local Gemma sorted my Downloads folder and found a secret I'd forgotten about

AI 導讀

開發者 Kunal 建立 slothdesk,讓本機 Gemma 4 整理下載資料夾、分類檔案並生成待辦摘要,也可辨識截圖中的秘密。工具透過 Ollama 在筆電運行,規則會鎖定機密檔案而不讓模型開啟;程式碼處理日期排序和重複檔案,Gemma 負責分類及挑選優先事項。作者以 69 個截圖檔案測試,掃描需時 7.8 分鐘,並發現一張檔名規則未能識別、顯示恢復資訊的截圖。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge: Week 3 (theme: Slow and Steady).

What I Built

My Downloads folder had over forty files in it this week: old copies of my resume, a traffic challan named after its receipt number, statements, and a few files that really shouldn't be lying around in Downloads at all.

I knew roughly what was in there. I just never wanted to open forty files one at a time to deal with it, so I built something that does it for me.

Tidying files with a small local model is a popular idea this week. sloth-sorter renames files with Gemma 3, and Screenshot Sloth flags screenshots holding OTPs and card numbers. I wanted two things beyond tidy names: a hard rule about which files any model may open, and to be told what in the pile actually needs me this week.

slothdesk is a command-line tool that runs entirely on my laptop:

  1. scan: Gemma 4, running locally through Ollama, looks at every file (screenshots as images, PDFs as text) and gives it a name that says what it is, plus a folder. download (3).pdf becomes finance/2026-09-15-electricity-bill-october-2026.pdf. Nothing moves yet.
  2. apply: moves everything into sorted/, and writes a journal so undo can put it all back.
  3. digest: writes me a note I can read in two minutes: the three things to deal with first, what's coming up, what shouldn't be sitting in Downloads, and what I can delete.

No file leaves the machine, and secrets aren't opened by any model at all.

Demo

slothdesk scanning, sorting and summarising a fake Downloads folder

Everything in that recording is fake. npm run demo builds a messy folder out of made-up bills, a bank statement, a challan, a lease notice, fake keys and recovery codes, and a few app screenshots, so you can try slothdesk without pointing it at your own files.

This is the top of the note it wrote for that folder:

Start here

  1. Pay the fine by 2026-11-05. This has a payment deadline and could incur penalties. 2026-10-25-traffic-fine-receipt-2026.pdf
  2. Sign and return renewal agreement by 2026-11-15. This is a critical deadline for the rental agreement. 2026-10-25-rental-agreement-renewal-notice.pdf
  3. Attend plumber's appointment on 2026-10-26. This is the soonest upcoming scheduled event. 2026-10-22-landlord-plumber-appointment-and-renewal.png

Coming up

  • Mon 26 Oct: Plumber's appointment 2026-10-22-landlord-plumber-appointment-and-renewal.png
  • Fri 30 Oct: Due date for payment 2026-09-15-electricity-bill-october-2026.pdf
  • Sun 1 Nov: Gym membership renewal deadline 2026-10-25-notes-about-tasks-and-renewals.txt
  • ...

Lock these up

  • rootkey.csv: cloud credentials
  • dev-server_key.pem: private key or keystore
  • github-recovery-codes.txt: recovery codes
  • 2026-10-20-secret-on-screen.png: secret shown inside the file
  • ...

The full note is in the repo.

Code

GitHub logo KunalSiyag / slothdesk

Sort a messy Downloads folder with a local Gemma 4, then get a two-minute note from Ultramarine. Secrets never leave the laptop.

slothdesk 🦥

Sort a messy Downloads folder without touching it yourself.

A local Gemma 4 looks at every file on your laptop and gives it a real name and a folder. Then it writes you a two-minute note: what to deal with first, what's coming up, what should not be sitting in Downloads, and what you can delete.

Everything runs on your machine through Ollama. Secrets aren't even opened.

slothdesk sorting a fake Downloads folder

$ slothdesk scan ~/Downloads
[ 1/23] download (3).pdf
      -> sorted/finance/2026-09-15-electricity-bill-october-2026.pdf
[ 5/23] LOCKED rootkey.csv
      -> sorted/_lock-this-up/rootkey.csv
[15/23] Screenshot_2026-10-21_23-14-07.png
      -> sorted/code/2026-10-21-rust-compilation-error-message.png
[21/23] LOCKED Screenshot_2026-10-20_00-12-44.png
      -> sorted/_lock-this-up/2026-10-20-secret-on-screen.png
...
planned 23 files in 137s. 4 secret, 8 private, 2 duplicates. Nothing has moved yet.

$ slothdesk apply ~/Downloads     # moves them, writes an undo journal
$ slothdesk undo ~/Downloads      # puts every file back
$ slothdesk digest ~/Downloads    # the two-minute note

How it decides what a model may see

Every file goes through…

How I Built It

It's about 600 lines of Node with one dependency. Ollama runs the model, pdftotext pulls text out of PDFs, and ffmpeg shrinks screenshots to 1024 px so a 4 GB GPU keeps up.

Deciding what a model is allowed to see

Before any model runs, every file goes through a gate:

  • Secret: caught by name (*.pem, id_rsa, rootkey.csv, anything with "recovery codes") or by a signature in the first 64 KB (a private key header, an AKIA… key, a ghp_… token, a block of recovery codes). No model ever opens these. They go to sorted/_lock-this-up/, where they'll nag me.
  • Private: bank, tax, ID, payslip, resume or challan by name, or text containing a PAN, an Aadhaar-like number, an IFSC code or a PNR. Gemma reads these to name them, but the note writer only learns the category ("bank record"), plus any dates and to-dos.
  • Ordinary: everything else. The writer gets the new name and a one-line summary.

Everything handed to the note writer goes through a scrubber that strips emails, links, PAN-shaped ids, amounts, and any token with four or more digits. Years and ISO dates survive, because deadlines are the point. Original file names are never passed on either, since a tax file is often named after your PAN.

The writer is the same local Gemma, so strictly I don't need any of this. I built the boundary as if the writer were a stranger anyway, so I can swap in a hosted model later without changing what it can learn. There's a --cloud flag for exactly that.

The secret my rules missed

I ran scan on a copy of my real Screenshots folder: 69 files. It took 7.8 minutes, about 7 seconds a screenshot, with no failures. Then I read through the names it had picked, and one of them stopped me. Gemma had named it after what it showed: a recovery screen, with the secret on it. I'd screenshotted it at some point and forgotten, and it had been sitting in a folder full of game screenshots ever since. My name rules couldn't have caught it, because the file was called Screenshot_2026-…png.

So Gemma's answer for every image now includes a secret field: true if it shows a password, a recovery or seed phrase, backup codes or a key. Anything it flags gets treated exactly like rootkey.csv from then on: locked up, no summary passed on, and the writer can't ask about it. On the second run it flagged two of my screenshots. The demo folder has a fake recovery-phrase screenshot so you can watch it happen.

A screenshot folder is full of secrets that don't look like secrets. I wouldn't upload mine anywhere, so the model that reads it has to be one I can run myself.

The note: code for facts, the model for judgment

My first version let Gemma write the whole note. It took over three minutes, left the dates out of order, dropped the flight and the end of the lease, and put the electricity bill under "lock these up". A model with about 4B effective parameters isn't good at holding twenty files in mind and sorting them.

So the work is split now:

  • Code writes everything that has to be exact: upcoming dates in order (only ones where I have to act, not "file created on"), what to lock up, duplicates, old installers, and folder counts.
  • Gemma does the judgment part. It picks the three things I should do first, and before it picks, it can check facts with one tool:
ask_local(file_id, question)
  ask_local f6: Has the traffic fine mentioned in this file been paid?
    -> The status of the traffic fine is listed as UNPAID. Payment is due by the date of November 5, 2026.

The tool opens that one file on the laptop, answers in at most two sentences, and scrubs the answer. Secret files refuse. This uses Ollama's native tool calling with gemma4:e4b, and the whole note takes about a minute instead of three.

Every request, tool call and answer is written to .slothdesk/outbound/, so I can read exactly what the writer saw.

Small things that mattered

  • Turning thinking off. Gemma 4 reasons before it answers by default. For "name this screenshot" that took 28 seconds and 615 tokens. With think: false it takes about 6 seconds and 40 tokens, and the names were just as good.
  • Dates without years. A chat saying "Saturday 26 Oct" came back as 2024. Telling Gemma the file's own date, and to pick the next matching date after it, fixed that.
  • Times aren't dates. "Badge pickup closes at 10:30 AM" became a deadline on October 30. That's now one more line in the prompt.
  • Gemma copying my prompt. I first told it it was "filing a messy Downloads folder", and it named a tweet screenshot messy-downloads-screenshots-folder. Asking it to describe what the image itself shows fixed that.
  • A misc folder that ate everything. On my real screenshots, 27 of 69 landed in misc, mostly games and app screens. Adding games and apps folders and calling misc "a last resort" brought it down to 6.
  • Duplicates. Files are hashed. The oldest copy with the shortest name counts as the original, so Resume.pdf beats Resume (1).pdf.

The Lazy Payoff

With slothdesk, my part is three commands and reading a note. Gemma's part is 7.8 minutes for 69 screenshots, or about 3 minutes for the 23-file demo folder including the note, and I don't have to watch either.

The bigger saving isn't the renaming, though. I never have to open the challan, the lease notice or the bank statement to find out whether one of them needs me this week. The note tells me and points at the file. It also found a secret I'd forgotten I had a picture of, which no amount of manual tidying would have made me look for.

Why Open Matters Here

This only works because the model is open-weight and runs on my own hardware:

  • The pile is the most private data I have. IDs, statements and, it turns out, a secret I'd forgotten about. A hosted model would see all of it. Gemma 4 sees it on my GPU, and nothing leaves.
  • I can check every part. The gate, the scrubber, the prompts and the model weights are all things I can read and run. When it misses something, like that screenshot, I can see why and fix it.
  • It costs nothing per file. I can rescan the whole folder every week without thinking about it. Tidying is only useful if it happens all the time.
  • It runs on a laptop GPU. gemma4:e4b is small enough for 4 GB of VRAM and still reads screenshots, PDFs and chat bubbles well enough to name them.

What's Next

  • Watch mode, to sort new downloads as they land.
  • Sub-folders, and a --keep list for files I want left alone.
  • A weekly run that drops the note into my notes app.

Prize Categories

  • Best Use of Gemma: Gemma 4 (gemma4:e4b) runs locally through Ollama and does all the model work. It reads screenshots as images and PDFs as text, names and files them, spots private documents and secrets visible on screen, answers ask_local questions about single files, and uses native tool calling to check facts before writing the note.

Credits

Built with Gemma 4 through Ollama, pdftotext from poppler, ffmpeg, and headless Chrome for the fake demo files. Written with help from Claude Code.

來源:DEV Community · dev.to