IdealOS

Database-Centric Desktop OS — Implementation Plan

Snapshot of the living doc as of 2026-11-20. The live, commentable version is at https://claude.ai/artifact/2AoVkkrF4cbFsHAEHQXKxe.

This plan turns the feature list into milestones M0–M14, from first boot to a daily-driver system.

Approach

Build the bus and database first, and make every service run natively on macOS before it runs on the device. Only the display and input backends are Linux-only.

Milestone map

Arrows point from a milestone to the milestones that need it.

Phase 0 · Bring-up
   M0 First boot ───────────────────────────────► M1 Pixels
        │                                            │
Phase 1 · Core OS                                    │
        ▼                                            │
   M2 Message bus ──► M3 Database v1                 │
                           │                         │
                           ▼                         │
                      M4 App runtime ◄───────────────┘
                           ▼
                      M5 Widgets and WM
                           ▼
                      M6 Permissions
                           ▼
                      M7 First apps
Phase 2 · Daily driver     ▼
                      M8 Backup and restore
                           │
     ┌──────────┬──────────┼──────────┬──────────┬──────────┐
     ▼          ▼          ▼          ▼          ▼          ▼
  M9 Editor  M10 Email  M11 Music  M12 Chat  M13 Browser  M14 DB shell
                ▲                                │
                └──── full HTML email waits ─────┘

M1 and M2 can be built in parallel after M0. Phase 1 is a single chain because each milestone needs the one before it. Phase 2 fans out after M8.

Repository layout

One repo: a Cargo workspace for everything in Rust, a pnpm workspace for TypeScript, and a Buildroot external tree for the image.

idealos/
├── Cargo.toml              # Rust workspace
├── package.json            # pnpm workspace for sdk/ and apps/
├── crates/
│   ├── protocol/           # message types, scene ops, query filter, grants; JSON Schema + TS codegen
│   ├── bus-client/         # client library used by every service and the app host
│   ├── busd/               # broker: routing, pub/sub, peer identity, permission checks
│   ├── db-core/            # storage engine: SQLite, Loro, query compiler, blobs, history
│   ├── dbd/                # database service on the bus
│   ├── permd/              # grants store, prompts, audit log
│   ├── secretsd/           # encrypted secrets store
│   ├── compositor/         # scene graph, widgets, layout, text, renderer, window manager
│   │   └── backends/       # winit (hosted) and kms (DRM/KMS + libinput)
│   ├── app-host/           # QuickJS runtime, one process per app
│   ├── session/            # starts and restarts services; launches apps in sandboxes
│   ├── netd/               # NetworkManager bridge
│   ├── ptyd/               # PTYs and terminal grids for the terminal app
│   ├── audiod/             # PipeWire playback
│   ├── maild/              # Gmail API sync
│   ├── chatd-dummy/        # fake chat service
│   ├── importd/            # file importers and exporters
│   ├── backupd/            # snapshots, backup, restore
│   ├── browser-host/       # Servo embedding, external surfaces
│   └── osctl/              # CLI: bus tracing, db queries, app install
├── sdk/                    # @idealos/sdk: bus, db, signals, widgets, permissions
├── apps/                   # settings, documents, terminal, editor, mail, music, chat, browser
├── schemas/                # system schemas: Contact, Email, Message, Track, ...
├── image/                  # Buildroot external tree
│   ├── configs/            # qemu_aarch64_defconfig, rpi4_defconfig
│   ├── board/              # partition layouts, RAUC config, overlays
│   └── package/            # Buildroot packages for our crates and apps
├── tools/                  # run-qemu, flash-sd, deploy-to-pi
└── docs/

Development environment

Most work happens on the Mac in hosted mode. An aarch64 Linux build VM produces images and device binaries, QEMU checks Linux-only paths, and the Pi checks performance.

Change Run it on How
Bus, database, permission logic Mac cargo test, cargo run
Compositor rendering, widgets, layout Mac hosted winit backend
TypeScript apps and SDK Mac osctl app install --watch
KMS, libinput, sandboxing, NetworkManager QEMU dev image plus SSH deploy
GPU performance, memory, audio, Wi-Fi Pi 4 dev image plus SSH deploy

Key interfaces

These are first drafts. Each one lives in the protocol crate as Rust types, with JSON Schema and TypeScript types generated from them.

