Architecture

PlanToCodeTechnical System Walkthrough

A technical walk-through of how PlanToCode is built so you can study the architecture, reuse the patterns, or build a similar planning pipeline. The desktop app relies on external LLM providers configured with your API keys.

TauriRustSQLiteLLM orchestration

System Walkthrough Video

A short, end-to-end walkthrough of the planning pipeline: task input, file discovery jobs, plan generation, merge instructions, and execution handoff.

  • Tauri shell and React UI surface the workflow
  • Rust background jobs stream progress updates
  • SQLite stores sessions, jobs, and logs
  • LLM plans are generated and merged with structure

System Architecture and Implementation Walkthrough

Each panel below shows the desktop app and backend collaborating: Tauri shell, Rust job processors, SQLite persistence, and model orchestration coordinating planning and execution.

System Walkthrough Video

A short, end-to-end walkthrough of the planning pipeline: task input, file discovery jobs, plan generation, merge instructions, and execution handoff.

  • Tauri shell and React UI surface the workflow
  • Rust background jobs stream progress updates
  • SQLite stores sessions, jobs, and logs
  • LLM plans are generated and merged with structure

File Discovery Pipeline

A four-stage Rust workflow: LLM-assisted root selection, regex filtering, relevance scoring, and extended path finding to build a focused file set.

  • Root folder selection uses the directory tree and task prompt
  • Regex filter generates pattern groups and applies git ls-files
  • Relevance scoring chunks file contents with token estimates
  • Extended path finder expands context with file + tree data
File Discovery Pipeline
View full size

Persisted File Context

Each workflow stage writes results to background_jobs so file sets can be reused across sessions and inspected later.

  • Workflow stages stored as job records
  • Selected file lists persisted as JSON responses
  • Session included_files reused across jobs
  • SQLite history survives restarts
Persisted File Context
View full size

Video Analysis Ingestion

Screen recordings are sent to the `/api/llm/video/analyze` endpoint with prompts and FPS settings to generate structured summaries.

  • Multipart upload includes duration_ms and framerate
  • Model format is provider/model (google/* required)
  • Usage and cost tracked in server billing logs
  • Summary stored as job metadata artifacts
Video Analysis Ingestion
View full size

Multi-Model Plan Generation

ImplementationPlanProcessor streams plan drafts from full file contents; merge jobs consolidate multiple drafts into one plan.

  • Plan jobs include selected file contents + directory tree
  • Structured plan metadata captured per job
  • Merge prompt uses <source_plans> and <user_instructions>
  • Final plan stored alongside source drafts
Multi-Model Plan Generation
View full size

Background Job Monitoring

Rust job processors stream progress and state transitions to the UI while persisting job history in SQLite.

  • Created, queued, preparing, running, completed/failed/canceled
  • Streaming updates via Tauri events
  • Token usage captured per run
  • Cancel long-running jobs
Background Job Monitoring
View full size

Prompt and Model Configuration

Runtime model settings are fetched from `/api/config/desktop-runtime-config`; prompt overrides are stored in SQLite.

  • Per-task allowed models and defaults
  • System prompts served by the server API
  • Project-level prompt overrides in project_system_prompts
  • Local key_value_store for runtime preferences
Prompt and Model Configuration
View full size

Workflow Automation Buttons

Copy buttons insert templated prompts with task context for handoff into terminals or external tools.

  • Templates sourced from task model config
  • Placeholders resolved against the active plan
  • Handoff to PTY sessions or clipboard
  • Actions tied to job metadata for audit
Workflow Automation Buttons
View full size

Plan Merge Instructions

ImplementationPlanMergeProcessor merges multiple plan drafts using XML-tagged source plans and optional instructions.

  • Source plans pulled by job ID
  • Merge instructions stored in metadata
  • File contents + directory tree add context
  • Merged plan stored alongside inputs
Plan Merge Instructions
View full size

Usage and Cost Ledger

Server-side usage entries and job metadata capture model usage across providers.

  • Per-job token and cost metadata
  • Provider-aware usage entries
  • Billing endpoints expose usage summaries
  • Audit trail for model spend
Usage and Cost Ledger
View full size

Explore the architecture in context

Map each UI panel to the underlying processors, then dive deeper into the architecture docs and build guides.