DEV Community

Cover image for Touch Grass to Deploy: The Git Hook That Refuses to Push Until You Go Outside
HMV
HMV

Posted on Fully Autonomous

Touch Grass to Deploy: The Git Hook That Refuses to Push Until You Go Outside

*This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass*

What I Built

Touch Grass to Deploy is an automated Git pre-push gatekeeper powered by a local, open-weight vision-language model (moondream2).

As developers, we pride ourselves on relentless productivity, rapid git pushes, and shipping code. But that loop often keeps us chained to our monitors for hours without taking a genuine physical break. Switching tabs to a browser or checking a phone isn't a break—it's just swapping one screen for another.

This tool enforces a literal physical boundary: your code will refuse to deploy until you physically step away from your desk, walk outside, and provide authentic photographic evidence of nature.

When you run git push, the hook halts execution in the terminal. It inspects your project root for proof of nature (grass.jpg) and runs local vision inference. If it verifies real foliage, grass, trees, or sky, the push is authorized, the image is consumed, and your code deploys. If you haven't stepped outside—or tried to trick it with indoor monitor screenshots or terminal text—the deployment is immediately aborted.


Demo

1. The Blocked State (No outdoor proof found)

$ git push origin main

======================================================================
  🌿 TOUCH GRASS TO DEPLOY | Git Pre-Push Gatekeeper 🌿
======================================================================

🚫 DEPLOYMENT BLOCKED: NO PROOF OF NATURE FOUND!
----------------------------------------------------------------------
You have attempted to `git push` without providing physical evidence
that you have stepped away from your screen.

👉 HOW TO UNLOCK YOUR GIT PUSH:
  1. Stand up from your desk.
  2. Walk outside into the physical world.
  3. Touch real grass, foliage, or gaze at the sky.
  4. Snap a photo on your phone.
  5. Save the photo as grass.jpg in your project root.
  6. Re-run `git push`.

"The screen should be the shortest part of the experience."
----------------------------------------------------------------------

❌ git push aborted by Touch Grass gatekeeper.
error: failed to push some refs

Enter fullscreen mode Exit fullscreen mode

2. The Verification Passed State (After touching real grass)

$ git push origin main

======================================================================
  🌿 TOUCH GRASS TO DEPLOY | Git Pre-Push Gatekeeper 🌿
======================================================================
Found candidate proof: grass.jpg

[1/3] 📷 Inspecting proof: grass.jpg...
[2/3] 🧠 Initializing local vision model (vikhyatk/moondream2 on CPU)...
      (Zero cloud API calls. Complete offline privacy.)
[3/3] 🔍 Analyzing visual features for authentic outdoor nature...
      AI Model Verdict: YES

✅ PROOF ACCEPTED! NATURE CONFIRMED.
----------------------------------------------------------------------
🌿 Congratulations! You touched grass and disconnected from the matrix.
🚀 Your git push has been authorized by local vision intelligence.

🧹 Consumed grass.jpg (fresh proof required for future pushes).

Proceeding with remote deployment...
Everything up-to-date

Enter fullscreen mode Exit fullscreen mode

Code


The project is structured with zero bloat:

  • verify_grass.py: The local vision pipeline loading moondream2 and querying the model for outdoor flora.

  • setup_hook.py: Automated setup script to configure the Git hook either per-repository or globally across every repo on your computer.

  • .git/hooks/pre-push: Native shell hook intercepting the push signal.


How I Built It

The core design principle was ensuring that the screen is the shortest part of the experience, and that anyone even on a low-spec laptop can run this without expensive cloud infrastructure.

  1. Native Git Interception: Built using Git's native pre-push client hook system. It intercepts the push lifecycle before any network packets leave the machine.

  2. Open-Weight Vision AI (moondream2): Rather than calling proprietary multimodal APIs, I used vikhyatk/moondream2 (revision 2024-08-26), a compact ~1.86B parameter vision model.

  3. Pure CPU Execution: Configured using PyTorch CPU wheels with low_cpu_mem_usage=True and evaluated inside torch.no_grad(). It requires no dedicated GPU and runs seamlessly within standard RAM constraints.

  4. Single-Use Verification Mechanism: When an outdoor photo is verified (YES), the script deletes grass.jpg from the folder. This ensures you can't reuse the same leaf photo for your next feature push—you have to get outside again.


Why Does Open Innovation Matter?

This project could not function ethically or practically with closed-source, proprietary APIs:

  • 100% Offline Capability (Works in Nature): If you are coding from a park, a trail, or a spot with zero cellular coverage, a closed API like GPT-4o or Claude is completely useless. Because moondream2 runs locally via open weights, git verification works entirely off-grid with zero internet connection.

  • Zero Cost Barrier: Developers push code dozens of times a day. Tying each push to a pay-per-token commercial API would rack up bills and hit rate limits. Open weights allow you to verify unlimited deployments for $0.00 forever.

  • Absolute Privacy of Personal Photos: Your phone photos contain sensitive EXIF metadata, GPS coordinates, and glimpses of your personal surroundings. With open-weight AI executing directly in local memory, zero pixels and zero bytes of location telemetry ever leave your machine.


Prize Categories

  • Hacktoberfest Week 1: Touch Grass
  • Hugging Face Open-Source AI Challenge

Top comments (0)