Skip to content

Commit f8b07f0

Browse files
committed
docs: unify PRD into canonical architecture docs
1 parent 7d099db commit f8b07f0

5 files changed

Lines changed: 141 additions & 18 deletions

File tree

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: 107 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
# DexDex Design
22

3+
DexDex is a desktop-first orchestration UI for CLI-based coding agents.
34
DexDex uses a Connect RPC-first architecture with Tauri clients and Rust 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.
@@ -11,13 +26,31 @@ This document is the primary architecture reference.
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. Support iOS and Android as first-wave 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 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

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

132177
Each 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
```
135181
UnitTask
@@ -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

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

167237
DexDex does not support editing directly against arbitrary local folders.
@@ -235,6 +305,8 @@ For coding agents with plan mode:
235305
3. stream plan updates and rationale
236306
4. 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+
238310
See `docs/plan-yaml.md`.
239311

240312
## Event Streaming
@@ -267,25 +339,34 @@ Notification delivery uses Web Notification API.
267339

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

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

docs/main-server.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Main Server (Go)
1+
# Main Server (Rust)
22

33
Main Server is the control plane for DexDex.
44
It exposes Connect RPC APIs and coordinates task, PR, and event lifecycles.
@@ -19,7 +19,7 @@ It exposes Connect RPC APIs and coordinates task, PR, and event lifecycles.
1919

2020
```
2121
┌──────────────────────────────────────────────────────────────┐
22-
│ Main Server (Go)
22+
│ Main Server (Rust)
2323
│ │
2424
│ Connect RPC Handlers │
2525
│ ├── WorkspaceService │
@@ -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/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 provides the full authoring workflow.
21+
Mobile uses phased rollout on the same contracts:
22+
23+
1. baseline: task monitoring, log viewing, plan decisions, and stop actions
24+
2. expansion: broader remediation and review interaction flows
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

docs/worker-server.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Worker Server (Go)
1+
# Worker Server (Rust)
22

33
Worker Server executes SubTasks using AI coding agents in isolated worktree environments.
44

@@ -22,7 +22,7 @@ Worker Server executes SubTasks using AI coding agents in isolated worktree envi
2222

2323
```
2424
┌──────────────────────────────────────────────────────────────┐
25-
│ Worker Server (Go)
25+
│ Worker Server (Rust)
2626
│ │
2727
│ Job Receiver (Connect RPC client/server) │
2828
│ └── SubTask Runner │
@@ -50,6 +50,12 @@ Worker Server executes SubTasks using AI coding agents in isolated worktree envi
5050
8. export patch and metadata derived from commits
5151
9. cleanup according to retention policy
5252

53+
Execution mode note:
54+
55+
1. remote and local modes may use different repository bootstrap strategies
56+
2. both modes execute task runs in worktrees after bootstrap
57+
3. worker does not expose a direct business API for client-side calls
58+
5359
Path convention:
5460

5561
- cache: `~/.dexdex/repo-cache/<repo-hash>/`

0 commit comments

Comments
 (0)