<?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: Vivek S M</title>
    <description>The latest articles on DEV Community by Vivek S M (@vivek_s_m).</description>
    <link>https://dev.to/vivek_s_m</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%2F4243920%2Fb156e60a-2061-47b7-8a6a-4b4202d0e5aa.png</url>
      <title>DEV Community: Vivek S M</title>
      <link>https://dev.to/vivek_s_m</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vivek_s_m"/>
    <language>en</language>
    <item>
      <title>I wanted my Downloads folder to clean itself up. Then I realised a path isn't a file.</title>
      <dc:creator>Vivek S M</dc:creator>
      <pubDate>Sat, 14 Nov 2026 09:47:37 +0000</pubDate>
      <link>https://dev.to/vivek_s_m/i-wanted-my-downloads-folder-to-clean-itself-up-then-i-realised-a-path-isnt-a-file-11l0</link>
      <guid>https://dev.to/vivek_s_m/i-wanted-my-downloads-folder-to-clean-itself-up-then-i-realised-a-path-isnt-a-file-11l0</guid>
      <description>&lt;p&gt;&lt;em&gt;The story behind CleanDrop: a local-first Chrome extension that gives downloads better names and schedules their cleanup without blindly trusting a file path.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You know the routine. You download a PDF and Chrome saves it as &lt;code&gt;download (7).pdf&lt;/code&gt;. You tell yourself you'll rename it later. A week passes. Now you have six files with names that tell you absolutely nothing.&lt;/p&gt;

&lt;p&gt;And then there's the other problem: the Downloads folder slowly becomes a storage unit for things you needed once. A presentation for a meeting that ended last week. A ZIP you extracted months ago. A screenshot you only needed long enough to send it to someone.&lt;/p&gt;

&lt;p&gt;I wanted two small conveniences: make downloads easier to recognise, and let me say, “I only need this for a day, clean it up later.” That sounded like a small browser extension.&lt;/p&gt;

&lt;p&gt;The first idea was simple. The safe version wasn't. Renaming a file is easy; trusting a cleanup operation that will run tomorrow is a different problem.&lt;/p&gt;

&lt;p&gt;That project became &lt;strong&gt;CleanDrop&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F63b60vygre3xig5lqtcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F63b60vygre3xig5lqtcx.png" alt="CleanDrop popup showing its cleanup queue, default cleanup duration and a scheduled download" width="387" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;CleanDrop's popup: a simple queue for downloads I've explicitly chosen to clean up.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There was one question I hadn't thought through at first: &lt;strong&gt;what if the file disappears, and a completely different file takes its place at exactly the same path?&lt;/strong&gt; Should the scheduler delete it just because the timer expired? Obviously not. That question ended up shaping the most important part of the design.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Make filenames useful before reaching for AI
&lt;/h2&gt;

&lt;p&gt;My first instinct was to send every generic filename to a model. But why call one for a file already named &lt;code&gt;Quarterly_Financial_Report.pdf&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;CleanDrop tries the available evidence in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keep the original name if it is already meaningful.&lt;/li&gt;
&lt;li&gt;Inspect the URL for a useful filename, such as &lt;code&gt;/files/annual-report-2025.pdf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Use context from the page that initiated the download if the URL is opaque.&lt;/li&gt;
&lt;li&gt;Only if those steps produce no suggestion, ask the optional local model.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The analyzer flags generic names (&lt;code&gt;download&lt;/code&gt;, &lt;code&gt;document&lt;/code&gt;), camera/screenshot patterns, numeric basenames, UUIDs, hashes and known CDN rewrites.&lt;/p&gt;

&lt;h3&gt;
  
  
  The page and the file may come from different places
&lt;/h3&gt;

&lt;p&gt;A download button can live on a documentation site while the file itself comes from a CDN. Looking only at the download URL can miss the useful clue: the page the user was reading.&lt;/p&gt;

&lt;p&gt;A content script captures the page URL, title, description and Open Graph metadata; it does not scrape the body. The service worker keeps recent contexts in memory, matching the exact referrer, then its origin, then the download origin. If a restart clears that context, it falls back to the active tab.&lt;/p&gt;

&lt;p&gt;Only a &lt;code&gt;no_suggestion&lt;/code&gt; result reaches the local model. Its request includes the original filename, URL, referrer and page metadata. The prompt restricts it to that evidence, asks it to preserve the extension and forbids inventing file contents.&lt;/p&gt;

&lt;p&gt;For example, this is the kind of context it may receive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"filename"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"IMG_20260828.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://example-garden-blog.com/tulips.jpg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"page_title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"10 Best Spring Flowers For Your Garden"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"page_description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"A guide to planting tulips, daffodils, and crocuses."&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model endpoint is OpenAI-compatible and runs on &lt;code&gt;127.0.0.1&lt;/code&gt;. The Python request has a six-second timeout; the extension has an eight-second outer timeout guard. If the model is unavailable, slow or returns unusable output, Chrome keeps the original filename. A failed rename should never become a failed download.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fao9mfr38scdcv73haa22.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fao9mfr38scdcv73haa22.png" alt="CleanDrop filename decision pipeline" width="800" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The principle is simple: use evidence that's already there; let the model handle only the ambiguous remainder.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The extension uses Chrome's &lt;code&gt;onDeterminingFilename&lt;/code&gt; event, which supports asynchronous filename suggestions when the listener returns &lt;code&gt;true&lt;/code&gt; and calls &lt;code&gt;suggest&lt;/code&gt; later. &lt;a href="https://developer.chrome.com/docs/extensions/reference/api/downloads#event-onDeterminingFilename" rel="noopener noreferrer"&gt;Chrome's downloads API documents the event contract.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The browser process couldn't be my scheduler
&lt;/h2&gt;

&lt;p&gt;The next problem was less visible but had a big impact on the architecture.&lt;/p&gt;

&lt;p&gt;CleanDrop communicates with its Windows companion through &lt;code&gt;chrome.runtime.sendNativeMessage()&lt;/code&gt;. With this API, Chrome launches the native messaging host for an individual message. That is useful for short request/response work, but it is not a process you should expect to sit around checking a database every few seconds.&lt;/p&gt;

&lt;p&gt;So I separated two jobs that have different lifetimes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;cleandrop-host.exe&lt;/code&gt;&lt;/strong&gt; handles browser requests: suggest a filename, schedule cleanup, cancel an item or list pending items.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;cleandrop-scheduler.exe&lt;/code&gt;&lt;/strong&gt; runs continuously after user logon. It checks for expired downloads every 30 seconds and runs the local-model watchdog every 15 seconds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The extension owns browser interaction. The host answers the browser. The scheduler owns work that must continue after the browser request ends.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxq6rq404i5s9zwxwyj69.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxq6rq404i5s9zwxwyj69.png" alt="CleanDrop system architecture" width="800" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Two companion processes, because a browser request and a background scheduler should not have the same lifecycle.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This distinction follows Chrome's native messaging model: &lt;code&gt;sendNativeMessage&lt;/code&gt; starts a host for a message, while &lt;code&gt;connectNative&lt;/code&gt; provides a longer-lived port. &lt;a href="https://developer.chrome.com/docs/extensions/develop/concepts/native-messaging" rel="noopener noreferrer"&gt;Chrome's native messaging documentation&lt;/a&gt; explains the difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A path isn't a file identity
&lt;/h2&gt;

&lt;p&gt;Back to that question from the beginning.&lt;/p&gt;

&lt;p&gt;Imagine CleanDrop schedules this file for tomorrow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\Users\me\Downloads\invoice.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before tomorrow, the original file is removed. Another file is later placed at exactly the same path. A naive scheduler sees &lt;code&gt;invoice.pdf&lt;/code&gt;, sees that it is due, and deletes it.&lt;/p&gt;

&lt;p&gt;But that is not the file the user scheduled.&lt;/p&gt;

&lt;p&gt;A path tells you where to look. It doesn't prove what is currently there.&lt;/p&gt;

&lt;p&gt;On Windows, CleanDrop calls &lt;code&gt;GetFileInformationByHandleEx&lt;/code&gt; with &lt;code&gt;FileIdInfo&lt;/code&gt;. The returned &lt;code&gt;FILE_ID_INFO&lt;/code&gt; contains a volume serial number and a 128-bit file ID. When the user schedules cleanup, CleanDrop stores those values alongside the path and expiry timestamp.&lt;/p&gt;

