Skip to content

Latest commit

 

History

History
600 lines (484 loc) · 17.9 KB

File metadata and controls

600 lines (484 loc) · 17.9 KB

Product Requirements Document (PRD)

Claude Code Mobile - Flutter Edition

Version: 1.0.0
Date: April 1, 2026
Status: Draft


1. Executive Summary

Claude Code Mobile is a Flutter-based mobile application that brings the full power of Claude Code to mobile devices with remote server execution via SSH. Users can connect to remote servers, select working directories, and interact with Claude AI to perform software engineering tasks—all from their mobile device.

Key Differentiators

  • Zero Server Installation: No need to install Claude Code on the remote server
  • SSH-Based Execution: All operations execute on remote servers via SSH
  • Custom Provider Support: Add and manage multiple AI providers (Anthropic, Bedrock, Vertex, custom endpoints)
  • Full Tool Support: Complete implementation of Claude Code's tool system (Read, Write, Edit, Bash, Grep, Glob, etc.)
  • Mobile-First UX: Optimized for touch interfaces with modern dark theme

2. Problem Statement

Current Limitations

  1. Claude Code CLI requires terminal access and is not mobile-friendly
  2. Developers need to install Claude Code on every server they work with
  3. No native mobile solution for AI-assisted coding on remote servers
  4. Limited flexibility in choosing AI providers

Target Users

  • Mobile Developers: Working on-the-go, need quick access to remote codebases
  • DevOps Engineers: Managing multiple remote servers from mobile devices
  • Remote Workers: Accessing work servers from tablets/phones
  • Students/Learners: Learning to code with AI assistance on mobile devices

3. Product Vision

Mission

Enable developers to harness the full power of AI-assisted coding from any mobile device, with seamless remote server integration and zero server-side installation requirements.

Success Metrics

  • User Engagement: Average session duration > 15 minutes
  • Connection Reliability: SSH connection uptime > 99%
  • Tool Execution Success Rate: > 95%
  • User Satisfaction: App Store rating > 4.5/5
  • Performance: Tool execution latency < 2 seconds (excluding network)

4. Core Features

4.1 SSH Connection Management

Priority: P0 (Must Have)

Description:
Secure SSH connection to remote servers with credential management.

User Stories:

  • As a user, I can add multiple SSH server configurations
  • As a user, I can connect to a server using password or SSH key
  • As a user, I can browse and select a working directory on the remote server
  • As a user, I can see connection status in real-time
  • As a user, I can auto-reconnect if connection drops

Technical Requirements:

  • Support SSH password authentication
  • Support SSH key-based authentication (RSA, ED25519)
  • Store credentials securely using Flutter Secure Storage
  • Implement connection pooling and keep-alive
  • Handle network interruptions gracefully
  • Support SSH tunneling for additional security

Acceptance Criteria:

  • User can add/edit/delete SSH configurations
  • User can connect/disconnect from servers
  • Connection status updates in real-time
  • Auto-reconnect works within 5 seconds of network restoration
  • Credentials are encrypted at rest

4.2 Provider Management System

Priority: P0 (Must Have)

Description:
Flexible system for managing multiple AI providers with custom endpoint support.

User Stories:

  • As a user, I can add custom AI providers (Anthropic, Bedrock, Vertex, custom)
  • As a user, I can configure API keys and endpoints for each provider
  • As a user, I can switch between providers during a conversation
  • As a user, I can set a default provider
  • As a user, I can test provider connectivity before saving

Technical Requirements:

  • Support Anthropic API (first-party)
  • Support AWS Bedrock
  • Support Google Vertex AI
  • Support custom OpenAI-compatible endpoints
  • Store API keys in Flutter Secure Storage
  • Implement provider health checks
  • Support model selection per provider (Opus, Sonnet, Haiku)

Acceptance Criteria:

  • User can add/edit/delete providers
  • User can test provider before saving
  • User can switch providers mid-conversation
  • API keys are encrypted at rest
  • Provider errors are handled gracefully with user-friendly messages

4.3 Chat Interface with Tool Execution

Priority: P0 (Must Have)

