Skip to main content

The automated guardian of your sanity. Auto-ignores junk & protects repos.

Project description

๐Ÿ‘ป Ghost Protocol

The silent guardian of your AI-assisted workflow

Python 3.8+ License: MIT PRs Welcome


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


PyPI version


๐Ÿค” 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_modules or __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:

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghost_protocol-1.0.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghost_protocol-1.0.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

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

Hashes for ghost_protocol-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ca9a07230000b0b6878ee6853c2a29bc8d8eed51abf4b199b20eb420b1ce5f83
MD5 86e1afad22b38f4d20ebe2bc5d499728
BLAKE2b-256 45466ae9a33b91f36a15731078b45b6339f51ac0b04c4e8059859825f4594663

See more details on using hashes here.

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

Hashes for ghost_protocol-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b42f1434f99250b220b49138698c2d5afb405a772034d177c98d3d2efa084953
MD5 b23022f2e45aa91025aa9086b544d5ea
BLAKE2b-256 b992c9099b624e41f353d2fd39668212a164ba4212fb2476768acac789ff13cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page