&lt;p&gt;When the file becomes due, the scheduler:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Claims the scheduled database row.&lt;/li&gt;
&lt;li&gt;Checks that the stored path exists.&lt;/li&gt;
&lt;li&gt;Reads the current file identity at that path.&lt;/li&gt;
&lt;li&gt;Compares it with the identity captured when cleanup was scheduled.&lt;/li&gt;
&lt;li&gt;Proceeds only if the identities match.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The important check is small:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;actual_identity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_file_identity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"identity_key"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;actual_identity&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;download&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"identity_key"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"IDENTITY_MISMATCH"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the file is missing, the operation returns &lt;code&gt;NOT_FOUND&lt;/code&gt;. If a different file occupies the path, it returns &lt;code&gt;IDENTITY_MISMATCH&lt;/code&gt;. If the identity matches, CleanDrop asks the Windows Shell to move the file to the Recycle Bin using &lt;code&gt;FOF_ALLOWUNDO&lt;/code&gt;, then checks that the original path is gone.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnzjg743hx0c0gougjckc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnzjg743hx0c0gougjckc.png" alt="CleanDrop safe expiry lifecycle" width="800" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Identity is checked before the Recycle Bin operation. It is a safety gate, not an atomic filesystem transaction.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What if the user clicks Keep at the same time?
&lt;/h3&gt;

&lt;p&gt;There's another race: the scheduler notices that a file is due just as the user clicks &lt;strong&gt;Keep file&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;CleanDrop handles this with conditional SQLite updates. The scheduler can change a row from &lt;code&gt;SCHEDULED&lt;/code&gt; to &lt;code&gt;DELETING&lt;/code&gt; only if it is still scheduled and due. The keep action can change it from &lt;code&gt;SCHEDULED&lt;/code&gt; to &lt;code&gt;CANCELLED&lt;/code&gt; only if it is still scheduled. Whichever update commits first wins; the other operation no longer matches its expected state.&lt;/p&gt;

&lt;p&gt;The scheduler's claim is a conditional update:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;downloads&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;delete_status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'DELETING'&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;delete_status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'SCHEDULED'&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;delete_after&lt;/span&gt; &lt;span class="k"&gt;IS&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="kt"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;delete_after&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="kt"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'now'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This isn't a distributed lock. It's a small compare-and-set style transition for two competing operations on one local database row. That's the mechanism this design needs.&lt;/p&gt;

&lt;p&gt;There are still limits. CleanDrop checks identity at the stored &lt;code&gt;current_path&lt;/code&gt;; it doesn't search the drive to rediscover a file after it has been moved. And identity verification happens before a separate path-based Recycle Bin call, leaving a check-then-act window. The current implementation narrows the risk; it doesn't eliminate it.&lt;/p&gt;

&lt;p&gt;Windows documents the volume serial number and 128-bit file ID in &lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_id_info" rel="noopener noreferrer"&gt;&lt;code&gt;FILE_ID_INFO&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The performance surprise was in SQLite
&lt;/h2&gt;

&lt;p&gt;CleanDrop stores only downloads the user has explicitly scheduled for cleanup. During a Windows benchmark, mean SQLite insert latency was &lt;strong&gt;45.01 ms&lt;/strong&gt; with the rollback journal.&lt;/p&gt;

&lt;p&gt;I switched the connection to Write-Ahead Logging and &lt;code&gt;synchronous=NORMAL&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"PRAGMA journal_mode=WAL"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"PRAGMA synchronous=NORMAL"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In that recorded test, mean insert latency fell to &lt;strong&gt;3.07 ms&lt;/strong&gt; about 14.7× faster. The p99 moved from &lt;strong&gt;213.82 ms&lt;/strong&gt; to &lt;strong&gt;14.42 ms&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl2wkr54mz3dlat0bnbgw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl2wkr54mz3dlat0bnbgw.png" alt="SQLite WAL benchmark" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Measurements from the recorded Windows / Python 3.12.4 test environment, not a guarantee for every machine.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;WAL changes SQLite's read/write behavior and can help readers and writers make progress concurrently. It also introduces checkpointing considerations. &lt;code&gt;synchronous=NORMAL&lt;/code&gt; is a trade-off: the database remains consistent, but the most recent committed transaction can be lost after power loss or an operating-system crash. SQLite's &lt;a href="https://www.sqlite.org/wal.html" rel="noopener noreferrer"&gt;WAL documentation&lt;/a&gt; and &lt;a href="https://www.sqlite.org/pragma.html#pragma_synchronous" rel="noopener noreferrer"&gt;&lt;code&gt;synchronous&lt;/code&gt; pragma reference&lt;/a&gt; explain the details.&lt;/p&gt;

