# Implementation Phases

See [overview.md](overview.md) for system architecture and [decisions.md](decisions.md) for design decisions.

---

## Phase 1: Project Scaffolding [complete]

- Tauri 2.x + Svelte 5 frontend initialized
- Catppuccin Mocha CSS variables, dev scripts
- portable-pty (used by WezTerm) over tauri-plugin-pty for reliability

---

## Phase 2: Terminal Pane + Layout [complete]

- CSS Grid layout with responsive breakpoints (ultrawide / standard / narrow)
- Pane resize via drag handles, layout presets (1-col, 2-col, 3-col, 2x2, master+stack)
- xterm.js with Canvas addon (no WebGL on WebKit2GTK), Catppuccin theme
- PTY spawn from Rust (portable-pty), stream via Tauri events
- Copy/paste (Ctrl+Shift+C/V), SSH via PTY shell args

---

## Phase 3: Agent SDK Integration [complete]

- Node.js/Deno sidecar using `@anthropic-ai/claude-agent-sdk` query() function
- Sidecar communication: Rust spawns process, stdio NDJSON
- SDK message adapter: 9 typed AgentMessage types
- Agent store with session state, message history, cost tracking
- AgentPane: text, tool calls/results, thinking, init, cost, errors, subagent spawn
- Session resume (resume_session_id to SDK)

---

## Phase 4: Session Management + Markdown Viewer [complete]

- SQLite persistence (rusqlite), session groups with collapsible headers
- Auto-restore layout on startup
- Markdown viewer with Shiki highlighting and live reload via file watcher

---

## Phase 5: Agent Tree + Polish [complete]

- SVG agent tree visualization with click-to-scroll and subtree cost
- Terminal theme hot-swap, pane drag-resize handles
- StatusBar with counts, notifications (toast system)
- Settings dialog, ctx integration, SSH session management
- 4 Catppuccin themes, detached pane mode, Shiki syntax highlighting

---

## Phase 6: Packaging + Distribution [complete]

- install-v2.sh build-from-source installer (Node.js 20+, Rust 1.77+, system libs)
- Tauri bundle: .deb (4.3 MB) + AppImage (103 MB)
- GitHub Actions release workflow on `v*` tags
- Auto-updater with signing key

---

## Phase 7: Agent Teams / Subagent Support [complete]

- Agent store parent/child hierarchy
- Dispatcher subagent detection and message routing
- AgentPane parent navigation + children bar
- Subagent cost aggregation
- 28 dispatcher tests including 10 for subagent routing

---

## Multi-Machine Support (Phases A-D) [complete]

Architecture in [../multi-machine/relay.md](../multi-machine/relay.md).

### Phase A: Extract `agor-core` crate

Cargo workspace with PtyManager, SidecarManager, EventSink trait in shared crate.

### Phase B: Build `agor-relay` binary

WebSocket server with token auth, rate limiting, per-connection isolation, structured command responses.

### Phase C: Add `RemoteManager` to controller

12 Tauri commands, heartbeat ping, exponential backoff reconnection with TCP probing.

### Phase D: Frontend integration

remote-bridge.ts adapter, machines.svelte.ts store, routing via Pane.remoteMachineId.

### Remaining

- [ ] Real-world relay testing (2 machines)
- [ ] TLS/certificate pinning

---

## Extras: Claude Profiles & Skill Discovery [complete]

### Claude Profile / Account Switching

- Reads ~/.config/switcher/profiles/ with profile.toml metadata
- Profile selector dropdown, config_dir passed as CLAUDE_CONFIG_DIR env override

### Skill Discovery & Autocomplete

- Reads ~/.claude/skills/ (dirs with SKILL.md or .md files)
- `/` prefix triggers autocomplete menu in AgentPane
- expandSkillPrompt() injects skill content as prompt

### Extended AgentQueryOptions

- setting_sources, system_prompt, model, claude_config_dir, additional_directories
- CLAUDE_CONFIG_DIR env injection for multi-account support

---

## System Requirements

- Node.js 20+ (for Agent SDK sidecar)
- Rust 1.77+ (for building from source)
- WebKit2GTK 4.1+ (Tauri runtime)
- Linux x86_64 (primary target)
