LocalPilot Logo LocalPilot v0.1.5
🛠️ Engineering Manual & Specifications

Technical Architecture & CLI Reference

A complete reference for developers, DevOps engineers, and power users: hexagonal domain separation, 3-axis execution dispatch, process boundaries, and full CLI syntax.

1

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.

┌────────────────────────────────────────────────────────────────────────┐ │ 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 │ └──────────────────────┘ └──────────────────┘ └─────────────────────────┘
localpilot.domain

Pure Python entities: HardwareSnapshot, ExecutionPlan, CompatibilityCheckResult, scoring heuristics, and evidence-based state transitions.

localpilot.application

Transactional use cases: multi-step model staging, atomic download rollback, non-destructive inventory reconciliation, and background job state.

localpilot.runtimes

Isolated infrastructure adapters: socket probes, subprocess launchers, PID isolation, and HTTP API clients with strict timeouts.

2

The 3-Axis Execution Dispatch Engine

Most naive tools treat local AI as a monolithic "runtime" string (e.g. just "ollama" or "llamacpp"). LocalPilot decomposes execution into three mathematically orthogonal dimensions:

AXIS A Compute

Inference Backend

The raw computation library that loads tensors into memory and executes matrix multiplication on CPU or GPU.

• llama.cpp (GGUF)
• vLLM (Advanced)
• service-managed
AXIS B Service

Execution Service

The supervisor daemon or manager responsible for model residency, caching, and serving API requests.

• Ollama
• LocalPilot Managed
• LM Studio / llmster
• Docker Model Runner
AXIS C Process

Deployment Method

The process boundary and sandboxing model through which LocalPilot interfaces with the service.

• Direct Worker Subprocess
• Local Loopback HTTP API
• Container Runtime
Engineering Dispatch Rule: "LocalPilot resolves actual adapters from the full execution triplet. An Ollama plan connects to Ollama's HTTP daemon; a standalone GGUF plan routes to direct llama.cpp. It will never silently route LM Studio or vLLM to llama.cpp."
3

Complete CLI Command & Argument Reference

The localpilot binary is built with Typer and Rich, supporting structured terminal tables, plaintext scripts (--plain), and JSON piping (--json).

localpilot [COMMAND] Interactive Default

When invoked without subcommands, opens the numbered interactive home menu or full-screen dashboard.

$ localpilot tui   # Direct launcher for the Textual terminal GUI
localpilot doctor Hardware Diagnostics

Runs non-invasive hardware probing: CPU architecture, available cores, physical RAM, GPU acceleration (Metal / CUDA / ROCm), storage headroom, and port availability.

$ localpilot doctor
localpilot discover [OPTIONS] Model Sizing & Ranking

Queries local and registry catalogs, filters out models that exceed available memory, scores candidates using the agreed scoring policy, and selects the recommended execution plan.

Option / Flag Type Description
--task string Filter by task category: chat, coding
-q, --query string Case-insensitive search across model name, family, or ID
--plain flag Output plain space-separated text for shell scripts
--json flag Emit full candidate and execution plan metadata in JSON
$ localpilot discover --task chat --query llama
localpilot setup <candidate_id> [OPTIONS] Guided Installation

Executes guided installation: validates compatibility, downloads real weight artifacts, verifies SHA-256 hashes, provisions local runtime adapters, and performs verified smoke inference.

Argument / Option Type Description
<candidate_id> string Target model candidate ID (e.g. llama3.2:3b)
-y, --yes flag Accept proposed execution plan without interactive confirmation
--scope string Installation boundary: isolated (default), user, system
$ localpilot setup llama3.2:3b --yes
localpilot installed | running Inventory Management

installed lists models present on disk with their verification stage (TESTED_HERE), size, and runtime. running probes live PID/service instances. Supports --plain and --json.

$ localpilot installed --json
localpilot storage | remove <id> Space Reclamation

storage outputs total gigabytes used across model weights, SQLite databases, and logs. remove <id> safely deletes weights without touching third-party files.

$ localpilot storage
$ localpilot remove llama3.2:3b --delete-files -y
localpilot self update | uninstall Application Lifecycle

self update queries PyPI and performs safe in-place upgrades. self uninstall cleanly purges symlinks and virtual environments with optional --purge-models.

$ localpilot self update
4

Engineering Decisions & Guarantees

🗜️ Why GGUF & Q4_K_M?

GGUF is a single-file, mmap-capable binary format designed for high-performance CPU/GPU inference. Q4_K_M uses 4-bit block quantization with medium k-quant coverage, preserving 99%+ of 16-bit float perplexity while slashing memory consumption by ~65%.

🛡️ Process Boundary Respect

LocalPilot enforces non-destructive process supervision. If an Ollama or LM Studio daemon is detected on port 11434 or 1234, LocalPilot connects as an unprivileged client. It will never send SIGTERM, modify foreign config files, or alter third-party model stores.

🚫 Zero Synthetic Artifacts

Production code paths contain zero placeholder mock files. Model registration requires real HTTP/registry downloads, verified content lengths, and SHA-256 validation. A model is never marked TESTED_HERE until actual prompt inference passes.

🔄 Atomic Staging & Rollback

Updates never overwrite working model weights in place. New versions are staged in a temporary directory (~/.local/share/localpilot/backups/), verified with smoke inference, and atomically swapped only upon verified success.

5

Developer Setup & Contributing

LocalPilot is maintained on GitHub using modern Python tooling (uv / venv), full typing with Pydantic v2, and Pytest test coverage:

1. Clone the repository
$ git clone https://github.com/fakhruldeen/LocalPilot.git && cd LocalPilot
2. Create virtual environment & install dependencies
$ python3 -m venv .venv && source .venv/bin/activate
$ pip install -e ".[dev]"
3. Run the automated test suite
$ pytest -v