Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,27 @@ that goes wrong.
to get the pull request moving.
- Request admission with `/queue <full-head-sha>` when the change is ready.

## OX Mobile design system

Every UI change in `desktop/ox-mobile` follows `desktop/ox-mobile/DESIGN.md`
(`crate::arcade` in `desktop/ox-mobile/src/arcade.rs`): build screens from
`arcade::card`, `arcade::section_rule`, `arcade::status_pill`, `arcade::banner`,
`arcade::primary_keycap`, `arcade::mono_well`, `arcade::eyebrow`, and
`arcade::cartridge`; keep native iOS chrome synced to the OX Arcade Dark/Light
palette; keep touch targets >= 44pt (`48pt` for primary/approval CTAs); wrap
button/chip rows for large text sizes; and honor Reduce Motion.
## OX Arcade design system (Desktop & Mobile)

Every UI change in `desktop/ox-desktop` and `desktop/ox-mobile` follows
[docs/design-system.md](docs/design-system.md) (and mobile specifics in
`desktop/ox-mobile/DESIGN.md`):

- **Core principle:** *The cabinet is pixel, the screen is clean.* Build
surfaces from `crate::kit` (Desktop) or `crate::arcade` (Mobile) using
`Palette::get(cx)` — never raw theme boxes or hex literals.
- **Buttons:** At most one primary key-cap CTA (`accent_dim` bottom bevel) per
view. Tabs, choices, and selectors always use uniform-height segmented/choice
controls (never `primary = selected`). Confirmations apply only to
irreversible harm and require a user setting to disable them.
- **Settings:** Place every setting in one of the 4 canonical groups
(`HOST & FLEET`, `ACCOUNTS & MODELS`, `WORKSPACE`, `ADVANCED`), with live
Mobile disclosure summaries and non-blocking inline Desktop saves.
- **Mobile-first / headless-host parity:** Keep native iOS/Android and Desktop
at full parity so a phone-only user with a headless `ox-host` can perform
every workflow cleanly (`>= 44pt` touch targets, `48pt` primary/approval CTAs,
wrapping button/chip rows at large text sizes, explicit sheet `Close`
controls, and Reduce Motion honored).

## Local checks before you push

Expand Down
8 changes: 5 additions & 3 deletions desktop/ox-mobile/DESIGN.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# OX Mobile Design System (OX Arcade)

Every screen and native surface in `desktop/ox-mobile` follows the **OX Arcade**
design system shared with OX Desktop (`desktop/ox-desktop/src/appearance.rs`,
`docs/design/polish-plan.md`).
Every screen and native surface in `desktop/ox-mobile` follows the shared
**OX Arcade Design System** ([docs/design-system.md](../../docs/design-system.md)),
covering unified Desktop + Mobile button grammar, the 4-group Settings
architecture, and headless-host mobile-only parity. This file documents the
mobile-specific `crate::arcade` primitives and iOS/Android layout rules.