Bus envelope

Frames are length-prefixed JSON (a 4-byte big-endian length, then UTF-8 JSON) over a Unix socket. The broker stamps from on every message; a client-supplied from is dropped.

{"id": 42, "kind": "request", "to": "db", "method": "query", "params": {"type": "Email", "where": {"read": false}}}
{"id": 42, "kind": "response", "ok": true, "result": {"docs": []}}
{"id": 43, "kind": "response", "ok": false, "error": {"code": "permission_denied", "message": "read Email not granted"}}
{"id": 44, "kind": "request", "to": "db", "method": "watch", "stream": true, "params": {"type": "Email", "where": {"read": false}}}
{"id": 44, "kind": "stream", "data": {"kind": "diff", "added": [], "changed": [], "removed": []}}
{"kind": "subscribe", "id": 45, "topic": "ui.theme"}
{"kind": "publish", "topic": "ui.theme", "from": {"service": "settings"}, "data": {"dark": true}}

Scene-graph ops

An app sends a batch of ops per transaction. Node IDs are allocated by the app, per connection. Node 1 is the window’s root.

{"id": 50, "kind": "request", "to": "compositor", "method": "commit", "params": {"window": 1, "ops": [
  {"op": "create", "id": 10, "type": "vstack", "props": {"gap": 8, "padding": 12}},
  {"op": "create", "id": 11, "type": "label", "props": {"text": "Inbox (3)", "style": "title"}},
  {"op": "create", "id": 12, "type": "button", "props": {"label": "Compose"}},
  {"op": "insert", "parent": 1, "child": 10, "index": 0},
  {"op": "insert", "parent": 10, "child": 11, "index": 0},
  {"op": "insert", "parent": 10, "child": 12, "index": 1},
  {"op": "listen", "id": 12, "events": ["click"]}
]}}

A later update is a single op: {"op": "set", "id": 11, "props": {"text": "Inbox (4)"}}. Events come back as {"kind": "publish", "topic": "ui.event", "data": {"window": 1, "id": 12, "event": "click"}}. A text widget can bind straight to a document field with "props": {"bind": {"doc": "<doc id>", "path": "body"}}, so typing goes from the compositor to the database without passing through the app.

Database queries

The query filter is JSON with Mongo-style operators, compiled to SQL over the JSON copies of documents. $link follows links between documents.

const unread = db.live({
  type: "Email",
  where: { read: false, labels: { $contains: "INBOX" } },
  orderBy: [["date", "desc"]],
  limit: 50,
});

const fromFamily = db.query({
  type: "Email",
  where: { from: { $link: { type: "Contact", where: { tags: { $contains: "family" } } } } },
});

const hits = db.search("quarterly report", { type: "Email" });

Permission grants

A grant names an app, the access it has, and a filter in the same query language. Capabilities such as network access are grants too.

{"app": "org.idealos.mail", "access": ["read", "write"], "type": "Email", "filter": {}}
{"app": "com.example.frame", "access": ["read"], "type": "Image", "filter": {"album": "Family"}}
{"app": "org.idealos.browser", "capability": "network"}

An app

import { app, db, ui, permissions } from "@idealos/sdk";

export default app(async () => {
  await permissions.request([{ access: ["read"], type: "Email" }]);
  const unread = db.live({ type: "Email", where: { read: false }, orderBy: [["date", "desc"]] });

  return ui.window({ title: "Inbox" },
    ui.vstack({ gap: 8 },
      ui.label(() => `Unread: ${unread().length}`),
      ui.list({ items: unread, row: (email) => ui.label(() => email().subject) }),
    ),
  );
});

Phase 0: Bring-up

M0: Toolchain and first boot

Goal: the same Buildroot config boots to a shell in QEMU and on the Pi 4, and Rust binaries deploy to both.

Done when: make qemu boots the dev image to a shell on the Mac, the Pi 4 boots from SD card, and a Rust binary deployed over SSH runs on both.

M1: Pixels

Goal: the compositor draws a scene graph through wgpu on all three targets: hosted macOS, QEMU and the Pi.

Done when: a demo scene equal to about 20 windows of rects, images and text runs on the Pi 4 at 1080p and 60 fps, or the gap is measured and written down. The same code runs hosted and in QEMU.

Phase 1: Core OS

