AI-powered terminal error watcher and auto-fixer for any project
Project description
GhostFix
AI-powered terminal error watcher and auto-fixer.
GhostFix watches any command, detects runtime errors, gathers the relevant code context, asks an AI provider for a focused unified-diff patch, and applies the fix from your terminal.
See GhostFix in Action
Watch the GhostFix demo video.Why GhostFix?
Development servers, test runners, CLIs, scripts, and training jobs fail in noisy ways. GhostFix sits beside the command, reads the error stream, finds the file and line that matter, then proposes a small patch you can review before applying.
GhostFix is built for developers who want fast repair loops without giving up control.
Features
- Watch any shell command: Next.js, Django, Flask, pytest, Node, Go, Rust, Java, Ruby, and more.
- Detect common error signals and parse stack traces across multiple languages.
- Resolve source files from stack traces and collect nearby code context.
- Use cloud providers: OpenAI, Claude, or Gemini.
- Use local/custom models through Ollama, LM Studio, vLLM, or any OpenAI-compatible endpoint.
- Generate unified-diff patches and apply them with
git applyfirst. - Create backups in
.ghostfix_backups/before patching. - Restart the watched command after a successful fix.
- Limit repeated fixes for the same error with retry controls.
- Keep humans in the loop by default with patch confirmation prompts.
Install
pip install ghostfix
From source:
git clone https://github.com/Shibani987/ghostfix-ai.git
cd ghostfix-ai
pip install -e .
Python 3.9 or newer is required.
Quick Start
Cloud AI mode:
ghostfix watch "npm run dev" --fix --ai
GhostFix asks for the provider and API key each time watch --ai runs. This keeps new terminal sessions from silently reusing an old saved key.
Force a provider but still enter the key for this run:
ghostfix watch "python manage.py runserver" --fix --ai --provider gemini
Local/custom model mode:
ghostfix init
ghostfix watch "python app.py" --fix
Edit the generated ghostfix.config.py to point at Ollama, LM Studio, vLLM, or your own model server.
Commands
| Command | Description |
|---|---|
ghostfix watch "CMD" |
Watch a command and print its output. |
ghostfix watch "CMD" --fix --ai |
Watch and fix using a cloud AI provider. |
ghostfix watch "CMD" --fix |
Watch and fix using ghostfix.config.py custom model settings. |
ghostfix setup |
Save a default cloud provider/API key for setup workflows. |
ghostfix init |
Create a project-level ghostfix.config.py. |
ghostfix config-show |
Show the merged GhostFix configuration with masked API key. |
Flags
| Flag | Description |
|---|---|
--fix |
Enable the AI repair pipeline when an error is detected. |
--ai |
Use OpenAI, Claude, or Gemini instead of a custom model config. |
--provider <name> |
Force openai, claude, or gemini. |
--auto |
Apply patches without confirmation. Use carefully. |
--config <path> |
Load a specific ghostfix.config.py. |
--verbose |
Show extra renderer/debug output. |
How It Works
watched command fails
|
v
error parser detects language, error type, file, and line
|
v
context builder collects source snippets and project tree
|
v
AI provider returns root cause, explanation, and unified diff
|
v
GhostFix shows the fix and asks before applying
|
v
patcher backs up files, applies patch, and restarts command
Configuration
Create a config file:
ghostfix init
Example:
GHOSTFIX_CONFIG = {
"model": {
"type": "custom",
"endpoint": "http://localhost:11434/api/chat",
"model_name": "codellama:13b",
},
"watch": {
"ignore": ["node_modules", ".git", "dist", "__pycache__"],
"max_file_size_kb": 500,
"context_lines": 60,
},
"fix": {
"auto_apply": False,
"create_backup": True,
"restart_on_fix": True,
"max_retries": 3,
},
}
See Configuration and Providers.
Supported Error Families
| Ecosystem | Detection | Stack trace parsing |
|---|---|---|
| Python, Django, Flask | Yes | Yes |
| Node.js, TypeScript, Next.js | Yes | Yes |
| Java | Yes | Yes |
| Go | Yes | Yes |
| Rust | Yes | Yes |
| Ruby | Yes | Yes |
| Generic CLI output | Yes | Partial |
Safety
GhostFix is designed to keep you in control:
- Patches are shown before applying unless
--autois enabled. - Backups are created before patching by default.
- The same error is not fixed forever; retry limits stop loops.
- Project scanning ignores common generated folders.
- API keys are masked in
config-show.
Read Security before using GhostFix on sensitive repositories.
Documentation
- Installation
- Configuration
- Providers
- Architecture
- Troubleshooting
- Release Checklist
- Contributing
- Changelog
Release Status
Current version: 0.1.0
This is an early release. The core loop is ready for testing, but patch quality depends on the chosen AI model and the context available in the error output.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ghostfix-0.1.0.tar.gz.
File metadata
- Download URL: ghostfix-0.1.0.tar.gz
- Upload date:
- Size: 6.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a20948e5be24cb843e87b9a078ca75a5190d703bce7214ce57df80db6ffe56f
|
|
| MD5 |
dd5c21a02ce36e39945467f8f7f5ea41
|
|
| BLAKE2b-256 |
81c2d1a889835c6c324aa5c3e8b9196c284be2fd17e2829e4f797b30c3a192c9
|
File details
Details for the file ghostfix-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ghostfix-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f0e16b8afb29b24f2965db03d11e302c5d410bb54a3a1104a3a3fc24d12a671
|
|
| MD5 |
b333433240440a656d76799b7e264191
|
|
| BLAKE2b-256 |
f01802d67ab55cd37d5fb2bdee7373f55aef855e4e76b8a22d4816a5ae4bebf2
|