-
-
The Splendid Quality Agent creates a quality summary directly within GitLab MRs.
-
The Splendid Quality Agent flow can be invoked by mentioning it in an MR, or it could be set up to run automatically.
-
The custom flow provides a report of its code quality analysis directly within GitLab MRs.
-
The custom flow summarizes quality results.
-
The flow provides recommendations for any critical findings.
-
Issues can be automatically created from critical quality issues identified by the custom flow.
-
An interactive agent allows developers to chat with the system about code quality.
-
Detailed UML flow diagram for the custom flow.
-
High-level block diagram for the custom flow - part 1.
-
High-level block diagram for the custom flow - part 2.
Sustaining Code Quality in the Age of AI-Accelerated Development
Every engineering organization claims to value high-quality code. Clean architecture, maintainability, test coverage, and consistency are universally recognized as important. However, there is often a gap between what organizations say they value and what they systematically invest in measuring and protecting.
Feature velocity is tracked closely. Delivery timelines are monitored. Metrics around deployment frequency and incident response are visible to leadership. Code quality, on the other hand, is frequently treated as an implicit expectation rather than an explicitly managed asset. It lives in review comments, in senior engineers’ instincts, and in periodic refactoring efforts that compete with roadmap priorities.
Organizations routinely declare that code quality is critical, yet few invest in measuring and protecting it with the same rigor they apply to shipping features.
Modern AI tools allow engineers to generate code at unprecedented speed. Entire features can be scaffolded in minutes. Refactors that once required days of manual effort can now be drafted in a couple hours. This increase in productivity is real and valuable. At the same time, it introduces new risks.
When AI-generated code is merged quickly and repeatedly, subtle anti-patterns can propagate across a repository far more rapidly than before. As AI tools begin to assist not only in writing code but also in reviewing it, there is a risk that weak assumptions reinforce one another. Small increases in complexity, duplicated logic, missing validation, security oversights, and incomplete test coverage may not trigger immediate failures, but over time they erode the structural integrity of a system.
In this environment, code quality must be treated as an actively managed risk. Velocity without stewardship can lead to compounding technical debt.
The "Splendid Quality Analysis" flow and agent was created to address this challenge directly within the GitLab development lifecycle.
A GitLab-Native Approach to Code Stewardship
The Splendid Quality Agent operates entirely within GitLab using the GitLab Duo Agent Platform. It integrates directly into the merge request workflow and extends beyond analysis to actively participate in the broader software development lifecycle.
It provides two complementary ways to interact with the system: an automated quality analysis flow and an interactive conversational agent.
Automated Splendid Quality Analysis Flow
The Splendid Quality Analysis flow can be triggered automatically when a merge request is opened or manually by an engineer who wants deeper review. It integrates directly with GitLab CI, merge requests, and issues.
This custom flow uses the following process to deliver a code quality analysis of the files involved in a merge request and to follow up with engineers on next steps for resolving any quality issues identified by the flow.
Step 1: Deterministic Metric Calculation
The process begins with objective, industry-standard code quality metrics calculated in CI, including:
- Cyclomatic complexity deltas
- Halstead metrics
- LOC analysis
- Static analysis findings
Step 2: Semantic Evaluation with GitLab Duo
A custom GitLab Duo Agent then analyzes the merge request diff alongside the computed metrics. The agent identifies:
- Significant complexity increases
- Patterns of duplication
- Inconsistencies with project conventions
- Areas where testing may be insufficient
Step 3: Quality Summary
The custom agent combines the results of the deterministic calculations and the semantic analysis to generate a report that summarizes its findings from a code quality perspective. This summary can be posted as a comment within a MR or in response to a chat session with the agent, depending upon how the user is interacting with the system.
Step 3: Lifecycle Actions and Issue Creation
Splendid Quality Agent does not stop at commentary.
When critical quality issues are detected, the flow can automatically create GitLab issues linked to the merge request. These issues include:
- A description of the identified risk
- References to specific files or code sections
- Suggested remediation steps
- Labels that categorize the type of quality concern
By creating issues directly within GitLab, the agent ensures that quality findings become visible, trackable work items rather than ephemeral review comments. This connects merge request analysis to project management and long-term planning.
Interactive Quality Agent
In addition to the automated flow, engineers can interact with Splendid Quality Agent through a conversational interface powered by GitLab Duo.
Engineers can ask questions such as:
- How has complexity trended across this repository?
- Which modules consistently introduce duplication?
- What areas of the codebase show signs of architectural drift?
- What refactoring work should we prioritize?
Because the agent’s responses are grounded in the same deterministic metrics calculated in CI, conversations are anchored in measurable data rather than subjective impressions.
This dual model combines proactive enforcement with exploratory analysis.
Example Scenario
A developer opens a merge request that passes all tests and satisfies functional requirements. The pipeline is green.
However, the deterministic analysis reveals a significant increase in cyclomatic complexity. The semantic agent highlights nested logic and repeated patterns introduced in the diff. A structured summary is posted to the merge request explaining the risk.
Because the complexity increase is significant, the flow can automatically create linked GitLab issues for refactoring and additional test coverage. These issues are labeled, assigned, and visible in project boards.
The change can still move forward if justified, but the associated quality debt is no longer invisible. It is captured within GitLab’s issue tracking system and incorporated into the team’s planning process.
Technical Architecture
The Splendid Quality Agent is built on two complementary pillars: deterministic quality analysis tooling and a GitLab Duo Agent custom flows and agents that operationalize those results within the GitLab lifecycle.
The architecture is intentionally layered. Objective quality signals are calculated first. Only then does semantic reasoning occur. This ensures that all LLM-driven analysis is grounded in measurable data rather than subjective interpretation.
Pillar 1: Deterministic Quality Analysis Engine (Go-Based Tooling)
At the foundation of the Splendid Quality Agent is a deterministic quality analysis system written in Go. This tooling is exposed to the GitLab Duo Agent environment as a set of callable tools, allowing the custom flow and conversational agent to request objective quality metrics as needed.
Language Detection and Delegation
The entrypoint of the Go tooling performs automatic language detection for the repository under analysis. The current implementation supports:
- Go
- TypeScript
TypeScript was chosen because it is one of the most widely used languages in public repositories. The architecture is modular and can be extended to support additional languages in the future by adding language-specific analyzers.
Once the language is identified, the system delegates analysis to a set of metric-specific analyzers tailored to that language.
Industry-Standard Metrics
The tooling calculates widely recognized code quality metrics, including:
- Cyclomatic Complexity
- Halstead Metrics (volume, difficulty, effort)
- Lines of Code (LOC) analysis
Each metric is calculated using language-aware parsing and analysis. For example, cyclomatic complexity is derived from control flow constructs such as conditionals and loops, while Halstead metrics are calculated based on operators and operands extracted from the abstract syntax tree.
The analyzers operate deterministically and do not rely on probabilistic reasoning.
Structured Output
All results are emitted as structured JSON documents. These outputs include:
- Per-file metrics
- Per-function metrics
- Aggregate deltas relative to a base branch
- Threshold exceedance indicators
This JSON output serves as the contract between deterministic analysis and higher-level reasoning. The custom flow and conversational agent consume this structured data in subsequent steps.
By separating metric calculation from interpretation, the system maintains a clear boundary between objective measurement and semantic analysis.
Pillar 2: GitLab Duo Agent Custom Flow and Agent
The second pillar of the architecture is the GitLab Duo Agent–based custom flow and interactive agent. This layer transforms deterministic quality signals into actionable lifecycle outcomes within GitLab.
Automated Splendid Quality Analysis Flow
The custom flow can be triggered automatically when a merge request is opened or manually when deeper analysis is desired.
The flow orchestrates several steps:
- Invoke deterministic Go-based tooling through the Duo Agent tool interface.
- Collect and parse JSON metric outputs.
- Retrieve merge request diffs and metadata from GitLab.
- Perform semantic evaluation using GitLab Duo.
- Produce structured quality reports.
- Create or update GitLab issues when critical findings are detected.
Because the flow operates inside the GitLab ecosystem, it can interact directly with:
- Merge requests
- CI pipeline artifacts
- Labels
- Issues
- Project boards
This tight integration ensures that findings are not isolated reports but active elements of the SDLC.
Semantic Evaluation Layer
Once deterministic metrics are calculated, the GitLab Duo Agent performs semantic reasoning grounded in those metrics.
For example, if cyclomatic complexity increases beyond a configured threshold, the agent can:
- Identify the specific functions responsible
- Explain why the increase may introduce maintenance risk
- Suggest refactoring patterns
The semantic layer does not replace deterministic analysis. It interprets it, contextualizes it, and communicates it clearly to developers.
Automated Issue Creation
One of the most significant architectural decisions in this project is integrating issue creation directly into the flow.
When critical quality thresholds are exceeded, the system suggests that GitLab issues be created that include:
- A summary of the identified quality concern
- References to affected files and functions
- Extracted metric values
- Suggested remediation strategies
- Labels categorizing the issue type
These issues are linked to the originating merge request, making quality debt visible and traceable within project management workflows.
This step extends the system beyond analysis and review. It embeds quality stewardship into planning and prioritization.
Why This Matters
AI is transforming how software is produced. The organizations that succeed will not simply generate more code; they will maintain healthy systems while doing so.
Splendid Quality Agent ensures that, as development accelerates, quality is not left to intuition or good intentions. By combining deterministic industry-standard metrics, GitLab Duo semantic reasoning, merge request integration, and issue creation, it turns stewardship into a scalable, lifecycle-native discipline within GitLab.
Quality becomes measurable. Risk becomes visible. Improvement becomes actionable.
In an era of accelerating output, Splendid Quality Agent ensures that integrity scales alongside it.
Log in or sign up for Devpost to join the conversation.