Skip to content

Latest commit

ย 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  AI Codebase Knowledge Platform

Understand any codebase faster. An AI-powered developer platform that analyzes GitHub repositories, extracts code intelligence, builds dependency relationships, and provides context-aware explanations and answers using RAG, AST analysis, and LLM-based reasoning.

Status Python FastAPI Next.js TypeScript License

Overview โ€ข Features โ€ข Architecture โ€ข Tech Stack โ€ข Getting Started โ€ข API โ€ข Roadmap


๐Ÿ“Œ Overview

Understanding an unfamiliar software repository can require hours of manually reading files, tracing imports, following function calls, and searching for documentation.

The AI Codebase Knowledge Platform is designed to reduce that effort.

A developer provides a public GitHub repository URL, and the platform:

GitHub Repository
       โ”‚
       โ–ผ
Repository Cloning
       โ”‚
       โ–ผ
Codebase Discovery
       โ”‚
       โ–ผ
Source File Filtering
       โ”‚
       โ–ผ
AST / Structural Analysis
       โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ File Intelligence
       โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Function Intelligence
       โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Dependency / Call Graph
       โ”‚
       โ–ผ
Knowledge Retrieval
       โ”‚
       โ–ผ
LLM Reasoning
       โ”‚
       โ–ผ
Context-Aware Developer Answers

The goal is to evolve the platform from a codebase-aware RAG system into an agentic developer assistant capable of autonomously exploring and reasoning about software repositories.


โœจ Core Capabilities

๐Ÿ”— Repository Intelligence

  • Clone public GitHub repositories from a URL
  • Automatically discover repository structure
  • Traverse source directories
  • Filter relevant source files
  • Extract useful code artifacts

๐Ÿงฉ Code Understanding

  • File-level code analysis
  • Function-level explanations
  • Class and dependency identification
  • AST-based structural analysis
  • Code relationship extraction

๐Ÿ•ธ๏ธ Dependency & Call Graph

Analyze relationships between functions and modules to help developers understand:

Module A
   โ”‚
   โ”œโ”€โ”€ imports โ†’ Module B
   โ”‚
   โ””โ”€โ”€ calls โ†’ Function X
                    โ”‚
                    โ””โ”€โ”€ calls โ†’ Function Y

This makes it easier to trace execution paths through unfamiliar code.

๐Ÿ’ฌ RAG-Powered Codebase Q&A

Ask natural-language questions such as:

"Where is authentication handled?"

"How does the repository process uploaded files?"

"Which function generates the dependency graph?"

"What happens after a repository is cloned?"

The system retrieves relevant code context before generating an answer.

๐Ÿค– Agentic AI โ€” In Development

The next stage introduces agentic workflows capable of:

  • Exploring multiple files
  • Following dependencies
  • Reasoning across modules
  • Gathering relevant context
  • Performing multi-step codebase investigation

๐Ÿ› ๏ธ Developer Tooling โ€” Planned

Future integrations include:

  • VS Code extension
  • AI-powered pull request review
  • PR summarization
  • CI/CD integration
  • IDE-aware code explanations

๐Ÿ—๏ธ Architecture

High-Level Architecture

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚      Developer       โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   Next.js Frontend   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚    FastAPI Backend   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ”‚                      โ”‚                      โ”‚
             โ–ผ                      โ–ผ                      โ–ผ
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚ GitHub Repo โ”‚       โ”‚ AST Analysis โ”‚       โ”‚  Retrieval   โ”‚
      โ”‚   Cloning   โ”‚       โ”‚   Engine     โ”‚       โ”‚    Layer     โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ”‚                     โ”‚                      โ”‚
             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                   โ”‚
                                   โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   Code Knowledge     โ”‚
                         โ”‚      Layer           โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚    LLM / RAG Layer   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚ Context-Aware Answer โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”„ Codebase Analysis Pipeline

1. GitHub URL
      โ†“
2. Repository Clone
      โ†“
3. Repository Traversal
      โ†“
4. Source File Detection
      โ†“
5. Code Parsing
      โ†“
6. AST Extraction
      โ†“
7. Function / Class Extraction
      โ†“
8. Dependency Analysis
      โ†“
9. Call Graph Construction
      โ†“
10. Knowledge / Retrieval Layer
      โ†“
11. LLM Context Construction
      โ†“
12. AI Explanation / Q&A

This architecture separates deterministic code analysis from probabilistic LLM reasoning, improving the reliability of the overall system.


๐Ÿง  AI & Code Intelligence

The platform combines several complementary approaches.

Component Purpose
AST Analysis Understand code structure deterministically
File Analysis Identify purpose and important components
Function Analysis Explain signatures, parameters and logic
Dependency Analysis Identify relationships between modules
Call Graph Trace function-to-function relationships
Embeddings Represent code semantically
Vector Retrieval Retrieve relevant code context
RAG Ground LLM responses in repository context
LLM Generate explanations and answers
Agentic Workflows Perform multi-step repository investigation

๐Ÿงฑ Tech Stack

Frontend

  • Next.js
  • React
  • TypeScript
  • Tailwind CSS

Backend

  • Python
  • FastAPI
  • Uvicorn
  • GitPython

Code Intelligence

  • Python AST
  • Dependency analysis
  • Call graph construction
  • Static code inspection

AI / GenAI

  • Large Language Models
  • Embeddings
  • Vector retrieval
  • Retrieval-Augmented Generation
  • Agentic workflows

Deployment

  • Render โ€” Backend
  • Vercel-compatible deployment โ€” Frontend

๐Ÿ“ Project Structure

