LocalPilot is a local-first, safety-oriented coding assistant that helps you understand and refactor code using a local LLM — without risking repository corruption.
It is built around a strict safety pipeline:
- AST-based code understanding
- System-generated diffs (not LLM-generated)
- Git-validated patch application
LLMs suggest. Systems decide. Git enforces.
- 🧠 Local LLM support (Qwen / DeepSeek / StarCoder)
- 🌳 AST-based function extraction (Tree-sitter)
- 🔍 Explain files and code structure
- 🔧 Safe function-level refactoring
- 🧪 Git-validated patch application
- 💻 CLI-first workflow (VS Code integration planned)
LocalPilot enforces three non-negotiable rules:
Diff headers and file paths are generated by the system, never by the LLM.
All patches are validated using:
git apply --checkThe LLM outputs refactored code only.
Unified diffs are generated programmatically.
These rules guarantee zero unsafe writes to your repo.
Tree-sitter AST
↓
Function Extraction
↓
LLM → Refactored Function
↓
System → Rebuild File
↓
System → Unified Diff
↓
git apply --check
↓
Optional Apply
localpilot/
├── app/
│ ├── assistant/
│ │ ├── llm.py
│ │ ├── prompts.py
│ │ ├── explain.py
│ │ ├── refactor.py
│ │ ├── apply.py
│ │ ├── apply_diff.py
│ │ ├── diff_utils.py
│ │ ├── diff_guard.py
│ │ └── diff_validator.py
│ │
│ ├── cli/
│ │ └── assistant.py
│ │
│ ├── indexer/
│ │ ├── parser.py
│ │ ├── extract.py
│ │ ├── chunker.py
│ │ ├── embed.py
│ │ ├── index_repo.py
│ │ └── summary.py
│ │
│ ├── utils/
│ │ └── diff_check.py
│ │
│ └── config.py
│
├── storage/
├── archive/
├── script-archive/
├── test_sample.py
├── test_run_extraction.py
├── setup.py
├── requirements.txt
└── README.md
python -m venv .venv
source .venv/bin/activatepip install -r requirements.txt
pip install -e .git statusassistant explain app/assistant/llm.pyassistant refactor app/assistant/llm.py::generate- Qdrant-powered context retrieval
- Multi-function refactors
- VS Code extension
- Test-aware refactoring
MIT
LLMs assist.
Systems constrain.
Git protects.
📐 Architecture: ARCHITECTURE.md
👩💻 Developer Workflow: DEVELOPER_WORKFLOW.md
🔐 Security: SECURITY.md
🤝 Contributing: CONTRIBUTING.md