Stop wasting tokens on garbage files.
Stop committing 50MB SQLite databases.
Stop explaining to AI why your project has 847 PNG files.
Installation β’ Quick Start β’ Features β’ Configuration
You're vibe-coding with Claude/Cursor/Copilot. Life is good.
Then you notice:
- πΈ Token costs are through the roof
- π AI responses are slow because context is bloated
- π± You accidentally committed a 200MB video file
- π AI keeps "seeing" your
node_modulesor__pycache__
Ghost Protocol fixes all of this. Automatically. In the background.
| Feature | What it does |
|---|---|
| π« Auto-Ignore | Detects heavy files (images, videos, databases) and adds them to .gitignore + .cursorignore |
| π§Ή Self-Cleaning | Removes stale entries when you delete the original files |
| π‘οΈ Commit Guard | Blocks git commit if you try to push oversized source files |
| π Live Monitor | Beautiful TUI dashboard showing token count & estimated API cost |
| β‘ Zero Config | Works out of the box. Sensible defaults. |
| π Silent | Runs in background. No notifications. No interruptions. |
pip install ghost-protocolAfter installation, the ghost command will be available globally.
# Clone the repo
git clone https://github.com/Adrena1ine-ai/Ghost-Protocol.git
cd Ghost-Protocol
# Install in development mode
pip install -e .Three commands. That's it.
# 1. Install the git hook (one time only)
ghost --install
# 2. Start the guardian daemon (run in background)
ghost --ghost
# 3. (Optional) Open the monitor in another terminal
ghost --monitorNow forget about it. Ghost Protocol handles the rest.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π» Ghost Protocol v2.0.0 | Status: ACTIVE β
βββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ€
β π Project Stats β π§ The Brain β
β β β
β Total Tokens 1,247,832 β β’ Writer: IgnoreManager (DRY) β
β Files Tracked 342 β β’ Scanner: Auto-updating (30s)β
β Est. Cost ($3/M) $3.74 β β’ Config: Cached & Valid β
β β β
β β Press Ctrl+C to exit. β
βββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββ
Create ghost_config.json in your project root:
{
"limits": {
"max_asset_size_mb": 1.0,
"max_code_size_mb": 0.5,
"debounce_seconds": 0.5
},
"skip_dirs": ["my_custom_folder", "secrets"],
"extensions": {
"garbage": [".custom", ".mybigfile"],
"code": [".mycode"]
}
}| Setting | Default | Description |
|---|---|---|
max_asset_size_mb |
1.0 | Auto-ignore assets larger than this |
max_code_size_mb |
0.5 | Warn/block code files larger than this |
debounce_seconds |
0.5 | Wait time before processing file changes |
venv, .venv, node_modules, __pycache__, .git,
.idea, .vscode, dist, build, coverage, target...
.log, .sqlite, .db, .zip, .mp4, .mp3, .pdf,
.png, .jpg, .gif, .exe, .dll, .bin...
βββββββββββββββ βββββββββββββββ βββββββββββββββββββ
β Watchdog ββββββΆβ Queue ββββββΆβ IgnoreManager β
β (Events) β β (Debounce) β β (Atomic Write) β
βββββββββββββββ βββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββ
β .gitignore β
β.cursorignoreβ
βββββββββββββββ
Key Design Decisions:
- Singleton Config β Thread-safe, cached sets for O(1) lookups
- File Locking β Cross-platform advisory locks (fcntl/msvcrt)
- Atomic Writes β temp file β os.replace() for data integrity
- Fail-Closed β Git hook blocks commit on any error
# Project structure
ghost-protocol/
βββ main.py # Entry point & CLI
βββ requirements.txt # Dependencies
βββ src/
βββ config.py # Singleton configuration
βββ core.py # Logger & console
βββ utils.py # Atomic write, file locking
βββ watcher.py # File system events β queue
βββ scanner.py # Project stats & git integration
βββ pruner.py # Cleanup stale ignore entries
βββ ignore_manager.py # DRY: single source for ignore logic
βββ monitor.py # Rich TUI dashboardPRs are welcome! Please:
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
This is a common issue on Windows when Python Scripts folder is not in PATH.
Quick fix - Use Python module instead:
python -m src --install
python -m src --ghostPermanent fix - Add Scripts to PATH:
-
Find your Scripts folder:
python -c "import site; import os; print(os.path.join(site.getuserbase(), 'Scripts'))"
-
Add to PATH temporarily:
$env:Path += ";C:\Users\YourName\AppData\Roaming\Python\Python314\Scripts"
-
Add to PATH permanently:
- Press
Win + R, typesysdm.cpl, press Enter - Go to Advanced β Environment Variables
- Under User variables, find
Pathβ Edit - Click New and add the Scripts path
- Click OK and restart your terminal
- Press
- Not a git repo: Make sure you're in a git repository (
git initif needed) - Import errors: Reinstall with
pip install --upgrade ghost-protocol
MIT Β© 2024 β Do whatever you want with it.
Made for vibe coders, by a vibe coder.
Because life's too short to manually edit .gitignore
β Star this repo if Ghost saved your tokens β