The automated guardian of your sanity. Auto-ignores junk & protects repos.
Project description
๐ป Ghost Protocol
The silent guardian of your AI-assisted workflow
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
๐ค The Problem
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.
โจ Features
| 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. |
๐ฆ Installation
From PyPI (Recommended)
pip install ghost-protocol
After installation, the ghost command will be available globally.
From Source
# Clone the repo
git clone https://github.com/Adrena1ine-ai/Ghost-Protocol.git
cd Ghost-Protocol
# Install in development mode
pip install -e .
๐ Quick Start
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 --monitor
Now forget about it. Ghost Protocol handles the rest.
๐ The Monitor
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ป Ghost Protocol v21.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. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ๏ธ Configuration
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"]
}
}
Default Settings
| 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 |
Pre-configured Skip Directories
venv, .venv, node_modules, __pycache__, .git,
.idea, .vscode, dist, build, coverage, target...
Pre-configured Garbage Extensions
.log, .sqlite, .db, .zip, .mp4, .mp3, .pdf,
.png, .jpg, .gif, .exe, .dll, .bin...
๐๏ธ How It Works
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ 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
๐งโ๐ป For Developers
# 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 dashboard
๐ค Contributing
PRs 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
๐ License
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 โญ
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 ghost_protocol-1.0.1.tar.gz.
File metadata
- Download URL: ghost_protocol-1.0.1.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca9a07230000b0b6878ee6853c2a29bc8d8eed51abf4b199b20eb420b1ce5f83
|
|
| MD5 |
86e1afad22b38f4d20ebe2bc5d499728
|
|
| BLAKE2b-256 |
45466ae9a33b91f36a15731078b45b6339f51ac0b04c4e8059859825f4594663
|
File details
Details for the file ghost_protocol-1.0.1-py3-none-any.whl.
File metadata
- Download URL: ghost_protocol-1.0.1-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b42f1434f99250b220b49138698c2d5afb405a772034d177c98d3d2efa084953
|
|
| MD5 |
b23022f2e45aa91025aa9086b544d5ea
|
|
| BLAKE2b-256 |
b992c9099b624e41f353d2fd39668212a164ba4212fb2476768acac789ff13cd
|