I made `git push` refuse to work until I touch grass
说明与用途
一个 Git pre‑push 钩子,要求开发者在推送前先到户外走走,使用本地 Gemma 4 模型验证外景照片。
问题
Developers lose track of time and neglect breaks while coding, leading to burnout and reduced productivity.
结果
The tool achieved 18/18 correct classifications on a 18‑photo benchmark, blocking fakes and encouraging short outdoor breaks before code pushes.
工作流
- 1. Run
touchgrass installto add a pre‑push hook. - 2. After the configured time indoors,
git pushis blocked and shows a QR code. - 3. Run
touchgrass proveto start a local or tunneled web page that opens the rear camera. - 4. Capture a photo of an outdoor scene within 15 minutes of capture time.
- 5. The photo is sent to Gemma 4 via Ollama for analysis.
- 6. The script evaluates the model’s JSON output for outdoors, sky_or_plants, and no screen.
- 7. If all checks pass, the hook resets the timer and allows the push; otherwise the push remains blocked.
证据
I made git push refuse to work until I touch grass
After 3 hours indoors (you can change that), this happens. Here's a real one from testing, with the limit set to 1 minute:
The first run got 16 out of 18. Every real photo was right. Both fakes sailed through as "Grass confirmed"
Second run: 18 out of 18, about 26 seconds a photo on a 4 core CPU with no GPU.
The photo goes to Gemma through Ollama, on localhost.
- 记录日期: 2026-10-10T15:10:53.702Z