How I Built a Local-First AI OS on Windows Using Node.js 24 node:sqlite, FTS5, and sqlite-vec
Most AI agents ask you to upload your mail, files, and desktop context to a third-party cloud and trust them not to do anything destructive. I wanted the opposite: a local-first AI operating system that runs on my own W
Most AI agents ask you to upload your mail, files, and desktop context to a third-party cloud and trust them not to do anything destructive.
I wanted the opposite: a local-first AI operating system that runs on my own Windows machine, keeps all memory in SQLite, works with any model (Ollama, Gemini, OpenAI, Anthropic, OpenRouter), and asks before it acts.
Today I open-sourced Mergen OS v3.0.0 (GitHub Β· Direct Windows ZIP, AGPL-3.0 + Commercial). Here are the three architectural decisions that made it practical.
1. One Unified Local Brain (node:sqlite + FTS5 + sqlite-vec)
Instead of spinning up Docker + Qdrant/Chroma/Postgres, Mergen OS uses Node.js 24's built-in node:sqlite with FTS5 and the sqlite-vec extension in a single local mergen.db file.
Six local sources are indexed into one unified_memory table:
- Meeting transcripts (
vault/meetings/*.md) - B2B accounts & CRM activities
- Daily goals and scheduled tasks
- Compact daily chat summaries
- Active contextual memories (strictly excluding secrets)
Every query runs hybrid Reciprocal Rank Fusion (RRF):
-
unified_memory_fts(bm25) for exact lexical & prefix matches -
unified_memory_vec(vec0128-dim local L2-normalized embeddings) for morphological & cross-lingual recall
All three UI surfaces β the HUD chat, the Nixy desktop notch (live meeting whisper cards), and Business Hub search β query the exact same local index.
(Tip for anyone using node:sqlite + sqlite-vec: bind vec0 primary keys as BigInt(id) rather than JS Number, because node:sqlite binds JS numbers as REAL.)
2. Fail-Closed Approval & Safety Plane
Every non-read tool call passes through a single pipeline:
intent -> plan -> risk/policy check -> human approval -> execution -> receipt/evidence -> rollback
- Approval Queue: Sending emails, posting to social media, running PowerShell, or touching money pauses for explicit user approval.
- Kill Switch: Immediately halts all side effects.
- Prompt-Injection Quarantine: External web/email content is marked untrusted; tainted turns cannot trigger sensitive tools automatically.
-
Mergen Vault: Local encrypted secrets (
scrypt + AES-256-GCM) that never enter logs, memory, or cloud prompts.
3. Fast 12-Language HUD + Isolated Python .venv Sidecars
- Splitting the 12-language HUD dictionary into per-language lazy-loaded JSON packs (
apps/hud/assets/i18n/*.json) cut the initial i18n JS payload by 97.9% (760 KB β 15.7 KB). - Optional Python features β dual-channel WASAPI loopback meeting capture (works even on Bluetooth headsets), local Whisper STT, and the Nixy WebView2 desktop notch β run in an isolated
.venvmanaged by a restart-capped supervisor.
Try It in 3 Minutes (Windows 10/11, No Admin Rights)
- Download
Mergen-OS-v3.0.0-win64.zipfrom Releases. - Extract anywhere and double-click
Install-Mergen.cmd. - Open
http://localhost:3000and pick only the modules you want (Personal, B2B Export, Creator, Developer, or All).
Repo: https://github.com/lupusmagnum1/mergen-os
Would love your feedback on the hybrid SQLite memory design and the approval plane!
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.