DEV Community

David Cain
David Cain

Posted on

Trail Companion: a trail assistant that works where the cloud can't

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

Trail Companion: a trail assistant that works where the cloud can't

This is a submission for the Hacktoberfest 2026 Week 1 Challenge — theme: "Touch Grass".

What I Built

Trail Companion is a command-line assistant that answers foraging-safety, campsite, and Leave No Trace questions — and it runs entirely offline on your laptop. No signal, no problem. I built it for the hiker who is three miles past the last bar of cell service and wondering whether that white mushroom is dinner or a helicopter ride.

Using it feels like texting a knowledgeable trail buddy. You ask a question in plain English — "is this white mushroom safe to eat?", "how do I hang a bear bag?" — and it answers from a bundled trail reference, with Gemma doing the reasoning. Every foraging answer ends with a hard rule: verify with an expert before you eat anything. The tool is opinionated about safety on purpose.

Demo

git clone https://github.com/dcain2336/trail-companion
cd trail-companion
pip install -r requirements.txt
ollama pull gemma3   # one-time, ~2GB
python demo.py
Enter fullscreen mode Exit fullscreen mode

demo.py runs three sample questions end to end — foraging safety, campsite selection, Leave No Trace — and shows which Gemma backend answered each one. No API key needed for the local path.

How It Fits the Theme

"Touch Grass" is about getting outside. Trail Companion is software for the exact moment you leave the grid behind: it assumes you have no connection and plans accordingly. The whole design starts from the trailhead, not the desk — offline-first isn't a feature here, it's the premise.

Why Open Innovation Matters Here

A trail safety tool that phones home to a cloud API is useless exactly when you need it most — no bars, no answers. Open weights flip that: the intelligence lives on the device, in the woods, with you. That's the whole argument for this project, and it's one a closed API model literally cannot make.

Open also means auditable. The safety prompts and the knowledge base are plain files in the repo — anyone can read them, correct them, and improve them. For safety-critical advice like "can I eat this," that transparency isn't a nice-to-have, it's the entire game. You should be able to inspect exactly what your advisor was told before you trust it with your stomach.

And it's forkable by anyone, for free, forever. No subscription, no per-token billing, no account. A scout troop, a search-and-rescue team, a mycology club — they can all take this, extend the knowledge base for their region, and run it on a laptop they already own.

Technical Details

  • Model: Gemma 3 (gemma3 via Ollama, local inference) with a free-tier fallback to gemma-3-27b-it through the Gemini API — same code path, automatic switchover if Ollama isn't running
  • Stack: Python, Ollama, Gemini API; no frameworks, no build step
  • What the open pieces do: Gemma's open weights are load-bearing — local inference is the entire offline story. The knowledge base (knowledge/) is plain markdown: foraging safety rules, poisonous lookalikes, camping basics, Leave No Trace principles. The agent loop (agent.py) injects the relevant reference into the prompt before Gemma answers, and the safety wrapper in trail_companion.py appends the expert-verification rule to every foraging response. Swap the model, extend the knowledge, audit the prompts — it's all files, not black boxes.

Prize Categories

  • Best Use of Gemma

Code

https://github.com/dcain2336/trail-companion

Top comments (0)