touch-grass
Claude Code plugin and MCP server that nudges you to take outdoor breaks based on local weather, sunset timing, and session streaks. Exposes check_grass_conditions, suggest_activity, log_touch_grass, and get_stats tools — fully local, no API keys, no cloud storage.
README
<div align="center">
🌿 touch-grass
The Claude Code plugin that reminds you to go outside.
Weather-aware · sunset-aware · session-aware · never interrupts your flow.
Install · How it works · Tools · Privacy · Site
</div>
<div align="center"> <img src="./plugin/docs/demo.gif" alt="touch-grass demo — SessionStart hook injects live weather, sunset timing, and streak state; the agent nudges the user outside at a natural pause and logs the activity via the MCP server" width="860" /> </div>
Why this exists
Pomodoro timers interrupt your flow. Calendar blocks get ignored. The best time to step away from your editor is a moving target that depends on the weather, the time of day, your streak, and what you're in the middle of — none of which a dumb interval timer knows.
Your AI coding agent already knows when you hit a natural pause. It finished the feature. It's waiting for you to answer a question. The tests went green. That's the right moment to nudge — not every 25 minutes on the dot.
touch-grass turns your agent into a context-aware break buddy. A SessionStart hook feeds it live weather and sunset timing at the top of every session. A skill teaches it tiger-mom tone (warm, specific, never preachy). An MCP server lets it log when you actually went outside. You keep your flow. It keeps you honest.
What it does
Like a Pomodoro timer, but it knows the weather, your sunset time, and your coding streak — and it talks to your AI agent instead of interrupting you.
- SessionStart hook injects live weather, sunset timing, and streak state into your agent's context every time a Claude Code session starts.
- MCP server exposes four tools your agent (Claude Code, Cursor, Claude Desktop, Codex) can call on demand.
- Skill teaches the agent when to nudge, when to stay quiet, and what tone to use (tiger mom, not preachy).
It's a Claude Code pomodoro replacement for people who'd rather have their coding agent tell them to go outside than have a screen-blocking timer break their flow.
Install
Claude Code (full experience — hook + MCP + skill):
/plugin install nalediym/touch-grass
That's it. Open a new session — the hook fires, the context drops in, your agent takes it from there.
<details> <summary><strong>Other MCP clients</strong> (Cursor, Claude Desktop, Codex) — MCP tools only, no proactive hook</summary>
git clone https://github.com/nalediym/touch-grass
cd touch-grass/plugin/mcp-server && npm install
Then add to your client's MCP config:
{
"mcpServers": {
"touch-grass": {
"command": "node",
"args": ["/absolute/path/to/touch-grass/plugin/mcp-server/index.mjs"]
}
}
}
You get the four MCP tools but lose the SessionStart hook, which is Claude Code specific. Your agent will only bring up grass when you explicitly ask about it.
</details>
How it works
flowchart LR
A[Claude Code<br/>session starts] --> B[SessionStart hook fires]
B --> C[ip-api.com<br/>location]
B --> D[open-meteo.com<br/>weather + sunset]
B --> E[~/.touch-grass/state.json<br/>streak + sessions]
C --> F[Context injection]
D --> F
E --> F
F --> G[Agent<br/>decides when to nudge]
G -.calls.-> H[MCP tools]
H --> E
On session start, a hook script runs. It detects your location from your public IP (cached 24h), fetches current weather and sunset time from open-meteo, reads your local streak file, and synthesises a short context block for the agent. The agent reads it, sits on it, and at a natural pause — feature done, bug fixed, waiting for input — nudges you outside with language that matches the actual conditions.
When you confirm you went outside, the agent calls log_touch_grass via the MCP server, which increments your streak in the local state file.
MCP tools
| Tool | Purpose | Returns |
|---|---|---|
check_grass_conditions |
Weather, temperature, minutes until sunset, and the user's streak state. Decision context. | JSON block with weather, sunset, isNice, minutesToSunset, state |
suggest_activity |
Random activity recommendation, weighted by time of day. Golden hour gets sunset-specific suggestions. | Plain text like "🌅 catch the sunset" |
log_touch_grass |
Records that the user went outside. Updates their streak. Call only when confirmed. | Confirmation with new streak count |
get_stats |
Raw session telemetry and streak history. | JSON block |
All four are callable from any MCP-compatible agent. In Claude Code, the agent mostly uses them via the context the hook injects — you rarely need to call them manually.
Example prompts
The plugin works ambiently, but these phrasings work well if you want to bring it up yourself:
- "Should I touch grass right now?"
- "What's my streak?"
- "Remind me to go outside before sunset."
- "I just went for a walk, log it."
- "Is it nice out?"
Privacy
Everything is local-first.
- Stored on your machine:
~/.touch-grass/state.json(streak, session counts, last touched date) and~/.touch-grass/config.json(cached location, weather threshold). - Leaves your machine: your public IP is sent to
ip-api.comonce every 24 hours to resolve city coordinates, and those coordinates are sent toapi.open-meteo.comon each session start to get weather and sunset. - Never leaves your machine: your streak, your activity notes, your coding schedule, your prompts, anything from your Claude Code session.
No accounts. No API keys. No telemetry. No analytics. No auth. If you want to disable network access entirely, pin "location" manually in ~/.touch-grass/config.json and the IP lookup never fires.
Configuration
<details> <summary>Override defaults in <code>~/.touch-grass/config.json</code></summary>
{
"location": {
"lat": 40.7128,
"lon": -74.0060,
"city": "New York",
"timezone": "America/New_York",
"fetchedAt": 9999999999999
},
"niceWeatherThresholdC": 15,
"breakIntervalHours": 2,
"enabled": true,
"customActivities": [
{ "label": "walk to the corner store", "emoji": "🛒" },
{ "label": "sit on the fire escape", "emoji": "🪜" }
]
}
| Key | Default | Description |
|---|---|---|
location |
auto (ip-api) | Pin to a specific location. Set fetchedAt to a future timestamp to disable auto-refresh. |
niceWeatherThresholdC |
15 |
Temperature (°C) below which weather isn't considered "nice." |
breakIntervalHours |
2 |
After this many hours of continuous coding, nudges get firmer. |
enabled |
true |
Set to false to silence the hook without uninstalling. |
customActivities |
null |
Replace the default activity list with your own. Each entry is { "label": "...", "emoji": "..." } or just a plain string. Supporter perk. |
</details>
Troubleshooting
<details> <summary><strong>I installed the plugin but my agent doesn't mention grass at session start.</strong></summary>
Run the hook by hand to confirm it works:
node plugin/hooks/session-start.mjs
You should see a JSON object with hookSpecificOutput.additionalContext containing the nudge. If additionalContext is an empty string, the hook couldn't reach ip-api.com or open-meteo.com — check your network. If the hook is fine but Claude Code never calls it, the plugin isn't wired up — re-run /plugin install nalediym/touch-grass in a fresh session.
</details>
<details> <summary><strong>How do I know the hook actually fired in my last session?</strong></summary>
Check ~/.touch-grass/state.json. The sessionStart, lastSessionStart, and totalCodingSessions fields update every time the hook runs. If sessionStart is older than your most recent claude invocation, the hook isn't running.
</details>
<details> <summary><strong>ip-api.com is blocked on my network. Can I still use this?</strong></summary>
Yes. Pin your location manually in ~/.touch-grass/config.json:
{
"location": {
"lat": 40.7128,
"lon": -74.0060,
"city": "New York",
"timezone": "America/New_York",
"fetchedAt": 9999999999999
}
}
The high fetchedAt timestamp prevents the 24h cache from expiring, so the IP lookup never fires. Weather will still be fetched from open-meteo.com.
</details>
<details> <summary><strong>How do I disable the nudges without uninstalling?</strong></summary>
Set "enabled": false in ~/.touch-grass/config.json. The hook still writes session telemetry but emits empty context, so the agent stops seeing grass reminders.
</details>
<details> <summary><strong>How do I reset my streak?</strong></summary>
Delete or edit ~/.touch-grass/state.json. The file will be recreated on the next session with defaults.
</details>
<details> <summary><strong>How do I uninstall?</strong></summary>
/plugin uninstall touch-grass
rm -rf ~/.touch-grass
The ~/.touch-grass directory only holds your state and cached location — safe to delete.
</details>
Development
git clone https://github.com/nalediym/touch-grass
cd touch-grass/plugin/mcp-server && npm install
# Test the hook directly (outputs JSON context)
node ../hooks/session-start.mjs
# Test the MCP server with the inspector
npx @modelcontextprotocol/inspector node ./index.mjs
Three moving parts:
plugin/hooks/session-start.mjs— zero-dep Node script. Called by Claude Code on session start. Outputs JSON to stdout.plugin/mcp-server/index.mjs— MCP server. Uses@modelcontextprotocol/sdk. stdio transport.plugin/lib/grass.mjsandplugin/lib/nudge.mjs— shared logic (weather, sunset, state, nudge text).
The hook and the MCP server read from the same state file, so they stay in sync.
Related
- Claude Code plugin docs
- Model Context Protocol
- open-meteo.com — free, keyless weather API
- ip-api.com — free, keyless IP geolocation
License
MIT · Built in the shade.
<div align="center"> <sub>Your screen will be here when you get back. 🌱</sub> </div>
Support
touch-grass is free and MIT-licensed. If it's helped you step away from the screen, consider supporting it:
Support on Polar → — $9 one-time. Your name goes in the supporters list, you get priority issues, and you unlock custom activity lists in config.
Supporters
Be the first. Support on Polar →
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。