Flutter mobile app providing OpenCode-like UI/UX for AI coding agents, with events sourced from Claude Code via supported integration mechanisms.
flowchart TB
subgraph Mobile["📱 ReCursor Flutter App"]
UI["OpenCode-like UI\n(Tool Cards, Diff Viewer, Timeline)"]
State["Riverpod State Management"]
WSClient["WebSocket Client"]
end
subgraph Desktop["💻 Development Machine"]
Bridge["ReCursor Bridge Server\n(TypeScript)"]
subgraph Integration["Claude Code Integration"]
Hooks["Hooks System\n(HTTP Event Observer)"]
AgentSDK["Agent SDK\n(Parallel Session)"]
CC["Claude Code CLI"]
end
end
subgraph Anthropic["☁️ Anthropic API"]
API["Claude API"]
end
UI <--> State
State <--> WSClient
WSClient <-->|wss:// (Tailscale/WireGuard)| Bridge
Bridge <-->|HTTP POST| Hooks
Hooks -->|Observes| CC
Bridge <-->|Optional| AgentSDK
AgentSDK <-->|API Calls| API
CC <-->|Internal| API
⚠️ Claude Code Remote Control is first-party only — there is no public API for third-party clients to join or mirror existing Claude Code sessions.
Supported Integration Path:
- Claude Code Hooks — HTTP-based event observation (one-way)
- Agent SDK — Parallel agent sessions (not mirroring)
- MCP (Model Context Protocol) — Tool interoperability
Goal: Bootable app with auth, secure connectivity to bridge, and basic agent chat with OpenCode-style UI.
- Initialize Flutter project (iOS + Android targets)
- Set up directory structure:
lib/core/,lib/features/,lib/shared/ - Configure linting (
flutter_lints), formatting, analysis options - Set up GitHub Actions CI pipeline
- Configure Fastlane for iOS (Match) and Android (keystore)
- Tests: Verify project builds on both platforms
- Implement GitHub OAuth2 flow
- Support Personal Access Token (PAT) auth as fallback
- Secure token storage via
flutter_secure_storage - Auth state management with Riverpod
- Tests: Unit test auth provider state transitions
- Define WebSocket protocol (see bridge-protocol.md)
- Implement WebSocket client service with
web_socket_channel - Connection pairing via QR code (encode bridge URL + auth token)
- Tailscale integration documentation / setup guide
- Always use
wss://; optional certificate pinning - Auto-reconnect with exponential backoff
- Tests: Unit test WebSocket service with mocks
- Chat UI with message list (user messages + agent responses)
- Streaming text rendering (word-by-word)
- Markdown rendering for agent responses
- OpenCode Pattern: Message part-based rendering (text, tool_use, tool_result)
- Send message → bridge → Agent SDK → streamed response flow
- Session management (start new, resume existing)
- Tests: Widget test chat UI with mock stream
- File tree browsing via bridge
- File viewer with syntax highlighting
- Tests: Unit test bridge file commands
Phase 1 Deliverable: App authenticates via GitHub, connects to bridge, sends messages to Agent SDK session, displays streamed responses with OpenCode-style UI.
Goal: Claude Code Hooks integration, tool cards, diff viewer, and push notifications.
- Bridge
/hooks/eventendpoint to receive Claude Code events - Configure Claude Code to POST events to bridge
- Event validation and queuing
- Forward events to connected mobile clients
- Tests: Integration test hook event flow
- OpenCode-style Tool Cards: Rich cards for tool use and results
- Tool icons based on tool type (edit_file, read_file, run_command, etc.)
- Expandable tool results with syntax highlighting
- Tool status indicators (pending, running, completed, error)
- Tests: Widget test tool card states
- OpenCode-style Diff Viewer: Syntax-highlighted unified diff
- Side-by-side diff option (landscape / tablet)
- File-by-file navigation for multi-file diffs
- Inline file status indicators (added, modified, deleted)
- Tests: Golden tests for diff rendering
- OpenCode-style Timeline: Visual timeline of session events
- Event types: tool use, user messages, agent responses
- Timeline navigation (jump to specific event)
- Tests: Widget test timeline rendering
- Display pending tool calls from Hooks (
PreToolUseevents) - Approve / reject / modify UI with clear action descriptions
- Forward approval to Agent SDK session (parallel execution)
- Audit log of approved/rejected actions
- Tests: Unit test approval state machine
- WebSocket-based notification system
- Notification types: task complete, approval required, error
- In-app notification center (bell icon, unread count)
- Local notifications via
flutter_local_notificationswhen backgrounded - Event queue on bridge: stores events while app disconnected
- Tests: Integration test event replay on reconnect
Phase 2 Deliverable: Users see Claude Code activity via Hooks, view tool cards and diffs with OpenCode-style UI, approve actions, and receive push notifications.
Goal: Voice input, multi-agent support, terminal access, and offline capability.
- Speech-to-text via platform APIs (
speech_to_textpackage) - Voice input button in chat interface
- Text preview before send (edit transcribed text)
- Tests: Unit test transcription → message flow
- Agent registry (Claude Code, OpenCode, Aider, Goose)
- Per-agent connection management
- Agent switcher UI
- Parallel session support
- Tests: Unit test agent registry CRUD
- Embedded terminal view (read-only output from bridge)
- Command input for direct shell access via Agent SDK
- ANSI color rendering
- Session history and scrollback
- Tests: Unit test ANSI parsing
- Local database with Drift (SQLite) for conversations, tasks, agent configs
- Hive for lightweight caching (UI preferences, session tokens)
- Repository pattern: read local first, sync remote in background
- Offline queue for pending messages/commands
- Conflict resolution: last-write-wins with
updated_attimestamps - Tests: Integration test offline → reconnect flow
Phase 3 Deliverable: Voice-driven coding, multi-agent orchestration, terminal access, and full offline capability.
Goal: Performance, accessibility, and platform-specific refinements.
- Large repo handling (paginated file trees, lazy loading)
- WebSocket message compression
- Image and asset caching strategy
- Memory profiling and optimization
- Tests: Performance benchmarks for large diffs
- Responsive layouts with
LayoutBuilder/MediaQuery - Split-view for chat + diff on tablets
- Landscape-optimized terminal view
- Tests: Widget tests at multiple screen sizes
- Semantic labels for all interactive elements
- Screen reader compatibility (TalkBack / VoiceOver)
- Dynamic type / font scaling support
- High contrast mode
- Tests: Accessibility audit
- App Store metadata, screenshots, descriptions
- Privacy policy and terms of service
- Crash reporting (Sentry)
- Analytics (opt-in, privacy-respecting)
- Final end-to-end testing on physical devices
- Tests: Full E2E test suite via
patrol
Phase 4 Deliverable: Production-ready app on App Store and Google Play.
| Level | Tool | Coverage |
|---|---|---|
| Unit | flutter_test + mockito |
Services, providers, models, serialization |
| Widget | flutter_test |
UI components with mock dependencies |
| Golden | alchemist |
Visual regression for key screens |
| Integration | integration_test |
Full flows: auth → connect → chat → hooks |
| E2E | patrol |
Complete user journeys on real devices |
| Layer | Choice | Rationale |
|---|---|---|
| Framework | Flutter | Cross-platform, CC Pocket precedent |
| State | Riverpod | Type-safe, testable, Conduit pattern |
| Networking | web_socket_channel |
Standard Flutter WebSocket |
| Auth | GitHub OAuth2 + PAT | github_oauth package |
| Local DB | Drift (SQLite) | Type-safe queries, migrations |
| Cache | Hive | Fast key-value for ephemeral data |
| Notifications | flutter_local_notifications |
Local alerts when backgrounded |
| Bridge | TypeScript (Node.js) | CC Pocket pattern |
| Tunnel | Tailscale / WireGuard | Zero-config mesh VPN |
| CI/CD | GitHub Actions + Fastlane | Industry standard |
| Testing | flutter_test, mockito, patrol, alchemist |
Full coverage pyramid |
- Architecture Overview — System architecture
- Data Flow — Message sequence diagrams
- Claude Code Hooks Integration — Event observation
- Agent SDK Integration — Parallel sessions
- OpenCode UI Patterns — UI component mapping
- Bridge Protocol — WebSocket specification
- Security Architecture — Security implementation
- Offline Architecture — Sync and storage
Last updated: 2026-03-17