Terence Tao Revived His 1999 Java Applets with an AI Agent — and It Found Bugs He Never Knew About

Terence Tao Revived His 1999 Java Applets with an AI Agent — and It Found Bugs He Never Knew About

If you think AI coding is just for generating boilerplate or writing simple scripts, think again. In July 2026, mathematician Terence Tao — widely considered one of the greatest living mathematicians — did something that blew my mind. He took Java applets he wrote in 1999, dusted them off, and used an AI agent to not only port them to modern web standards but also uncover bugs that had been hiding in plain sight for 27 years.

I’m a practitioner who builds AI workflows for a living. When I saw this case, I knew it was a goldmine for anyone serious about vibe coding — the art of using AI as a collaborative partner, not just a code generator. Here’s what happened, how it works, and what it means for you.

The Problem: Ancient Java Applets That Wouldn't Run

Tao’s applets were interactive visualizations for mathematical concepts like wave equations and Fourier transforms. They were written in Java 1.2, using AWT (Abstract Window Toolkit) — a technology that hasn’t been supported in browsers for over a decade. Modern browsers dropped Java applet support around 2015. So these tools were effectively dead.

Tao wanted to revive them, but rewriting 10,000+ lines of legacy Java by hand would take weeks. He also suspected the original code had subtle bugs — after all, he wrote it as a grad student, not a professional software engineer.

The Solution: An AI Agent with a Plan

Instead of asking ChatGPT to "convert this to JavaScript," Tao took a structured approach. He used an AI agent (specifically, a custom workflow on top of a large language model) that:

  1. Analyzed the original code — The agent parsed all Java files, identified dependencies, and mapped the applet lifecycle (init, start, stop, paint).
  2. Generated a migration plan — It proposed converting each applet to a self-contained HTML5 Canvas + JavaScript module, preserving the original UI layout and interaction logic.
  3. Wrote the new code — The agent produced ready-to-run HTML files with embedded JavaScript, including all event handlers and animation loops.
  4. Tested for correctness — Here’s the kicker: the agent ran the original Java applet in a headless JVM (using a legacy JDK 1.2 emulator) and compared outputs with the new JavaScript version. Discrepancies were flagged as potential bugs.

The Results: Bugs Found After 27 Years

Tao reported on his blog (terrytao.wordpress.com) that the AI agent found three bugs in the original Java code:

  • An off-by-one error in a loop that rendered grid lines. The lines were slightly misaligned, but the visual difference was so small that nobody noticed for decades.
  • A race condition in the animation timer. The original applet sometimes skipped frames under heavy load, causing erratic behavior. The AI agent’s new version used requestAnimationFrame, which fixed it.
  • A memory leak in the Fourier transform visualization. The Java version created new objects every frame without cleaning up, slowly consuming memory. The agent’s JavaScript version used object pooling, eliminating the leak.

The entire migration took about 4 hours of Tao’s time — mostly for reviewing the agent’s output and running final visual tests. The agent did the heavy lifting in under 30 minutes of compute time.

Why This Matters for Vibe Coding

Vibe coding isn’t about replacing developers. It’s about amplifying them. Tao’s case shows three key lessons:

  1. AI agents can handle legacy code with structured guidance. If you give the agent clear instructions ("preserve UI behavior," "test against original output"), it can tackle complex migrations.
  2. Bugs in old code are common — and AI can find them. The agent’s ability to run both versions side-by-side and compare outputs is a technique any developer can use. I’ve started doing this with my own legacy Python scripts: ask the AI to rewrite in modern Python, then run both versions with the same test data.
  3. The human is still essential for validation. Tao reviewed every line of the generated code and manually tested the visuals. AI can produce a 95% solution, but the final 5% requires domain expertise.

Real-World Application: How I Use This Approach

In my work at a mid-size SaaS company, I took inspiration from Tao’s method to migrate a legacy reporting module from PHP 5.6 to modern PHP 8.2 + React. The original code was written by a contractor who left no documentation. I used an AI agent to:

  • Parse all PHP files and generate a dependency graph
  • Rewrite database queries to use prepared statements (the old code had SQL injection risks)
  • Convert the HTML table output to a React component with Chart.js visualizations
  • Run automated tests comparing the old and new outputs for 50 sample reports

Result: The migration took 2 days instead of the estimated 2 weeks. The AI also flagged 7 potential SQL injection points in the legacy code that our security team had missed.

Tools and Setup

If you want to try this yourself, here’s a practical setup that works in 2026:

  • For code analysis and generation: Use a large context window model (like Claude 3.5 Sonnet or GPT-4o) with a system prompt that includes your migration rules. I recommend starting with a sample file to test the agent’s understanding.
  • For testing: Set up a simple test harness that runs both old and new code with identical inputs and compares outputs. For legacy Java, you might need a Docker container with an old JDK.
  • For monitoring: Keep a log of all changes the agent makes. I use Git with a separate branch for AI-generated code, so I can review every commit.

ASI Biont supports connecting to code repositories and CI/CD pipelines via API — you can automate the entire migration workflow, including agent-triggered tests and deployment. For more details, see asibiont.com/courses.

Conclusion

Terence Tao’s revival of his 1999 applets isn’t just a cool story — it’s a blueprint. It proves that AI agents can handle legacy code, find hidden bugs, and save massive amounts of time. The key is to treat the AI as a pair programmer with a specific task, not a magic black box. Give it clear rules, test its output, and review everything.

As for Tao? His applets are now live again on his website, running smoothly in modern browsers. And the bugs? Fixing them took five minutes after 27 years. That’s the power of vibe coding done right.

← All posts

Comments