water-gate

Your AI watches you drink water. water-gate blocks your next Claude Code prompt until your webcam sees you take a sip. 100% local, and it fails open: a broken camera or a missing dependency never locks you out.
"My AI won't let me code until I hydrate."
How it works
- A
UserPromptSubmit hook runs on every prompt: pure stdlib, sub-50ms when no drink is due.
- When a drink is due, it opens a webcam window in a foreground Terminal (see Privacy).
- MediaPipe watches for hand-to-mouth plus either a bottle/cup near your face or a head-tilt-back, held for ~1.5 seconds.
- The HUD shows live detection boxes (you, the cup) and signal chips (
person / hand / mouth / tilt / cup) so you can see exactly what it sees.
- Debt cleared → window closes → your prompt proceeds like nothing happened.
prompt → due? → webcam window → sip detected → debt cleared → prompt proceeds
│
└─ camera missing / uv missing / timeout / crash → prompt proceeds anyway
Install
/plugin marketplace add mgiovani/water-gate
/plugin install water-gate@water-gate
Requirements:
uv: curl -LsSf https://astral.sh/uv/install.sh | sh
- A webcam, macOS or Linux, Python 3.10–3.12 available to
uv
- macOS: grant Terminal camera access (System Settings → Privacy & Security → Camera)
- First real challenge downloads ~16 MB of models once, straight from Google's public model host
Dev / local testing without publishing:
claude --plugin-dir ./water-gate
Config
| key | default | meaning |
|---|
enabled | true | master switch |
blocking | true | aborting the sip blocks the prompt; false = just nags |
trigger.mode | time | time | prompts | roulette |
trigger.minutes_every | 30 | (time) minutes between challenges |
trigger.prompts_every | 15 | (prompts) challenge every N prompts |
trigger.roulette_pct | 10 | (roulette) % chance per prompt |
sips_per_challenge | 1 | sips required to clear debt |
anti_cheat | true | look for a bottle/cup near your mouth; a seen vessel or a head-tilt-back counts the sip. false = head-tilt required |
hold_seconds | 1.5 | continuous hold to count a sip |
countdown_seconds | 3 | pre-detection countdown |
Set any key: /water config trigger.mode roulette. Other controls:
- Disable entirely:
/water disable (re-enable with /water enable)
- Hard kill switch (env var, no config needed):
export WATER_GATE_OFF=1
- Skip gating on a single prompt: just start it with
/water, a prefix that is always ungated
- Check status any time:
/water status
- Try the webcam flow without waiting for a real trigger:
/water test
🔒 Privacy
The camera feed never leaves your machine. No frames are saved to disk, no network upload, no telemetry, no analytics, nothing phoning home. MediaPipe inference runs entirely locally. The only network call water-gate ever makes is a one-time model download from Google's public MediaPipe model host, the first time it needs a model it doesn't have yet. Read watergate/challenge.py to check: it's the one file that touches the webcam, and it's short enough to read in five minutes.
Honest limitation
water-gate detects the gesture of drinking, not the liquid. No on-device model can verify there's actually water in your cup: it cannot tell water from coffee, soda, or an empty glass you're pretending with. If you're willing to fake a sip to avoid drinking water, that's between you and your kidneys. This is a hydration nudge, not a courtroom.
Fail-open, guaranteed
No webcam, no uv, a MediaPipe crash, a timeout, a weird OS error: your prompt goes through. The only thing that blocks your prompt is explicitly aborting a sip challenge (pressing ESC or closing the window) while blocking is true. Every other failure mode logs a reason to ~/.water-gate/gate.log and lets you proceed. This will never lock you out of your own editor.
FAQ
Does it store video? No. Frames are processed in memory, frame by frame, and discarded.
Why does a Terminal window pop up? macOS silently hands a backgrounded webcam process black frames, with no permission prompt and no error. Running the challenge in a foreground Terminal is what makes the camera permission (and the picture) actually work.
Can I cheat it? Yes, trivially. It's a nudge, not a lock.