qor Tech Spec
The core functionality of qor: what every feature gets, and how it works underneath. As of November 29, 2026.
Contents
Overview
qor is a local desktop app (Electron, React, TypeScript) whose core lets drop-in features share storage, theming, backups, a dashboard and Claude access. It has no server or database. All state is files in one data directory.
This is an as-built spec: it describes qor as the code works today.
| In scope (core) | Out of scope |
|---|---|
| Feature and theme contract, discovery, hosting | The internals of the 9 features (To Do, Health, Job Tracker and others) |
| Storage, enablement, dashboard layout, backups | The styling of the 10 themes |
| Claude providers, background jobs, email intake | The vendored Go job-hunter tool |
| Shared services: metrics, PDF and email export, web fetch | Gmail, Google Health and Oura sync behaviour, beyond how core uses them |
Design rules
- Drop-in extensions. Adding a folder under
features/orthemes/registers it at build time. There is no manifest to edit. - Content and presentation are separate. Features build UI only from the theme's components.
- Disabling never touches content. It writes one flag to
config/features.json. - Claude is swappable. Features call one interface and don't choose the provider.
Architecture
qor has two main layers. The renderer runs all UI and extension code, and the main process owns files, credentials, subprocesses and most network access.
| Layer | Path | Responsibility |
|---|---|---|
| Main | src/main/ | Files, backups, Claude transport, PDF export, IPC handlers, timers |
| Preload | src/preload/ | The only bridge into the renderer. contextIsolation is on, nodeIntegration off |
| Renderer core | src/renderer/core/ | Extension contract, discovery, hosting, storage hook, jobs, theming |
| Shared | src/shared/ | Types and IPC channel names used by both sides |
| Extensions | features/, themes/ | Found by import.meta.glob at build time |
At startup, main creates the data folders, registers IPC and starts the backup timers. It also starts two other tasks:
- A scan of local Claude Code transcripts, every 5 minutes.
- A Job Tracker reply check. Main polls every 15 minutes and runs it when enabled and due (default once a day).
Data Model
All state sits in one directory, and a feature's id is also its content filename. The directory is $QOR_DATA_DIR if set. Otherwise it is .qor-dev-data/ in development or userData/qor-data/ when packaged.
| Type | Key fields | Notes |
|---|---|---|
AppConfig | themeId, claude, backup, manualTimes, manualBaselines | Stored values are merged over defaults, so new keys appear on upgrade |
FeatureStates | id → enabled, changedAt | A missing entry means enabled |
WidgetLayout | featureId, w, h, collapsed, hidden | 24-column grid, 50 px rows, layout version 2. Version 1 values are doubled on load |
IntakeMessage | id, receivedAt, from, subject, body | Ignored after 30 days |
MetricRecord | feature, process, startedAt, durationMs, ok, error, counts, stepsMs | Rebuilt and validated in main before it is appended |
BackupEntry | kind, id, createdAt, sizeBytes | id is the kind plus a sortable timestamp |
Storage guarantees
- Atomic replace.
writeJsonwrites a.tmpfile, then renames it over the target. - Ordering. Writes are queued per file, and
readJsonwaits for pending writes. - Id safety. Content reads and writes require ids of 1–64 lowercase letters, digits or hyphens, not starting with a hyphen.
Core Flows
FeatureHost gives every view the same context, and the renderer queues slow or emailed work so features can apply it.
Hosting and persistence
A feature has a required Page and optional Widget and Settings views. FeatureHost mounts each one inside an error boundary, so a render crash stays within that view.
The design assumes one hook per content file at a time.
Claude requests
Features call ask or askJson and don't choose a provider. ask() rejects empty prompts, and rejects skill requests unless the CLI provider is active.
| Behaviour | CLI provider (default) | API provider |
|---|---|---|
| Transport | claude -p --output-format json, prompt on stdin, run from the temp directory | @anthropic-ai/sdk, optional and loaded on first use |
| Auth | The user's Claude Code sign-in | ANTHROPIC_API_KEY, else the key in config |
| Structured output | Schema added to the prompt, JSON extracted from the reply | Native json_schema format, then parsed |
web, skill, tools | Passed as allowed tools | Skills rejected. web and tools ignored |
| Local files | Read tool plus the files' folders | Attached as PNG, JPEG or PDF blocks |
| Limits | 180 s default timeout, 32 MB output | 16,000 max tokens by default. timeoutMs is not applied |
| Refusals | Reported only if the CLI returns an error | Optional server-side fallback, retried without it if the call fails |
- Lean mode.
lean: truekeeps only the web or file tools needed and a short system prompt. It skips MCP servers, skills and user settings. It is ignored whenskillortoolsis set, and by the API provider. Project notes record an email-parse batch falling from about 41k to 2.3k tokens. - File access. Only main can set
files. The IPC handler strips it from renderer requests.
Email intake
Intake lets a feature take instructions by email, and mail is fetched only when the user presses Check Email. Subjects must start with qor. The mailbox's own address is always accepted, and other senders must be on the allow-list.
- A feature opts in with
intake: { subject, handle }. It applies mail only while its page or widget is mounted. - If
handlethrows, the batch stays queued. The host retries on the next check or visit, so handlers must be all-or-nothing. - Concurrent checks share one run. Queue changes are serialised, and the last 500 message ids are remembered.
Background jobs
ctx.jobs.start queues slow work that continues after the user leaves the page. One job runs at a time across all features, in start order. A key already queued or running is ignored.
work returns a data update. Core applies it through the mounted feature's setData, or reads and writes the file if the feature is closed. A thrown error changes nothing. The queue is in memory, so it doesn't survive a reload or quit.
Interfaces and Configuration
Extensions have one public import, @qor/theme-kit, and reach main through services that core hands them.
Feature contract
FeatureModule member | Required | Purpose |
|---|---|---|
manifest | Yes | id, name, description, optional icon and version |
initialData | Yes | Default content, and the base for the load merge |
Page | Yes | Full view with its own sidebar route |
Widget, widgetDefaults | No | Dashboard view and starting size |
Settings | No | Section in the app's Settings page, mounted when expanded |
intake | No | Email subject and handler |
FeatureContext group | Members |
|---|---|
| Own data | data, setData, loading, saving |
| Cross-feature | readFeatureData, writeFeatureData, openFeature, openFullPage |
| Core services | claude, jobs, metrics, intake, exportPdf, emailDocument, webFetch |
| Feature-specific adapters | jobSearch, jobTracker, gmail, googleHealth, oura, digest, bodyScan, claudeUsage |
Discovery, theming and dashboard
- Discovery. The registry skips a feature with no
Page, no manifest id or an unsafe id. It skips a theme with no id or components. - Themes. A theme supplies tokens, components and optional CSS and effects. Missing required components (32 listed) come from the
defaulttheme, and Settings marks the theme as partial. - Enablement. Disabled features leave the sidebar and dashboard. Their content and widget slot are kept.
- Dashboard. New widgets are added automatically, and slots for removed features are dropped. Main clamps sizes and removes duplicates.
- Reports. Features describe a
PrintDocument, and core renders it as a PDF or an email body. Email goes only to the intake mailbox.
Backups
Content and config are snapshotted as plain folder copies on separate timers (see Data Model). By default, qor also backs up both on quit. Restore first snapshots the current state, then replaces the live folder, and the UI reloads.
Configuration and dependencies
| Item | Detail |
|---|---|
claude settings | provider cli, cliPath claude, API model claude-opus-5, effort high, refusalFallback on |
| Environment | QOR_DATA_DIR moves the data directory. ANTHROPIC_API_KEY overrides the stored key |
| Runtime and build | Electron 31, React 18, TypeScript 5.5, electron-vite 2. dev and build also compile the job-hunter tool with Go |
| Optional | @anthropic-ai/sdk for the API provider |
| Commands | npm run dev, npm run demo, npm run typecheck, npm run build |
| Metrics | Appended to metrics/runs.jsonl on a best-effort basis. A failed write never fails the run |