<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Akshat</title>
    <description>The latest articles on DEV Community by Akshat (@thecuriouslad).</description>
    <link>https://dev.to/thecuriouslad</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4162067%2F718c568b-2046-4ec5-9ff5-681f53c42b55.png</url>
      <title>DEV Community: Akshat</title>
      <link>https://dev.to/thecuriouslad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thecuriouslad"/>
    <language>en</language>
    <item>
      <title>REVENANT: The Error-Memory Daemon That Haunts Your Code Before You Compile 👻</title>
      <dc:creator>Akshat</dc:creator>
      <pubDate>Sat, 31 Oct 2026 07:36:35 +0000</pubDate>
      <link>https://dev.to/thecuriouslad/revenant-the-error-memory-daemon-that-haunts-your-code-before-you-compile-5h5n</link>
      <guid>https://dev.to/thecuriouslad/revenant-the-error-memory-daemon-that-haunts-your-code-before-you-compile-5h5n</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built 🧠👻
&lt;/h2&gt;

&lt;p&gt;Every competitive programmer and software engineer knows that sickening feeling in their stomach: you spend 40 minutes designing a graph algorithm, submit to the online judge, and immediately get hit with:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;❌ &lt;strong&gt;Wrong Answer on Test 23&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You spend the next hour tearing your hair out, only to discover the culprit: you forgot &lt;code&gt;1LL&lt;/code&gt; during a multiplication, causing a silent 32-bit integer overflow. Or you forgot to call &lt;code&gt;adj[i].clear()&lt;/code&gt; between multiple test cases.&lt;/p&gt;

&lt;p&gt;The most painful part? &lt;strong&gt;You made this exact same mistake two weeks ago. And three weeks before that.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Human programmers don't fail randomly—we fail in our own consistent, idiosyncratic blind spots. Compilers verify types and syntax, but they have zero memory of your personal debugging history.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introducing REVENANT 💀
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;REVENANT&lt;/strong&gt; is an open-source error-memory daemon and CLI built specifically for competitive programmers (tailored for modern C++17). It transforms your machine into a personal memory bank that actively remembers how &lt;strong&gt;you&lt;/strong&gt; fail.&lt;/p&gt;

&lt;p&gt;Instead of running slow cloud LLMs after you get stuck, REVENANT introduces a &lt;strong&gt;Two-Path Architecture&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;⚡ &lt;strong&gt;The Hot Path (&amp;lt; 10ms Pre-Scan):&lt;/strong&gt; Before your compiler (&lt;code&gt;g++&lt;/code&gt;) even runs, REVENANT instantly analyzes your source code against your personal "Graveyard" of past blunders. If it spots a signature pattern of a mistake that has haunted you before, it halts and warns you with spooky evidence before you waste a submission penalty.&lt;/li&gt;
&lt;li&gt;🧊 &lt;strong&gt;The Cold Path (Local Gemma 2 + MongoDB Vector Search):&lt;/strong&gt; If your code fails a local test case (&lt;code&gt;WA&lt;/code&gt;, &lt;code&gt;TLE&lt;/code&gt;, &lt;code&gt;RTE&lt;/code&gt;), REVENANT automatically spins up &lt;strong&gt;Google's Gemma 2 (2B)&lt;/strong&gt; offline via Ollama to perform a post-mortem, vectorizes the failure using &lt;code&gt;nomic-embed-text&lt;/code&gt; (768-dim embeddings), and indexes it in &lt;strong&gt;MongoDB Atlas Vector Search&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;⏳ &lt;strong&gt;Weakness Half-Life Decay:&lt;/strong&gt; Sins you haven't committed in weeks gradually fade away into dormancy (half-life = 14 days), while recurrent blunders escalate into high-alert &lt;em&gt;"Poltergeists"&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Demo 🎬
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7zl80ekbwz50mhoinsu5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7zl80ekbwz50mhoinsu5.png" alt="REVENANT CLI Pre-Scan Warning and Gemma 2 Diagnosis" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;👻 &lt;strong&gt;Pre-Compilation Haunting:&lt;/strong&gt; REVENANT detects a 32-bit integer overflow before compilation, executes local test cases, and invokes local Gemma 2 for an automated root-cause diagnosis.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9tenxh351bkdam51pt7d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9tenxh351bkdam51pt7d.png" alt="REVENANT Graveyard Sin Roster" width="800" height="693"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📜 &lt;strong&gt;The Graveyard:&lt;/strong&gt; Active catalog of developer blind spots, showing occurrence counts, severity tiers, and exponentially decaying weakness scores.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmrv8da1zb2t1yoe8ll9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmrv8da1zb2t1yoe8ll9v.png" alt="REVENANT Cloud Web Dashboard" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🌐 &lt;strong&gt;Cloud Graveyard Dashboard:&lt;/strong&gt; Live web interface hosted on Render displaying real-time developer failure analytics and MongoDB Atlas sync status.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Quick Terminal Tour
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Run local test cases with pre-compilation haunting&lt;/span&gt;
ghost run solution.cpp

&lt;span class="c"&gt;# 2. Inspect your active Graveyard and current weakness scores&lt;/span&gt;
ghost graveyard