Description:
Interactive chat interface where users communicate with Claude, with real-time tool execution visualization.

User Stories:

  • As a user, I can send messages to Claude
  • As a user, I can see Claude's responses in real-time (streaming)
  • As a user, I can see which tools Claude is executing
  • As a user, I can see tool execution progress
  • As a user, I can approve/deny tool executions (permission system)
  • As a user, I can view tool results inline
  • As a user, I can copy code snippets from responses

Technical Requirements:

  • Implement streaming response rendering
  • Support markdown rendering with syntax highlighting
  • Display tool execution indicators with progress
  • Implement permission system (auto-allow, prompt, deny)
  • Support message history with infinite scroll
  • Handle long-running tool executions
  • Support message editing and regeneration

Acceptance Criteria:

  • Messages stream in real-time
  • Tool executions show progress indicators
  • Code blocks have syntax highlighting
  • User can copy code with one tap
  • Permission prompts appear before destructive operations
  • Chat history loads smoothly with pagination

4.4 Tool System Implementation

Priority: P0 (Must Have)

Description:
Complete implementation of Claude Code's tool system, adapted for SSH execution.

Core Tools:

  1. FileReadTool: Read files from remote server
  2. FileWriteTool: Create/overwrite files on remote server
  3. FileEditTool: Partial file edits (find/replace)
  4. BashTool: Execute bash commands via SSH
  5. GrepTool: Search file contents (ripgrep)
  6. GlobTool: Find files by pattern
  7. WebFetchTool: Fetch web content (executed locally)
  8. WebSearchTool: Web search (executed locally)

Technical Requirements:

  • All file operations execute via SSH
  • Implement tool orchestration (parallel read-only, serial writes)
  • Support tool result caching
  • Handle tool execution timeouts
  • Implement progress reporting for long-running tools
  • Support tool execution cancellation

Acceptance Criteria:

  • All 8 core tools implemented and tested
  • Read-only tools execute in parallel (up to 10 concurrent)
  • Write tools execute serially
  • Tool timeouts handled gracefully
  • User can cancel long-running tools
  • Tool results cached appropriately

4.5 Session Management

Priority: P1 (Should Have)

Description:
Persistent conversation sessions with history and resume capability.

User Stories:

  • As a user, I can create new sessions
  • As a user, I can view all my past sessions
  • As a user, I can resume a previous session
  • As a user, I can delete sessions
  • As a user, I can search sessions by content
  • As a user, I can export session transcripts

Technical Requirements:

  • Store sessions in SQLite database
  • Implement session search with FTS (Full-Text Search)
  • Support session export (JSON, Markdown)
  • Implement session auto-save
  • Handle large sessions efficiently (pagination)

Acceptance Criteria:

  • Sessions persist across app restarts
  • User can resume sessions seamlessly
  • Session list loads quickly (< 1 second)
  • Search returns results in < 500ms
  • Export generates valid files

4.6 File Browser

Priority: P1 (Should Have)

Description:
Browse remote server file system and attach files to conversations.

User Stories:

  • As a user, I can browse the remote file system
  • As a user, I can view file contents
  • As a user, I can attach files to my messages
  • As a user, I can search for files
  • As a user, I can see file metadata (size, modified date, permissions)

Technical Requirements:

  • Implement lazy-loading directory tree
  • Support file preview (text, images, code)
  • Implement file search
  • Cache directory listings
  • Handle large directories efficiently

Acceptance Criteria:

  • Directory tree loads incrementally
  • File preview works for common formats
  • Search returns results quickly
  • Large directories don't freeze UI

4.7 Settings & Configuration

Priority: P1 (Should Have)

Description:
App-wide settings and configuration options.

User Stories:

  • As a user, I can configure app theme (dark/light)
  • As a user, I can set default provider
  • As a user, I can configure tool permissions (auto-allow, prompt, deny)
  • As a user, I can set SSH connection timeout
  • As a user, I can enable/disable analytics
  • As a user, I can clear app cache

Technical Requirements:

  • Store settings in SharedPreferences
  • Implement theme switching
  • Support per-tool permission configuration
  • Implement cache management

