| 1 | # 🧑💻 Elffuss Code — a VS Code-style IDE with an AI soul, 100% in your browser |
| 2 | |
| 3 | **Open a local folder and a full web IDE unfolds around it — real Monaco (the VS Code |
| 4 | editor), a file tree, tabs — with an AI agent that reads, searches and edits your project |
| 5 | for real. Everything runs in your browser: your code never leaves your machine.** |
| 6 | |
| 7 | **[▶️ Live demo](https://code.elffuss.com)** · |
| 8 | **[✳️ Elffuss Claw (sibling project)](https://github.com/KikoCis/elffuss-claw)** · |
| 9 | **[🧬 Shared core](https://github.com/KikoCis/elffuss)** · |
| 10 | **License: Apache-2.0** |
| 11 | |
| 12 | <p align="center"> |
| 13 | <a href="https://code.elffuss.com"> |
| 14 | <img src="https://utopiaia.com/demos/elffuss/elffuss-code-demo.gif" alt="Elffuss Code — the agent reads calc.py, finds a real bug and fixes it, all locally" width="820"> |
| 15 | </a> |
| 16 | </p> |
| 17 | |
| 18 | > In the demo above, a **small model running entirely in the browser** reads `calc.py`, |
| 19 | > finds a real bug and fixes it with a minimal edit — using genuine tool-calling, not |
| 20 | > autocomplete. |
| 21 | |
| 22 | --- |
| 23 | |
| 24 | ## Why it's different |
| 25 | |
| 26 | - **Your code stays on your machine.** No upload, no account, no server round-trip. The |
| 27 | folder is opened locally via the [File System Access API](https://developer.mozilla.org/docs/Web/API/File_System_Access_API). |
| 28 | - **The model runs on *your* GPU** via WebGPU — nothing is sent to a cloud API by default. |
| 29 | - **Real tool-calling, not autocomplete.** The agent reads files, greps the project and |
| 30 | makes minimal, surgical edits — and you watch each tool call happen. |
| 31 | - **Real editor.** Monaco (the actual VS Code editor core), file tree, tabs, `Ctrl+S`. |
| 32 | - **Zero install, zero build.** Vanilla ES modules. Open the URL and you're in. |
| 33 | |
| 34 | ## How it works |
| 35 | |
| 36 | 1. **Landing** → "📁 Open code folder" (File System Access — Chrome/Edge). |
| 37 | 2. **IDE** → file tree (left) · Monaco with tabs and `Ctrl+S` (center) · AI chat (right). |
| 38 | 3. The agent works **only inside your project**, through a small set of tools: |
| 39 | - `code.tree` — list the project |
| 40 | - `code.read` — read a file (paginated, 100 lines at a time, can center on a line) |
| 41 | - `code.search` — grep across the project, with line numbers |
| 42 | - `code.edit` / `code.write` — make edits (the editor refreshes instantly) |
| 43 | 4. **Local brain by default:** Gemma-4 (E4B on desktop, E2B on mobile) via **LiteRT-LM on |
| 44 | WebGPU**, with an **ONNX / transformers.js** fallback (Qwen2.5-0.5B `q4`) when WebGPU |
| 45 | isn't available. External providers (OpenAI, Anthropic, Ollama) are **opt-in** in ⚙️ — |
| 46 | keys stay in your browser and calls go straight to the provider. |
| 47 | 5. **Optional real terminal.** A tiny local **Bridge** (opt-in) lets the agent run real |
| 48 | `node` / `npm` / `python` and read the output — still on your machine, nothing hosted. |
| 49 | |
| 50 | ## Run locally |
| 51 | |
| 52 | ```bash |
| 53 | python3 server/serve.py 8645 # → http://localhost:8645 |
| 54 | ``` |
| 55 | |
| 56 | Chrome/Edge recommended (WebGPU + File System Access). The **Basic** mode needs no |
| 57 | download; models are fetched from the CDN/HF the first time and cached afterwards. |
| 58 | |
| 59 | Test hook: `?test-opfs` uses the browser's OPFS storage as the project (native folder |
| 60 | pickers require a human gesture, which headless tests can't provide). |
| 61 | |
| 62 | ## Architecture |
| 63 | |
| 64 | ``` |
| 65 | web/ |
| 66 | index.html IDE shell: tree · Monaco · agent chat |
| 67 | js/main.js boot, model selection, WebGPU detection |
| 68 | js/agent.js agentic loop: model → tool-call JSON → result → model |
| 69 | js/ide.js Monaco, tabs, file tree, HTML preview |
| 70 | js/tools/code.js code.tree / read / search / edit / write (the only thing touching your files) |
| 71 | js/bridge.js optional local Bridge (real node/npm/python) |
| 72 | js/providers/ onnx (transformers.js) · api (OpenAI/Anthropic/Ollama) |
| 73 | server/serve.py static server + CORS proxy (dev) |
| 74 | ``` |
| 75 | |
| 76 | No framework, no build step. The agent talks to the tools with |
| 77 | ` ```tool {"tool":…,"args":…} ``` ` blocks — the same protocol across every provider. |
| 78 | |
| 79 | ## Shares a core with Elffuss |
| 80 | |
| 81 | `db.js`, `context.js` (ACE-lite context eviction), `settings.js`, the providers and the |
| 82 | WebGL splash come from the sibling repo **[elffuss](https://github.com/KikoCis/elffuss)**. |
| 83 | Fix something there → sync it here. |
| 84 | |
| 85 | ## License |
| 86 | |
| 87 | [Apache-2.0](LICENSE). |
| 88 | |
| 89 | ## Gestión de contexto |
| 90 | |
| 91 | El empaquetador de contexto (BM25 con IDF endógena contra la pregunta viva, sin heurísticas) está medido: recuerdo de hechos **15,1 % → 65,3 %** al mismo gasto de tokens, y **recuperar bien bate a no comprimir** (F1 28,09 contra 22,56 del contexto completo, con el 8 % de los tokens). |
| 92 | |
| 93 | Tablas completas, ablaciones y referencias en el **[core compartido](https://github.com/KikoCis/elffuss#cómo-se-mide-el-gestor-de-contexto)** · la historia con lo que salió mal en la **[bitácora](https://bitacora.utopiaia.com/posts/16-beaten-by-doing-nothing.html)**. |