Inspiration

This project started as a question that I couldn't stop thinking about: if experienced engineers improve code through iteration, testing, benchmarking, and combining ideas from multiple versions, why do AI coding tools stop after generating a single response?

I wanted to build something that mirrors how software actually gets better. GENESIS is my attempt to turn code generation into an evolutionary process where every improvement has evidence, ancestry, and measurable performance.

What it does

GENESIS is a Darwinian Code Evolution Engine. It creates a population of executable algorithm candidates, evaluates them on correctness and performance, then evolves the next generation through elitism, mutation, AST-aware crossover, and novel candidate generation.

OpenAI gpt-4o-mini generates mutations and new candidate approaches. The evolutionary engine decides what survives.

Each candidate is executed in an isolated browser worker with a timeout. Candidates must pass correctness tests before performance is benchmarked. Performance uses identical deterministic inputs and reports median runtime.

The interface makes the process inspectable: the Evolutionary Lineage graph shows retained organism history and real parent-child relationships, while the Hall of Fame preserves the best verified programs found across the run.

How I built it

I built GENESIS with Next.js and React. Next.js API routes call the OpenAI API for mutation and novel candidate generation.

For crossover, I use Acorn to parse JavaScript into an AST and Astring to regenerate code after recombining compatible program structures. Candidate code runs in browser Web Workers with timeout protection. D3 renders the evolutionary lineage graph, and the application records fitness history, Hall of Fame entries, operation logs, and parent relationships.

I used Codex with GPT-5.6 Terra during development for architecture review, debugging, verification, and iterative engineering work. The runtime model inside GENESIS is gpt-4o-mini.

Challenges I ran into

The hardest part was making the evolutionary claims measurable rather than decorative. I had to ensure every organism received the same benchmark cases, clone mutable inputs before execution, preserve organism history instead of only showing the current generation, and make pause/resume safe during asynchronous evolution.

Another challenge was making crossover real. Rather than combining code as raw text, GENESIS uses AST-aware crossover between compatible syntax structures and validates generated output before evaluation.

What I learned

I learned that an LLM is most useful here as a source of variation, not as the entire decision-maker. Correctness tests, deterministic benchmarks, selection, and retained lineage are what make the system explainable.

GENESIS does not promise that average fitness rises every generation. Exploration can introduce weaker variants. Instead, elitism and the Hall of Fame preserve strong verified candidates while the system searches for better ones.

Built With

  • acorn
  • astring
  • codex
  • d3.js
  • framer-motion
  • gpt-4o-mini
  • gpt-5.6-terra
  • javascript
  • next.js
  • openai-api
  • react
  • web-workers
Share this project:

Updates