&lt;span class="c"&gt;# 3. Commune with uncategorized failures: Gemma 2 synthesizes new Sin categories&lt;/span&gt;
ghost seance

&lt;span class="c"&gt;# 4. Run the 100-run backtesting benchmark across historical test splits&lt;/span&gt;
ghost backtest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;🌐 &lt;strong&gt;Live Cloud Dashboard:&lt;/strong&gt; &lt;a href="https://revenant-wp4s.onrender.com/" rel="noopener noreferrer"&gt;https://revenant-wp4s.onrender.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;🔌 &lt;strong&gt;Live API Stream:&lt;/strong&gt; &lt;a href="https://revenant-wp4s.onrender.com/api/ghosts" rel="noopener noreferrer"&gt;https://revenant-wp4s.onrender.com/api/ghosts&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;🩺 &lt;strong&gt;Health Check:&lt;/strong&gt; &lt;a href="https://revenant-wp4s.onrender.com/health" rel="noopener noreferrer"&gt;https://revenant-wp4s.onrender.com/health&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Code 💻
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/the-curious-lad" rel="noopener noreferrer"&gt;
        the-curious-lad
      &lt;/a&gt; / &lt;a href="https://github.com/the-curious-lad/revenant" rel="noopener noreferrer"&gt;
        revenant
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;👻 REVENANT: "Ghost in the Machine" Error-Memory Developer Tool&lt;/h1&gt;
&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Every mistake you make leaves a ghost behind. Ghosts linger, gain strength when repeated, fade when conquered, and haunt you before you run doomed code."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Built for &lt;strong&gt;DEV Open-Source AI Challenge: Week 4 (Theme: Ghost in the Machine)&lt;/strong&gt; &amp;amp; Hacktoberfest 2026.&lt;/p&gt;




&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🔮 What is REVENANT?&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;Developers don't fail randomly—we fail &lt;strong&gt;systematically&lt;/strong&gt; according to personal blind spots (32-bit integer overflows, unreset global vectors in test loops, 0-vs-1 indexing, negative modulo operations).&lt;/p&gt;