Acceptance Criteria:

  • Settings persist across app restarts
  • Theme changes apply immediately
  • Permission settings affect tool execution
  • Cache clearing works correctly

5. Technical Architecture

5.1 Technology Stack

  • Framework: Flutter 3.x
  • Language: Dart 3.x
  • State Management: flutter_bloc
  • SSH Client: dartssh2
  • HTTP Client: dio
  • Database: sqflite
  • Secure Storage: flutter_secure_storage
  • Markdown Rendering: flutter_markdown
  • Syntax Highlighting: flutter_highlight
  • Code Generation: freezed, json_serializable

5.2 Architecture Pattern

Clean Architecture with BLoC

┌─────────────────────────────────────┐
│      Presentation Layer             │
│   - Screens (UI)                    │
│   - Widgets                         │
│   - BLoCs (State Management)        │
└──────────────┬──────────────────────┘
               │
┌──────────────▼──────────────────────┐
│      Domain Layer                   │
│   - Entities                        │
│   - Use Cases                       │
│   - Repository Interfaces           │
│   - Tool Abstractions               │
└──────────────┬──────────────────────┘
               │
┌──────────────▼──────────────────────┐
│      Data Layer                     │
│   - Repository Implementations      │
│   - Data Sources (SSH, API, Local)  │
│   - Models (DTOs)                   │
│   - Mappers                         │
└─────────────────────────────────────┘

5.3 Project Structure

lib/
├── core/
│   ├── constants/
│   ├── errors/
│   ├── theme/
│   └── utils/
├── data/
│   ├── datasources/
│   │   ├── ssh/
│   │   ├── api/
│   │   └── local/
│   ├── models/
│   └── repositories/
├── domain/
│   ├── entities/
│   ├── repositories/
│   ├── usecases/
│   └── tools/
└── presentation/
    ├── blocs/
    ├── screens/
    └── widgets/

5.4 Key Design Decisions

1. SSH Execution Model

  • All file operations execute via SSH commands
  • No server-side agent required
  • Commands wrapped in error handling
  • Results streamed back to app

2. Tool Orchestration

  • Read-only tools execute in parallel (max 10)
  • Write tools execute serially
  • Tool results cached with TTL
  • Progress reported via streams

3. State Management

  • BLoC for business logic
  • Separate BLoCs for chat, connection, provider
  • Events for user actions
  • States for UI rendering

4. Data Persistence

  • SQLite for sessions and messages
  • SharedPreferences for settings
  • Secure Storage for credentials
  • File cache for remote files

5. Error Handling

  • Network errors: retry with exponential backoff
  • SSH errors: reconnect automatically
  • API errors: display user-friendly messages
  • Tool errors: return to LLM for handling

6. User Experience (UX)

6.1 Design Principles

  1. Mobile-First: Optimized for touch, one-handed use
  2. Dark Theme: Modern, eye-friendly dark theme as default
  3. Minimal Friction: Reduce taps to common actions
  4. Progressive Disclosure: Show advanced options only when needed
  5. Feedback: Always show what's happening (loading, progress, errors)

6.2 Key Screens

Home Screen

  • List of recent sessions
  • FAB to create new session
  • Quick access to settings
  • Connection status indicator

Connection Screen

  • SSH server configuration
  • Directory browser
  • Connection test
  • Save/Connect actions

Chat Screen

  • Message list (scrollable)
  • Input field with send button
  • Tool execution indicators
  • Provider selector
  • Menu (settings, file browser, session info)

Settings Screen

  • Provider management
  • SSH configurations
  • Tool permissions
  • Theme selection
  • About/Help

6.3 Interaction Patterns

  • Swipe: Delete sessions, dismiss notifications
  • Long Press: Copy messages, select multiple items
  • Pull to Refresh: Reload session list
  • Tap: Select, open, execute
  • Drag: Reorder providers

7. Security & Privacy

7.1 Security Requirements

  • All credentials encrypted at rest (AES-256)
  • SSH keys stored in secure storage
  • API keys never logged or exposed
  • HTTPS for all API communication
  • Certificate pinning for Anthropic API
  • Session data encrypted in database
  • Biometric authentication option

