PatchPilot is a terminal-native AI orchestration engine for real development workflows.
Features - Installation - Usage - Architecture - Roadmap
PatchPilot is not just another chatbot wrapper.
It's a CLI-first AI orchestration engine designed for developers who need intelligent code analysis, refactoring, and patching capabilities directly from their command line. Built with Typer and Rich, it supports both interactive REPL and one-shot command modes.
- Multi-format Intelligence - Analyze code, documents, spreadsheets, and presentations
- Context-Aware - Smart memory management prevents context overflow
- Real-time Patching - Preview and apply AI-generated code changes
- Provider-Agnostic - Works with any OpenAI-compatible API
- Developer-First - Built for terminal workflows, not browser chat
- Dual Mode - Interactive REPL or one-shot commands
PatchPilot automatically extracts and prepares content from various file formats for LLM reasoning:
| Category | Supported Formats |
|---|---|
| Code | .py .js .ts .html .css .json |
| Documents | .pdf .docx .rtf .odt |
| Data | .xlsx .csv |
| Presentations | .pptx |
- Token Tracking - Monitor and optimize context window usage
- File Pinning - Lock important files in context
- Smart Trimming - Automatic context management
- Session Isolation - Separate conversations for different projects
- Resettable Sessions - Clean slate when needed
- Session Persistence - SQLite-backed history with resume support
One-shot commands for CI/scripts:
patchpilot fix src/main.py -i "add error handling"
patchpilot refactor src/utils.py -i "extract to class"
patchpilot patch src/api.py -i "add retry logic"Or use the interactive REPL:
| Command | Description | Use Case |
|---|---|---|
/fix |
Detect and repair bugs | Find logical errors, syntax issues |
/refactor |
Improve code structure | Optimize readability, performance |
/patch |
Generate and apply edits | Apply AI-suggested changes |
/pin |
Lock file in context | Maintain focus on key files |
/tokens |
Inspect token usage | Monitor context consumption |
/history |
List past sessions | Browse previous conversations |
/resume |
Resume a past session | Continue where you left off |
Modular. Extensible. Provider-Agnostic.
| Category | Technologies |
|---|---|
| CLI Framework | Python 3.10+, Typer |
| Terminal Rendering | Rich (markdown, tables, panels) |
| LLM Integration | openai SDK, httpx |
| Persistence | aiosqlite (SQLite) |
| Document Processing | PyPDF2, python-docx, openpyxl |
| Presentations | python-pptx |
| Web Parsing | beautifulsoup4 |
| Office Formats | odfdo, striprtf |
| Configuration | python-dotenv |
- Python 3.10 or higher
- pip package manager
- An OpenAI-compatible API key
# Clone the repository
git clone https://github.com/fuwadog/patchpilot.git
cd patchpilot
# Create virtual environment
python -m venv venv
# Activate virtual environment (PowerShell)
venv\Scripts\Activate.ps1
# Install in editable mode (installs patchpilot command)
pip install -e .# Clone and install dependencies
git clone https://github.com/fuwadog/patchpilot.git
cd patchpilot
python -m venv venv
venv\Scripts\Activate.ps1
pip install -r requirements.txt# Copy the example env file
copy .env.example .env
# Edit .env with your credentials
notepad .envCreate a .env file in the project root:
# API Configuration (required)
OPENAI_API_KEY=your_api_key_here
OPENAI_BASE_URL=https://integrate.api.nvidia.com/v1
AI_MODEL=z-ai/glm4.7
# Model Parameters
AI_TEMPERATURE=0.4
MAX_RESPONSE_TOKENS=4096
# Context Management
MAX_TOTAL_TOKENS=4500
MAX_FILE_TOKENS=1500
MAX_CONVO_MESSAGES=40
MAX_FILES=12
# Persistence
PATCHPILOT_DB_PATH=~/.patchpilot/sessions.db| Variable | Default | Description |
|---|---|---|
OPENAI_API_KEY |
"" |
API key for provider |
OPENAI_BASE_URL |
https://integrate.api.nvidia.com/v1 |
API endpoint |
AI_MODEL |
z-ai/glm4.7 |
Model identifier |
AI_TEMPERATURE |
0.4 |
LLM temperature (0.0-2.0) |
MAX_TOTAL_TOKENS |
4500 |
Max context window tokens |
MAX_FILE_TOKENS |
1500 |
Max tokens per file |
MAX_CONVO_MESSAGES |
40 |
Max conversation turns |
MAX_FILES |
12 |
Max concurrent loaded files |
MAX_RESPONSE_TOKENS |
4096 |
Max tokens per response |
PatchPilot works with any OpenAI-compatible API endpoint:
- NVIDIA AI Foundation Models
- OpenAI GPT Models
- Azure OpenAI
- Local models (via Ollama, LM Studio, vLLM)
- Any provider with OpenAI-compatible API
# Interactive REPL
python -m src
# Or if installed as a CLI tool:
patchpilot
patchpilot chatRun code operations directly without entering the REPL:
# Fix bugs in a file
patchpilot fix src/main.py -i "add null check before method call"
# Refactor code
patchpilot refactor src/utils.py -i "extract duplicate logic into helper"
# Generate and preview a patch
patchpilot patch src/api.py --instructions "add retry with backoff"
# Dry-run (preview without applying)
patchpilot fix src/main.py -i "fix bug" --dry-run# Load a single file
/file src/app.py
# Load entire directory
/folder src/
# Pin important file to context
/pin main.py
# List loaded files
/list
# Show file content
/show main.py
# Unload a file
/unload main.py
# Clear all files
/unload-all# Check token usage
/tokens
# Show detailed context info
/context
# Reset conversation
/reset
# Show help
/help
# List past sessions
/history
# Resume a session
/resume <session-id>
# Save a code snippet
/snippet save my-helper
# List snippets
/snippet list# 1. Start REPL
patchpilot
# 2. Load your legacy project
>>> /folder legacy_project/
# 3. Pin critical file
>>> /pin main.py
# 4. Check token budget
>>> /tokens
# 5. Request refactoring
>>> /refactor
# 6. Review and apply patch
>>> /patch- Streaming responses (real-time output)
- Session persistence (SQLite-backed history)
- One-shot commands (CI-friendly mode)
- Vector-based file indexing (FAISS/ChromaDB)
- Multi-provider routing (fallback strategies)
- Git integration (commit, diff, branch operations)
- Interactive diff viewer (side-by-side comparison)
- Docker support (containerized deployment)
- CI/CD pipeline (GitHub Actions)
- Plugin system (extensible architecture)
- RAG integration (knowledge base augmentation)
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Install with dev dependencies
pip install -e ".[dev]"
# Or from requirements-dev.txt
pip install -r requirements-dev.txtThis project is licensed under the MIT License - see the LICENSE file for details.
- Built for the developer community (nah, i just made this for me to use, feel free to roast me or something...)
- Powered by NVIDIA AI Foundation Models
- Inspired by the need for intelligent, terminal-native development tools
It's a terminal-native AI orchestration engine for real development workflows.