A concise map of the system, the core loop, and the required dependencies.
•
15 min read
•
PlanToCode is a desktop workspace that plans and validates code changes before execution. It coordinates a local Rust job engine, a React UI, and a server proxy for LLM calls. The system follows an offline-first architecture where the desktop app operates independently using SQLite for local state, while the server handles authentication, LLM provider routing, and billing. Without external LLM providers configured with your API keys, the planning and analysis pipelines will not run.
System map
Map of the desktop app, the Rust core, local SQLite storage, and the server proxy.
Click to expand
Four-layer architecture with data flowing down and events streaming back up.
Core loop in practice
Capture the task from text, voice transcription (via useVoiceTranscription hook), or video recording analysis.
Refine the task description and objectives with text_improvement jobs through TextImprovementProcessor.
Run the file discovery workflow: RootFolderSelectionProcessor selects directories, RegexFileFilterProcessor applies patterns, FileRelevanceAssessmentProcessor scores contents, ExtendedPathFinderProcessor expands context.
Generate implementation plans via ImplementationPlanProcessor, which streams XML-formatted plans to the Monaco viewer.
Optionally merge multiple plan drafts with ImplementationPlanMergeProcessor using XML-tagged source plans.
Execute or export the approved plan through PTY terminal sessions or copy-button templates for external agents.
Persist every job, artifact, and terminal log to SQLite (background_jobs, terminal_sessions tables) for auditability.
Major components
Desktop UI (React) in desktop/src/ with Monaco plan views, terminal panels, and providers (SessionProvider, TextImprovementProvider).
Rust core (Tauri v2) in desktop/src-tauri/ handling commands, jobs, and persistence with capability-based permissions.
Local SQLite schema in desktop/src-tauri/migrations/consolidated_schema.sql with WAL mode for concurrent access.
Server proxy (Actix-Web) in server/src/ for auth, provider routing, streaming responses, and billing via Stripe.
Mobile iOS client in mobile/ios/Core/ with SwiftUI interface, Auth0 PKCE, and WebSocket device linking.
Infrastructure automation in infrastructure/ansible/ for Hetzner (EU) and InterServer (US) dedicated servers.
Required dependencies
External LLM providers (OpenAI, Anthropic, Google, X.AI, OpenRouter) for plan generation, transcription, and analysis.
Auth0-based authentication with PKCE flow for desktop and mobile sessions.
PostgreSQL 17 and Redis 7+ for server-side user accounts, billing state, and job queues (self-hosted deployments).
Local filesystem access via git ls-files or directory traversal for file discovery workflows.
Whisper-compatible transcription endpoint for voice input processing.