DEV Community

Ekong Ikpe
Ekong Ikpe

Posted on

Gnoke Persist: Your Browser Has Short-Term Memory Loss. I Fixed It. ๐Ÿ‘Œ

Gnoke vibes

Have you ever spent an hour typing something into a website, only for your phone to get a notification, refresh the page, and POOFโ€”everything you typed is gone?

That happens because browsers are like Etch-A-Sketches. The moment you "shake" them (refresh or switch apps), they wipe the screen clean. This is especially true on Android, where the system often kills "sleeping" browser tabs to save battery, destroying your unsaved work without warning.

I built gnoke-persist to give your browser a permanent memory. Itโ€™s a tiny, zero-dependency script that turns your browser into a durable tool.

Here is how it works (using three tiny "robots"):

1. The Spirit (The Ghost in the Machine) ๐Ÿ‘ป

The Spirit is a tiny robot that watches you type. Every time you press a key, it scribbles what you wrote into a secret notebook inside the browser.

  • The Magic: If the tab dies or you refresh, the Spirit reads its notebook and refills the boxes. This form recovery works across all modern browsersโ€”Safari, Chrome, Firefox, and Edge.
  • The Privacy Filter: The Spirit is helpful, but it tries to be safe. It looks for words like password, token, or secret and ignores those fields. While itโ€™s not a cryptographic vault, itโ€™s designed to keep your secrets out of the recovery log.

2. The Shelf (The Safety Net) ๐Ÿงบ

Usually, if a website tries to save a file to your computer and the battery dies mid-save, that data just disappears.

The Shelf uses a "Write-Ahead" strategy. Before it even tries to touch your hard drive, it puts a copy of the data on a waiting shelf (IndexedDB). If the browser crashes, the data stays on the shelf. The next time you open the app, the robot sees the item and attempts to finish the delivery for you.

3. The Bridge (The Key-Holder) ๐Ÿ”‘

Browsers are very protective. Even if you give a website permission to a folder, the browser "locks the door" every time you refresh the page.

The Bridge remembers where your files live. Even when the door locks, the Bridge stays standing. You don't have to pick your folder all over again; you just tap one button to provide a "user gesture." The Bridge then re-opens the path and flushes any saved work from the Shelf straight onto your computer.


The Breakdown of Capabilities

Feature Chrome / Edge / Brave Safari (iOS/Mac) Firefox
Spirit (Form Recovery) โœ… Universal โœ… Universal โœ… Universal
The Shelf (Durable Log) โœ… Local Sync โœ… Local Sync โœ… Local Sync
The Bridge (Disk Write) โœ… Direct to Folder โŒ Capability Limited โŒ Capability Limited

The Technical Truth (For the Engineers)

If you prefer documentation over metaphors, here is the recovery chain under the hood:

  • The Spirit = State Persistence: Uses a debounced listener on input events to sync form values to IndexedDB. It attempts a final sync on visibilitychange, though durability ultimately depends on IndexedDB commit timing before a process kill.
  • The Shelf = Write-Ahead Logging (WAL): Every write() call is first committed to an IndexedDB object store before being sent to the File System Access API. This provides a durability layer that survives process termination.
  • The Bridge = Handle Re-acquisition: Manages the FileSystemDirectoryHandle stored in IndexedDB. It handles the NotAllowedError by providing an orchestration layer that re-requests permission via a user gesture, then flushes the WAL (the Shelf) to disk.

Why should you care?

Most web apps are "flimsy." I wanted to build something "Durable." * Zero Dependencies: A tiny vanilla script. No heavy engines, no cloud required.

  • Private & Local: Your data stays in your browser and on your disk.
  • Progressive Grace: It recovers what it can everywhere, and does the heavy lifting where the browser allows it.

The vibe is simple: Stop losing work.


Check it out:

gnoke-persist v0.1.1 ยท Edmund Sparrow ยท MIT 2026

Top comments (0)