Inspiration

Every developer knows technical debt exists. Nobody tracks it automatically. I watched my team spend hours every week manually reviewing code quality, writing the same feedback comments on merge requests, and creating the same GitLab issues over and over again. I built GitLens AI to eliminate this repetitive work completely.

What it does

GitLens AI is an automated technical debt detection agent built on the GitLab Duo Agent Platform. Every time a merge request is opened or updated, GitLens AI automatically activates and runs 11 steps without any human intervention:

  • Fetches the real code diff from GitLab
  • Analyzes it using AI for 6 types of technical debt
  • Runs a Green Agent scan for energy-inefficient code patterns
  • Generates auto-fix suggestions with exact before/after code
  • Tracks debt score trends over time
  • Posts a complete report directly on the merge request
  • Creates GitLab issues for every high severity problem
  • Records the debt score in a trend tracker
  • Updates README badges automatically
  • Generates weekly debt reports every Monday
  • Celebrates when teams achieve clean code

How we built it

I built GitLens AI using Python and the GitLab API v4. The core AI analysis uses the Groq LLM API with Llama 3.3-70b, which runs inside GitLab Duo Agent Platform using Anthropic Claude by default. The project includes a custom GitLab Duo Agent YAML configuration and a multi-agent flow that orchestrates two specialized agents a debt scanner and an issue creator working together automatically.

The most challenging part was designing the 11-step automated pipeline that runs entirely without human intervention, posting real comments on real merge requests and creating real GitLab issues automatically.

Challenges we ran into

The biggest challenge was getting the GitLab Duo Agent Platform YAML schema exactly right. The validator is very strict about the format of toolset definitions, and it took multiple iterations to get the flow configuration passing validation. I also had to carefully design the AI prompts to produce structured, parseable output consistently across different code patterns.

Another challenge was building the Green Agent energy efficiency detection translating vague concepts like "energy inefficiency" into specific, detectable code patterns with actionable fix suggestions.

Accomplishments that we're proud of

The moment GitLens AI posted its first real comment on a real GitLab merge request automatically with a debt score, six specific issues, auto-fix code suggestions, and a Green Agent energy report all in under 10 seconds, with zero manual intervention that felt genuinely powerful.

I am also proud of the Auto-Fix Generator, which doesn't just say "fix this" but shows the exact corrected code ready to copy and apply. No other tool on the GitLab platform does this today.

What we learned

I learned that building a truly autonomous agent is much harder than building a tool that assists humans. The difference is reliability an agent that runs automatically must handle every edge case gracefully, produce consistent output every time, and integrate cleanly with GitLab's existing workflow without disrupting it.

I also learned that the GitLab Duo Agent Platform is genuinely powerful for building agentic workflows that react to real developer events and take meaningful automated actions.

What's next for GitLens AI

  • Multi-language support for JavaScript, TypeScript, Java, and Go
  • Debt Budget Enforcement block MR merges when debt score exceeds a configurable threshold
  • GitLab Duo Chat integration for natural language debt queries
  • Machine learning improvements using historical debt data for more accurate project-specific detection
  • Dependency debt analysis to flag outdated and energy-heavy packages

Built With

  • anthropic-claude
  • gitlab-api-v4
  • gitlab-ci/cd
  • gitlab-duo-agent-platform
  • groq-llm-(llama-3.3-70b)
  • python
  • python-dotenv
  • requests
  • shields.io
Share this project:

Updates