Track active coding time with Claude Code and nudge yourself to take breaks
Project description
Garlic 🧄 — the AI Vampire 🧛 Warding Tool
Garlic is used to ward off vampires. According to Steve Yegge, AI tools have a vampiric effect on us, draining us of energy and making us tired and exhausted. Not because they are not good at coding, or do not make us much more productive, but simply because we get dopamine for getting stuff done quicker, leading us to work longer and think harder. In short, we need to touch grass. Instead of going hard for 12 hours straight with our coding agent of choice and burning ourselves out to only create value for our employer, we should be mindful of the $/hr formula and consider a new balance. He estimates there are no more than 3-4 hours of good work that we can do in a day with all this uplift without burning our own candles a little too brightly. As someone quite sensitive to the effects of extended dopamine release on the mind and body, I tend to agree with him. So I created garlic, a CLI tool that helps you keep the draining to a minimum and maintain your own energy levels so we can continue to be healthy little worker bees for years to come.
The idea came from this article by Steve Yegge.
How does it work?
garlic hooks into Claude Code using its hooks system. It tracks three events:
- Session start — when you open a new Claude Code session
- Prompt submit — when you send a message to Claude
- Stop — when Claude finishes responding
From these events, garlic estimates how much time you have spent actively coding each day. It works across multiple concurrent Claude Code sessions by sharing a single state file with file locking.
The time model is simple: each time you submit a prompt, garlic looks at the gap since the last event. If the gap is short (under 10 minutes by default), it counts the full gap as active time. If the gap is long (you went for a walk, had lunch, etc.), it assumes you spent about 10 minutes getting back up to speed. This keeps the estimate honest without needing to spy on your screen.
As you approach configurable thresholds (1 hour, 2 hours, etc.), garlic asks Claude to gently nudge you to consider taking a break. You choose how it nudges — gentle, firm, or spicy. Each threshold only fires once, so you won't be nagged on every prompt.
Setup
Install garlic with uv:
uv tool install garlic-cli
Run setup to install the Claude Code hooks:
garlic setup
This does two things:
- Creates
~/.garlic/config.tomlwith sensible defaults - Adds garlic's hooks to
~/.claude/settings.jsonso they run across all your projects
Setup is idempotent — safe to run again if you need to repair or update hooks.
Usage
# See how long you have been Clauding today
garlic status
# Disable nudging for the rest of the day (tracking continues)
garlic ignore
Configuration
Edit ~/.garlic/config.toml to customize:
# Max time (minutes) to attribute to a single gap between events.
# If you step away for an hour, garlic assumes you spent this many
# minutes getting back up to speed rather than counting the full gap.
max_prompt_gap_minutes = 10
# Hour of day (0-23) when the daily timer resets.
reset_hour = 2
# Accumulated minutes at which garlic will nudge you.
# Each threshold fires only once per day.
nudge_thresholds_minutes = [60, 120, 180, 240]
# Nudge personality: "gentle", "firm", or "spicy".
nudge_style = "gentle"
Things I should know?
No prompt injection risk. The nudge messages output by garlic's hooks are hardcoded in the project. There is no mechanism for external input to influence what gets sent to your agent. You can audit every possible message in src/garlic/nudges.py.
No third-party dependencies. Garlic uses only the Python standard library. This is an intentional choice — it runs on every prompt you send, so the supply chain should be as small and auditable as possible.
No data leaves your machine. All state lives in ~/.garlic/ and is never transmitted anywhere.
Built with Claude. This project was built with Claude Code, which is fitting given what it does.
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 garlic_cli-0.1.1.tar.gz.
File metadata
- Download URL: garlic_cli-0.1.1.tar.gz
- Upload date:
- Size: 53.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31f6614c125ceb4ea97aede95aad5ec89817ac18c705612ad2df7194c7bbf4fa
|
|
| MD5 |
3c261818e6d87cc0545ed46257675ee7
|
|
| BLAKE2b-256 |
de1a71b42d31a960344bed6535e7c502065a539ac2233a8ed091f90a56943ef1
|
File details
Details for the file garlic_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: garlic_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84834912bbe8965d501aecf433d3d561fe8efbfe5bb136d172332b2729a67d51
|
|
| MD5 |
07ab7740c567d6bf6c50de501e288445
|
|
| BLAKE2b-256 |
a44f7134e0f809b2e8e9c2b89031f97367eac06d8e3bdedc6623d2761db2ab61
|