M2: Message bus

Goal: services and apps exchange requests and pub/sub messages through busd, with trusted identities.

Done when: two services talk over busd on all three targets, osctl bus tap shows the traffic, and latency on the Pi is measured.

M3: Database v1

Goal: a working document store with queries, live updates, full-text search, links, blobs, history, undo and snapshots.

Done when: osctl can create, query, search, link and undo documents; a live query subscriber gets diffs; snapshots restore; Pi benchmark numbers are recorded.

M4: App runtime

Goal: a TypeScript app runs in its own process and shows a live database query in a window.

Done when: a counter app and an app showing a live list of notes run in windows, both hosted and on the Pi.

M5: Widgets and window manager

Goal: a full widget set and a usable desktop with windows and workspaces.

Done when: several apps share workspaces, every widget works in the gallery, and bound text edits survive a restart.

M6: Permissions and sandboxing

Goal: apps get only what they are granted, for both data and network access.

Done when: an app without grants gets permission_denied; a prompt grants access; revoking database access takes effect immediately; a network grant takes effect after restart; tests show apps cannot open files or sockets they were not given.

M7: First apps

Goal: the Pi boots straight to a desktop that can join Wi-Fi, browse documents and run a shell. This ends Phase 1.

Done when: the Pi boots to the desktop, joins Wi-Fi from Settings, and the author can browse documents and use a shell.

Phase 2: Daily driver

M8 comes first. After that, M9 to M14 depend only on Phase 1 and can be built in any order, except that full HTML email waits for the browser.

M8: Backup and restore

Goal: no data is lost to a dead SD card. Encrypted backups, a recovery boot and system updates moved to a later milestone (see Later: encryption, recovery and system updates).

Done when: after wiping the data partition, a restore from USB brings back every document and blob.

M9: Text editor

Goal: a place to write that never loses anything. Documents are database records, so there are no files and no Save button: every keystroke is stored, history keeps every version, and undo survives a restart. Most of the work is UI; the database already does persistence, history, search and links.

Compositor work first:

The editor:

Later:

Done when: the author writes real documents in it.

M10: Email (Gmail API)

Done when: the inbox syncs incrementally, and reading, archiving, labeling, replying and sending all work.

M11: Music player

Goal: your music library on the Pi, playing without a skip. Playback lives in audiod, a service, not in the app: the app’s JavaScript can stall or quit, but audio mustn’t, so the app is a remote control and music keeps playing when it’s closed.

System work first:

audiod:

The library:

The player app:

Later:

Done when: an album imported from USB plays from the library, keeps playing with the app closed, and is controlled from the top bar.

M12: Chat (dummy service)

Done when: the chat app works against the dummy service, and the interface is documented for real services.

M13: Browser (Servo)

Done when: common sites are usable on the Pi, and history and bookmarks show up in the document browser.

M14: Database shell, import and export, history viewer

Done when (Phase 2 gate): the author uses the system as their main computer for writing, mail and music for one week.

Future projects

Not scheduled. Each needs its own go-ahead.

Later: encryption, recovery and system updates

Moved out of M8, to come after the Phase 2 apps or when beta testers need them.

Done when: an encrypted backup restores with only its recovery code, a device that won’t boot restores from USB, and a deliberately broken update rolls back.

Pi 3: OpenGL ES 2.0 renderer

The Pi 3’s GPU (VideoCore IV, Mesa’s vc4 driver) only does OpenGL ES 2.0. It has no Vulkan driver (V3DV starts at the Pi 4’s VideoCore VI), and wgpu’s GL backend needs ES 3.0, so today the Pi 3 renders on the CPU through lavapipe. On a Pi 3B+ at 1080p a frame takes about 250 ms (4 fps at best), and the compositor uses about a full core even at rest. Rendering at 720p and letting the display hardware scale it up (--render-height) makes text fuzzy and didn’t visibly help.

Done when: the Pi 3 draws the desktop at native 1080p at 30 fps or better while a window is dragged, with sharp text.

Styles, fonts and transitions

How things look, and how they move, without apps drawing anything themselves. Today’s theme is a fixed set of constants (theme.rs) that apps name with $accent. Colour tokens are already looked up as each frame’s draw list is built, so restyling is a table swap and region damage redraws what changed with no new code. Window textures are a later phase (see screen and window effects).

