Introduction
As software organizations grow, repositories become larger, teams become more distributed, and application architectures become increasingly complex. In many enterprises, thousands of source files are spread across multiple repositories, microservices, and development teams. When a bug occurs, a security issue is discovered, or a feature requires modification, developers often face a common challenge:
Who owns this code?
While tools like CODEOWNERS files and repository permissions provide some guidance, they are often incomplete, outdated, or difficult to maintain. As engineering organizations scale, manually tracking code ownership becomes increasingly difficult.
Artificial Intelligence offers a smarter approach. By analyzing commit history, pull requests, code contributions, repository activity, documentation, and team structures, AI can automatically identify the most likely owners of a codebase, service, or feature.
In this article, we'll explore how to build an intelligent code ownership discovery system using .NET, GitHub APIs, and Azure OpenAI.
Why Code Ownership Matters
Code ownership plays a critical role in software delivery.
When ownership information is unavailable, teams experience:
Slower bug resolution
Delayed code reviews
Inefficient incident response
Knowledge silos
Increased onboarding time
Poor collaboration between teams
Consider the following scenario:
A production issue is detected in the payment service. The original developers have changed teams, and the documentation is outdated.
Without clear ownership, engineers may spend hours identifying the correct people to contact.
An AI-powered ownership discovery platform can solve this problem automatically.
Understanding Intelligent Ownership Discovery
Traditional ownership systems rely on static rules.
Example:
PaymentService/*
Team-Payments
While useful, these rules fail when:
Teams change
Repositories evolve
Developers move roles
Services become shared
AI systems analyze multiple signals to determine ownership dynamically.
These signals may include:
Commit history
Pull request activity
Code review participation
Repository contributions
Documentation references
Deployment history
Incident management records
The result is a much more accurate ownership model.
Solution Architecture
A modern ownership discovery platform consists of the following layers:
Data Collection Layer
Collect information from:
GitHub
Azure DevOps
Jira
Internal Wikis
Incident Platforms
Analysis Layer
An ASP.NET Core service processes contribution data.
AI Layer
Azure OpenAI analyzes contribution patterns and ownership relationships.
Recommendation Layer
Ownership recommendations are delivered through APIs, dashboards, or developer tools.
Creating the ASP.NET Core Project
Create a new Web API project.
dotnet new webapi -n OwnershipDiscovery
Install required packages.
dotnet add package Octokit
dotnet add package Azure.AI.OpenAI
These packages provide GitHub integration and AI capabilities.
Collecting Repository Contribution Data
GitHub APIs provide valuable ownership signals.
Create a contributor model.
public class ContributorInfo
{
public string UserName { get; set; }
public int CommitCount { get; set; }
public int PullRequests { get; set; }
public int Reviews { get; set; }
}
This information forms the foundation of ownership analysis.
Retrieving Commit History
Commit activity is one of the strongest ownership indicators.
Example service:
public class GitHubRepositoryService
{
private readonly GitHubClient _client;
public GitHubRepositoryService(string token)
{
_client = new GitHubClient(
new ProductHeaderValue(
"OwnershipDiscovery"));
_client.Credentials =
new Credentials(token);
}
}
The service retrieves repository contributors and commit history.
Example ownership signal:
PaymentService.cs
Contributor A:
450 commits
Contributor B:
25 commits
Contributor C:
12 commits
Contributor A is likely the primary owner.
Analyzing Pull Request Activity
Commits alone do not tell the entire story.
Developers frequently review and approve changes without making commits.
Example model:
public class PullRequestActivity
{
public string UserName { get; set; }
public int ReviewsCompleted { get; set; }
public int ApprovalsGiven { get; set; }
}
Review activity often identifies technical leaders and subject matter experts.
Creating Ownership Profiles
Ownership recommendations should combine multiple signals.

Join the conversation! Your thoughts help the community grow.