TouchGrass, a new project submitted for the Hacktoberfest Open-Source AI Challenge, aims to eliminate scorekeeping arguments by acting as a phone-based referee for outdoor games. Built by developer SHWETANK-SAURABH, the project utilizes an open-weight model to propose game twists, but crucially, it never grants the AI direct control over the game state. The architecture prioritizes safety and determinism, ensuring that while the model can be creative, the rules remain strictly enforced by code.

The Architecture of Controlled Chaos

At the heart of TouchGrass is a strict separation of concerns: the AI proposes, and the engine decides. The system uses Gemma 3 (4B), served locally via Ollama, to generate structured proposals for events like safe zones or bonus challenges. These proposals are not executed immediately; instead, they pass through a rigorous pipeline involving schema validation with Zod, game legality checks, and deterministic safety validation. If the model outputs malformed JSON or suggests an illegal move, the engine simply rejects the event, allowing the game to continue without interruption. The technical stack is robust and practical for a hackathon project, featuring a TypeScript monorepo, Next.js 16 for the website, and a WebSocket server for multiplayer sessions. Data persistence is handled by MongoDB, while the AI agent framework is built on Mastra. The developer has implemented over 2,000 automated tests, including 35 scripted scenarios specifically for evaluating Game Master behavior, ensuring that changes to prompts or safety rules are measurable rather than subjective.

Lessons from Local Inference

The project highlights the tangible benefits of using open-weight models for local development. By running Gemma 3 on their own machine, the developer could inspect inputs and outputs directly, which helped identify and fix a data leak where a game join code was exposed to the model unnecessarily. This level of transparency is often difficult with closed APIs. Furthermore, local inference eliminates per-turn API costs, making experimentation accessible for families and youth groups who might otherwise be deterred by usage-based billing. However, the developer notes that smaller models like Gemma 3 (4B) can be overly cautious, frequently choosing to extend rounds rather than introducing varied twists. This behavior underscores the need for continuous evaluation and prompt tuning. The safety validator, while effective at rejecting known hazards, cannot account for real-world conditions like nearby traffic or park-specific rules, reminding users that the software is a tool, not a replacement for human judgment.

Key Takeaways

  • TouchGrass uses Gemma 3 (4B) via Ollama for local, cost-free AI inference.
  • The architecture enforces a strict 'propose, validate, execute' pipeline to prevent AI hallucinations from breaking game logic.
  • Over 2,000 automated tests ensure that game mechanics remain deterministic and independent of model variability.
  • Currently, Tag and Hide & Seek are playable, while three other games are defined but not yet implemented.

The Bottom Line

TouchGrass is a compelling example of how to integrate LLMs into consumer products without sacrificing reliability. By treating the model as an untrusted source of suggestions rather than the authority, the project offers a blueprint for safe, open-source AI applications.