&lt;p&gt;Linters are too generic, and running an LLM on every save or run is far too slow. &lt;strong&gt;REVENANT&lt;/strong&gt; is a personalized error-memory tool that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Remembers how you personally fail&lt;/strong&gt; by persisting failure snapshots into &lt;strong&gt;MongoDB Atlas&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Warns you before you run doomed code&lt;/strong&gt; via a &lt;strong&gt;&amp;lt;10ms Hot-Path Scanner&lt;/strong&gt; (Zero AI latency on the hot path).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diagnoses failures using local Gemma via Ollama&lt;/strong&gt; into strict JSON when tests fail.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summons Séances&lt;/strong&gt;…&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/the-curious-lad/revenant" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The complete codebase is 100% open-source under the MIT license:&lt;br&gt;
🔗 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/the-curious-lad/revenant" rel="noopener noreferrer"&gt;https://github.com/the-curious-lad/revenant&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Core Components
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;bin/ghost.js&lt;/code&gt; — Global CLI entry point (&lt;code&gt;ghost run&lt;/code&gt;, &lt;code&gt;ghost graveyard&lt;/code&gt;, &lt;code&gt;ghost seance&lt;/code&gt;, &lt;code&gt;ghost backtest&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/scanner/detectors.js&lt;/code&gt; — 16 canonical competitive programming sins with ReDoS-safe AST-like patterns and zero false alarms on passing code.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/ai/ollama.js&lt;/code&gt; &amp;amp; &lt;code&gt;src/ai/diagnostician.js&lt;/code&gt; — Local Google Gemma 2 diagnostic engine with strict JSON schema validation.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/db/mongo.js&lt;/code&gt; — Official MongoDB Atlas client with native &lt;code&gt;$vectorSearch&lt;/code&gt; and offline JSON fallback.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/eval/backtest.js&lt;/code&gt; — 100-run controlled benchmark evaluation engine.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src/server.js&lt;/code&gt; — Express web server and REST API for cloud dashboard deployment on Render.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  How I Built It 🛠️
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Offline AI: Local Google Gemma 2 via Ollama
&lt;/h3&gt;

&lt;p&gt;Developers writing code under contest conditions or traveling often have zero internet access. We engineered REVENANT around &lt;strong&gt;Google's Gemma 2 (2B)&lt;/strong&gt; running locally via Ollama:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero API Latency:&lt;/strong&gt; Local inference ensures no waiting for cloud API queues during tight practice sessions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict Schema Enforcement:&lt;/strong&gt; When tests fail, REVENANT feeds compiler output and failed test diffs into Gemma 2 to produce clean, structured root-cause analyses and exact C++ diff recommendations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local Embeddings:&lt;/strong&gt; We use &lt;code&gt;nomic-embed-text&lt;/code&gt; locally to transform code contexts into 768-dimensional vectors without transmitting private code over the wire.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  2. Semantic Memory: MongoDB Atlas Vector Search
&lt;/h3&gt;

&lt;p&gt;When an unclassified or novel error occurs, REVENANT pushes the failure context and its 768-dim vector to MongoDB Atlas. Using Atlas's native &lt;code&gt;$vectorSearch&lt;/code&gt; pipeline with cosine similarity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;REVENANT identifies whether an uncategorized bug is semantically identical to a past failure (similarity ≥ 0.82).&lt;/li&gt;
&lt;li&gt;During &lt;code&gt;ghost seance&lt;/code&gt;, REVENANT clusters recurring uncategorized bugs and prompts Gemma 2 to invent and name entirely new Sin categories (e.g., &lt;em&gt;"Modulo Subtraction Underflow"&lt;/em&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  3. Weakness Decay: The Ghost Half-Life Formula
&lt;/h3&gt;

&lt;p&gt;A tool that nags you forever about a bug you fixed 6 months ago is annoying. REVENANT models memory using an exponential half-life decay formula:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Weakness(t) = Weakness₀ × (0.5)^(Δt / 14) + 1&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Every repeat mistake adds &lt;strong&gt;+1.0&lt;/strong&gt; weakness.&lt;/li&gt;
&lt;li&gt;Every 14 days of clean coding cuts weakness by &lt;strong&gt;50%&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Weakness below &lt;strong&gt;0.2&lt;/strong&gt; enters &lt;strong&gt;Dormancy&lt;/strong&gt;; weakness above &lt;strong&gt;3.0&lt;/strong&gt; triggers &lt;strong&gt;Poltergeist&lt;/strong&gt; priority in your terminal.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  4. Zero False-Alarm Gate
&lt;/h3&gt;

&lt;p&gt;To ensure REVENANT never slows down a programmer whose code is correct, we implemented a False-Alarm Verification Gate in &lt;code&gt;src/scanner/validator.js&lt;/code&gt;. When testing against reference solutions from the famous Codeforces &lt;strong&gt;CP-31 Sheet&lt;/strong&gt; (e.g., &lt;em&gt;Helmets in Night&lt;/em&gt;, &lt;em&gt;Connected Components&lt;/em&gt;), passing code triggers &lt;strong&gt;0 false positives&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  5. Cloud Graveyard on Render
&lt;/h3&gt;

&lt;p&gt;While the CLI runs locally on your workstation to access &lt;code&gt;g++&lt;/code&gt; and local test files, REVENANT deploys a web service on &lt;strong&gt;Render&lt;/strong&gt; via &lt;code&gt;render.yaml&lt;/code&gt;. The Render service connects to MongoDB Atlas to render a real-time leaderboard of haunting sins and provides a public REST API for judges to inspect.&lt;/p&gt;


&lt;h2&gt;
  
  
  Benchmark &amp;amp; Empirical Verification 📊
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fen8hzp5vxuwpj4rb6j8g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fen8hzp5vxuwpj4rb6j8g.png" alt="REVENANT 100-Run Backtest Benchmark Evaluation" width="800" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🔬 &lt;strong&gt;Empirical Validation:&lt;/strong&gt; Automated 100-run backtest benchmark simulating 70 historical training mistakes and 30 unseen evaluation problems from the Codeforces CP-31 sheet.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Score&lt;/th&gt;
&lt;th&gt;Significance&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Precision&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;100.0%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Every single pre-scan warning pointed to a genuine flaw.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Recall&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;81.3%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Caught 13 out of 16 actual failure bugs before compilation.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;False Alarm Rate&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.0%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Passed 100% of verified clean solutions without interruption.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Overall Accuracy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;90.0%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Across 30 unseen test evaluation runs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pre-Scan Overhead&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&amp;lt; 10ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Imperceptible delay before compilation.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Note on Language Extensibility: While REVENANT is currently optimized for competitive programming in modern C++17, its two-path scanning architecture can readily be extended to Python, Rust, and Go.&lt;/em&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Why Does Open Innovation Matter? 🌐
&lt;/h2&gt;

&lt;p&gt;Why build this with open-source AI rather than a commercial cloud API?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Protecting Contest Honor &amp;amp; Code Privacy:&lt;/strong&gt; Competitive programming contests (ICPC, Codeforces, LeetCode) have strict honor codes against external API assistance. Sending source code to proprietary cloud servers risks violating contest rules or leaking solutions. Open weights running locally guarantee complete code privacy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preserving Developer Flow State:&lt;/strong&gt; Waiting 3 to 5 seconds for a commercial API on every compilation completely breaks developer focus. By pairing an instantaneous deterministic regex pre-scan (&amp;lt;10ms) with local Gemma 2 cold-path post-mortems, REVENANT never blocks your rhythm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;True Reproducibility:&lt;/strong&gt; Closed APIs change under the hood without notice. With open-weight models like Gemma 2:2b, your development tools behave predictably and remain reproducible forever.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Spirit of It 🕯️
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Ghost in the Machine&lt;/em&gt; asks: what lingers inside our hardware when the monitors turn off?&lt;/p&gt;

&lt;p&gt;When we spend hours debugging algorithms, our machines absorb our fatigue, our subconscious biases, and our recurring blind spots. The ghost haunting your terminal isn't some hostile AI entity—&lt;strong&gt;the ghost is you.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is the ghost of you at 3:00 AM submitting &lt;code&gt;int&lt;/code&gt; instead of &lt;code&gt;long long&lt;/code&gt;. It is the phantom of contest rating lost to a missing graph clear.&lt;/p&gt;

&lt;p&gt;REVENANT captures those ghosts, catalogues them, and turns them into a watchful guardian that protects you from repeating your past mistakes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prize Categories 🏆
&lt;/h2&gt;

&lt;p&gt;We are entering REVENANT into the following tracks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Overall Challenge Winner / Ghost in the Machine Track:&lt;/strong&gt; Directly embodies the theme by turning developer debugging trauma into an active, protective memory daemon.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google / Gemma Partner Track:&lt;/strong&gt; Powered by local &lt;strong&gt;Gemma 2 (2B)&lt;/strong&gt; via Ollama for offline test-failure diagnoses, structured diff recommendations, and Sin category synthesis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MongoDB Atlas Partner Track:&lt;/strong&gt; Leverages native &lt;strong&gt;MongoDB Atlas Vector Search&lt;/strong&gt; (&lt;code&gt;$vectorSearch&lt;/code&gt;, 768-dim embeddings, cosine similarity) for semantic error deduplication and automated clustering.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Render Partner Track:&lt;/strong&gt; Cloud Graveyard Web Service and public REST API deployed automatically via &lt;code&gt;render.yaml&lt;/code&gt; on &lt;strong&gt;Render&lt;/strong&gt; at &lt;a href="https://revenant-wp4s.onrender.com/" rel="noopener noreferrer"&gt;https://revenant-wp4s.onrender.com/&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Acknowledgements &amp;amp; Tech Stack
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google DeepMind&lt;/strong&gt; for the Gemma 2 open-weight models&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MongoDB Atlas&lt;/strong&gt; for managed cloud Vector Search&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Render&lt;/strong&gt; for cloud hosting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ollama&lt;/strong&gt; for local open-weight inference&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TLE Eliminators (CP-31 Sheet)&lt;/strong&gt; for real-world competitive programming test problems&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Huge thanks to DEV, Hacktoberfest, Google Gemma, MongoDB Atlas, and Render for this incredible challenge! Now I'm going to run a quick exorcism on my terminal and pray my 3:00 AM bugs don't come back to haunt me. Happy Hacktoberfest and Happy Halloween! 🎃👻🕯️&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>AI Gardener: Spend 30 Seconds Here. Spend the Rest Outside.</title>
      <dc:creator>Akshat</dc:creator>
      <pubDate>Thu, 08 Oct 2026 07:05:36 +0000</pubDate>
      <link>https://dev.to/thecuriouslad/ai-gardener-spend-30-seconds-here-spend-the-rest-outside-2m9j</link>
      <guid>https://dev.to/thecuriouslad/ai-gardener-spend-30-seconds-here-spend-the-rest-outside-2m9j</guid>
      <description>&lt;p&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week1-2026-10-05"&gt;Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;AI Gardener — Spend 30 seconds here. Spend the rest outside.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most gardening apps and AI chatbots do the exact opposite of touching grass: they keep you glued to your screen reading long encyclopedias, tweaking complex trackers, or scrolling through walls of generic AI text. I built &lt;strong&gt;AI Gardener&lt;/strong&gt; around a single rule: &lt;strong&gt;spend 30 seconds on the screen to see today's exact physical action, then close the app and go outside into your garden.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI Gardener is an open-source, multimodal gardening companion powered by local open-weight models (&lt;code&gt;gemma3:4b&lt;/code&gt; for structured reasoning and vision, and &lt;code&gt;nomic-embed-text&lt;/code&gt; for 768-dimensional semantic embeddings via Ollama), grounded with MongoDB Atlas Vector Search, and deployed live on Render.&lt;/p&gt;

&lt;p&gt;Instead of giving generic textbook advice, AI Gardener acts like a local agronomist that remembers your garden across days and weeks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Go Outside — Today's Next Actions Card:&lt;/strong&gt; At the very top of the dashboard, a dedicated action card surfaces the single next physical task for each of your active gardens (up to 3 concurrent gardens per user). You check what to do today in 30 seconds, walk outside, do the work in the soil, and mark it Done.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sequential Multi-Day Lifecycle Progression:&lt;/strong&gt; Tasks are completed in real-world chronological order (&lt;code&gt;Day 1&lt;/code&gt;, &lt;code&gt;Day 2&lt;/code&gt;, &lt;code&gt;Day 3&lt;/code&gt;...). Once you finish your current batch of 5 tasks, a &lt;code&gt;Done — Generate Next Plan&lt;/code&gt; button unlocks, advancing your garden from &lt;code&gt;Day 1–5&lt;/code&gt; to &lt;code&gt;Day 6–10&lt;/code&gt; and transitioning your garden phase from &lt;code&gt;PLANTING&lt;/code&gt; to &lt;code&gt;GROWING&lt;/code&gt; and &lt;code&gt;MAINTENANCE&lt;/code&gt; without ever repeating completed tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hyper-Local Climate and Crop Grounding:&lt;/strong&gt; Growing tomatoes in Gorakhpur during winter fog (Rabi season) requires completely different care than growing hibiscus in Shimla or okra in Pune during the monsoon. I grounded the system in 2,174 curated plant health records across 76 crops and 70 agro-climatic records sourced from ICAR-CRIDA district contingency plans and meteorological authorities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multimodal Leaf Photo Diagnosis:&lt;/strong&gt; When you are outside in your garden and notice yellow halos, leaf curl, or brown spots on a leaf, you snap a photo and upload it. Gemma 3's vision capability inspects the leaf, cross-checks our plant pathology and local climate vectors (such as morning fog increasing fungal blight risk), and automatically updates your daily task schedule with targeted recovery actions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Who is it for?&lt;/strong&gt;&lt;br&gt;
Home gardeners, balcony and terrace growers, and beginners who want hyper-local, step-by-step physical tasks tailored to their exact city, square footage or pot count, daily sunlight hours, and season.&lt;/p&gt;
&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Deployed Application (Render):&lt;/strong&gt; &lt;a href="https://ai-gardener.onrender.com" rel="noopener noreferrer"&gt;https://ai-gardener.onrender.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Screenshots / Demo Video:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbykipdcltkgc9o04h8wt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbykipdcltkgc9o04h8wt.png" alt="AI Gardener login and sign-up screen on Render" width="800" height="423"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs95uinxdcuh32zk96b4r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs95uinxdcuh32zk96b4r.png" alt="AI Gardener sunlight guardrail rejecting 100 hours of daily sunlight while preserving chickpea context" width="799" height="382"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F40y8yodv2fj3uu6hcboe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F40y8yodv2fj3uu6hcboe.png" alt="AI Gardener multi-garden dashboard showing Today's Next Actions card for Gorakhpur Tomato and Shimla Hibiscus gardens" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/the-curious-lad" rel="noopener noreferrer"&gt;
        the-curious-lad
      &lt;/a&gt; / &lt;a href="https://github.com/the-curious-lad/ai-gardener" rel="noopener noreferrer"&gt;
        ai-gardener
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;🌱 AI Gardener — &lt;em&gt;Touch Grass&lt;/em&gt;
&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Hacktoberfest 2026 · Week 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;An open-source AI gardening assistant that gets you off the screen and into the soil.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://nodejs.org" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/fcc1fb293ab5f072fff22c59991434c614c5d72489cb0779c5f00674016befc0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4e6f64652e6a732d32302b2d3333393933333f6c6f676f3d6e6f64652e6a73266c6f676f436f6c6f723d7768697465" alt="Node.js"&gt;&lt;/a&gt;
&lt;a href="https://www.mongodb.com/atlas" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/6dca90d96b485da0fc5f001af42f3922a35f4ac5be6176799e068b8450f63ff9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6f6e676f44422d41746c61732d3437413234383f6c6f676f3d6d6f6e676f6462266c6f676f436f6c6f723d7768697465" alt="MongoDB Atlas"&gt;&lt;/a&gt;
&lt;a href="https://ai.google.dev/gemma" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/012f13cc98eef64627198dfe8af62e0d8118e0e83b7e8d1d011c5fea4ea91144/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f47656d6d612d3325323034422d3432383546343f6c6f676f3d676f6f676c65266c6f676f436f6c6f723d7768697465" alt="Gemma 3"&gt;&lt;/a&gt;
&lt;a href="https://ollama.com" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/987532c4a707fd19a018e523cc3f9f8935c7723226c1f2cc4aaf076b59a450cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f776572656425323062792d4f6c6c616d612d626c61636b3f6c6f676f3d6f6c6c616d61" alt="Ollama"&gt;&lt;/a&gt;
&lt;a href="https://render.com" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/333edf9357e9d4e9574f1b3ae619689f0892f4ccc332f49b4c59864f76b37700/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4465706c6f792d52656e6465722d3436453342373f6c6f676f3d72656e646572266c6f676f436f6c6f723d7768697465" alt="Render"&gt;&lt;/a&gt;
&lt;a href="https://github.com/the-curious-lad/ai-gardener/LICENSE" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667" alt="License: MIT"&gt;&lt;/a&gt;
&lt;a href="https://hacktoberfest.com" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/9a81c3d5347047eb7e9eb086eabe713af7156194e2ac6f3cbdcf6084ae3e210a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4861636b746f626572666573742d323032362d464636413030" alt="Hacktoberfest"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;✨ The Idea&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Most AI tools keep you glued to a screen.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;AI Gardener flips that.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You spend 30 seconds telling it about your garden. It gives you one clear task for today. You go outside, do it, come back, and optionally snap a photo of your plant. The AI analyzes the photo, checks its knowledge base for diseases or care tips, and gives you tomorrow's task.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The screen is the shortest part of the experience.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🎯 Prize Categories&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;How We Qualify&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🏆 &lt;strong&gt;Overall (Touch Grass)&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Spend 30 seconds on the screen, spend the rest outside — built on open-weight &lt;code&gt;gemma3:4b&lt;/code&gt; and &lt;code&gt;nomic-embed-text&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🍃 &lt;strong&gt;MongoDB Atlas&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;4 collections (&lt;code&gt;garden_sessions&lt;/code&gt;, &lt;code&gt;users&lt;/code&gt;, &lt;code&gt;plant_health_knowledge&lt;/code&gt; with 2,174 records, &lt;code&gt;climate_location_knowledge&lt;/code&gt; with 70 records) + 768-dim&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;…&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/the-curious-lad/ai-gardener" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/the-curious-lad/ai-gardener" rel="noopener noreferrer"&gt;https://github.com/the-curious-lad/ai-gardener&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;I built AI Gardener around a modular, provider-agnostic open-source AI architecture running &lt;code&gt;gemma3:4b&lt;/code&gt; and &lt;code&gt;nomic-embed-text&lt;/code&gt; locally on Ollama, backed by MongoDB Atlas for stateful session persistence and 768-dimensional vector retrieval, and hosted on Render.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Four-Stage Agentic Pipeline
&lt;/h3&gt;

&lt;p&gt;Every user message or photo upload flows through four specialized stages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stage 1 — Intent-Aware Query Rewriter and Router (&lt;code&gt;queryRewriter.js&lt;/code&gt;):&lt;/strong&gt; Combines &lt;code&gt;gemma3:4b&lt;/code&gt; structured JSON extraction (validated with Zod schemas) with a deterministic regex signal extractor so explicit user inputs (cities, Indian states, sq ft/pots, sunlight hours, seasons, and plant names) are never dropped or re-asked. Initial garden planning requires all 5 essential context fields (plant, city/state, growing area, daily sunlight hours, and season), while general botany questions or photo observations bypass unnecessary context checks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 2 — Dual-Collection Hybrid Vector Retrieval (&lt;code&gt;knowledgeVectorSearch.js&lt;/code&gt; and &lt;code&gt;climateVectorSearch.js&lt;/code&gt;):&lt;/strong&gt; Converts the normalized query into a 768-dimensional vector using &lt;code&gt;nomic-embed-text&lt;/code&gt; and queries two MongoDB Atlas collections in parallel: &lt;code&gt;plant_health_knowledge&lt;/code&gt; (2,174 records across 76 crops) and &lt;code&gt;climate_location_knowledge&lt;/code&gt; (70 district and agro-climatic zone records). For regional climate, it resolves a 4-tier geographic hierarchy: Exact Location Mapping -&amp;gt; Regional Climate -&amp;gt; Seasonal Context -&amp;gt; Country/Zone Fallback.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 3 — Multimodal Photo Reader (&lt;code&gt;photoReader.js&lt;/code&gt;):&lt;/strong&gt; Uses &lt;code&gt;gemma3:4b&lt;/code&gt; vision to extract structured symptoms (&lt;code&gt;visibleSymptoms&lt;/code&gt;, &lt;code&gt;leafCondition&lt;/code&gt;, &lt;code&gt;possiblePestSigns&lt;/code&gt;, &lt;code&gt;possibleDiseaseSigns&lt;/code&gt;, &lt;code&gt;severity&lt;/code&gt;, and &lt;code&gt;confidence&lt;/code&gt;) from uploaded leaf photos, feeding those visual findings directly into the vector search and planner.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 4 — Phase-Aware Planner (&lt;code&gt;plannerService.js&lt;/code&gt;):&lt;/strong&gt; Synthesizes user context, retrieved agronomic records, climate constraints, and completed task history to generate sequential daily tasks (&lt;code&gt;Day 1&lt;/code&gt; to &lt;code&gt;Day 5&lt;/code&gt;, then &lt;code&gt;Day 6&lt;/code&gt; to &lt;code&gt;Day 10&lt;/code&gt;, etc.) and manage lifecycle transitions (&lt;code&gt;PLANTING&lt;/code&gt; -&amp;gt; &lt;code&gt;GROWING&lt;/code&gt; -&amp;gt; &lt;code&gt;MAINTENANCE&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Multi-Layer Domain and Input Guardrails
&lt;/h3&gt;

&lt;p&gt;Small 4B parameter models can easily get derailed if a user enters impossible physical numbers, fictional places, or prompt injections. I built 5 deterministic guardrail layers around the Query Rewriter and Planner:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Guardrail 1 — Off-Topic, Length, and Prompt-Injection Fast-Path (0 LLM Calls):&lt;/strong&gt; Non-gardening queries (coding, sports, finance, cooking recipes), messages exceeding the 600-character limit, and prompt-injection attempts (such as "ignore previous instructions" or "reveal system prompt") are intercepted and refused in under 1 millisecond with zero LLM calls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guardrail 2 — Physical Sunlight Bounds Validation (1 to 16 Hours):&lt;/strong&gt; If someone enters an impossible value like 100 hours of daily sunlight or 0 hours, the guardrail rejects the invalid number while preserving the rest of their valid context, reminding them that a day only has 24 hours and asking for a realistic 1 to 16 hour daily sunlight figure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guardrail 3 — Knowledge-Base Location Verification:&lt;/strong&gt; If a user enters an unrecognized or fictional place (like "Atlantis") that is not in our climate knowledge base, the system strips the invalid location and transparently asks the user for a supported city or Indian state instead of hallucinating climate data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guardrail 4 — Supported Plant Verification:&lt;/strong&gt; Every requested plant is checked against our 76 verified CSV crops and supported Indian garden/ornamental plants. If someone asks to grow a non-plant item or unsupported species, the guardrail catches it immediately and suggests supported vegetables, herbs, fruits, and flowers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guardrail 5 — Agronomic Low-Sunlight Mismatch Warnings:&lt;/strong&gt; When a user plans a sun-loving crop (such as tomato, sunflower, chilli, hibiscus, or rose) with less than 4 hours of daily sunlight, the Planner automatically prepends a Sunlight Heads-Up warning advising them to place movable containers in their brightest south- or west-facing spot.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Bounded Context Summarizer for Small Local Models
&lt;/h3&gt;

&lt;p&gt;Feeding an ever-growing chat history into a local 4B model quickly degrades instruction following and increases latency. I built a deterministic Context Summarizer (&lt;code&gt;contextSummarizer.js&lt;/code&gt;) that maintains a compact 7-line structured memory summary (&lt;code&gt;contextSummary&lt;/code&gt;) inside MongoDB while preserving the full raw &lt;code&gt;conversationHistory&lt;/code&gt; in the database. Every AI prompt receives only the compact summary plus the last 4 messages, keeping token counts flat and inference fast even after dozens of turns.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Engineering for Latency, Streaming Resilience, and a 371 MB -&amp;gt; 114 MB Memory Optimization
&lt;/h3&gt;

&lt;p&gt;Running an AI + Vector Search backend on Render's 512 MB RAM tier alongside a tunneled local Ollama instance surfaced real production challenges that I solved during development:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cutting Memory Usage from 371 MB to 114 MB (69% Reduction):&lt;/strong&gt; Initially, Render was crashing with HTTP 502 Out-Of-Memory errors. Profiling heap memory revealed that parsing our 9.2 MB &lt;code&gt;plant_health_knowledge.csv&lt;/code&gt; fallback file character-by-character (&lt;code&gt;currentField += ch&lt;/code&gt;) created millions of V8 &lt;code&gt;ConsString&lt;/code&gt; sliced string references, ballooning heap + RSS memory to 371 MB. I rewrote &lt;code&gt;parseCSV&lt;/code&gt; in &lt;code&gt;src/utils/csvParser.js&lt;/code&gt; using zero-copy index slicing (&lt;code&gt;content.slice(fieldStart, i)&lt;/code&gt;) and flat UTF-8 buffer allocation, dropping CSV memory footprint from 371 MB down to 114 MB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Progressive Filter Relaxation in Vector Search:&lt;/strong&gt; Instead of loading all 2,174 documents into Node.js memory when a strict metadata filter returned 0 hits, I implemented progressive filter relaxation directly in MongoDB (&lt;code&gt;plant + knowledgeTypes&lt;/code&gt; -&amp;gt; &lt;code&gt;plant only&lt;/code&gt; -&amp;gt; bounded 200-document slice), keeping steady-state vector search RAM at just 63 MB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Streaming NDJSON + Truncated JSON Auto-Repair:&lt;/strong&gt; When &lt;code&gt;gemma3:4b&lt;/code&gt; generated long 5-day plans over a tunnel, waiting for a single non-streamed HTTP response caused proxy idle timeouts. I switched &lt;code&gt;OllamaProvider&lt;/code&gt; to stream NDJSON tokens continuously (&lt;code&gt;stream: true&lt;/code&gt;), added automatic brace/quote stack balancing (&lt;code&gt;repairJsonCandidate&lt;/code&gt;) to recover truncated JSON outputs, and added a 24/7 hybrid deterministic fallback so the live Render app stays 100% functional even when my local laptop GPU is offline.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;Building AI Gardener on open-weight models (&lt;code&gt;gemma3:4b&lt;/code&gt; and &lt;code&gt;nomic-embed-text&lt;/code&gt;) via Ollama proved four major advantages over closed proprietary APIs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;True Multimodal Privacy for Home Photos:&lt;/strong&gt; When users take photos of their backyard, balcony, or living space to diagnose a plant leaf, those images are processed on open weights under my control rather than being uploaded to a commercial third-party training pipeline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Per-Token Cost for Multi-Step Agent Loops:&lt;/strong&gt; Each garden plan or photo diagnosis runs multiple structured steps (Query Rewriter -&amp;gt; 768-dim Embedding -&amp;gt; Dual Vector Retrieval -&amp;gt; Multimodal Vision -&amp;gt; Phase Planner). With open weights running locally on Ollama, iterating across hundreds of test turns and multi-day replans cost $0.00 in API fees.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic Control Over Small Models:&lt;/strong&gt; Because I could inspect every raw token stream from &lt;code&gt;gemma3:4b&lt;/code&gt;, I was able to build custom JSON stream repair, bounded 7-line context summarization, and domain guardrails that make a compact 4B open model perform reliably on consumer hardware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid Edge + Cloud Resilience:&lt;/strong&gt; By combining a cloud web host (Render) and cloud vector database (MongoDB Atlas) with a tunneled local Ollama inference engine and deterministic agronomy fallbacks, the project demonstrates how solo developers can ship zero-cost, open-weight AI web apps to production.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Full Agent Session Log (GitHub):&lt;/strong&gt; &lt;a href="https://github.com/the-curious-lad/ai-gardener/blob/main/AGENT_SESSION.md" rel="noopener noreferrer"&gt;https://github.com/the-curious-lad/ai-gardener/blob/main/AGENT_SESSION.md&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;During my agentic pair-programming session in Google Antigravity, AI Gardener evolved from a basic single-session chat prototype into a hardened, production-grade multi-garden platform. Here is a summary of what our initial prototype looked like and the key engineering changes we made together:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;From Single Chat Prototype to Multi-Garden Lifecycle Management:&lt;/strong&gt;
We started with a single-session chat prototype, then redesigned the architecture to support lightweight user accounts, up to 3 concurrent gardens per user, a unified "GO OUTSIDE — TODAY'S NEXT ACTIONS" card across all active gardens, and strict sequential task completion (&lt;code&gt;Day 1–5&lt;/code&gt; -&amp;gt; &lt;code&gt;Done — Generate Next Plan&lt;/code&gt; -&amp;gt; &lt;code&gt;Day 6–10&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solving the Day 6+ Replan &amp;amp; Phase Regression Bug:&lt;/strong&gt;
When testing multi-week progression, we noticed &lt;code&gt;gemma3:4b&lt;/code&gt; sometimes repeated &lt;code&gt;Day 6&lt;/code&gt; labels or reset the phase back to &lt;code&gt;PLANTING&lt;/code&gt; on Day 6. We re-engineered the Planner prompt and deterministic post-processor to filter out completed task titles, enforce monotonic day numbering (&lt;code&gt;startDay + idx&lt;/code&gt;), and advance phases cleanly from &lt;code&gt;PLANTING&lt;/code&gt; -&amp;gt; &lt;code&gt;GROWING&lt;/code&gt; -&amp;gt; &lt;code&gt;MAINTENANCE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Debugging Render's 512 MB OOM Crash (371 MB -&amp;gt; 114 MB):&lt;/strong&gt;
When deploying to Render, the server hit HTTP 502 Out-Of-Memory restarts. We profiled Node.js &lt;code&gt;process.memoryUsage()&lt;/code&gt; step-by-step, discovered that character-by-character CSV parsing on the 9.2 MB knowledge base was allocating 371 MB of V8 &lt;code&gt;ConsString&lt;/code&gt; objects, and rewrote the parser with zero-copy slicing to bring memory down to 114 MB (and 63 MB steady-state during vector search).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fixing Proxy Timeouts with NDJSON Streaming &amp;amp; JSON Repair:&lt;/strong&gt;
Long structured outputs from local &lt;code&gt;gemma3:4b&lt;/code&gt; over a Cloudflare tunnel occasionally timed out or truncated mid-JSON. We switched &lt;code&gt;OllamaProvider&lt;/code&gt; to continuous NDJSON streaming, built a stack-based JSON auto-repair utility (&lt;code&gt;repairJsonCandidate&lt;/code&gt;), and added a clean one-click &lt;code&gt;Retry Sending&lt;/code&gt; button in the UI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hardening Security &amp;amp; Adding 5 Domain Guardrails:&lt;/strong&gt;
In our final pass, we removed the internal Pipeline Inspector from the client UI so raw server state is never exposed, added a 600-character input cap, and built 5 domain guardrails so unrealistic inputs (like "100 hours of sunlight" or unknown cities/plants) are caught and explained gracefully.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Overall Challenge Winner — Week 1: Touch Grass (Open-Source AI Innovation):&lt;/strong&gt; Built from the ground up with open-weight models (&lt;code&gt;gemma3:4b&lt;/code&gt; and &lt;code&gt;nomic-embed-text&lt;/code&gt; via Ollama) around the core motto "Spend 30 seconds here. Spend the rest outside." — turning local agro-climatic data, 2,174 plant pathology records, and leaf photos into immediate daily physical tasks in the garden.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Gemma:&lt;/strong&gt; Uses &lt;code&gt;gemma3:4b&lt;/code&gt; as both its structured JSON reasoning router/planner and its multimodal vision engine for leaf disease diagnosis, enhanced with custom JSON stream repair, 5 domain guardrails, and a bounded 7-line context summarizer designed specifically for a 4B parameter context window.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Render:&lt;/strong&gt; Deployed live on Render (&lt;a href="https://ai-gardener.onrender.com" rel="noopener noreferrer"&gt;https://ai-gardener.onrender.com&lt;/a&gt;) and engineered specifically for Render's 512 MB RAM environment by reducing CSV parser memory from 371 MB to 114 MB, streaming NDJSON chunks to prevent proxy timeouts, and providing a 24/7 hybrid fallback.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of MongoDB Atlas:&lt;/strong&gt; Uses MongoDB Atlas across 4 collections (&lt;code&gt;garden_sessions&lt;/code&gt;, &lt;code&gt;users&lt;/code&gt;, &lt;code&gt;plant_health_knowledge&lt;/code&gt;, and &lt;code&gt;climate_location_knowledge&lt;/code&gt;), combining stateful multi-garden lifecycle persistence with 768-dimensional &lt;code&gt;$vectorSearch&lt;/code&gt; retrieval across 2,174 plant health records and 70 hierarchical climate records.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Thank you to the DEV team, MLH, DigitalOcean, Google DeepMind, Render, and MongoDB for hosting Hacktoberfest 2026 and championing open-source AI! Building this project solo was an awesome learning experience — now it is time for me to close my terminal, step outside, and touch some grass. 🌱&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
  </channel>
</rss>
