Skip to content

Commit cf7a18e

Browse files
authored
docs: merge PRD into canonical design and align docs (#258)
## Summary - merge the new PRD into docs/design.md as the single canonical reference - align architecture docs with main-server canonical communication and Rust server stack wording - add PRD-to-entity/state mapping and update UI/mobile/notification docs for consistency ## What changed - update design/api/main-server/worker-server/tauri docs to reflect the merged architecture decisions - add PRD terminology and task-state presentation mapping in entities doc - update UI and workspace/mobile connectivity wording for parity-focused rollout ## Scope - documentation only - no proto or application code changes
1 parent 7d099db commit cf7a18e

File tree

9 files changed

+212
-21
lines changed

9 files changed

+212
-21
lines changed

docs/api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
This document defines the DexDex API contract.
44
All business communication is Connect RPC-based.
55

6+
## Contract Alignment Note
7+
8+
This document is the product and architecture source of truth for API behavior.
9+
Proto/code synchronization may lag this document and is tracked as follow-up work.
10+
611
## Protocol
712

813
- Transport: HTTP/2 (fallback HTTP/1.1 where needed)
@@ -17,6 +22,8 @@ All business communication is Connect RPC-based.
1722
3. Public requests and responses use enums for known variants.
1823
4. Streaming channels emit typed events with monotonic sequence IDs.
1924
5. Coding-agent session output contracts are normalized and provider-agnostic.
25+
6. Main server is the canonical business API boundary for clients.
26+
7. Client applications do not call worker-server internals directly for business flows.
2027

2128
## Service Overview
2229

docs/design.md

Lines changed: 115 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,64 @@
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.
45
This 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

823
1. 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`.
1025
3. Use `Workspace` as the primary connectivity and scope concept.
1126
4. Use UnitTask-centric workflows with nested SubTask and AgentSession history.
1227
5. Make PR management and PR review assist first-class workflows.
1328
6. 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

1833
1. Direct local folder execution without worktree.
1934
2. Tauri-invoke-first business contracts.
2035
3. 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

102148
Detailed 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

132178
Each 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
```
135182
UnitTask
@@ -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

147216
Worker 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.
162231
4. PR creation and Commit to Local use this commit chain as the source of truth.
163232
5. 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

167238
DexDex does not support editing directly against arbitrary local folders.
@@ -235,6 +306,8 @@ For coding agents with plan mode:
235306
3. stream plan updates and rationale
236307
4. 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+
238311
See `docs/plan-yaml.md`.
239312

240313
## Event Streaming
@@ -267,25 +340,34 @@ Notification delivery uses Web Notification API.
267340

268341
See `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
304386
5. shortcut matching uses physical key codes and modifiers so behavior is stable across input language modes
305387
6. 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

309397
Server-side structured logging is required for:
@@ -327,6 +415,12 @@ Client-side logging is required for:
327415
2. token-based auth for shared remote workspaces
328416
3. scoped secret usage with minimal runtime lifetime
329417
4. 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

docs/entities.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,34 @@ enum StreamEventType {
185185
}
186186
```
187187

188+
## PRD Terminology Mapping
189+
190+
| PRD term | Canonical entity model |
191+
|---|---|
192+
| Task | UnitTask |
193+
| Session | AgentSession (scoped by SubTask) |
194+
| PR Creation step | SubTask (`type = PR_CREATE`) |
195+
| Review/CI remediation step | SubTask (`type = PR_REVIEW_FIX` or `PR_CI_FIX`) |
196+
197+
## PRD Task State Mapping (Derived UI Labels)
198+
199+
PRD task labels are presentation-oriented states.
200+
Persisted source of truth remains `UnitTaskStatus`, `SubTaskStatus`, and `AgentSessionStatus`.
201+
202+
| PRD label | Derived mapping in canonical model |
203+
|---|---|
204+
| Draft | client-side draft before UnitTask is created |
205+
| Queued | `UnitTaskStatus = QUEUED` and initial `SubTaskStatus = QUEUED` |
206+
| Running | `UnitTaskStatus = IN_PROGRESS` with active `SubTaskStatus = IN_PROGRESS` |
207+
| WaitingForHuman | `UnitTaskStatus = ACTION_REQUIRED` with `SubTaskStatus = WAITING_FOR_USER_INPUT` or `WAITING_FOR_PLAN_APPROVAL` |
208+
| PlanReady | `UnitTaskStatus = ACTION_REQUIRED` with `SubTaskStatus = WAITING_FOR_PLAN_APPROVAL` |
209+
| Approved | derived UI checkpoint after plan approval; persisted execution continues as `UnitTaskStatus = IN_PROGRESS` |
210+
| Building | derived UI checkpoint while build-phase SubTask is `IN_PROGRESS` |
211+
| PRCreating | derived UI checkpoint while `SubTaskType = PR_CREATE` and `SubTaskStatus = IN_PROGRESS` |
212+
| Completed | `UnitTaskStatus = COMPLETED` |
213+
| Failed | `UnitTaskStatus = FAILED` or active SubTask/session failed |
214+
| Canceled | `UnitTaskStatus = CANCELLED` or `SubTaskStatus = CANCELLED` |
215+
188216
## Core Entities
189217

190218
### Workspace

docs/main-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ It exposes Connect RPC APIs and coordinates task, PR, and event lifecycles.
5252

5353
Main server is the canonical business interface.
5454
No client workflow requires Tauri-only business contracts.
55+
Client business flows and streaming subscriptions are routed through main server; direct client-to-worker business channels are not part of the contract.
5556

5657
## Data Ownership
5758

docs/notifications.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ DexDex uses Web Notification API as the primary desktop and mobile notification
1515
3. PR review activity requires remediation
1616
4. PR CI failure
1717
5. AgentSession failure
18+
6. Agent session requires human input (`WAITING_FOR_USER_INPUT`)
19+
7. Authentication/session refresh required for continued workflow
20+
21+
Trigger mapping note:
22+
23+
1. trigger semantics use existing notification enums in `docs/entities.md`
24+
2. auth-required prompts are represented through action-required notification categories
1825

1926
## Notification Flow
2027

docs/tauri-app.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@ The app is Connect RPC-first.
88
Business communication uses Connect RPC as the primary path.
99
Tauri-specific APIs are only for platform integration.
1010
Client consumes normalized coding-agent message contracts only.
11+
The app does not use direct client-to-worker business APIs.
1112

1213
## Supported Platforms
1314

1415
1. Desktop: macOS, Windows, Linux
1516
2. Mobile: iOS, Android
1617

18+
## Capability Rollout
19+
20+
Desktop and mobile are both first-class product targets on the same contracts.
21+
Capability rollout is phased by interaction constraints:
22+
23+
1. baseline: task monitoring, log viewing, plan decisions, stop actions, and key remediation actions
24+
2. expansion: broader remediation, review interaction, and deeper authoring parity
25+
1726
## Client Architecture
1827

1928
```
@@ -164,6 +173,13 @@ Client exposes immediate stop actions:
164173
2. badge color mapping editor
165174
3. PR auto-fix preferences
166175
4. notification permission and display preferences
176+
5. appearance mode (Light, Dark, System)
177+
6. shortcut discoverability and keymap preferences
178+
179+
Staged settings with security guardrails:
180+
181+
1. agent credential import/bridge flows
182+
2. worker environment profile management with scoped secret handling
167183

168184
## Testing Focus
169185

0 commit comments

Comments
 (0)