7.2 Privacy Requirements

  • No telemetry without user consent
  • Conversation data stays on device
  • Optional cloud backup (encrypted)
  • Clear data deletion
  • Privacy policy compliance (GDPR, CCPA)

8. Performance Requirements

8.1 Response Times

  • App launch: < 2 seconds
  • SSH connection: < 5 seconds
  • Message send: < 100ms (to start streaming)
  • Tool execution: < 2 seconds (excluding network/compute)
  • Session load: < 1 second
  • File browser: < 500ms per directory

8.2 Resource Usage

  • Memory: < 200MB average
  • Storage: < 100MB app size
  • Battery: < 5% per hour of active use
  • Network: Efficient (compress large responses)

8.3 Scalability

  • Support 1000+ sessions
  • Support 10,000+ messages per session
  • Support 100+ SSH configurations
  • Support 50+ providers

9. Testing Strategy

9.1 Unit Tests

  • All use cases
  • All repositories
  • All tools
  • All BLoCs
  • Coverage target: > 80%

9.2 Integration Tests

  • SSH connection flow
  • API communication
  • Tool execution
  • Session persistence
  • Coverage target: > 60%

9.3 Widget Tests

  • All screens
  • All widgets
  • User interactions
  • Coverage target: > 70%

9.4 E2E Tests

  • Complete user flows
  • Critical paths
  • Error scenarios

10. Deployment & CI/CD

10.1 GitHub Actions Workflow

- Build Android APK/AAB
- Build iOS IPA
- Run tests (unit, integration, widget)
- Code quality checks (lint, format)
- Security scanning
- Generate coverage report
- Deploy to TestFlight/Play Console (beta)

10.2 Release Process

  1. Feature development on feature branches
  2. PR review with automated checks
  3. Merge to develop branch
  4. Weekly beta releases
  5. Monthly stable releases
  6. Hotfix process for critical bugs

10.3 Versioning

  • Semantic versioning (MAJOR.MINOR.PATCH)
  • Build numbers auto-incremented
  • Changelog generated from commits

11. Future Enhancements (Post-MVP)

Phase 2 (3-6 months)

  • Multi-agent support (spawn sub-agents)
  • Voice input/output
  • Collaborative sessions (multiple users)
  • Git integration (commit, push, PR)
  • Terminal emulator
  • Code editor with syntax highlighting

Phase 3 (6-12 months)

  • Desktop app (Windows, macOS, Linux)
  • Web app (PWA)
  • Plugin system for custom tools
  • Marketplace for providers/tools
  • Team workspaces
  • Analytics dashboard

12. Success Criteria

Launch Criteria (MVP)

  • All P0 features implemented
  • Test coverage > 70%
  • No critical bugs
  • Performance requirements met
  • Security audit passed
  • Beta testing with 50+ users
  • App Store approval

3-Month Post-Launch

  • 1,000+ active users
  • 4.5+ star rating
  • < 1% crash rate
  • 50%+ user retention (30-day)

6-Month Post-Launch

  • 10,000+ active users
  • 4.7+ star rating
  • < 0.5% crash rate
  • 60%+ user retention (30-day)
  • Featured on App Store/Play Store

13. Risks & Mitigation

Risk Impact Probability Mitigation
SSH connection instability High Medium Implement robust reconnection, queue commands
API rate limiting High Medium Implement caching, request throttling
Large file handling Medium High Stream files, implement size limits
Battery drain Medium Medium Optimize background tasks, use efficient algorithms
Security vulnerabilities High Low Regular security audits, dependency updates
App Store rejection High Low Follow guidelines strictly, prepare appeals

14. Appendix

14.1 Glossary

  • Provider: AI API service (Anthropic, Bedrock, etc.)
  • Tool: Executable function (Read, Write, Bash, etc.)
  • Session: Conversation thread with history
  • SSH: Secure Shell protocol for remote access
  • BLoC: Business Logic Component (state management pattern)

14.2 References

14.3 Document History

Version Date Author Changes
1.0.0 2026-04-01 Claude Initial draft

End of Document