**Core principle:** *The cabinet is pixel, the screen is clean.*
Chrome, navigation, status, and identity use the 80s arcade palette and pixel
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ For a first install, start with the [quickstart](../README.md#install-and-first-

- Follow the [repository instructions](../AGENTS.md) for reviews and CI. For security reports and trust boundaries, use the [security policy](../SECURITY.md) and [threat model](threat-model.md).
- To reproduce a result, use the [verification guide](verification.md), the [Codex fixtures](../tests/fixtures/stock_codex/README.md) or the [Claude Code fixtures](../tests/fixtures/stock_claude/README.md). Desktop has its own [build instructions](../desktop/README.md#build-from-source) and [performance measurements](design/desktop/gate-report.md).
- For mobile changes, use the [OX Arcade design system](../desktop/ox-mobile/DESIGN.md) and [native vs. browser parity checklist](mobile-parity.md). The opt-in iPhone Live Activity has a [build guide](../desktop/ox-mobile/live-activity/README.md) and [verification record](../desktop/ox-mobile/live-activity/VERIFICATION.md).
- For UI work on Desktop or Mobile, follow the [OX Arcade design system](design-system.md) (button grammar, 4-group Settings placement, and headless-host mobile parity), the [mobile primitives guide](../desktop/ox-mobile/DESIGN.md), and the [native vs. browser parity checklist](mobile-parity.md). The opt-in iPhone Live Activity has a [build guide](../desktop/ox-mobile/live-activity/README.md) and [verification record](../desktop/ox-mobile/live-activity/VERIFICATION.md).
- For a release, use the [release checklist](design/desktop/release-checklist.md), [workflow](../.github/workflows/ci.yml) and [asset manifest script](../desktop/ci/release-assets.sh). Tag-specific notes live in [releases](releases). Check [published releases](https://github.com/oxstack/ox/releases) for downloads and [delivery status](verification.md#checking-delivery) for the latest confirmed dev or TestFlight commit.
- [Design reviews, plans and worklogs](design) record decisions and observations at the revisions they name. For present behavior, start with the task guide above and follow its implementation.
118 changes: 118 additions & 0 deletions docs/design-system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# OX Arcade Design System (Desktop & Mobile)

This is the single design reference for **OX Desktop** (`desktop/ox-desktop`) and **OX Mobile** (`desktop/ox-mobile`). Every UI change—whether built by a person or an agent—follows these rules so Desktop and Mobile feel like one finished, cohesive, joyful product.

> **Core principle:** *The cabinet is pixel, the screen is clean.*
> Chrome, navigation, status, and identity carry the 80s arcade palette, crisp key-cap bevels, and 7×7 / 20×11 pixel sprites. Transcripts, markdown, code, diffs, and forms stay calm, structured, and effortlessly legible at every text size.

---

## 1. Visual Language & Semantic Tokens

Desktop (`desktop/ox-desktop/src/appearance.rs`) and Mobile (`desktop/ox-mobile/src/arcade.rs`) share one semantic token set in **OX Arcade Dark**, **OX Arcade Light**, and **System (Omarchy)** (with automatic WCAG AA ≥ 4.5:1 contrast guards and hairline clamping).

| Token | Role | Dark | Light |
| --- | --- | --- | --- |
| `bg` | Page canvas | `#191a29` | `#f5f5fa` |
| `nav` | Sidebar, cabinet header, bottom tabs, composer dock, terminal wells | `#12131f` | `#ffffff` |
| `panel` | Cards, editor surfaces, banners, overlays | `#222538` | `#eceef8` |
| `raised` | Default buttons, active tabs/choices, hover fills | `#2d3149` | `#e3e6f4` |
| `line` / `line_strong` | Card hairlines / focused borders & overlay bezels | `#3d415a` / `#494c6c` | `#a9b0c7` / `#6875a6` |
| `fg` / `muted` | Primary / secondary ink (WCAG AA ≥ 4.5:1) | `#f0eff8` / `#b4b7ce` | `#191d32` / `#47516d` |
| `accent` / `accent_dim` | Selection & primary CTA fill / key-cap bottom bevel | `#a6b9ff` / `#6b81c8` | `#465d9c` / `#2f4274` |
| `warning` | Needs you, approval, pending, update ready, YOLO | `#f3bc80` | `#935119` |
| `success` | Connected, live, running, saved, added diff lines | `#92d9bc` | `#216747` |
| `error` | Failed, destructive, removed diff lines, closed error | `#f3a598` | `#a82f35` |

### Hard rules
- **Never hard-code colors or ad-hoc component boxes.** Read `Palette::get(cx)` and build surfaces from `crate::kit` (Desktop) or `crate::arcade` (Mobile). Never hand-roll `.bg(cx.theme().secondary)` or raw hex literals in views.
- **Color always carries meaning—and never stands alone.** Reserve `warning`, `success`, and `error` strictly for status, diffs, and alerts; always pair color with visible text.
- **4 px grid & typography restraint.** Pixel/mono uppercase labels (`section_rule`, `status_pill`, `eyebrow`, key hints) stay short (1–4 words). Never set prose or sentences in uppercase monospace.
- **No visual clutter.** No CRT scanlines, neon bloom/glow, gradients over readable text, or heavy blurred shadows over content. Elevation comes from surface step (`nav` → `bg` → `panel` → `raised`) and crisp `1px` `line` / `line_strong` borders.

---

## 2. Button & Control Grammar

Every button on Desktop and Mobile belongs to exactly one of five roles. Do not mix them.

| Role | Visual spec | Desktop | Mobile | When to use |
| --- | --- | --- | --- | --- |
| **Primary CTA (Key-cap)** | Solid `accent` fill, `on_accent` text, bottom bevel in `accent_dim` (`2px` Desktop / `3pt` Mobile). Height `32px` Desktop / `48pt` Mobile. | `kit::button(..., primary = true, ...)` | `arcade::primary_keycap(button(...), palette)` | **At most one per view** (one exception: Mobile Home's `New thread` + `New project` start row). Never style a destructive action or a selected tab as primary. |
| **Segmented / Choice / Tab** | Uniform height (`28px` Desktop / `44pt` Mobile). Selected = `raised` fill + `accent` border/indicator; unselected = quiet. | `kit::choice_button` / `rail::segmented_button` / `rail::nav_rail_item` | `arcade::selectable_card` / `.selected(on)` chip | Tabs, radio options, harness/runtime selectors, mode switches, filter chips. **Never pass `is_selected` into `primary = true`** (it breaks hierarchy and causes a 4 px height jump). |
| **Quiet Secondary** | `raised` fill, `1px` `line` border, `28px` Desktop / `44pt` Mobile. | `kit::button(..., primary = false, ...)` | `button(...)` | Standard in-flow actions (`Refresh`, `Find`, `Switch`, `Close`, `Cancel`). |
| **Ghost / Toolbar** | Transparent fill until hovered/pressed, `muted` ink, `28px` Desktop. | `kit::toolbar_button` / `kit::icon_button` | Header/inline ghost actions | Quiet header utilities, dismiss controls, compact chips. |
| **Destructive / Stop** | `error` ink and/or border, never solid `accent` primary. | `kit::danger_button` / dedicated `■ Stop` slot | `button(...).danger()` | `Remove`, `Delete`, `Deny`, `Stop`. While a turn is running on Desktop, keep `■ Stop` in a persistent dedicated slot—never hide it when the user starts typing a steer message. |

### Interaction & confirmation rules
- **Instant tactile feedback:**
- Copy controls must confirm visually (`Copied ✓`, auto-reverting cleanly) and scope their feedback key to the specific thread/turn/item.
- Mobile tappable rows use `arcade::tappable_card` (touch-down `.active` feedback + `Haptic::Light` on navigation/actions, `Haptic::Warning` on destructive arm/confirm). Disabled rows must look disabled (`opacity(0.55)`, no press highlight).
- **Confirmations only for irreversible harm (per [AGENTS.md](../AGENTS.md)):**
- Add an inline OX Arcade `Tone::Error` confirmation card only when an action causes irreversible loss (e.g., **Remove paired host** revokes pairing and clears drafts; **Delete project** removes project definition and worker rules). Always clear armed confirmation state when navigating away or switching hosts.
- Do **not** add confirmation friction to reversible actions (e.g., archiving a thread, stopping a turn).
- **Overlays & sheets never trap the user:**
- Desktop overlays use consistent `OVERLAY_RADIUS`, `line_strong` border, clickable dim scrim, and `Esc` dismiss.
- Mobile inline sheets and drawers always render an explicit `≥ 44pt` `Close` control (never rely on iOS edge-swipe alone, which Android lacks).
- Approval sheets pin primary `Allow` / `Deny` decisions in a fixed footer outside the scrollable command/detail well so `Deny` never clips below the fold.

---

## 3. Holistic Settings Architecture (“Where Settings Go”)

Settings use the **exact same 4 groups** on Desktop (fixed left Settings rail + quick filter + `max_w(720px)` reading column) and Mobile (scannable full-width `arcade::tappable_card` disclosure rows—never double-boxed inside outer cards):

| Group | Owns | Desktop rail | Mobile disclosure rows |
| --- | --- | --- | --- |
| **`HOST & FLEET`** | Machine identity, connectivity, remote devices, active processes, updates, worker links, idle lifecycle | `Hosts`, `Remote access`, `Sessions` | Top `Switch host` card, `Host details`, `Host connection`, `Running processes`, `Host updates`, `Paired devices`, `Worker links` |
| **`ACCOUNTS & MODELS`** | Subscriptions, API providers, keys, model ordering, web search | `Accounts`, `Providers & models`, `API keys`, `Starred models`, `Web search` | Compact `Accounts` rows (with one shared `Refresh`), `Providers`, `API keys`, `Starred models`, `Review key transfer` |
| **`WORKSPACE`** | Appearance, motion, text size, input, notifications, new-thread defaults, memory, device security | `Appearance & input`, `Notifications`, `New threads`, `Memory` | `Notifications`, `New threads`, `Appearance`, `Text size`, `Hardware Enter key`, `Reduce motion`, iOS Face ID protection |
| **`ADVANCED`** | Raw config editors, legacy compatibility, host removal | `Advanced configuration`, `Legacy Codex provider` | `Advanced configuration`, `Remove paired host` (with inline confirmation) |

### Settings placement & UX rules
1. **Host-owned vs. device-local:** Settings that change how the host runs agents (providers, API keys, starred models, accounts, projects, new-thread default, idle timeout, host push enrollment) belong to the active host and clearly show which host you are editing. Display/input/motion/device-lock settings are device-local.
2. **Never make users tap blindly:** Every Mobile Settings row must show a live subtitle, count, or status pill plus a trailing `›` chevron (e.g., `2 LIVE`, `UPDATE`, `4 providers`, `6 starred`).
3. **Never blank the screen on save:** Distinguish initial load from background saves. Toggling a preference keeps the form visible and updates an inline header status pill (`SYNCING` → `SAVED`, cleared on navigation or error).
4. **One source of truth:** Never show contradictory settings on two pages (e.g., `Sessions` links directly to `Appearance & input` for `End idle sessions` and surfaces any `OX_HOST_IDLE_MINUTES` override clearly).
5. **Always escapable:** Desktop Settings always shows an explicit `← Back` button and closes on unmodified `Esc` whenever no text input is focused.
6. **No debug fixtures in release UI:** Internal probes (such as `"Input test"`) must be gated behind `cfg!(debug_assertions)` so beta/release users never see developer test tools.

---

## 4. Mobile-First & Headless-Host Parity Contract

A user running a **headless `ox-host`** on a server or laptop with **OX Mobile as their only screen** is a first-class user, not a companion afterthought.

When adding or changing any feature, check all six parity pillars:

1. **Zero-detour thread start:** Pressing **New thread** (from Desktop sidebar, Mobile Home, or Mobile Project Hub) immediately opens a fresh composer draft on the user's standard/default worker-capable route so they can type right away—while keeping harness/route switching 1 tap/click away inside the draft without losing typed text.
2. **Threads first inside Projects:** Opening a project on Mobile lands on a **Project Hub** showing `NEEDS YOU`, `LIVE`, and `RECENT` threads plus `+ New thread` immediately, with folder/worker-rule editing tucked consistently behind `Settings` (same for 1-folder and multi-folder projects).
3. **Real coding-session search:** Activity/sidebar search matches thread titles, defined project display names, and harness/route names with multi-word queries. Transcript Find searches prose, commands, file diffs, tool calls, and web searches with inline match highlights and a dismissible stepper bar.
4. **Clean multi-approval & worker triage:** Both platforms show `NEEDS YOU · 1 OF N`, cycle cleanly across all waiting threads (`Next waiting`), keep nested workers visually subordinate under their lead with one-tap `← Back to lead`, and let operators jump directly to live/waiting processes.
5. **Complete headless administration on phone:** A mobile-only user must be able to switch hosts, pair/revoke devices, inspect & end running processes, apply host updates, sign in to accounts, add/edit/remove providers & API keys, star models, manage projects & worker rules, read/edit OX Memory, and open reviewed terminals—without ever touching Desktop.
6. **Touch & Dynamic Type safety on Mobile:** Every interactive control is `≥ 44pt` tall (`48pt` for primary/approval CTAs), single-line titles/paths use `.min_w_0().truncate()`, action/chip rows wrap cleanly (`.flex_wrap()`), and critical header controls (`Tools`, `Back`) stay pinned outside any horizontal scroll strip.

---

## 5. Arcade Motion, Sprites & Delight Rules

The 80s arcade personality is what makes OX memorable and fun—keep it **alive, context-aware, and restrained**:

- **Fixed slots only:** Pixel sprites belong in the marquee (`OX`), list/header cartridges (`7×7`), the live activity strip (`20×11` on an 8 fps stepped clock), empty states, and approval headers. Never float sprites over prose or code.
- **React to what is actually happening:** Map real tool calls, commands, and lifecycle moments (reading, building, testing, running commands, web search, workers, memory, reviews, shipping/pushing, waiting `INSERT COIN`, and one-shot `Done · HIGH SCORE` / `GAME OVER` / `Stopped` finales) to distinct pixel scenes shared between Desktop and Mobile.
- **Tasteful easter eggs:** Small interactive cameos (tapping the live arcade sprite or marquee) are encouraged as long as they stay self-contained, never block primary interactions, never add layout jitter, and respect Reduce Motion.
- **Reduce Motion & battery hygiene:** Always honor both the system Reduce Motion setting and OX Mobile's local Reduce Motion toggle (`Palette::motion`), falling back to a crisp still key frame. Pause all timers when the window/app is inactive or backgrounded.

---

## 6. Pre-PR Design Checklist

Before opening a UI PR on Desktop or Mobile, verify every item:

- [ ] **One primary CTA per view** using the `accent_dim` key-cap bevel; all tabs/choices use uniform-height segmented/choice controls.
- [ ] **No raw theme/box overrides**—every surface uses `crate::kit` or `crate::arcade` tokens and looks balanced in both OX Arcade Dark and Light.
- [ ] **Settings belong in one of the 4 canonical groups**, with live Mobile disclosure summaries and non-blocking Desktop saves.
- [ ] **Mobile-only headless-host user check:** Can a phone-only user discover, reach, and exit this flow cleanly in 1–2 taps at large text sizes?
- [ ] **No UX traps:** Desktop overlays/Settings exit on `Esc` + click-outside/`← Back`; Mobile sheets have explicit `≥ 44pt` `Close`; `Deny` never clips; `Stop` stays visible while drafting.
- [ ] **Diff & status parity:** `+` = `success`, `−` = `error`, `@@` = `muted`, `+N −M` file counts, consistent status pills (`LIVE`, `NEEDS YOU`, `CONNECTING`, `IDLE`, `ENDED`).
- [ ] **Reduce Motion honored** and zero new compiler/Clippy warnings on Linux, iOS, and Android (`debug` + `release`).