💡 Inspiration

To be honest, this project was born out of pure frustration. Every time I opened a Merge Request, I had to wait hours for feedback, only to get comments on basic things like "optimize this loop" or "missing error handling." I tried using existing AI reviewers, but they kept scanning the entire file even if I only changed two lines of code. It felt like a massive waste of API tokens and time.

I wanted to build something smarter: an assistant that reviews only the code I changed (the git diff) and drops the feedback right where I work—directly inside my GitLab Merge Request thread.

⚙️ What it does

CodeSentry AI is a smart developer assistant that runs an 8-agent LangGraph pipeline.

  • The Workflow: You can paste your code in the dashboard or just paste a GitLab MR URL.
  • Parallel Reviews: Four specialized agents immediately run in parallel to review your code for Bugs, Security, Performance, and Best Practices.
  • Consolidation: A decision layer filters the duplicate issues, a generator creates clean code fixes, and a staff-level reviewer scores the code out of 10.
  • Auto-Commenting: If you put in a GitLab MR URL, the tool automatically posts a structured markdown comment table, a scorecard, and collapsible code snippets with suggested fixes directly into your GitLab MR discussion thread.

🛠️ How we built it

  • The Agent Pipeline: Built using LangGraph (StateGraph) for managing the state transitions between agents, and LangChain.
  • The AI Stack: We used Gemini 2.0 Flash for final consolidation, Mistral Large for deep security checks, and Llama 3.3 70B (via Groq) for high-speed bug and performance analysis.
  • Stack: Node.js/Express for the backend, Neon PostgreSQL for the database (storing history and share tokens), and React 19 on the frontend. Framer Motion was used to animate the agents so the user can see them working in real-time.

🚧 Challenges we ran into

  • API Rate Limits: The biggest headache during development. I kept hitting rate limits on Gemini and Mistral. To solve this, I built a zero-downtime try-catch fallback mechanism. If Gemini hits its quota limit, Groq's Llama 3.3 takes over instantly.
  • Git Diff Parsing: Writing a parser to clean up unified git diffs, extracting only the lines starting with + (added code), and feeding them to parallel agents without losing the context of the surrounding code was a real challenge.

🏆 Accomplishments that we're proud of

  • It actually works! Seeing the CodeSentry bot post a beautifully formatted review table on my GitLab MR for the first time was an absolute "yes!" moment.
  • Dashboard Visualizer: Turning a complex backend agent graph into a frontend visual loader where you can watch the agents spin up, analyze, and pass state to each other.

📖 What we learned

  • Multi-agent orchestration is way cleaner using State Graphs than trying to write nested async loops in standard code.
  • Prompt engineering is not just about instructions; it’s about forcing strict JSON schemas and handling structural failures gracefully.

🔮 What's next for CodeSentry AI

  • GitLab OAuth Integration: Currently, the system uses a backend-configured token. I want to add proper OAuth so users can log in and have the bot comment on their behalf. (Starting this right after my ongoing college exams!).
  • Auto-Commit Fixes: Adding an "Apply Fix" button that automatically commits the AI-suggested code corrections directly to the branch.
  • Webhooks: Triggering the review workflow automatically the second a new Merge Request is created.

Built With

Share this project:

Updates