DEV Community

Cover image for Local Micro-Garden & Frost Date Advisor | Touch Grass Challenge
Athul Jenson
Athul Jenson

Posted on

Local Micro-Garden & Frost Date Advisor | Touch Grass Challenge

Hacktoberfest: Maintainer Spotlight

🌿 Overview: Bringing AI Outdoors ("Touch Grass")

Developers spend countless hours glued to screens and debugging code. For Week 1 of the Hacktoberfest Open-Source AI Challenge under the "Touch Grass" theme, I built the Local Micro-Garden & Frost Date Advisor Agent.

This interactive CLI agent evaluates regional frost limits, identifies cold-hardy crops, and creates an actionable outdoor task list based on how many hours you want to spend outside getting your hands in the soil.


🛠️ Tech Stack & Local Setup

The agent runs 100% locally on a Mac with zero external API dependencies or cloud key limits:

  • Framework: Mastra (@mastra/core) for agent orchestration and tool execution.
  • LLM Engine: Local llama3.1 model running via Ollama with native tool-calling support.
  • Type Safety & Validation: Zod for strict tool input/output schema enforcement.
  • Runtime: Node.js + TypeScript (tsx).

💡 Architecture & Tools

The agent coordinates two Mastra tools to build the garden plan:

  1. getFrostDataTool: Analyzes historical frost dates and recommends cold-weather crops (such as Spinach, Garlic, Kale, and Winter Cabbage).
  2. generatePlanTool: Converts your target outdoor time into a step-by-step checklist covering soil prep, mulching, and frost sheet installation.

🤖 Local Agent Definition (src/agent.ts)

import { Agent } from '@mastra/core/agent';
import { createOpenAI } from '@ai-sdk/openai';
import { getFrostDataTool, generatePlanTool } from './tools.js';

// Connect to local Ollama instance running llama3.1
const ollama = createOpenAI({
  baseURL: '[http://127.0.0.1:11434/v1](http://127.0.0.1:11434/v1)',
  apiKey: 'ollama',
});

export const gardenAgent = new Agent({
  id: 'micro-garden-agent',
  name: 'Micro-Garden Frost Advisor',
  instructions: `
    You are an AI assistant designed for the "Touch Grass" challenge.
    Your goal is to evaluate local frost dates and produce an outdoor weekend gardening plan.
    Encourage hands-on outdoor physical activity and practical soil maintenance.
  `,
  model: ollama('llama3.1'),
  tools: {
    getFrostData: getFrostDataTool,
    generatePlan: generatePlanTool,
  },
});
Enter fullscreen mode Exit fullscreen mode

📸 Demo & Terminal Output
Running the CLI with Bengaluru and 5 outdoor hours:

🌱 --- Micro-Garden & Frost Date Advisor Agent --- 🌱

Enter your City or ZIP code: Bengaluru
How many hours do you want to spend outside gardening this weekend? 5

Consulting outdoor garden advisor...

--- YOUR WEEKEND OUTDOOR PLAN ---
Here is your customized outdoor action plan for Bengaluru:

  1. Soil Prep: Apply a thick mulch layer to protect cold-hardy crops.
  2. Planting Checklist: Plant Spinach, Garlic, and Winter Cabbage.
  3. Frost Covers: Install simple protection sheets over sensitive beds.

Enjoy your 5 hours outdoors in the garden! 🌻
🔗 Repository & Quickstart

GitHub Repository: github.com/2AJ0/touch-grass-micro-garden-agent

How to Run Locally

# 1. Pull the tool-calling model in Ollama
ollama pull llama3.1

# 2. Clone & Install
git clone [https://github.com/2AJ0/touch-grass-micro-garden-agent.git](https://github.com/2AJ0/touch-grass-micro-garden-agent.git)
cd touch-grass-micro-garden-agent
npm install

# 3. Launch CLI Agent
npx tsx index.ts
Enter fullscreen mode Exit fullscreen mode

What winter crops are you planning for your garden this season? Let me know in the comments! 🍃

Top comments (0)