Skip to content

πŸ€– AI-Powered Multi-Agent System for Autonomous Technical Debt Detection, Prioritization & Remediation | Built with Google ADK

License

Notifications You must be signed in to change notification settings

Priyanshjain10/codedebt-guardian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– CodeDebt Guardian

AI-Powered Multi-Agent System for Autonomous Technical Debt Detection, Prioritization & Remediation

CI Python 3.10+ License: MIT Built with Gemini

Built by Priyansh Jain | IIT Jodhpur β€” Applied AI & Data Science


🎯 What is this?

Technical debt costs organizations $3.61 per line of code and consumes 40–60% of developer sprint time.

Traditional tools like SonarQube only detect problems. CodeDebt Guardian detects, prioritizes, AND autonomously fixes them by opening real GitHub Pull Requests.


✨ Key Features

Feature Description
πŸ•΅οΈ 3-Agent Pipeline Detection β†’ Ranking β†’ Fix Proposal, orchestrated sequentially
πŸ€– Auto-Fix PRs Opens real GitHub PRs with code fixes applied autonomously
πŸ“Š RICE Scoring Business-impact-weighted priority ranking
πŸ’Ύ Persistent Memory SQLite-backed cache β€” no re-analyzing the same repo
🌐 Web UI Streamlit dashboard with Plotly charts
πŸ”­ Observability Span tracing + per-operation metrics for every agent call
βœ… 40+ Tests Full pytest suite with CI on Python 3.10/3.11/3.12

πŸ›οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Orchestrator Agent         β”‚
β”‚  Session Management             β”‚
β”‚  PersistentMemoryBank (SQLite)  β”‚
β”‚  ObservabilityLayer             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          β”‚                  β”‚
β–Ό          β–Ό                  β–Ό
Agent 1         Agent 2            Agent 3
Debt Detection  Priority Ranking   Fix Proposal
- Python AST    β€’ RICE Score       β€’ 6 Templates
- Gemini 2.0    β€’ AI Impact        β€’ Gemini AI
- Regex rules   β€’ Sprint Plan      β€’ Before/After
           β”‚
           β–Ό
     PRGenerator
Branch β†’ Patch β†’ Commit β†’ Pull Request

πŸš€ Quick Start

Prerequisites

Installation

git clone https://github.com/Priyanshjain10/codedebt-guardian.git
cd codedebt-guardian
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env  # Add your API keys

Usage

# Launch web UI
python main.py --ui

# CLI analysis
python main.py --repo https://github.com/owner/repo

# Auto-fix mode β€” creates real GitHub PRs
python main.py --repo https://github.com/owner/repo --auto-fix --max-prs 3

Python API

from agents.orchestrator import CodeDebtOrchestrator

guardian = CodeDebtOrchestrator()
detection = guardian.detect_debt("https://github.com/owner/repo")
ranked    = guardian.rank_debt(detection)
fixes     = guardian.propose_fixes(ranked[:10])

# Auto-fix: create real PRs
prs = guardian.create_pull_requests(
    repo_url="https://github.com/owner/repo",
    fix_proposals=fixes,
    ranked_issues=ranked,
    max_prs=3,
)
for pr in prs:
    print(f"#{pr['number']}: {pr['html_url']}")

πŸ” What Gets Detected

Security πŸ”΄ β€” Hardcoded passwords, API keys, bare except clauses Structure 🟠 β€” God classes, long functions, too many parameters Maintainability 🟑 β€” Missing docstrings, no type hints, high cyclomatic complexity Project Health 🟒 β€” No tests, no CI/CD, unpinned dependencies, missing README


πŸ“ Project Structure

codedebt-guardian/
β”œβ”€β”€ agents/
β”‚   β”œβ”€β”€ orchestrator.py           # Master coordinator
β”‚   β”œβ”€β”€ debt_detection_agent.py   # AST + Gemini scanning
β”‚   β”œβ”€β”€ priority_ranking_agent.py # RICE scoring
β”‚   └── fix_proposal_agent.py     # Fix generator
β”œβ”€β”€ tools/
β”‚   β”œβ”€β”€ pr_generator.py           # Autonomous GitHub PR creation
β”‚   β”œβ”€β”€ persistent_memory.py      # SQLite-backed memory
β”‚   β”œβ”€β”€ github_tool.py            # GitHub REST API
β”‚   β”œβ”€β”€ code_analyzer.py          # AST metrics
β”‚   └── observability.py          # Span tracing
β”œβ”€β”€ models/
β”‚   └── schemas.py                # Pydantic v2 data models
β”œβ”€β”€ ui/app.py                     # Streamlit web UI
β”œβ”€β”€ tests/                        # 40+ unit tests
β”œβ”€β”€ .github/workflows/ci.yml      # GitHub Actions CI
└── main.py                       # CLI entry point

πŸ§ͺ Running Tests

pytest tests/ -v --cov=agents --cov=tools

πŸ—ΊοΈ Roadmap

  • 3-agent detection & fix pipeline
  • RICE-based priority scoring
  • Auto-Fix PR generation
  • SQLite persistent memory
  • Streamlit web UI
  • GitHub Actions CI
  • GitHub Action (auto-analyze on PR)
  • Support for JavaScript/TypeScript
  • Slack/Discord notifications
  • VS Code extension

🀝 Contributing

PRs welcome! Fork β†’ Branch β†’ Test β†’ PR.


πŸ“ License

MIT β€” see LICENSE


⭐ Star this repo if it helped you!

Priyansh Jain | IIT Jodhpur

About

πŸ€– AI-Powered Multi-Agent System for Autonomous Technical Debt Detection, Prioritization & Remediation | Built with Google ADK

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages