DEV Community

Cover image for Touch Grass AI: Offline Edge Nature Expedition Planner with Gemma 2
ANIL PRADHAN
ANIL PRADHAN

Posted on

Touch Grass AI: Offline Edge Nature Expedition Planner with Gemma 2

Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass Submission 🌿

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass

What I Built

I built Touch Grass AI, an offline-first, edge-ready expedition advisor engineered to disconnect developers, engineers, and digital workers from acute screen fatigue and guide them into nature safely.

Most outdoor tools rely heavily on constant smartphone interactionβ€”tracking screens, GPS navigation apps, and push notificationsβ€”defeating the purpose of disconnecting. Touch Grass AI inverts this relationship:

  • It processes local environment telemetry and user goals to generate a complete, deterministic expedition plan before stepping out.
  • It calculates daylight safety windows and elevation-specific temperature drops locally without hitting cloud servers.
  • It enforces a strict "Screen-Free Protocol" with physical tactile activities (e.g., stowing devices in bags, botanical texture audits) designed to keep the phone screen the shortest part of the expedition.

Demo

The end-to-end edge pipeline runs in a fully reproducible environment with Google Gemma 2 (2B) inference.

Verified Expedition Dispatch Artifact:


json
{
  "objective": "Enjoy a scenic alpine trail hike and botanical exploration, immersing yourself in nature and appreciating the local flora.",
  "preparation_checklist": [
    "Pack a sturdy backpack with snacks, water, and a first-aid kit.",
    "Wear appropriate hiking boots and clothing for varying weather conditions.",
    "Bring a physical field guide for identifying local plants."
  ],
  "safety_advisory": "Stay on marked trails, be aware of your surroundings, and inform someone of your hiking plans. Carry a whistle for emergencies and monitor ambient summit temperatures.",
  "screen_free_action": "Engage in mindful observation of the natural environment without screen usage. Focus on the sounds, sights, and textures around you. Identify native plant species by noting their growth patterns.",
  "mindfulness_anchor": "Take deep breaths and ground yourself in the natural world. Focus on the present moment and eliminate digital distractions."
}


Code
The complete codebase, offline telemetry engine, and Jupyter implementation are open-source and hosted on GitHub:

touch-grass-nature-advisor

🌿 Touch Grass AI: Edge Expedition Planner

Open In Colab License: Apache 2.0 Hacktoberfest 2026 Model: Google Gemma 2

An offline-first, edge-ready outdoor expedition companion engineered to disconnect software professionals from screen fatigue. Built with Google Gemma 2 (2B), deterministic physics-based trail telemetry, and strict Pydantic structured schema validation.


πŸ“Œ Architecture Overview

Traditional lifestyle and outdoor AI applications depend on cloud APIs, which fail on remote alpine trails without cellular reception. Touch Grass AI operates as a hybrid edge pipeline:

  1. Deterministic Telemetry Engine: Computes real-time solar elevation angles and atmospheric lapse rate adjustments locally using pure mathematical heuristics.
  2. Open-Weight Reasoning Core: Evaluates computed risks using Google's open-weight gemma-2-2b-it model running on-device via Hugging Face Transformers.
  3. Structured Verification Gate: Enforces deterministic JSON compliance via Pydantic schemas, eliminating generative hallucination.
[ User Activity & GPS / Altitude ]
                β”‚
                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   OfflineEnvironmentEngine             β”‚
β”‚   β€’ Solar Elevation Approximation      β”‚
β”‚   β€’ Altitude Lapse Rate (-6.5Β°C/1km)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚ Telemetry Vectors
                   β–Ό
…

GitHub Repository URL: https://github.com/Anil-Pradhan-web/touch-grass-nature-advisor

How I Built It
Touch Grass AI is architected around a hybrid neuro-symbolic pipeline combining deterministic physical calculations with Google's open-weight model:

Deterministic Telemetry Engine (OfflineEnvironmentEngine):

Implements offline solar elevation geometry based on latitude and UTC hour angles to determine UV risk and sunset twilight exposure without external weather APIs.

Computes atmospheric lapse rate thermal drops (~6.5Β°C drop per 1,000m elevation gain) to alert users to cold fronts at higher trail altitudes.

Open-Weight Edge Inference Core:

Powered by Google's google/gemma-2-2b-it instruction-tuned model running locally in 16-bit precision (bfloat16) via Hugging Face transformers and accelerate.

The lightweight 2B parameter profile makes it suitable for edge laptops and mobile hardware without requiring cluster-grade infrastructure.

Schema Enforcement (OutdoorPlanSchema):

Utilizes Pydantic to validate raw generative outputs into structured data contracts. If output generation deviates, the agent applies fallback telemetry bounds to guarantee zero runtime failures.

Why Does Open Innovation Matter?
On remote mountain ridges, national parks, and dense forest trails, cellular connectivity is either severely throttled or completely nonexistent. Closed-source, cloud-dependent AI APIs (like OpenAI or Anthropic) fail outright in these environments because they require constant high-bandwidth internet connectivity.

Building on open innovation and open-weight models made this possible by enabling:

Zero-Connectivity Independence: Gemma runs directly on local hardware without sending telemetry data across the wire.

Privacy Preservation: Sensitive GPS coordinates, trail logs, and departure schedules remain strictly on the user's machine.

Zero API Ingress/Egress Costs: Eliminates perpetual token subscription fees, democratizing nature exploration tools for solo hikers and students alike.

Auditable Safety: Open weights ensure maintainers can inspect model behavior and combine neural outputs with deterministic physical sanity checks.

Prize Categories
Best Use of Gemma

Enter fullscreen mode Exit fullscreen mode

Top comments (0)