# How the Hiring Agent Distinguishes Between Open-Source and Self-Owned GitHub Projects

> Discover how the hiring agent distinguishes open-source from self-owned GitHub projects by analyzing contributor counts. Learn the criteria used in repository classification.

- Repository: [HackerRank/hiring-agent](https://github.com/interviewstreet/hiring-agent)
- Tags: internals
- Published: 2026-07-19

---

**The Hiring Agent classifies repositories as "open_source" or "self_project" based on contributor count, marking repositories with more than one unique contributor as open-source and all others as self-owned.**

The interviewstreet/hiring-agent repository automates candidate portfolio analysis by retrieving public GitHub data and applying a deterministic heuristic to distinguish between open-source and self-owned GitHub projects. This classification logic resides in the `fetch_all_github_repos` function and enables downstream LLM prompts to prioritize meaningful collaborative work when evaluating engineering candidates.

## Fetching Repository Contributors via the GitHub API

The classification process begins by retrieving contributor metadata for each public repository. In [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py), the `fetch_repo_contributors` function calls the GitHub REST API endpoint `GET /repos/{owner}/{repo}/contributors` to fetch the complete list of distinct contributors.

According to the source code, the implementation stores the API response in `contributors_data` and calculates the contributor count using Python's `len()` function:

```python
contributors_data = fetch_repo_contributors(username, repo_name)
contributor_count = len(contributors_data)

```

This logic appears in lines 39-41 of [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py), where the agent prepares the raw data needed for the classification heuristic.

## The Contributor Count Heuristic for Project Classification

After gathering contributor statistics, the agent applies a binary classification rule within the `fetch_all_github_repos` function. According to lines 46-48 in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py), the logic uses a conditional expression:

```python
project_type = (
    "open_source" if contributor_count > 1 else "self_project"
)

```

**If `contributor_count` exceeds one**, the repository is labeled `"open_source"`; otherwise, it receives the `"self_project"` classification. This simple threshold effectively distinguishes solo personal projects from community-driven repositories.

The classified `project_type` field becomes part of the repository metadata object, which the system passes to the `github_project_selection.jinja` template for LLM-based portfolio analysis.

## Filtering Out Low-Quality Forks

Before classification, the agent filters out forked repositories that likely represent trivial copies rather than maintained forks. Lines 34-36 in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) implement this guard clause:

```python
if repo.get("fork") and repo.get("forks_count", 0) < 5:
    continue

```

**Forks with fewer than 5 stars** are skipped entirely, preventing "toy" forks from skewing the candidate's portfolio analysis. This ensures that the `project_type` classification only applies to substantive repositories.

## Implementation Example: Classifying a Candidate's Portfolio

To classify an entire candidate portfolio, import the `fetch_all_github_repos` function and process the returned metadata:

```python
from github import fetch_all_github_repos

# Example: classify a candidate's repositories

github_url = "https://github.com/example-candidate"
projects = fetch_all_github_repos(github_url, max_repos=50)

for p in projects:
    print(f"{p['name']}: {p['project_type']} (contributors: {p['contributor_count']})")

```

Typical output distinguishes collaborative work from solo projects:

```

awesome-api: open_source (contributors: 4)
personal-website: self_project (contributors: 1)

```

For single-repository analysis, use the lower-level helper functions directly:

```python
from github import fetch_repo_contributors, extract_github_username

owner = extract_github_username("https://github.com/example-candidate")
contributors = fetch_repo_contributors(owner, "awesome-api")
project_type = "open_source" if len(contributors) > 1 else "self_project"

print(project_type)   # → open_source

```

The resulting `project_type` values integrate with the `GitHubProfile` dataclass defined in [`models.py`](https://github.com/interviewstreet/hiring-agent/blob/main/models.py) and feed into the selection templates used by the hiring pipeline.

## Summary

- **The Hiring Agent uses a contributor count heuristic** in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) to label repositories as `"open_source"` or `"self_project"`.
- **Repositories with more than one contributor** are classified as open-source; all others are marked as self-owned.
- **Low-quality forks** (those with fewer than 5 stars) are filtered out before classification to ensure data quality.
- **The classification** supports downstream LLM prompts in `github_project_selection.jinja` to highlight relevant collaborative experience.

## Frequently Asked Questions

### What threshold does the hiring agent use to classify a project as open-source?

The agent applies a strict contributor count threshold of **greater than one**. Any repository with two or more unique contributors is classified as `"open_source"`, while repositories with exactly one contributor are labeled `"self_project"`. This logic is implemented in lines 46-48 of [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py).

### How does the hiring agent handle forked repositories?

The agent filters out forks that have fewer than 5 stars before classification. Specifically, lines 34-36 in [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) skip any repository where `repo.get("fork")` is true and `repo.get("forks_count", 0)` is less than 5, preventing insignificant forks from affecting the portfolio analysis.

### Where is the project classification stored after determination?

The `project_type` string is stored within the repository metadata dictionary returned by `fetch_all_github_repos`. This data populates the `GitHubProfile` dataclass defined in [`models.py`](https://github.com/interviewstreet/hiring-agent/blob/main/models.py) and is passed to the LLM prompt template at `prompts/templates/github_project_selection.jinja` for final project selection.

### Can the classification logic be customized?

While the current implementation uses a hardcoded threshold of one contributor in the `fetch_all_github_repos` function, the modular design of [`github.py`](https://github.com/interviewstreet/hiring-agent/blob/main/github.py) allows developers to modify the classification logic or adjust the contributor count threshold by editing the conditional statement at lines 46-48.