&lt;p&gt;Two other measurements helped shape the design: the native-host round trip averaged &lt;strong&gt;95.07 ms&lt;/strong&gt;, including subprocess startup, protocol handling and the database operation. That is not a full Chrome end-to-end measurement. The local filename-model benchmark recorded a &lt;strong&gt;1,075.6 ms median&lt;/strong&gt; and &lt;strong&gt;1,935.3 ms p95&lt;/strong&gt;, which reinforced why model inference should stay optional and bounded.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Let an assistant inspect the queue but don't give it a delete button
&lt;/h2&gt;

&lt;p&gt;I added an optional MCP server so an assistant can answer questions such as “What's scheduled to be cleaned up this week?” or “Keep this file.” Its tools are deliberately limited:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;list_scheduled_deletions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;search_downloads&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;get_download&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;keep_file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is no delete tool. Reads use SQLite's read-only mode (&lt;code&gt;mode=ro&lt;/code&gt;). The only state-changing operation is &lt;code&gt;keep_file&lt;/code&gt;, and it can cancel an item only while its status is still &lt;code&gt;SCHEDULED&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The MCP layer excludes incognito downloads, reduces source URLs to hostnames, strips control/invisible characters from website-controlled text and bounds result sizes. These steps reduce exposure; they do not eliminate privacy or prompt-injection risks. The server runs locally over stdio, but connecting it to a cloud assistant still sends tool results into that assistant's conversation. &lt;strong&gt;Local transport does not automatically mean local inference.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned and what I'd improve next
&lt;/h2&gt;

&lt;p&gt;CleanDrop started as a convenience feature. It became a project about making automation safe when the world changes between scheduling and execution.&lt;/p&gt;

&lt;p&gt;The lessons I’m taking forward are straightforward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use deterministic evidence before paying the cost or accepting the uncertainty of inference.&lt;/li&gt;
&lt;li&gt;Give short-lived browser requests and persistent background work separate process lifetimes.&lt;/li&gt;
&lt;li&gt;Treat paths as references, not identities.&lt;/li&gt;
&lt;li&gt;Make competing state transitions explicit.&lt;/li&gt;
&lt;li&gt;Benchmark before assuming the database is fast enough.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'd still like to improve moved-file recovery and close the gap between identity verification and the later Recycle Bin operation. CleanDrop is Windows-focused today because it relies on Windows file identity and the Windows Shell.&lt;/p&gt;

&lt;p&gt;The bigger lesson is this: &lt;strong&gt;automation is easy when everything goes right. Building automation that behaves safely when things change unexpectedly is the hard part.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The source is available at &lt;a href="https://github.com/its-nott-me/CleanDrop" rel="noopener noreferrer"&gt;github&lt;/a&gt;. If you were building a cleanup tool, how would you handle a file that moves after it has been scheduled?&lt;/p&gt;




&lt;p&gt;If you found CleanDrop useful or interesting, consider giving the repo a ⭐ on GitHub. It helps support the project and motivates me to keep improving it!&lt;/p&gt;




&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.chrome.com/docs/extensions/reference/api/downloads#event-onDeterminingFilename" rel="noopener noreferrer"&gt;Chrome downloads API - &lt;code&gt;onDeterminingFilename&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.chrome.com/docs/extensions/develop/concepts/native-messaging" rel="noopener noreferrer"&gt;Chrome extensions - Native messaging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_id_info" rel="noopener noreferrer"&gt;Microsoft - &lt;code&gt;FILE_ID_INFO&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.sqlite.org/wal.html" rel="noopener noreferrer"&gt;SQLite - Write-Ahead Logging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.sqlite.org/pragma.html#pragma_synchronous" rel="noopener noreferrer"&gt;SQLite - &lt;code&gt;PRAGMA synchronous&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>chromeextension</category>
      <category>performance</category>
      <category>opensource</category>
      <category>python</category>
    </item>
  </channel>
</rss>
