-
-
The agent's end-to-end autonomous workflow. It finds 4 issues, generates all fixes, and submits the final pull request automatically.
-
The agent correctly identifies and adds a high-quality, AI-generated docstring to a simple function in calculator.py.
-
Proving its versatility, the agent also documents a more complex, professional function in the project's utils.py file.
Inspiration
As a software developer, I know the frustration of dealing with technical debt. We spend countless hours on tedious, repetitive maintenance tasks like fixing missing documentation, which slows down innovation and drains morale. While linters can find problems, they can't fix them. We were inspired to build a solution that moves beyond simple assistance to true, intelligent automation. We didn't want to build another tool; we wanted to build an autonomous AI teammate.
What it does
The Codebase Curator is an autonomous AI agent that acts as a proactive junior developer on your team. With zero human intervention, it performs the entire code maintenance workflow:
- Analyzes Codebases: It connects to any public GitHub repository and intelligently scans every file to identify code quality issues.
- Generates Fixes: Using the Google Gemini 1.5 Flash model, it writes high-quality, context-aware code to fix the problems it finds.
- Submits for Review: It autonomously executes a professional Git workflow by creating a new branch, committing its changes, and submitting a clean, descriptive pull request, making its work ready for human review.
For this MVP, we've taught the agent to find and fix missing docstrings in Python codebases, but its framework is designed to be extended to handle any type of automated code remediation.
How we built it
The agent is built with a modular Python backend.
- Orchestration: A central
main.pyscript manages the agent's workflow from start to finish. - Code Analysis: We used Python's built-in
ast(Abstract Syntax Tree) module to parse code structurally. This allows the agent to surgically and efficiently identify function nodes, a far more robust method than simple text parsing. - AI Code Generation: We integrated the Google Gemini 1.5 Flash API for its speed, generous rate limits, and powerful code generation capabilities.
- Git Automation: The
GitPythonlibrary was used to programmatically control the entire Git workflow—cloning, branching, committing, and pushing. - GitHub Integration: The
PyGithublibrary handles the final, crucial step of authenticating with the GitHub API to create the pull request.
Challenges we ran into
Building a truly autonomous agent presented numerous real-world challenges. We had to implement robust error handling for Windows-specific file permission errors (PermissionError: [WinError 5]). The most significant hurdle was debugging the GitHub API integration, where we pinpointed a 404 Not Found error to incorrect permission scopes on the Personal Access Token, a critical lesson in API security and interaction.
Accomplishments that we're proud of
We are incredibly proud of building a fully end-to-end autonomous system. It's not a prototype that works on mock data; it's a real tool that interacts with live, public APIs and successfully performs a complex, multi-step workflow. The moment we saw the first AI-generated pull request appear on GitHub was a huge accomplishment.
What we learned
We learned that the difference between a simple script and a robust agent lies in handling the details: authentication, API rate limits, error handling, and security scopes. This project was a deep dive into the practical realities of building AI systems that interact with real-world developer tools.
What's next for Codebase Curator
This is just the beginning. The core framework is designed to be a "plug-and-play" system for code remediation. The next steps are to build new modules for the agent to handle more complex tasks, such as:
- Automated Bug Fixing: Identifying and fixing common bugs or exceptions.
- Dependency Management: Automatically updating outdated packages in
requirements.txtorpackage.json. - Code Refactoring: Performing complex code improvements, like optimizing inefficient loops.
Log in or sign up for Devpost to join the conversation.