Skip to content

ritwin82/Multi_Persona_AI_Debugger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🧠 DebugMind

A multi-persona AI debugging consensus engine — Get 5 expert AI perspectives on your bugs, then watch them reach a consensus.

DebugMind Screenshot

DebugMind automatically analyzes your code using 5 distinct AI developer personas in parallel. Each persona brings a unique perspective — from ruthless fixing to patient teaching to performance optimization. A consensus engine then synthesizes all insights into a definitive fix and explanation.

🏗️ Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    Frontend (React + Vite)                       │
│                    http://localhost:5173                         │
└───────────────────────────┬─────────────────────────────────────┘
                            │ POST /api/debug
                            ▼
┌─────────────────────────────────────────────────────────────────┐
│               Python Backend (FastAPI)                           │
│               http://localhost:3001                              │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌────────┐ │
│  │ Fixer   │  │ Teacher │  │Optimizer│  │ Tester  │  │Visual. │ │
│  │ (Groq)  │  │(Gemini) │  │(Gemini) │  │(OpenR.) │  │ (Groq) │ │
│  └────┬────┘  └────┬────┘  └────┬────┘  └────┬────┘  └────┬───┘ │
│       └────────────┴───────────┼───────────┴────────────┘       │
│                                ▼                                 │
│                    ┌─────────────────────┐                       │
│                    │  Consensus Engine   │                       │
│                    │      (Gemini)       │                       │
│                    └─────────────────────┘                       │
├─────────────────────────────────────────────────────────────────┤
│         RAG: CVE Fetcher (NVD) + MDN Docs Fetcher               │
└─────────────────────────────────────────────────────────────────┘

🎭 Personas & Models

Persona Model Provider RAG Context Role
🔧 The Fixer Llama 3.1 8B Instant Groq CVE Database Ruthless, instant bug fixes
👨‍🏫 The Teacher Gemini 1.5 Flash 8B Google None Patient explanations with analogies
The Optimizer Gemini 1.5 Flash Google MDN Web Docs Performance analysis & Big-O
🧪 The Tester Mistral 7B Instruct OpenRouter None Failing/passing test generation
👁️ The Visualizer Llama 3.1 8B Instant Groq None Step-by-step execution tracing
🎯 Consensus Gemini 1.5 Flash Google All Personas Meta-analysis & final verdict

Why These Models?

  • Llama 3.1 8B on Groq: Blazing fast inference (~100ms) for The Fixer and Visualizer where speed is critical
  • Gemini 1.5 Flash: Excellent reasoning and huge context window for complex analysis and consensus building
  • Mistral 7B Instruct: Precise instruction-following for structured test generation

🔍 RAG Implementation

The system uses Retrieval-Augmented Generation to enhance persona responses:

RAG Source Persona Purpose
NVD CVE Database The Fixer Security vulnerability awareness
MDN Web Docs The Optimizer Latest JavaScript best practices

Both sources have a 3-second timeout to prevent delays.

✨ Features

  • Monaco Code Editor with syntax highlighting and line numbers
  • 5 Toggleable AI Personas - enable/disable any persona
  • Side-by-side Diff Viewer for comparing original vs fixed code
  • ELI5 Mode - simplify any explanation for beginners
  • Sample Bugs Library - 5 preloaded bugs to test
  • Bug Pattern Tracker - tracks your debugging history
  • Export Report - generate HTML reports
  • Auto Language Detection - supports 14+ languages

🚀 Quick Start

1. Get Your API Keys (Free Tiers Available)

Provider Link Free Tier
Groq console.groq.com Yes
Google AI aistudio.google.com Yes
OpenRouter openrouter.ai Yes

2. Configure Environment

# Copy example env file
cd backend
cp .env.example .env

# Edit .env with your API keys
GROQ_API_KEY=your_groq_key_here
GEMINI_API_KEY=your_gemini_key_here
OPENROUTER_API_KEY=your_openrouter_key_here

3. Install & Run

# Terminal 1: Python Backend
cd backend/python
pip install -r requirements.txt
python main.py

# Terminal 2: Frontend
cd frontend
npm install
npm run dev

📁 Project Structure

debugmind/
├── frontend/
│   ├── src/
│   │   └── App.jsx          # Main React component
│   ├── index.html
│   └── package.json
│
├── backend/
│   ├── .env                  # API keys (create from .env.example)
│   ├── .env.example
│   │
│   └── python/              # Python AI backend
│       ├── main.py          # FastAPI server (port 3001)
│       ├── requirements.txt
│       ├── providers/
│       │   ├── groq.py
│       │   ├── gemini.py
│       │   └── openrouter.py
│       ├── personas/
│       │   ├── fixer.py
│       │   ├── teacher.py
│       │   ├── optimizer.py
│       │   ├── tester.py
│       │   ├── visualizer.py
│       │   └── consensus.py
│       ├── rag/
│       │   ├── cve_fetcher.py
│       │   └── mdn_fetcher.py
│       └── utils/
│           ├── language_detector.py
│           └── library_extractor.py
│
└── README.md

🔧 Environment Variables

Variable Description Required
GROQ_API_KEY Groq API key for Llama models Yes
GEMINI_API_KEY Google AI API key for Gemini Yes
OPENROUTER_API_KEY OpenRouter API key for Mistral Yes
PORT Express server port (default: 3001) No
PYTHON_PORT Python server port (default: 3002) No
FRONTEND_URL Frontend URL for CORS (default: http://localhost:5173) No

🛠️ Tech Stack

React Vite Node.js Express Python FastAPI

Frontend: React, Vite, Monaco Editor, react-diff-viewer-continued
Backend: Express.js (Gateway), FastAPI (AI Processing)
AI Providers: Groq, Google Gemini, OpenRouter
RAG Sources: NVD CVE Database, MDN Web Docs

📝 License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors