Hexagonal Clean Architecture (Ports & Adapters)
LocalPilot is engineered using strict domain-driven hexagonal boundaries. The core business rules and verification logic have zero dependencies on CLI frameworks, TUI libraries, or specific runtime binaries.
Calculates RAM/VRAM offload ratio, reserves 512 MB OS buffer, and excludes oversized weights.
Multi-factor weighting: fit confidence, generation speed, quantization quality, and platform acceleration.
Immutable 3-axis execution triplet: Backend × Managed Service × Deployment Method.
Evidence-backed state transitions: UNTESTED → DOWNLOADED → TESTED_HERE (verified inference).
- • Linux / Darwin OS Probes
- • Apple Metal & Unified Memory
- • NVIDIA CUDA & AMD ROCm
- • Loopback Port Scanner
- • Ollama Model Registry Client
- • Hugging Face Hub (GGUF Weights)
- • Curated Local Seed Catalog
- • SHA-256 Digest & Length Validator
- • llama.cpp Direct Subprocess Runner
- • Ollama Local REST API Client
- • LM Studio / llmster Client
- • Reference-Counted Storage & SQLite
📐 View Monospace ASCII Architectural Blueprint Expand Raw ASCII
┌────────────────────────────────────────────────────────────────────────┐
│ PRESENTATION LAYER │
│ Typer CLI (localpilot) │ Textual TUI (Visual Hub) │
└─────────────────────────────────┬──────────────────────────────────────┘
▼
┌────────────────────────────────────────────────────────────────────────┐
│ APPLICATION LAYER │
│ SetupWorkflow │ UpdateWorkflow │ JobManager │ ActivityService │
└─────────────────────────────────┬──────────────────────────────────────┘
▼
┌────────────────────────────────────────────────────────────────────────┐
│ DOMAIN LAYER │
│ CompatibilityPolicy │ ScoringPolicy │ ExecutionPlan │ VerifiedState │
└──────────────┬──────────────────┬──────────────────────┬───────────────┘
▼ ▼ ▼
┌──────────────────────┐ ┌──────────────────┐ ┌─────────────────────────┐
│ PLATFORM ADAPTERS │ │ SOURCE ADAPTERS │ │ RUNTIME ADAPTERS │
│ Linux / Darwin │ │ Ollama Registry │ │ llama.cpp runner │
│ Hardware Inspector │ │ HuggingFace Hub │ │ Ollama API Client │
│ Metal / CUDA check │ │ Local Seed DB │ │ LM Studio Client │
└──────────────────────┘ └──────────────────┘ └─────────────────────────┘
Pure Python entities: HardwareSnapshot, ExecutionPlan, CompatibilityCheckResult, scoring heuristics, and evidence-based state transitions.
Transactional use cases: multi-step model staging, atomic download rollback, non-destructive inventory reconciliation, and background job state.
Isolated infrastructure adapters: socket probes, subprocess launchers, PID isolation, and HTTP API clients with strict timeouts.