I got tired of AI Reviewers hallucinating, so I built an Autonomous Agent for GitLab instead.
Source: Dev.to
Introduction
We’ve all been there. You push a massive 300‑line Merge Request, and within seconds an “AI Code Reviewer” bot leaves a dozen comments on your PR.
Two of them complain about a “missing import” that is clearly handled globally by your framework. One suggests a library you explicitly removed last sprint. The rest are annoying formatting nits. You quietly click Resolve Thread twelve times and sigh.
Standard AI reviewers simply pipe your .patch file into an LLM and pray for the best. They lack context, which is exactly why I built AI Review Agent—a truly autonomous, context‑aware code review agent built natively for GitLab using Go.
Why Existing AI Reviewers Fall Short
Zero Codebase Context
“Why did you use
mylog.Info()instead offmt.Println()?”
The reviewer has no knowledge of your project’s logging conventions or helper utilities.
Context‑Window Explosions
Bombarding the LLM with a 150‑file MR diff quickly exhausts the model’s context window, causing it to forget the original system prompt and produce irrelevant or hallucinated feedback.
One‑Way Communication
Most bots dump a review and disappear. You can’t ask them to elaborate or clarify their suggestions.
How AI Review Agent Works Differently
The bot doesn’t just statically read the diff. It is equipped with tools such as read_file, search_code, and multi_diff.
When it encounters a call like CacheManager.Get(), it will pause, use search_code to locate the CacheManager implementation in the codebase, read it, and then decide whether the code is buggy—eliminating hallucinated assertions.
Persistent Conversation
Instead of dropping a single comment and vanishing, AI Review Agent stays in the conversation:
@reply to it on the GitLab thread.
“Actually, I did it this way because of a race condition in the upstream service.”
Every codebase has its own unwritten rules. AI Review Agent is designed to get smarter over time, learning from a “Repository Best Practices” rulebook.
Webhook‑Driven Architecture
AI Review Agent runs as a high‑performance webhook server. After a one‑time configuration on your GitLab project, the webhook triggers the agent on every push. Reviews are queued asynchronously with a worker‑pool system and retry logic, ensuring that even if the OpenAI API hiccups, your review is never lost.
Usage
You can interact with the agent directly from the terminal:
./cli review --project-id 123 --mr-id 45 --model claude-3-7-sonnet-20250219
The CLI prints the AI’s suggestions and lets you interactively type 1, 3, 5, etc., to decide which comments to push to the live GitLab MR.
Technical Details
- Language: Go 1.25
- Architecture: Clean Architecture abstractions for easy extensibility
- Features:
- Graceful degradation
- Multi‑LLM routing (OpenAI, Anthropic, Google Gemini)
- Persistent storage with SQLite or PostgreSQL for asynchronous jobs and feedback metrics
Get Involved
If your team uses GitLab and you’re looking for a smarter, less noisy AI reviewer—or if you’re simply interested in Go‑based AI agents—check out the project:
🔗 GitHub Repository:
I’m actively seeking feedback, feature requests, and early contributors. Let me know in the comments: What is the most annoying comment an AI reviewer has ever left on your PR?