Stained Glass OS

Stained Glass OS — Claude Code Brief

Org: https://github.com/Stained-Glass-OS (you can create repos there via the GitHub tool) Owner: David Hamner. Ask him when a decision is marked [DAVID].

1. Mission

An open-source, drop-in Windows replacement for managed fleets:

The full vision is built from independently useful subprojects, each shipping as Debian packages that the Stained Glass image consumes.

Non-goals

2. Hard rules

  1. Clean room. Never use leaked Microsoft source. Never disassemble or decompile Microsoft binaries. Black-box behavioral testing against real Windows is fine and encouraged. Microsoft-published open source (e.g. microsoft/Windows-Driver-Frameworks, MIT) is fine, but keep it in its own repo, never inside the Wine tree, so Wine patches stay upstreamable.
  2. Test domains only. Use a lab realm (SGTEST.LAN) and a developer Entra tenant. Never point anything at a production domain, tenant, or real credentials. Never commit secrets.
  3. Every piece has a scripted gate. A subproject is not "working" until make test (or equivalent) exits 0 headlessly. No gate, no merge. Prefer differential tests against a Windows VM oracle.
  4. Don't fork until a patch forces it. Start on packaged upstream Wine. Create wine-sg only when the first real patch exists. Shape every Wine patch for upstream submission (small, tested, one concern). Before submitting anything upstream, check Wine's current contribution policy regarding AI-assisted code and record it in an ADR.
  5. Create repos lazily. Only when the subproject starts. Empty placeholder repos are noise.
  6. Packaging from day one. Each repo carries debian/ and builds a .deb in CI.
  7. Record decisions. stained-glass/docs/decisions/NNNN-title.md (ADR: context, options, decision, evidence). When you evaluate alternatives, write down what broke and why.
  8. Small PRs, conventional commits, CI green. GitHub Actions per repo.

3. Repo map (create on demand)

Repo Purpose License
stained-glass Meta: this brief, README, ROADMAP, ADRs, cross-repo issues CC-BY-SA docs
sg-image mkosi config → bootable immutable Debian image; QEMU boot gate [DAVID] default LGPL-2.1+
sg-session Session glue: compositor launch, system prefix init, explorer start same
sg-testlab Oracle harness: run the same test binaries on Windows VM and SG, diff results; winetest baselines same
wine-sg Wine fork (multi-user wineserver, NT security model, fixes). Only when needed LGPL-2.1+ (Wine's)
wdf-wine Port of Microsoft WDF (KMDF/UMDF) onto Wine's ntoskrnl MIT (upstream's)
sg-pnp udev hotplug → INF match (setupapi) → auto-load into winedevice LGPL-2.1+
gpo-agent Fetch GPOs from SYSVOL, apply registry.pol into system hive, scripts LGPL-2.1+
prt-broker Entra device registration + PRT lifecycle; COM server implementing IProofOfPossessionCookieInfoManager for Edge/Chromium [DAVID]
sg-shell The desktop shell (see §6) depends on origin
sg-compositor wlroots compositor with taskbar/toplevel integration (replaces cage later) [DAVID]
sg-greeter greetd greeter + lock screen, PAM/winbind auth [DAVID]

Local workspace: one directory, each repo cloned as a subdirectory. Every repo gets its own short CLAUDE.md (build, test, gate commands, pointers back to this brief).

4. Phase 0 — bring-up (start here)

Target: a Debian image that boots in QEMU straight into Wine's explorer /desktop as the shell, from a system-level prefix.

Steps: 1. Create stained-glass (meta). Commit this brief as docs/BRIEF.md, plus README, ROADMAP (phases below), ADR template. 2. Create sg-image: - mkosi, Debian stable (trixie) + backports kernel/Mesa, Format=disk, UEFI bootable. - Packages: Wine, DXVK, VKD3D-Proton, greetd, cage, XWayland, Samba/winbind client bits (unused yet), openssh-server for test access. - Wine source: evaluate Debian's package vs WineHQ devel/staging builds. Evaluate Wine's new WoW64 mode to keep the image pure amd64 (no i386 multiarch). Record in an ADR. 3. Create sg-session: - greetd autologin (placeholder for sg-greeter) → cage → wine explorer /desktop=shell,<WxH>. - System prefix at a fixed path (e.g. /var/lib/stained-glass/prefix), initialized at image build or first boot. Single user for now; note every place that assumes single-user in docs/multiuser-debt.md. That list seeds the wineserver work. - Try both display paths: (a) cage + XWayland + winex11 virtual desktop, (b) winewayland. Pick whichever gives a working taskbar and window management today; ADR the result. 4. Gate (make boot-test in sg-image): - Boot headless in QEMU with a timeout. - Guest-side check over ssh/serial: explorer.exe and wineserver alive, desktop window exists, a test Win32 app (notepad) launches and appears in the window list. - QMP screendump saved as a CI artifact. - Exit code reflects pass/fail. 5. CI: GitHub Actions builds the image and runs the gate (KVM if available, TCG fallback with longer timeout).

Done when: fresh clone → make image && make boot-test passes locally and in CI, and the screenshot shows a taskbar with a running app.

Report back at the end of Phase 0: what worked, X11 vs Wayland finding, Wine build choice, the multi-user debt list.

5. Phase 1 — the three spikes (decide the project's fate)

Run in this order. Each has a kill criterion.

S1. wdf-wine: KMDF on Wine's ntoskrnl (highest novelty, cleanest oracle)

S2. Multi-user system Wine (deepest architectural risk)

S3. TWAIN/USB imaging under stock Wine (validates the driver thesis on real hardware)

6. Later phases (sketch only; don't start without David)

7. Oracle harness (sg-testlab, start during Phase 1)

8. Human-provided inputs (ask David; don't work around)

9. First session checklist

  1. Read this brief fully. Create stained-glass, commit brief/README/ROADMAP/ADR template.
  2. Create sg-image and sg-session; get to a passing make boot-test.
  3. Write ADRs: Wine build source, WoW64 mode, X11 vs winewayland.
  4. Write docs/multiuser-debt.md.
  5. Open issues in stained-glass for S1, S2, S3 with their gates copied verbatim from §5.
  6. Stop and report. Do not start Phase 1 repos until David confirms.