Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AI Coding Agent

An AI-powered coding agent built with Python 3.11 that explores an existing GitHub repository, identifies relevant source files, creates an implementation plan using a local Large Language Model (LLM), applies AI-assisted code modifications, and generates an execution summary.

The project was developed as part of the AI Coding Agent Assignment.


🚀 Features

  • 🔍 Clone and inspect an existing GitHub repository
  • 📂 Automatically explore the repository structure
  • 🧠 Identify relevant source files based on the user request
  • 📄 Read and analyze project files
  • 🤖 Generate an implementation plan using Qwen2.5-Coder running locally with Ollama
  • ✨ Apply AI-assisted modifications to the selected files
  • 📝 Generate an execution report summarizing the completed work
  • 🛠 Preserve the existing Node.js application structure

🏗 Architecture

                 User Request
                       │
                       ▼
               AI Coding Agent
                       │
        ┌──────────────┼──────────────┐
        │              │              │
        ▼              ▼              ▼
 Repository      Repository      Implementation
 Exploration      Analysis           Planning
        │              │              │
        └──────────────┼──────────────┘
                       ▼
              Relevant File Selection
                       │
                       ▼
           Ollama (Qwen2.5-Coder 7B)
                       │
                       ▼
             AI Code Modification
                       │
                       ▼
            Updated Repository Files
                       │
                       ▼
             Execution Report

⚙️ Agent Workflow

  1. Clone the target GitHub repository.
  2. Explore the repository structure.
  3. Detect relevant project files.
  4. Read important source files.
  5. Generate an implementation plan using the LLM.
  6. Apply AI-generated code modifications.
  7. Save the updated files.
  8. Generate an execution report.

📂 Project Structure

ai_coding_agent/
│
├── core/
│   ├── explorer.py
│   ├── indexer.py
│   ├── planner.py
│   ├── modifier.py
│   ├── executor.py
│   └── summarizer.py
│
├── providers/
│   ├── ollama_provider.py
│   ├── base.py
│   └── placeholder.py
│
├── reports/
│   └── execution_report.md
│
├── tools/
│   ├── read_file.py
│   ├── write_file.py
│   ├── git_diff.py
│   └── run_tests.py
│
├── workspace/
│   └── target_repo/
│
├── agent.py
├── requirements.txt
└── README.md

🧠 Repository Exploration

The agent automatically analyzes the cloned repository and identifies the files most relevant to the requested feature.

For the provided repository, the agent selected:

  • app/controllers/note.controller.js
  • app/models/note.model.js
  • app/routes/note.routes.js

These files were identified because they control note management, data storage, and API routing.


📌 User Request

Improve the application so users can better organise and search their notes.


✅ Changes Implemented

The AI agent proposed and applied changes including:

  • Added support for note categories
  • Added support for note tags
  • Improved search functionality
  • Updated controller logic
  • Updated data model
  • Updated API routes

After modification, the Node.js application was successfully started to verify that the project remained operational.


🛠 Technologies Used

Category Technology
Language Python 3.11
LLM Qwen2.5-Coder (7B)
Runtime Ollama
Backend Target Node.js + Express.js
Version Control Git

⚖️ Assumptions

  • The target repository follows a standard Node.js project structure.
  • Relevant files can be identified through repository exploration.
  • AI-generated code is reviewed before final acceptance.
  • The repository is accessible through Git.

⚠️ Trade-offs

  • Large repositories increase processing time.
  • LLM-generated code may require human review.
  • The current implementation modifies selected files rather than generating Git patches.
  • Repository-specific testing is limited to verifying successful application startup.

▶️ Running the Project

Clone the repository

git clone <your-repository-url>
cd ai_coding_agent

Install dependencies

pip install -r requirements.txt

Start Ollama

ollama serve

Download the model

ollama pull qwen2.5-coder:7b

Run the agent

python agent.py

📋 Example Output

==================================================
AI CODING AGENT
==================================================

[1/5] Exploring repository...

Relevant Files
 - app/controllers/note.controller.js
 - app/models/note.model.js
 - app/routes/note.routes.js

[3/5] Reading important files...

[4/5] Creating execution plan...

[5/6] Applying AI modifications...

✅ Updated note.controller.js
✅ Updated note.model.js
✅ Updated note.routes.js

Execution report generated.

🤖 AI Usage

AI assistance was used for:

  • Repository understanding
  • Execution planning
  • Source code modification
  • Documentation generation

All AI-generated code was manually reviewed before being accepted to ensure the target application remained functional.


📈 Future Improvements

  • Multi-file context reasoning
  • Git patch generation instead of full file replacement
  • Automatic syntax validation
  • Unit test execution
  • Rollback support
  • Docker containerization
  • Support for multiple LLM providers
  • Interactive command-line interface

👨‍💻 Author

Ishar Roy

B.Tech – Computer Science & Engineering

Future Institute of Engineering and Management


⭐ Thank you for reviewing this submission!

About

AI-powered coding agent built with Python and Ollama that explores existing repositories, generates implementation plans, and applies AI-assisted code modifications using a local LLM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages