|
1 | | -# GhostCoder 👻 |
| 1 | +# 👻 GhostCoder |
2 | 2 |
|
3 | | -An invisible coding partner that runs in the background, watches your terminal and IDE sessions, detects when you're stuck, and dispatches the right specialist agent to help without interrupting your flow. |
| 3 | +**The AI coding partner that doesn't trust itself.** |
4 | 4 |
|
5 | | -## Core Concept |
6 | | -GhostCoder does **NOT** have a sidebar or chat interface. It observes: |
7 | | -- Terminal session (pre/post-commands, exit codes, stderr/stdout stack traces). |
8 | | -- File system changes (modified files, contents, open buffers). |
| 5 | + |
9 | 6 |
|
10 | | -When it detects errors or complex tasks, it uses local LLMs to classify the situation and selects an appropriate specialist agent from your local Antigravity agency skills to show a concise, inline, dismissible hint. |
| 7 | +[](https://github.com/anujsingh-cse/GhostCoder/actions) |
| 8 | +[](https://pypi.org/project/ghostcoder/) |
| 9 | +[](https://opensource.org/licenses/MIT) |
11 | 10 |
|
12 | | -## Architecture |
| 11 | +## Why GhostCoder? |
13 | 12 |
|
| 13 | +| | Cursor | Copilot | GhostCoder | |
| 14 | +|--|--------|---------|------------| |
| 15 | +| UI | Sidebar chat | Inline completion | **No UI. Inline hints only** | |
| 16 | +| Trust | You trust the AI | You trust the AI | **AI challenges itself** | |
| 17 | +| Audit | None | None | **Full replay + explain** | |
| 18 | +| Safety | None | None | **Guardrails block dangerous** | |
| 19 | +| Cost | $20/mo | $10/mo | **Free, local, MIT** | |
| 20 | +| Hardware | Cloud | Cloud | **GTX 1650 4GB** | |
| 21 | + |
| 22 | +## Three Features Nobody Else Has |
| 23 | + |
| 24 | +### 🔍 Inline Hints |
| 25 | +Specialist agents watch your code and whisper fixes. No sidebar. No context switching. |
| 26 | + |
| 27 | +When you run a command that fails, or write code with an obvious bug, GhostCoder classifies the error and routes it to the correct specialist agent (e.g., security engineer, database optimizer, frontend developer) to give you a dismissible inline hint. |
| 28 | + |
| 29 | +### 🔁 Ghost Replay |
| 30 | +Every decision is recorded, explainable, and replayable. |
| 31 | + |
| 32 | +If you want to understand why GhostCoder suggested a particular change or see a step-by-step trace of how an error was handled, you can inspect it or run a full replay. |
| 33 | + |
| 34 | +```bash |
| 35 | +# Explain what happened in a specific session event |
| 36 | +ghostcoder explain --session 20260716-001 --event 0 |
| 37 | + |
| 38 | +# Generate a project automation report (weekly/monthly) |
| 39 | +ghostcoder report --period week |
| 40 | + |
| 41 | +# Re-apply proposed fixes from a session |
| 42 | +ghostcoder replay --session 20260716-001 |
14 | 43 | ``` |
15 | | - +-----------------------+ |
16 | | - | GhostCoder Daemon | |
17 | | - | (Python) | |
18 | | - +-----------+-----------+ |
19 | | - | |
20 | | - +------------------------+------------------------+ |
21 | | - | | | |
22 | | - [Unix Domain Socket] [Unix Domain Socket] [Unix Domain Socket] |
23 | | - | | | |
24 | | - v v v |
25 | | - +--------------------+ +--------------------+ +--------------------+ |
26 | | - | Shell Plugin | | Neovim Plugin | | VS Code Extension | |
27 | | - | (Bash/Zsh/Fish) | | (Lua) | | (TypeScript) | |
28 | | - +--------------------+ +--------------------+ +--------------------+ |
| 44 | + |
| 45 | +### 🛡️ Ghost Skeptic & Safety Guardrails |
| 46 | +GhostCoder is the first coding assistant that validates its own output. |
| 47 | + |
| 48 | +- **Ghost Skeptic**: Uses an adversarial classifier model to look for logic flaws and security issues (e.g. plaintext credentials) in every suggested fix. If a flaw is detected, it is either corrected or blocked. |
| 49 | +- **Safety Guardrail**: Automatically screens proposed code blocks for database-destructive operations (`DROP DATABASE`) or risky directory deletions (`rm -rf`) to keep your workspace safe. |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## Hardware Compatibility & local LLMs |
| 54 | + |
| 55 | +GhostCoder runs entirely on your local machine. It is designed to work efficiently even on lightweight GPUs (e.g., **NVIDIA GTX 1650 4GB VRAM**): |
| 56 | +1. **Qwen2.5-0.5B (1GB VRAM)**: Kept loaded in memory for fast situation classification. |
| 57 | +2. **Qwen2.5-Coder-1.5B (2GB VRAM)**: Loaded on-demand for code generation, and automatically unloaded after 30 seconds of idle time. |
| 58 | +3. **CPU Fallback**: Gracefully falls back to CPU execution if GPU memory headroom (default 500MB) is exceeded. |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Quick Start |
| 63 | + |
| 64 | +### 1. Prerequisites |
| 65 | +Install [Ollama](https://ollama.com/) and pull the models: |
| 66 | +```bash |
| 67 | +ollama pull qwen2.5:0.5b |
| 68 | +ollama pull qwen2.5-coder:1.5b |
29 | 69 | ``` |
30 | 70 |
|
31 | | -## Hardware Compatibility & LLMs |
32 | | -GhostCoder is designed to run efficiently on low-end GPUs (e.g., **NVIDIA GTX 1650 4GB VRAM**): |
33 | | -1. **Qwen2.5-0.5B (1GB VRAM)**: Kept loaded in memory for fast command and situation classification. |
34 | | -2. **Qwen2.5-Coder-1.5B (2GB VRAM)**: Loaded on demand for code generation, and automatically unloaded after 30 seconds of idle time. |
35 | | -3. **Fallback**: Auto-falls back to CPU inference (or Gemini API Free Tier) if GPU memory is constrained. |
| 71 | +### 2. Install GhostCoder |
| 72 | +Install the CLI and background daemon: |
| 73 | +```bash |
| 74 | +pip install ghostcoder |
| 75 | +``` |
| 76 | + |
| 77 | +### 3. Initialize Integrations |
| 78 | +Configure your shell and start the daemon: |
| 79 | +```bash |
| 80 | +ghostcoder init |
| 81 | +``` |
| 82 | +This automatically appends source lines to your shell configuration (`.bashrc`, `.zshrc`, or `config.fish`) and launches the background daemon. |
36 | 83 |
|
37 | 84 | --- |
38 | 85 |
|
39 | | -## Installation & Setup |
| 86 | +## Editor & IDE Setup |
40 | 87 |
|
41 | | -1. **Prerequisites**: |
42 | | - - Install [Ollama](https://ollama.ai/) and start the daemon. |
43 | | - - Pull the required models: |
44 | | - ```bash |
45 | | - ollama pull qwen2.5:0.5b |
46 | | - ollama pull qwen2.5-coder:1.5b |
47 | | - ``` |
| 88 | +### Neovim |
| 89 | +Add the plugin folder to your runtimepath (e.g., using your package manager): |
| 90 | +```lua |
| 91 | +-- lazy.nvim configuration example |
| 92 | +{ |
| 93 | + "anujsingh-cse/GhostCoder", |
| 94 | + config = function() |
| 95 | + -- Integration works automatically over the Unix Domain Socket |
| 96 | + end |
| 97 | +} |
| 98 | +``` |
48 | 99 |
|
49 | | -2. **Install package**: |
| 100 | +### VS Code |
| 101 | +1. Open the `vscode` folder in this repository. |
| 102 | +2. Package the extension: |
50 | 103 | ```bash |
51 | | - pip install -e . |
| 104 | + cd vscode |
| 105 | + npm install |
| 106 | + npm run compile |
| 107 | + npx vsce package |
52 | 108 | ``` |
| 109 | +3. Install the generated `.vsix` file in VS Code. |
53 | 110 |
|
54 | | -3. **Initialize Plugins**: |
55 | | - ```bash |
56 | | - ghostcoder init |
57 | | - ``` |
58 | | - This command detects your shell, registers shell hooks, and starts the daemon. |
| 111 | +--- |
| 112 | + |
| 113 | +## CLI Command Reference |
| 114 | + |
| 115 | +- `ghostcoder start` - Start the background daemon. |
| 116 | +- `ghostcoder status` - Show active models, VRAM usage, and active integrations. |
| 117 | +- `ghostcoder logs` - Tail background daemon log output. |
| 118 | +- `ghostcoder stop` - Stop the daemon gracefully. |
| 119 | +- `ghostcoder skeptic --on|--off` - Enable or disable the skeptic validation agent. |
59 | 120 |
|
60 | 121 | --- |
61 | 122 |
|
62 | | -## CLI Usage |
| 123 | +## License |
63 | 124 |
|
64 | | -- `ghostcoder status` - Show loaded models, VRAM usage, and active integrations. |
65 | | -- `ghostcoder logs` - Tail daemon logs. |
66 | | -- `ghostcoder stop` - Stop the background daemon gracefully. |
| 125 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
0 commit comments