Autonomous Self-Healing CI/CD & Agent Skill powered by Local Open-Weight SLMs
Diagnose broken tests. Synthesize surgical patches with local SLMs. Verify in sandbox. Auto-commit.
PatchPilot is an open-source autonomous code-repair engine and Agent Skill Open Standard compliant module. When unit, integration, or CI tests fail, PatchPilot:
- Parses & Isolates Failures: Extracts stack traces, assertion errors, and culprit source files across
pytest,jest,vitest,cargo, andgo test. - Consults Local Open-Weight SLMs: Uses fast, lightweight local models (e.g. Qwen 2.5 Coder 1.5B/7B, Gemma 2 2B, DeepSeek Coder, Llama 3.2) via Ollama or llama.cpp — zero cloud API keys required.
- Applies & Verifies Patches: Applies candidate fixes and automatically re-executes the test suite in a sandboxed verification loop with automatic rollback protection.
- Auto-Commits or Hands Off to Agents: Emits unified diffs, conventional commits, or returns structured diagnostics to AI coding agents.
flowchart LR
A["❌ Broken Tests\n(CI / Local)"] --> B["🔍 Stack Trace\nExtractor"]
B --> C["🤖 Local SLM\n(Qwen 2.5 / Gemma 2)"]
C --> D["🩹 Surgical\nPatch Synthesis"]
D --> E{"🧪 Sandboxed\nTest Verification"}
E -- "Passes" --> F["✅ Git Auto-Commit\n& Verified Diff"]
E -- "Fails" --> C
- 🔒 100% Private & Offline: Runs entirely against local open-weight models (
ollama,llama.cpp,vLLM,LocalAI). Your code never leaves your workstation. - ⚡ Agent Skill Open Standard Compliant: Drop-in compatibility with Antigravity, Claude Code, Cursor, OpenCode, and any agent system adhering to the Agent Skill standard (
SKILL.md). - 🛡️ Zero-Risk Rollback: Backs up affected files in memory; automatically reverts code if max repair iterations fail.
- 🌐 Multi-Language Support: Native adapters for Python (
pytest,unittest), JS/TS (jest,vitest), Rust (cargo test), and Go (go test). - 🎨 Interactive Rich CLI: Beautiful terminal outputs, syntax-highlighted diffs, and diagnostics.
# Clone repository
git clone https://github.com/your-username/patchpilot.git
cd patchpilot
# Install package in editable mode
pip install -e .Make sure Ollama or an OpenAI-compatible local server is running:
# Pull a fast code-repair model
ollama pull qwen2.5-coder:1.5b
# or
ollama pull gemma2:2b# Run in any directory with failing tests
patchpilot heal
# Specify custom test command and model
patchpilot heal --cmd "pytest tests/" --model "qwen2.5-coder:1.5b" --commit| Command | Description |
|---|---|
patchpilot heal |
Executes tests, isolates failures, synthesizes fix with local SLM, and verifies in sandbox. |
patchpilot diagnose |
Parses and displays detailed failure tables and culprit files without modifying code. |
patchpilot models |
Lists local open-weight models detected on the machine. |
patchpilot version |
Displays the current version. |
PatchPilot is fully compliant with the Agent Skill Open Standard via SKILL.md.
To equip your coding agent with PatchPilot:
- Copy or link
patchpilot/or itsSKILL.mdinto your agent's skills directory (~/.agents/skills/patchpilotor workspace.skills/). - Agents will automatically trigger the skill when diagnosing or fixing test failures.
Run the built-in synthetic bug repair benchmark:
python scripts/benchmark.py| Model | Size | Repair Latency | Fix Accuracy |
|---|---|---|---|
| Qwen 2.5 Coder | 1.5B | ~1.2s | 88% |
| Qwen 2.5 Coder | 7B | ~3.8s | 96% |
| Gemma 2 | 2B | ~1.5s | 82% |
| DeepSeek Coder | 6.7B | ~3.5s | 94% |
Contributions are welcome! Please submit a PR or open an issue.
Distributed under the MIT License. See LICENSE for more information.