DEV Community

German Peña
German Peña

Posted on

loopwork: The AI proposes, you decide — a local coding workshop inside the chat

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission 🦥

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

What I Built

loopwork is a local workshop for files and code that lives inside the chat of DeepSeek, ChatGPT, Gemini and Claude. The AI never touches your disk: it only receives what you explicitly share, and its answers arrive as a diff you review, approve or reject.

  • Virtual disk (OPFS) or a real folder on your PC, with full ZIP export.
  • Editor with highlighting, search/replace, live HTML preview, and a mandatory diff before saving.
  • Local Git with buttons or commands (init, add, commit, diff, branch, checkout, restore).
  • Per-file checkpoints before any destructive operation, plus recovery after interrupted browser closes.
  • Bash-style project commands: mkdir -p app/{src,docs}, touch, tree, mktree.
  • Multi-step undo/redo that survives page reloads.

Who gets to be lazier? Anyone who codes with an AI chat and is tired of copy-pasting blocks by hand. With loopwork: share a file → the AI replies with a dv block → click Review patch → click Apply. A checkpoint is created and the SHA256 is verified before writing. If the file changed since the AI saw it, the proposal is rejected. Zero copy-paste, zero silent changes.

Demo

The page runs inside a real chat (Gemini, in the screenshot there) and walks through the full cycle: share → propose → review → apply → run → commit.

Code

GitHub logo germanpet-svg / loopwork

Entorno de edición y versionado 100% local en el navegador. Edita archivos, ejecuta código y colabora con IA sin subir nada a ningún servidor. OPFS + Git + WebAssembly.

loopwork

Taller local de archivos y código asistido por IA dentro de DeepSeek, ChatGPT, Gemini y Claude. Userscript basado en OPFS y Git: la IA propone, el usuario revisa y aprueba.

Versión actual: 1.15.0. 135 pruebas Node más una suite nueva en tests/ (121 pruebas: traducciones, análisis de código y e2e en Chromium) Es un prototipo funcional, no un IDE completo ni un sistema de respaldo externo.

Documentación: Manual del usuario (paso a paso) · Roadmap (estado y pendientes) · Portada del proyecto.

En 60 segundos

  1. Instala Tampermonkey y pega loopwork.js en un script nuevo.
  2. Abre DeepSeek (o ChatGPT / Gemini / Claude, experimentales): aparece el panel flotante.
  3. Nuevo archivo… → pega tu código → Compartir archivo… → pide un cambio.
  4. En la respuesta pulsa Revisar parche en DV, mira el diff y Aplicar cambios.
  5. Ejecutar para probar y Guardar cambios en Git para versionar.

Todo…

The complete userscript is in loopwork.js. The extension/ folder contains the Chrome extension variant.

How I Built It

loopwork is a userscript (~11k lines of plain JavaScript, no build) injected into four chat sites via Tampermonkey, plus an equivalent Chromium extension.

Three layers:

  1. Storage: OPFS or the File System Access API. Same FileSystemDirectoryHandle interface for both.
  2. Atomic writes: each write goes to .dv_tmp/<uuid>.tmp, verifies SHA256, logs PREPARED to .dv/journal.jsonl, writes the target, verifies, logs COMMITTED, then deletes the temporary file. On startup, recoverTransactions() completes, reverts, or saves the approved version aside.
  3. Isolated UI: a panel in a closed shadowRoot, with a capture-phase keyboard guard so ChatGPT doesn't steal focus into its composer.

Open AI at the core:

  • DeepSeek and GitHub Copilot collaborated as AI tools on ideas, code, docs and tests. No sponsorship or affiliation implied.
  • The dv protocol is an open JSON (path, hash, operation, old, new, optional patch or changes[]). Any LLM can emit it; any client can consume it.
  • The SHA256 verified before applying is what makes it possible to trust an LLM without a closed API: I don't need the model to be deterministic, only for its proposal to be tied to an exact file version.

No server: the only network requests are isomorphic-git and diff from jsDelivr at install (or bundled in the extension).

Why Does Open Innovation Matter?

loopwork could not exist as a closed API:

  • The disk is yours. OPFS and File System Access need no backend. A closed service would have to custody your files in its cloud.
  • The protocol is open and documented. Anyone can write a client that speaks dv, or a model that emits it. If a provider disappears, the format keeps working.
  • The SHA256 hash is the guarantee. I trust the model because every proposal is tied to an exact hash of the file it saw — not because the provider promises determinism.
  • The AI doesn't touch the disk. The design makes silent changes impossible, even if the model tries.
  • Open distribution. An 11k-line userscript fits in one file, can be audited, and can be forked.

The live page shows loopwork running inside Gemini, with nothing installed outside the browser: same userscript, same protocol, same editor and same local Git as in DeepSeek, ChatGPT or Claude. The same client talks to any LLM because the contract (hash + diff + approval) does not depend on the provider.

The Lazy Payoff

  • Copy-pasting code: ~15–20 times per session × ~10 s = ~3 min/session, and hours per month.
  • Reviewing what the AI changed: a 2–3 s read of the patch instead of re-reading the whole file. ~10× faster.
  • Recovering a broken file: one !restore instead of going back to a commit or losing work.
  • Mid-save browser closes: recoverTransactions() decides on startup. Zero broken files in daily use.

Did I use it this week? Yes — it's my daily tool for writing loopwork itself: the 11k lines have been edited, versioned and tested inside loopwork, with DeepSeek and Copilot emitting dv proposals I review with the editor. Pure dogfooding.

Prize Categories

  • Best Use of an Open-Weight Model — dv is model-agnostic; tested with DeepSeek and Copilot.
  • Best Developer Tool — mandatory diff + checkpoints are the heart.
  • Most Innovative Use of AI — SHA256 as a verifiable contract between LLM and disk.
  • Best Use of Open Source — isomorphic-git, diff, native Compression/Decompression Streams.

Thanks for reading. If it's useful, leave a comment or open an issue on the repo.

Top comments (0)