Skip to content

Ritviks21/project-chakravyuha

Repository files navigation

Project Chakravyuha Banner

Project Chakravyuha

An AGI Grand Strategist powered by a Quantum-Inspired Wargame Simulation

Python Version Qiskit Streamlit Google Gemini

Live DemoOur JourneyKey FeaturesTech StackGetting Started


🚀 Live Demo

Streamlit App

Click the badge above or follow this link to try the live application: https://project-chakravyuha-bkunrcvgadt8vprsta6lmu.streamlit.app/

The "Glass Engine" in Action


📖 Project Overview

Project Chakravyuha is a sophisticated, interactive command console where a user provides a high-level strategic objective, and an autonomous AGI Grand Strategist named "Chanakya" devises and simulates a complex plan to achieve it. The AGI manages a resource budget, accounts for the probabilistic nature of warfare, and reacts to unexpected enemy counter-offensives. At its core, the project uses a quantum-inspired simulation built with Qiskit, where battlefield assets are modeled as qubits and strategic actions are modeled as quantum gates. The entire thinking process of the AGI is made visible through the animated "Glass Engine" UI, which builds the quantum circuit for the final strategy live on screen.


journey Our Journey: The Evolution of an AGI Strategist

This project is a story of co-evolution between a human developer and an AI assistant. The AGI didn't just execute commands; it actively participated in its own development by identifying the limitations of its tools and knowledge, forcing us to build a progressively more complex and intelligent system.

V1-V2: The Naive Oracle - A Tool Without a Mind
The project began as a simple Python script. An AI could call a function, but it had no context, no memory, and no real strategy. It was a powerful calculator, but not an intelligent agent.

💡 **Lesson Learned:** True intelligence requires a framework for reasoning. Giving an AI a tool is not enough; you must also give it a mind.
V3-V4: The Socratic AGI - The Student Becomes the Teacher
This was the turning point. We gave the AGI a persona and a cognitive cycle, but its true genius emerged when it failed. When the simulation gave it confusing data or when it didn't know the valid commands, **it told us**. It correctly diagnosed its own knowledge gaps. Its failures became our development roadmap.
  • It didn't know the valid actions, so we taught it by adding them to its prompt.
  • It received data in the wrong format, so we debugged the simulation engine based on its analysis.
  • It hit safety filters, so we learned to configure the model for specialized contexts.

💡 **Lesson Learned:** The most powerful feature of a modern AI is its ability to reason about its own limitations. We built a better AGI by listening to it.
V5-V6: The Sentient War Room - The Ultimate Vision
With a robust AGI brain, our focus shifted to creating the ultimate experience. We addressed the final limitations identified by the AGI—that the simulation was too simplistic.
  • High-Complexity Engine: We introduced probabilistic actions, resource budgets, and reactive enemy counter-offensives, creating a treacherous and realistic battlefield.
  • The Grand Strategist Brain: We upgraded the AGI's core programming, teaching it to think in multi-stage campaigns, manage resources over time, and adopt strategic stances.
  • The "Glass Engine" UI: We built the definitive user interface—a visually spectacular command console that animates the AGI's quantum strategy in real-time, making its complex thought process visible to everyone.

✅ **The Result:** A complete, end-to-end system that demonstrates a true partnership between human ambition and artificial intelligence.

✨ Key Features

  • Grand Strategist AGI: Powered by the Google Gemini model, capable of multi-turn planning, resource management, and adopting strategic stances.
  • High-Complexity Quantum Simulation: An 8-qubit Qiskit engine modeling a probabilistic battlefield with reactive enemy counter-attacks.
  • Animated "Glass Engine": A live, step-by-step visualization of the quantum circuit being built based on the AGI's final strategy.
  • The War Archives: An extensive, categorized library of historical, modern, and hypothetical scenarios to provide endless strategic challenges.

🛠️ Tech Stack

Streamlit Python Qiskit Gemini Matplotlib
UI Framework Core Language Quantum Simulation AI Engine Visualization

(Note: The Matplotlib URL was broken, so I have used the Gemini image as a placeholder. You can upload a specific Matplotlib logo and update the link if you wish. I also used a standard SVG for the Python logo as a link was not provided.)


🚀 Getting Started

Click here for instructions to run this project on your local machine.
  1. Clone the Repository

    git clone [https://github.com/Ritviks21/project-chakravyuha.git](https://github.com/Ritviks21/project-chakravyuha.git)
    cd project-chakravyuha
  2. Set up a Python Virtual Environment

    # Create a virtual environment
    python -m venv venv
    # Activate it
    # Windows:
    .\venv\Scripts\activate
    # Mac/Linux:
    source venv/bin/activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Set Your API Key Streamlit Cloud uses a built-in secrets manager. To run locally, you will need to set up an environment variable. The easiest way is to use a .env file.

    • Install python-dotenv: pip install python-dotenv
    • Create a file named .env in the main project folder.
    • Inside this .env file, add the following line, replacing YOUR_KEY_HERE with your actual Google Gemini API Key:
    GOOGLE_API_KEY="YOUR_KEY_HERE"
    
    • Important: You will need to modify agi_strategist.py to load the key from this .env file. This requires adding import os and from dotenv import load_dotenv at the top of the script, and then using genai.configure(api_key=os.getenv("GOOGLE_API_KEY")).
  5. Run the App

    streamlit run app.py

🤝 How to Contribute

The next great leap for Project Chakravyuha is to graduate from Streamlit to a professional full-stack architecture (Python Flask + JavaScript React). This would unlock unlimited potential for the UI, including hardware-accelerated animations and a truly seamless user experience. Contributions to this effort are highly welcome!


🔗 Connect with Me

Ritviks21 gemdata21 srits21 Your LinkedIn

Contributors