You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SkyTwin is a local-first product — everything runs on the user's machine. But today, launching SkyTwin means opening a terminal and running `pnpm dev`. There's a 427 LOC Electron shell at `apps/desktop/` but it has minimal UI and no process management. For the HN launch, the desktop app is the product: users download an installer, launch, and go.
Claude Code estimate: ~4-6h
Current State (verified 2026-04-04)
`apps/desktop/src/main.ts`: Basic Electron app with `ServiceManager` and tray icon (~427 LOC)
`bin/skytwin-dev`: Shell script that starts processes with `&` — no restart, no health monitoring
`docker-compose.yml`: No restart policies, health checks only for CockroachDB
Web dashboard: Fully functional SPA at `apps/web/` — can be loaded in BrowserWindow
Proposed Change
Turn the Electron shell into a full desktop application that manages the entire SkyTwin lifecycle. Initial build targets macOS; Windows and Linux builds in #16.
Process management
Start CockroachDB, API, worker, web as supervised child processes
Health monitoring every 5s, restart with backoff (1s → 2s → 4s → max 30s)
5 failures in 5 minutes → mark failed, alert user
Graceful shutdown: SIGTERM → 5s wait → SIGKILL
System tray
Status: green (healthy) / yellow (degraded) / red (failed)
Menu: Open Dashboard, Pause Twin, Resume Twin, Settings, About, Quit
Main window
BrowserWindow loading localhost (existing web dashboard)
Optional login item via `app.setLoginItemSettings()`
Default off, configurable in Settings
First-launch flow
Check Node.js + CockroachDB
Guide install if missing (Homebrew on macOS, Chocolatey/Scoop on Windows, apt/snap on Linux)
Run migrations + seed
Start services
Open onboarding wizard
DMG packaging (macOS first)
electron-builder, app icon, Info.plist
Acceptance Criteria
Download DMG → drag to Applications → launch → onboarding wizard visible within 10 seconds
System tray icon shows green circle/dot when all 4 child processes (CockroachDB, API, worker, web) report healthy
`kill -9` on API child process → tray icon turns yellow within 5 seconds → API restarts automatically → tray returns to green within 10 seconds total
`kill -9` on API 5 times within 5 minutes → tray turns red → alert dialog shown: "SkyTwin API failed to start — check logs" → process not restarted again
"Pause Twin" from tray menu → worker stops polling (no new signals ingested) → tray menu shows "Resume Twin" instead → "Resume Twin" restarts polling within 2 seconds
During implementation, maintain two sources of truth to survive context compaction:
Local context file: Write progress, decisions, and blockers to .context/issue-13-desktop-app.md (gitignored). Update this file after each meaningful step. On compaction, re-read this file to restore state.
Context
SkyTwin is a local-first product — everything runs on the user's machine. But today, launching SkyTwin means opening a terminal and running `pnpm dev`. There's a 427 LOC Electron shell at `apps/desktop/` but it has minimal UI and no process management. For the HN launch, the desktop app is the product: users download an installer, launch, and go.
Claude Code estimate: ~4-6h
Current State (verified 2026-04-04)
Proposed Change
Turn the Electron shell into a full desktop application that manages the entire SkyTwin lifecycle. Initial build targets macOS; Windows and Linux builds in #16.
Process management
System tray
Main window
Native notifications
Auto-launch
First-launch flow
DMG packaging (macOS first)
Acceptance Criteria
Testing Plan
Effort Estimate
Total: ~4-6h Claude Code time
Files Reference
Out of Scope
Related
Working Context Protocol
During implementation, maintain two sources of truth to survive context compaction:
.context/issue-13-desktop-app.md(gitignored). Update this file after each meaningful step. On compaction, re-read this file to restore state.This ensures no quality loss across compaction events — the local file has granular state, the GitHub issue has durable history.