DEV Community

Ashutosh singh
Ashutosh singh

Posted on

WhatIF — An AI Counterfactual Machine

WhatIF — An AI Counterfactual Machine

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

WhatIF is an AI-powered counterfactual machine built around one simple question:

What if things had happened differently?

Instead of being another AI chatbot, WhatIF lets you create alternate scenarios and explore how a single change could affect everything that comes after it.

For example:

  • What if I had chosen a different college?
  • What if I had started learning programming three years earlier?
  • What if I had accepted that opportunity?
  • What if I had moved to another city?
  • What if a historical event never happened?
  • What if I made the opposite decision?

WhatIF takes a starting scenario and generates a counterfactual chain, exploring possible consequences, assumptions, branching outcomes, and alternate timelines.

I built it for a friend who constantly asks “what if?” about decisions, technology, games, and life.

I didn't want to build another productivity app or another ChatGPT wrapper.

I wanted to build something that feels more like a sandbox for imagination and reasoning.

Demo

🌐 Live Demo: https://what-if-cyan-phi.vercel.app/

Code

💻 GitHub Repository: https://github.com/ashudotbuilds/whatIF

The project is open source so others can experiment with the idea, inspect the implementation, and build their own variations.

How I Built It

WhatIF is built around open-weight AI and uses Gemma as its AI engine.

The core idea is to give the model a structured counterfactual scenario instead of treating it like a normal conversational chatbot.

The application takes the user's:

  1. What-if scenario
  2. Starting conditions
  3. Important variables
  4. Constraints
  5. Desired depth of exploration

and turns them into a structured alternate-world analysis.

The AI then explores a chain like:

Scenario → Assumptions → Immediate Effects → Secondary Effects → Long-Term Consequences → Alternative Outcomes

The frontend was intentionally kept simple so that users can immediately understand what to do.

The experience is essentially:

Ask a WhatIF → Explore the alternate reality → Follow the consequences

I deliberately avoided building a complicated AI dashboard. The goal was to make the experience feel more like an interactive thought experiment.

Why Does Open Innovation Matter?

Open innovation matters because it gives developers the ability to experiment with the intelligence layer of their applications instead of simply building another interface around a closed API.

Using an open-weight model like Gemma makes it possible to:

  • Experiment with different model configurations
  • Understand how the model behaves
  • Modify prompts and AI workflows
  • Build specialized AI experiences
  • Potentially run models locally
  • Reduce dependence on a single provider
  • Share the architecture and experiments with other developers

For WhatIF, this is especially important because counterfactual reasoning is the core of the product.

The AI isn't simply generating a normal response.

It is being used as an engine for exploring alternate possibilities.

Open models make this kind of experimentation more accessible to developers who want to understand, modify, and extend what they build.

My Agent Session

I built WhatIF using an AI coding agent and an iterative agentic development workflow.

The agent helped with:

  • Project structure
  • UI implementation
  • Counterfactual engine logic
  • Prompt design
  • API integration
  • Error handling
  • UX improvements
  • Dark/light mode
  • Documentation

One of the biggest iterations was simplifying the UI.

The first version felt too complicated, so I redesigned it around one simple idea:

Less dashboard. More imagination.

Prize Categories

I'm entering WhatIF for the following categories:

  • Gemma / Google
  • Open Source / Open Innovation

Built for a Friend

The most important part of this project isn't the technology.

It's the question that inspired it:

What if?

Everyone has decisions they replay in their head.

Everyone has moments where they wonder what could have happened if they had chosen differently.

WhatIF turns that curiosity into something you can actually explore.

Instead of asking AI:

"Tell me something."

You ask:

"What if?"

And then you see where that alternate reality takes you.


Built during Hacktoberfest Weekend 2026 with open-source AI, an AI coding agent, and a lot of counterfactual thinking.

Top comments (0)