Elffuss BraidHub

utopia-ia/elffuss-code public

178a8a01c6e9 · 6.3 KiBRenderedRawPermalink
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
4editor), a file tree, tabs — with an AI agent that reads, searches and edits your project
5for 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
361. **Landing** → "📁 Open code folder" (File System Access — Chrome/Edge).
372. **IDE** → file tree (left) · Monaco with tabs and `Ctrl+S` (center) · AI chat (right).
383. 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)
434. **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.
475. **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## VS Code extensions: themes, grammars, snippets
51
52The **Extensions** button in the activity bar (also *View → Extensions…*, or `/extensions`
53in the chat on small screens) searches [Open VSX](https://open-vsx.org)
54and installs the *declarative* part of VS Code extensions: **color themes** (with a
55Color Theme picker), **TextMate grammars**, **snippets** and **language configurations**
56(comments, brackets, indentation). You can also install a `.vsix` file.
57
58- **No extension code runs.** `main`/`browser` are ignored; the panel says what each
59 extension applies and what would need an extension host (commands, views, debuggers…).
60- **Your project stays in the browser.** Open VSX only sees what you search for and install.
61- Packages are checked against the SHA-256 that Open VSX publishes and kept in IndexedDB.
62- Grammars run on the same engine as VS Code (vscode-textmate + Oniguruma), loaded only
63 when a file needs one: the engine is vendored in `web/js/ext/vendor/` (unchanged, MIT)
64 and the Oniguruma WebAssembly comes from jsDelivr with an integrity check. Without
65 extensions, nothing extra loads.
66- What a package brings is treated as untrusted data: grammars and themes are cleaned
67 of names that would reach `Object.prototype`, snippet details are plain text (no remote
68 images), regular expressions that repeat a repetition are dropped, and `firstLine`
69 patterns run in a Worker with a time limit. The panel lists anything it had to skip.
70- `?noext` starts with every extension paused (to rescue a tab from a bad grammar).
71
72## Run locally
73
74```bash
75python3 server/serve.py 8645 # → http://localhost:8645
76```
77
78Chrome/Edge recommended (WebGPU + File System Access). The **Basic** mode needs no
79download; models are fetched from the CDN/HF the first time and cached afterwards.
80
81Test hook: `?test-opfs` uses the browser's OPFS storage as the project (native folder
82pickers require a human gesture, which headless tests can't provide).
83
84## Architecture
85
86```
87web/
88 index.html IDE shell: tree · Monaco · agent chat
89 js/main.js boot, model selection, WebGPU detection
90 js/agent.js agentic loop: model → tool-call JSON → result → model
91 js/ide.js Monaco, tabs, file tree, HTML preview
92 js/tools/code.js code.tree / read / search / edit / write (the only thing touching your files)
93 js/bridge.js optional local Bridge (real node/npm/python)
94 js/ext/ VS Code extensions: Open VSX, .vsix reader, themes, grammars, snippets
95 js/providers/ onnx (transformers.js) · api (OpenAI/Anthropic/Ollama)
96server/serve.py static server + CORS proxy (dev)
97```
98
99No framework, no build step. The agent talks to the tools with
100` ```tool {"tool":…,"args":…} ``` ` blocks — the same protocol across every provider.
101
102## Shares a core with Elffuss
103
104`db.js`, `context.js` (ACE-lite context eviction), `settings.js`, the providers and the
105WebGL splash come from the sibling repo **[elffuss](https://github.com/KikoCis/elffuss)**.
106Fix something there → sync it here.
107
108## License
109
110[Apache-2.0](LICENSE).
111
112## Gestión de contexto
113
114El 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).
115
116Tablas 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)**.