11# DexDex Design
22
3+ DexDex is a desktop-first orchestration UI for CLI-based coding agents.
34DexDex uses a Connect RPC-first architecture with Tauri clients and Rust 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.
@@ -11,13 +26,31 @@ This document is the primary architecture reference.
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 . Support iOS and Android as first-wave 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 is the primary platform for full authoring and remediation workflows.
44+
45+ ### Mobile
46+
47+ Mobile uses the same API and data model as desktop.
48+ Capability rollout is phased:
49+
50+ 1 . baseline support: remote task monitoring, log viewing, approval and stop actions
51+ 2 . expanded support: broader remediation and review actions as UX matures
52+
53+ Mobile is not a separate business-logic path.
2154
2255## Top-Level Architecture
2356
@@ -41,6 +74,12 @@ This document is the primary architecture reference.
4174 │ └────────────────────┘
4275```
4376
77+ Communication rule:
78+
79+ 1 . client business communication is main-server canonical
80+ 2 . client does not open direct business channels to worker server
81+ 3 . worker communication is server-to-server through Connect RPC
82+
4483## Monorepo Structure
4584
4685- ` apps/main-server/ ` (Rust)
@@ -97,6 +136,12 @@ Each workspace points to a main server endpoint.
97136- endpoint runs on a network-hosted server
98137- uses the same RPC and streaming contracts
99138
139+ Workspace contains:
140+
141+ 1 . repository groups
142+ 2 . UnitTasks and SubTasks
143+ 3 . workspace-scoped settings and policies
144+
100145## Data Model Overview
101146
102147Detailed model is maintained in ` docs/entities.md ` .
@@ -130,6 +175,7 @@ SubTask is also used for small operational tasks triggered by UI actions.
130175### AgentSession
131176
132177Each SubTask can run one or more AI coding agent sessions.
178+ Only one AgentSession is active at a time for a given SubTask.
133179
134180```
135181UnitTask
@@ -142,6 +188,28 @@ UnitTask
142188 └── AgentSession #4
143189```
144190
191+ Terminology mapping for PRD wording:
192+
193+ 1 . PRD ` Task ` maps to ` UnitTask `
194+ 2 . PRD ` Session ` maps to ` AgentSession ` (scoped by ` SubTask ` )
195+
196+ ## Execution Modes
197+
198+ DexDex supports local and remote execution modes with a shared orchestration contract.
199+
200+ ### Local Mode
201+
202+ 1 . execution happens on the user environment through worker runtime
203+ 2 . repository handling is worktree-only
204+
205+ ### Remote Mode
206+
207+ 1 . execution happens on remote worker server
208+ 2 . repository bootstrap may use clone or cache refresh
209+ 3 . execution always runs in task-specific worktrees after bootstrap
210+
211+ This keeps one invariant across both modes: ` repo-cache/bootstrap + worktree execution ` .
212+
145213## Agent Message Normalization Boundary
146214
147215Worker server is the normalization boundary for all coding-agent outputs.
@@ -162,6 +230,8 @@ Worker-produced code changes must be represented as real git commits.
1622304 . PR creation and Commit to Local use this commit chain as the source of truth.
1632315 . Patch artifacts are derived from commits for diff viewing and are not authoritative.
164232
233+ The ghost-commit concept is not used as a storage or orchestration model.
234+
165235## Worktree-Only Policy
166236
167237DexDex does not support editing directly against arbitrary local folders.
@@ -235,6 +305,8 @@ For coding agents with plan mode:
2353053 . stream plan updates and rationale
2363064 . attach plan decisions to SubTask and AgentSession records
237307
308+ Plan semantics remain agent-native. DexDex stores and orchestrates decisions, but does not replace the agent's planning logic.
309+
238310See ` docs/plan-yaml.md ` .
239311
240312## Event Streaming
@@ -267,25 +339,34 @@ Notification delivery uses Web Notification API.
267339
268340See ` docs/notifications.md ` .
269341
270- ## Mobile Strategy
342+ ## UI Shell Strategy
271343
272- iOS and Android are first-wave platforms .
344+ DexDex uses a multi-tab triage-first shell as the default .
273345
274- Design implications:
346+ 1 . workspace-oriented navigation and action-required queues
347+ 2 . tabbed detail workflows with persistent draft state
348+ 3 . keyboard-first operation across primary screens
275349
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
350+ A focused three-pane detail layout can be used as a screen-level variant:
280351
281- ## Multi-Tab UI Invariant
352+ 1 . left: task list or context rail
353+ 2 . center: task detail and timeline
354+ 3 . right: collapsed history or side activity
282355
283- The client provides multi-tab UI so users can work on multiple items concurrently.
356+ ## Settings Scope
284357
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
358+ Settings cover both currently implemented controls and staged integrations.
359+
360+ Immediate scope:
361+
362+ 1 . appearance mode (Light, Dark, System)
363+ 2 . keyboard shortcut settings and discoverability
364+ 3 . workspace and notification preferences
365+
366+ Staged scope with security guardrails:
367+
368+ 1 . agent credential import flows (for example OAuth token bridging)
369+ 2 . worker environment variable profiles with least-privilege handling, scoped exposure, and audit logs
289370
290371## Keyboard Input Rule
291372
@@ -304,6 +385,12 @@ Every screen includes appropriate keyboard shortcuts for its primary items and a
3043855 . shortcut matching uses physical key codes and modifiers so behavior is stable across input language modes
3053866 . tab management shortcuts are required (` new ` , ` close ` , ` previous ` , ` next ` )
306387
388+ ## Task Status Presentation Model
389+
390+ Storage status uses three-level enums (` UnitTaskStatus ` , ` SubTaskStatus ` , ` AgentSessionStatus ` ).
391+ UI may present simplified derived labels (for example Draft, PlanReady, Building) that map to underlying entity states.
392+ The persisted source of truth remains the three-level enum model in ` docs/entities.md ` .
393+
307394## Observability and Logging
308395
309396Server-side structured logging is required for:
@@ -327,6 +414,12 @@ Client-side logging is required for:
3274142 . token-based auth for shared remote workspaces
3284153 . scoped secret usage with minimal runtime lifetime
3294164 . strict validation for repository URLs, branch names, prompts, and review payloads
417+ 5 . guarded handling for staged credential-transfer and worker-env settings
418+
419+ ## Documentation Alignment Scope
420+
421+ This revision aligns architecture and product docs as the source of truth.
422+ Code and proto contract synchronization is tracked as follow-up work and is not part of this document-only integration.
330423
331424## Related Docs
332425
0 commit comments