Style sheets: CSS-like, but simpler. Colours and fonts only; layout stays in props.

:root   { --accent: #3b82f6; --text: #1f2937; font-family: "Inter Variable", sans-serif; font-size: 14px; }
button  { background: var(--control); color: var(--text); }
button.primary { background: var(--accent); color: var(--accent-text); }
button:pressed { background: var(--control-pressed); }
.code   { font-family: "DejaVu Sans Mono", monospace; }
@dark   { :root { --text: #e5e7eb; --surface: #111827; } }

Fonts: several families, local only.

Transitions: in the compositor only. Apps set the end value; the compositor animates there, so motion never waits on an app’s JavaScript or the bus.

At 3440x1440 the Pi 4 moves a window at about 35 fps (a drag’s cost, mostly the fixed tile cost of a partial frame), and 1080p should reach 60. Short transitions, 150 to 200 ms, hide a lower frame rate well.

Done when: switching to dark in Settings restyles every open app at once; an app overrides the accent colour and a font from its own style.css; the terminal’s family comes from the style; switching workspaces slides the windows across, and hover and press colours fade, at full frame rate on the Pi 4 at 1080p.

Grow /data to fill the card

HiDPI scaling

Screen and window effects

Shaders applied to the whole screen (a warm night tint) or to particular windows (dim inactive windows, grey out one that isn’t responding, frosted glass, open and minimize animations). Each window is already its own layer in the draw list (Scene::draw_list: one layer per child of the root), which is the seam both kinds of window effect use.

Beyond the usual effects, one aim of IdealOS is to explore new uses of GPU effects in the window manager: showing what an app is allowed to do and is doing, not just decorating it. The compositor already knows enough for that without new plumbing: each window’s app (apps.rs), that app’s grants, live (it follows permd’s table on perm.grants, so a revocation arrives within milliseconds), and each window’s workspace (wm.rs).

Ideas for effects that carry meaning:

Where each lands: the frame tint and edge glow need only the existing quad shader and theme tokens (draw.rs, theme.rs), with tiers worked out from the grants table the compositor already follows; content tints come with level 1 window effects; the data-access glow needs a new dbd event stream and a rule for who may subscribe.

Done when: a night tint fades in at a set time on the Pi, inactive windows can be dimmed, one per-window shader (blur behind a dialog, or an open animation) runs at full frame rate on the Pi 4, and windows show their permission tier and workspace in their frames.

Testing strategy

Most tests run on the Mac and in CI without hardware. QEMU covers boot and Linux-only paths, and a performance script on the Pi closes each milestone.

Area How it is tested
Query compiler Property tests (proptest): random documents and filters; SQL results must match a simple in-memory evaluator
CRDT and JSON copy Property tests: random edits; the JSON copy must always equal the Loro document’s state
Database durability Kill dbd during writes in a loop; check integrity and that no committed change is lost
Bus Fuzz the frame parser (cargo-fuzz); every service method gets a permission-denied test
Compositor Headless backend renders to an offscreen texture; golden-image tests on lavapipe for stable output
UI behavior Record scene-op streams from real apps and replay them in tests
SDK and apps Run in app-host against a mock bus
Boot and integration CI boots the image in QEMU and runs a smoke script over SSH: desktop up, app installed, query answered, screenshot taken
Performance Script on the Pi records frame time, input latency, bus round trip, query time and memory per app; numbers are tracked per milestone

First steps

Start with the repo skeleton, then run the six spikes. They are independent of each other, and their results update the feature list’s risks table before M1 starts.

  1. Repo skeleton, CI and the build VM (start of M0).
  2. Spike A: wgpu to KMS in QEMU, on lavapipe with a dumb-buffer copy and on virgl GLES.
  3. Spike B: wgpu to KMS on the Pi 4, on V3DV with dmabuf import.
  4. Spike C: Loro plus SQLite on the Pi: write, JSON copy, FTS5 index and query, at 10,000 documents.
  5. Spike D: memory and startup time of an rquickjs process on the Pi, times eight.
  6. Spike E: build Servo for aarch64 and render a page into an offscreen buffer.
  7. Spike F: Gmail OAuth sign-in and one mailbox sync from the Mac, to confirm scopes and token lifetime.
  8. Draft the protocol crate: bus envelope and scene-graph ops.