Thursday, December 18, 2025

Using AI to develop MAPS

 The AI Coding Journey: From Copilot to Gemini Pro

As we all know, AI is the current "it" thing. I’ve been using it for everything from household fixes to troubleshooting complex phone settings. For example, I finally configured my phone to stay on DND for everyone except my contacts—a task significantly more complicated than it sounds when you're balancing multiple Google Voice and carrier numbers. Recently, however, I decided to see what AI could do for my coding workflow.

I started with GitHub Copilot in VSCode, which was decent until I hit my monthly query limit. I then pivoted to the Google Gemini Pro Trial (a 12-month free pass), which also integrates directly into VSCode.

The Good, The Bad, and The "Try Again"

Using Gemini is simultaneously amazing and frustrating. The "diff-like" interface for approving code changes is brilliant. However, the experience degrades over long, protracted conversations; the history helps the AI stay context-aware, but it makes the response time crawl.

I’ve also encountered several technical quirks:

  • Failed Applications: Sometimes it fails to modify the file, requiring a "Try again" prompt.
  • The "Unknown Problem": Occasionally, it hits a wall that requires a full VSCode restart.
  • Loss of Agency: It’s easy to let the AI inject so much code that you no longer fully "know" your own project.

A perfect example of AI going down the wrong path happened while I was building a YouTube downloader. The AI insisted on using a complex PHP OOP library to wrap yt-dlp and ffmpeg. We spent hours fighting version mismatches between the apt version of yt-dlp and the GitHub binary. Finally, I had to step in: "Wait—I can run this perfectly at the command line with a cookies.txt file. Let’s jettison the library and just have PHP construct the shell command." It was a reminder that while AI is a powerful tool, it still needs an experienced dev to keep it from over-engineering itself into a corner.

Modernizing MAPS with Gemini

For the uninitiated, MAPS is my homegrown spam filtering system. It triggers from a user’s ~/.forward file, extracts the "From" address, and checks it against a MariaDB backend.

  • Whitelist: Delivered immediately.
  • Blacklist: Bounced with a "Not allowed" message.
  • Nulllist: Silent discard.
  • Unknown: The email is held, and the sender gets a registration link. If they click and identify themselves, their mail is released, and they are whitelisted.

Recent AI-Assisted Improvements:

  1. Persistent Sessions: Gemini helped me rewrite the login logic so the session cookie refreshes every time I visit the site. Instead of a hard 30-day expiration, it now only expires if I haven't logged in for 30 days.
  2. Subject Line Encoding: We’ve been working on better handling of non-ASCII subject lines. It's a work in progress—getting diverse character sets (like Chinese) to render correctly is a moving target.
  3. Safe HTML Rendering: This was a huge win. Previously, my email display was "raw" (and ugly) to prevent scripts or worms from executing. The AI implemented a sanitization module that:

    • Strips all scripts.
    • Disables all href links.
    • Converts links into "hover-only" tooltips so I can see the URL without the risk of clicking it.

Next, I moved on to my most ambitious change yet...

Android App - MAPS Mobile

I got this bright idea that I could make an Android App from my MAPS system. Going to the webpage on a phone, with tiny fonts, was really not mobile-friendly. Could I actually use Gemini to help me develop an Android app? I've never done one before.

Consulting Gemini about how to do this revealed that I needed to install Gradle and the Android SDK, both of which were easy to do on Linux. Gemini even showed me how I can create a VSCode task to build with Gradle and install using the adb CLI, which I also have been using to use scrcpy to view my Android phone on my Linux Desktop. Sweet! Now I can actually type Shift-Ctrl-B to build and install the app on my phone, then move my mouse cursor to the scrcpy window to test the changes. True, it's kind of a pain to have to remember to upload backend changes to my cloud server, but I wanted to access my live data as emails processed by my spam filter age quickly. Luckily, Gemini even taught me to ssh tunnel to my MariaDB in the cloud through localhost.

I've implemented the MAPS Mobile app with a lot of the functionality, querying, and directing Gemini on what I wanted to see changed or implemented. The mobile app doesn't implement all the functionality or the process flow of the web page. But the app is really what I need and what is practical for an Android app. And it is my first one!

Take aways

  • AIs aren't always right. You need to guide them. In order to guide them, you need ot know what you are doing. College grads and others are  trying to enter the field because they see it as the next big thing, but often lack the background to properly guide the AIs
  • Many businesses will miss this as they eye the bottom line (i.e., cost $$$) before understanding the practicality of this, much like they invested a lot into offshore tech support without asking the question: Won't this worsen communication between our employees and customers?
  • AI needs to be told when there is a better, more architecturally intelligent path. I.e. You still need qualified people
  • Coding with your vibe buddy, Mr. AI, needs to be learned like anything else
  • Vision you and your AI buddy to be a team, not a substitute.

No comments:

Post a Comment