# Locopilot [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/) [![Platform](https://img.shields.io/badge/platform-linux-lightgrey.svg)](#requirements) [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE) [![Status](https://img.shields.io/badge/status-prototype-orange.svg)](#current-status) [![Tests](https://img.shields.io/badge/tests-112%20passing-brightgreen.svg)](#development) Locopilot is a local Linux prototype for supervised desktop AI automation. It runs computer-use models inside an isolated sandbox desktop, checks every proposed action with deterministic guardrails, pauses before risky writebacks, and records a replayable audit trail. The project is designed for workflows where an AI system can produce structured work, but the final action still has to happen inside an existing desktop or web application without installing custom tooling in the vendor environment. ## What It Does - Starts an isolated Xvfb/XFCE desktop for agent work. - Drives the sandbox with `xdotool` while keeping your normal desktop separate. - Supports mock, Claude, and OpenAI computer-use providers behind one interface. - Enforces app allowlists, coordinate bounds, write-action policy, and human checkpoints before risky actions. - Writes JSONL audit logs, before/after screenshots, summaries, and readable replays. - Provides both CLI workflows and a PyQt supervisor UI. - Optionally exposes the sandbox over VNC when `x11vnc` is installed. ## Architecture ```text Your Linux machine ├── DISPLAY :0 │ ├── your normal desktop │ └── Locopilot supervisor UI └── DISPLAY :10+ ├── Xvfb isolated desktop ├── XFCE session ├── optional x11vnc viewer ├── xdotool action execution └── Claude / OpenAI / mock computer-use loop ``` Agent loop: ```text task -> screenshot -> provider -> guardrails -> checkpoint -> executor -> audit ``` Safety model: - The AI only sees the sandbox display. - Guardrails block unsafe actions before execution. - Checkpoints require human approval before Save, Submit, Delete, Finalize, and Close-style actions. - Audit logs record JSONL events plus before/after screenshots for replay. - Providers are swappable: mock, Claude computer-use, or OpenAI computer tool. ## Requirements Locopilot targets Linux desktops. System packages: ```bash sudo apt install -y xvfb xfce4 xdotool imagemagick x11vnc xrdp ``` `x11vnc` is only required for live VNC viewing. Core mock runs work without it. ## Install ```bash git clone https://github.com/pradhankukiran/locopilot.git cd locopilot python -m venv .venv . .venv/bin/activate pip install -e ".[ui,dev]" ``` Verify the CLI: ```bash locopilot --help ``` ## Quick Start Run a sandbox-backed demo without API keys: ```bash locopilot run --provider mock --yes "click the center and type hello" ``` Expected output includes the selected sandbox display, provider name, and audit directory path. Enable live VNC viewing: ```bash locopilot run --provider mock --yes --view "click the center and type hello" ``` If `x11vnc` is not installed, Locopilot reports that VNC was not started and still continues the task when possible. ## CLI Start, inspect, and stop a detached sandbox: ```bash locopilot sandbox start locopilot sandbox status locopilot sandbox stop ``` Run a task: ```bash locopilot run --provider mock --yes "demo task" ``` Replay a previous audit: ```bash locopilot audit ~/.local/share/locopilot/audit/task-1234567890 ``` List recent audits: ```bash locopilot audit --list ``` Start the supervisor UI: ```bash locopilot supervisor ``` The default supervisor provider is `mock`. Use `--provider claude` or `--provider openai` when credentials are configured. ## Providers Mock provider: ```bash locopilot run --provider mock --yes "demo task" ``` Claude provider: ```bash export ANTHROPIC_API_KEY=... locopilot run --provider claude "open Firefox and search for cats" ``` OpenAI provider: ```bash export OPENAI_API_KEY=... locopilot run --provider openai "open Firefox and search for cats" ``` ## Audit Trail By default, audit data is written under: ```text ${XDG_DATA_HOME:-~/.local/share}/locopilot/audit ``` Each task records: ```text task.txt log.jsonl summary.json step_0_before.png step_0_after.png ... ``` Use `locopilot audit` to render a readable replay from those files. ## Guardrails Guardrail policy can be loaded from YAML. See: - [config/guardrails.example.yaml](config/guardrails.example.yaml) - [docs/DEMO.md](docs/DEMO.md) The policy layer covers app allowlists, coordinate bounds, write-action approval, blocked actions, and checkpoint requirements. ## Development Install development dependencies: ```bash pip install -e ".[ui,dev]" ``` Run the test suite: ```bash pytest tests -v ``` Current local verification: ```text 112 passed ``` Useful docs and examples: - [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) - [docs/DEMO.md](docs/DEMO.md) - [docs/PHASES.md](docs/PHASES.md) - [examples/tasks.md](examples/tasks.md) - [examples/writeback_task.json](examples/writeback_task.json) ## Current Status Implemented: - isolated sandbox desktop - provider abstraction for mock, Claude, and OpenAI - action executor - guardrails and policy loading - human checkpoint flow - replayable audit logs - audit replay CLI - sandbox lifecycle CLI - optional VNC viewing - PyQt supervisor UI - CLI smoke demo Still prototype-level: - real ERP-specific workflows - robust visual form grounding - packaged desktop installer - production authentication and backend sync - live Claude/OpenAI provider validation in this checkout ## License Apache-2.0. See [LICENSE](LICENSE).