11# DexDex Design
22
3- DexDex uses a Connect RPC-first architecture with Tauri clients and Rust servers.
3+ DexDex is a cross-platform orchestration UI for CLI-based coding agents.
4+ DexDex uses a Connect RPC-first architecture with Tauri clients and Go servers.
45This document is the primary architecture reference.
56
7+ ## Product Overview
8+
9+ DexDex orchestrates coding agents such as Claude Code, OpenCode, and Codex CLI.
10+ DexDex does not implement model reasoning logic. It coordinates agent execution, stores execution history, and visualizes progress and outcomes.
11+
12+ Primary outcomes:
13+
14+ 1 . task orchestration with clear action states
15+ 2 . multi-repository execution with deterministic repository order
16+ 3 . plan approval and revision loop in UI
17+ 4 . PR creation and remediation as first-class flows
18+ 5 . real-time logs and event streaming
19+ 6 . local and remote execution through a unified API contract
20+
621## Product Goals
722
8231 . Use Tauri as the desktop and mobile app container.
9- 2 . Use Rust for ` main-server ` and ` worker-server ` .
24+ 2 . Use Go for ` main-server ` and ` worker-server ` .
10253 . Use ` Workspace ` as the primary connectivity and scope concept.
11264 . Use UnitTask-centric workflows with nested SubTask and AgentSession history.
12275 . Make PR management and PR review assist first-class workflows.
13286 . Provide real-time event streaming for UI updates and automation.
14- 7 . Support iOS and Android as first-wave platforms.
29+ 7 . Treat desktop, iOS, and Android as first-class platforms with phased capability rollout .
1530
1631## Non-Goals
1732
18331 . Direct local folder execution without worktree.
19342 . Tauri-invoke-first business contracts.
20353 . Native OS notification plugin as the primary notification channel.
36+ 4 . Building a proprietary coding-agent runtime that replaces CLI agents.
37+ 5 . Hosting git repositories.
38+
39+ ## Platform Strategy
40+
41+ ### Desktop
42+
43+ Desktop and mobile are both product-priority platforms.
44+ Desktop is optimized for dense authoring workflows and keyboard-heavy interaction.
45+
46+ ### Mobile
47+
48+ Mobile uses the same API and data model as desktop.
49+ Capability rollout is phased by interaction constraints, not platform priority:
50+
51+ 1 . baseline support: task monitoring, log viewing, approval and stop actions, and core remediation triggers
52+ 2 . expanded support: broader remediation, review interaction, and authoring parity as UX matures
53+
54+ Mobile is not a separate business-logic path.
2155
2256## Top-Level Architecture
2357
2458```
2559 Connect RPC + Event Streams
2660┌───────────────────────┐ https://api endpoint ┌───────────────────────┐
27- │ Tauri Client │ <----------------------> │ Main Server (Rust) │
61+ │ Tauri Client │ <----------------------> │ Main Server (Go) │
2862│ (Desktop / iOS / │ │ - RPC API │
2963│ Android) │ │ - Workspace/Task/PR │
3064│ - React UI │ │ - Event broker │
@@ -34,19 +68,25 @@ This document is the primary architecture reference.
3468 │ │ Connect RPC
3569 │ │
3670 │ ┌─────────▼──────────┐
37- │ │ Worker Server (Rust) │
71+ │ │ Worker Server (Go) │
3872 │ │ - Worktree exec │
3973 │ │ - Agent sessions │
4074 │ │ - Log stream │
4175 │ └────────────────────┘
4276```
4377
78+ Communication rule:
79+
80+ 1 . client business communication is main-server canonical
81+ 2 . client does not open direct business channels to worker server
82+ 3 . worker communication is server-to-server through Connect RPC
83+
4484## Monorepo Structure
4585
46- - ` apps/main-server/ ` (Rust )
47- - ` apps/worker-server/ ` (Rust )
86+ - ` apps/main-server/ ` (Go )
87+ - ` apps/worker-server/ ` (Go )
4888- ` apps/tauri-app/ ` (Tauri + React)
49- - shared Rust crates under ` crates/ ` with Cargo workspace management
89+ - shared crates and shared packages under ` crates/ `
5090
5191## Deployment Profiles
5292
@@ -97,6 +137,12 @@ Each workspace points to a main server endpoint.
97137- endpoint runs on a network-hosted server
98138- uses the same RPC and streaming contracts
99139
140+ Workspace contains:
141+
142+ 1 . repository groups
143+ 2 . UnitTasks and SubTasks
144+ 3 . workspace-scoped settings and policies
145+
100146## Data Model Overview
101147
102148Detailed model is maintained in ` docs/entities.md ` .
@@ -130,6 +176,7 @@ SubTask is also used for small operational tasks triggered by UI actions.
130176### AgentSession
131177
132178Each SubTask can run one or more AI coding agent sessions.
179+ Only one AgentSession is active at a time for a given SubTask.
133180
134181```
135182UnitTask
@@ -142,6 +189,28 @@ UnitTask
142189 └── AgentSession #4
143190```
144191
192+ Terminology mapping for PRD wording:
193+
194+ 1 . PRD ` Task ` maps to ` UnitTask `
195+ 2 . PRD ` Session ` maps to ` AgentSession ` (scoped by ` SubTask ` )
196+
197+ ## Execution Modes
198+
199+ DexDex supports local and remote execution modes with a shared orchestration contract.
200+
201+ ### Local Mode
202+
203+ 1 . execution happens on the user environment through worker runtime
204+ 2 . repository handling is worktree-only
205+
206+ ### Remote Mode
207+
208+ 1 . execution happens on remote worker server
209+ 2 . repository bootstrap may use clone or cache refresh
210+ 3 . execution always runs in task-specific worktrees after bootstrap
211+
212+ This keeps one invariant across both modes: ` repo-cache/bootstrap + worktree execution ` .
213+
145214## Agent Message Normalization Boundary
146215
147216Worker server is the normalization boundary for all coding-agent outputs.
@@ -162,6 +231,8 @@ Worker-produced code changes must be represented as real git commits.
1622314 . PR creation and Commit to Local use this commit chain as the source of truth.
1632325 . Patch artifacts are derived from commits for diff viewing and are not authoritative.
164233
234+ The ghost-commit concept is not used as a storage or orchestration model.
235+
165236## Worktree-Only Policy
166237
167238DexDex does not support editing directly against arbitrary local folders.
@@ -235,6 +306,8 @@ For coding agents with plan mode:
2353063 . stream plan updates and rationale
2363074 . attach plan decisions to SubTask and AgentSession records
237308
309+ Plan semantics remain agent-native. DexDex stores and orchestrates decisions, but does not replace the agent's planning logic.
310+
238311See ` docs/plan-yaml.md ` .
239312
240313## Event Streaming
@@ -267,25 +340,34 @@ Notification delivery uses Web Notification API.
267340
268341See ` docs/notifications.md ` .
269342
270- ## Mobile Strategy
343+ ## UI Shell Strategy
271344
272- iOS and Android are first-wave platforms .
345+ DexDex uses a multi-tab triage-first shell as the default .
273346
274- Design implications:
347+ 1 . workspace-oriented navigation and action-required queues
348+ 2 . tabbed detail workflows with persistent draft state
349+ 3 . keyboard-first operation across primary screens
275350
276- 1 . core workflows must be API-driven and mobile-safe
277- 2 . no desktop-only business logic path
278- 3 . notification and streaming strategy must work with mobile runtime constraints
279- 4 . workspace onboarding and PR remediation actions must be touch-friendly
351+ A focused three-pane detail layout can be used as a screen-level variant:
280352
281- ## Multi-Tab UI Invariant
353+ 1 . left: task list or context rail
354+ 2 . center: task detail and timeline
355+ 3 . right: collapsed history or side activity
282356
283- The client provides multi-tab UI so users can work on multiple items concurrently.
357+ ## Settings Scope
284358
285- 1 . detail views and workflow pages open as tabs in the app shell
286- 2 . tab state is persisted per workspace
287- 3 . tab switching does not discard running context or unsaved draft input
288- 4 . tab state indicators surface running/action-required/unread-update signals
359+ Settings cover both currently implemented controls and staged integrations.
360+
361+ Immediate scope:
362+
363+ 1 . appearance mode (Light, Dark, System)
364+ 2 . keyboard shortcut settings and discoverability
365+ 3 . workspace and notification preferences
366+
367+ Staged scope with security guardrails:
368+
369+ 1 . agent credential import flows (for example OAuth token bridging)
370+ 2 . worker environment variable profiles with least-privilege handling, scoped exposure, and audit logs
289371
290372## Keyboard Input Rule
291373
@@ -304,6 +386,12 @@ Every screen includes appropriate keyboard shortcuts for its primary items and a
3043865 . shortcut matching uses physical key codes and modifiers so behavior is stable across input language modes
3053876 . tab management shortcuts are required (` new ` , ` close ` , ` previous ` , ` next ` )
306388
389+ ## Task Status Presentation Model
390+
391+ Storage status uses three-level enums (` UnitTaskStatus ` , ` SubTaskStatus ` , ` AgentSessionStatus ` ).
392+ UI may present simplified derived labels (for example Draft, PlanReady, Building) that map to underlying entity states.
393+ The persisted source of truth remains the three-level enum model in ` docs/entities.md ` .
394+
307395## Observability and Logging
308396
309397Server-side structured logging is required for:
@@ -327,6 +415,12 @@ Client-side logging is required for:
3274152 . token-based auth for shared remote workspaces
3284163 . scoped secret usage with minimal runtime lifetime
3294174 . strict validation for repository URLs, branch names, prompts, and review payloads
418+ 5 . guarded handling for staged credential-transfer and worker-env settings
419+
420+ ## Documentation Alignment Scope
421+
422+ This revision aligns architecture and product docs as the source of truth.
423+ Code and proto contract synchronization is tracked as follow-up work and is not part of this document-only integration.
330424
331425## Related Docs
332426
0 commit comments