ai-codebase-platform/
โ”‚
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ ast_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ explain_service.py
โ”‚   โ”‚   โ””โ”€โ”€ prompt_builder.py
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ””โ”€โ”€ requirements.txt
โ”‚
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ LICENSE

Project structure may evolve as additional agentic and developer-tooling components are introduced.


๐Ÿš€ Getting Started

Prerequisites

Make sure you have:

  • Python 3.10+
  • Node.js 18+
  • npm
  • Git

1. Clone the repository

git clone https://github.com/dheeraj116232/ai-codebase-knowledge-platform.git

cd ai-codebase-knowledge-platform

2. Backend Setup

cd backend

Create a virtual environment:

Windows

python -m venv venv
venv\Scripts\activate

macOS / Linux

python3 -m venv venv
source venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Start the backend:

uvicorn main:app --reload --port 8000

Backend:

http://localhost:8000

Health check:

http://localhost:8000/health

Interactive API documentation:

http://localhost:8000/docs

๐Ÿ’ป Frontend Setup

Open another terminal:

cd frontend

Install dependencies:

npm install

Start the development server:

npm run dev

Frontend:

http://localhost:3000

๐Ÿงช Example Workflow

Step 1

Open the web application.

Step 2

Paste a public GitHub repository URL.

Step 3

Select:

Clone Repository

Step 4

The backend analyzes the repository.

Step 5

The platform extracts:

  • Repository structure
  • Files
  • Functions
  • Classes
  • Dependencies
  • Call relationships

Step 6

Use the AI interface to ask questions about the repository.

Example:

How does authentication work in this project?

The system retrieves relevant code context and generates an explanation.


๐Ÿ“ก API

Method Endpoint Purpose
GET /health Backend health check
POST /clone Clone a GitHub repository
POST /explain/file Generate a file explanation
POST /explain/function Explain a function
GET /callgraph Retrieve call graph information

Once the backend is running, the complete interactive API documentation is available through:

/docs

FastAPI automatically provides Swagger/OpenAPI documentation.


๐Ÿ—บ๏ธ Development Roadmap

โœ… Phase 1 โ€” Repository Intelligence

  • FastAPI backend
  • Next.js frontend
  • GitHub repository cloning
  • Repository traversal
  • Source-file filtering
  • Initial code analysis
  • RAG foundation

โœ… Phase 2 โ€” Code Intelligence

  • AST-based analysis
  • File explanations
  • Function explanations
  • Dependency analysis
  • Call graph generation

๐Ÿšง Phase 3 โ€” Agentic Code Intelligence

  • Multi-step codebase reasoning
  • Autonomous repository exploration
  • Cross-file reasoning
  • Context-aware investigation agents
  • Improved retrieval and reranking
  • Repository-level task planning

๐Ÿ”ฎ Phase 4 โ€” Developer Platform

  • VS Code extension
  • AI pull-request review
  • Automated PR summaries
  • CI/CD integration
  • IDE-aware code explanations
  • Autonomous debugging workflows

๐Ÿ” Security & Production Considerations

The current implementation is primarily designed for development, experimentation, and portfolio demonstration.

Before production deployment, several areas should be hardened:

  • Repository URL validation
  • SSRF protection
  • Repository size limits
  • Clone timeouts
  • Resource quotas
  • Sandboxed code analysis
  • Authentication and authorization
  • Rate limiting
  • Secret/API-key protection
  • Malicious repository handling
  • Dependency security scanning

These considerations are particularly important because the platform processes externally supplied repositories.


โšก Current Limitations

  • Repository cloning is currently synchronous.
  • Large repositories may require additional processing time.
  • Public GitHub repositories are the primary supported input.
  • Retrieval quality can vary depending on repository structure.
  • Production-grade URL and repository security hardening is still required.
  • Advanced reranking and autonomous agent workflows are under development.

๐ŸŽฏ Why This Project?

Modern software repositories can contain thousands of files and millions of lines of code.

Traditional search answers:

"Where is this code?"

This project aims to answer:

"How does this code work, why does it work this way, and what happens if I change it?"

The long-term objective is to build a developer intelligence layer that sits between the developer and the complexity of large software systems.


๐Ÿ“ˆ Future Vision

                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚       Developer          โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚ AI Codebase Understandingโ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ”‚                โ”‚                โ”‚
             โ–ผ                โ–ผ                โ–ผ
        Understand        Explain          Navigate
             โ”‚                โ”‚                โ”‚
             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚  AI Code Agent  โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ               โ–ผ               โ–ผ
            Plan           Modify           Test
              โ”‚               โ”‚               โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ–ผ
                     Software Development

The eventual goal is not simply a "chat with your codebase" application.

It is to build an AI system that can understand software, reason across its architecture, navigate dependencies, plan changes, and eventually assist with implementation and validation.


๐Ÿค Contributing

Contributions, suggestions, issues, and feature requests are welcome.

Contribution workflow

git checkout -b feature/your-feature

git add .

git commit -m "Add: your feature"

git push origin feature/your-feature

Then open a Pull Request.


๐Ÿ“„ License

This project is licensed under the MIT License.

See LICENSE for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Dheeraj Kumar

AI Engineer | Generative AI | Agentic AI | Machine Learning | Data Science

๐ŸŽ“ NIT Tiruchirappalli

Connect


๐Ÿง  Understand Code.

๐Ÿ” Discover Dependencies.

๐Ÿค– Build with AI.

Built with FastAPI, Next.js, Python, TypeScript, and a genuine curiosity about how software works.

โญ If you find this project interesting, consider starring the repository.

About

AI-powered codebase intelligence platform that enables semantic code search, repository Q&A, AST analysis, dependency graphs, automated documentation, PR reviews, and architecture visualization using RAG, LangGraph, and Groq.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages